[compilation db] Remove special module for compilation db

Summary:
We don't need to have separate `--` integration for compilation database. Instead use:
  infer --compilation-db-files db.json <other_infer_options> // no -- anywhere!

Reviewed By: jberdine

Differential Revision: D4327570

fbshipit-source-id: caf0dc9
master
Andrzej Kotulski 8 years ago committed by Facebook Github Bot
parent ebb6931358
commit 9fb0636ca1

@ -44,7 +44,6 @@ MODULE_TO_COMMAND = {
'xcodebuild': ['xcodebuild'],
'mvn': ['mvn'],
'ndk-build': ['ndk-build'],
'clang-compilation-database': ['clang-compilation-database'],
}

@ -38,7 +38,7 @@ let rec rmtree name =
type build_mode =
| Analyze | Ant | Buck | ClangCompilationDatabase | Gradle | Java | Javac | Make | Mvn | Ndk
| Analyze | Ant | Buck | Gradle | Java | Javac | Make | Mvn | Ndk
| Xcode | Genrule
let build_mode_of_string path =
@ -46,7 +46,6 @@ let build_mode_of_string path =
| "analyze" -> Analyze
| "ant" -> Ant
| "buck" -> Buck
| "clang-compilation-database" -> ClangCompilationDatabase
| "genrule" -> Genrule
| "gradle" | "gradlew" -> Gradle
| "java" -> Java
@ -61,7 +60,6 @@ let string_of_build_mode = function
| Analyze -> "analyze"
| Ant -> "ant"
| Buck -> "buck"
| ClangCompilationDatabase -> "clang-compilation-database"
| Genrule -> "genrule"
| Gradle -> "gradle"
| Java -> "java"
@ -151,21 +149,12 @@ let capture_with_compilation_database db_files =
CaptureCompilationDatabase.capture_files_in_database compilation_database
let capture build_cmd = function
| Analyze ->
()
| Analyze when not (List.is_empty !Config.clang_compilation_db_files) ->
capture_with_compilation_database !Config.clang_compilation_db_files
| Buck when Config.use_compilation_database <> None ->
L.stdout "Capturing using Buck's compilation database...@\n";
let json_cdb = CaptureCompilationDatabase.get_compilation_database_files_buck () in
capture_with_compilation_database json_cdb
| ClangCompilationDatabase ->
L.stdout "Capturing using a compilation database file...@\n";
let cmd_args = List.tl build_cmd |> Option.value ~default:[] in
if List.is_empty cmd_args then (
failwith
"Error parsing arguments. Please, pass the compilation database json file as in \
infer -- clang-compilation-database file.json." ;
Config.print_usage_exit ());
capture_with_compilation_database cmd_args
| Genrule ->
L.stdout "Capturing for Buck genrule compatibility...@\n";
let infer_java = Config.bin_dir ^/ "InferJava" in
@ -282,7 +271,7 @@ let analyze = function
| Java | Javac ->
(* In Java and Javac modes, analysis is invoked from capture. *)
()
| Analyze | Ant | Buck | ClangCompilationDatabase | Gradle | Genrule | Make | Mvn | Ndk | Xcode ->
| Analyze | Ant | Buck | Gradle | Genrule | Make | Mvn | Ndk | Xcode ->
if (Sys.file_exists Config.(results_dir ^/ captured_dir_name)) <> `Yes then (
L.stderr "There was nothing to analyze, exiting" ;
Config.print_usage_exit ()

@ -31,16 +31,16 @@ infer-out/report.json:
infer-out-with-index/report.json: $(CMAKE_BUILD_DIR)/compile_commands.json $(INFER_BIN) $(SOURCES)
$(call silent_on_success,\
$(INFER_BIN) -a $(ANALYZER) $(INFER_OPTIONS) -o infer-out-with-index --changed-files-index $(CMAKE_DIR)/index.txt -- clang-compilation-database $<)
$(INFER_BIN) -a $(ANALYZER) $(INFER_OPTIONS) -o infer-out-with-index --changed-files-index $(CMAKE_DIR)/index.txt --clang-compilation-db-files $<)
infer-out-no-index/report.json: $(CMAKE_BUILD_DIR)/compile_commands.json $(INFER_BIN) $(SOURCES)
$(call silent_on_success,\
$(INFER_BIN) -a $(ANALYZER) $(INFER_OPTIONS) -o infer-out-no-index -- clang-compilation-database $<)
$(INFER_BIN) -a $(ANALYZER) $(INFER_OPTIONS) -o infer-out-no-index --clang-compilation-db-files $<)
infer-out-reactive-capture/report.json: $(CMAKE_BUILD_DIR)/compile_commands.json $(INFER_BIN) $(SOURCES)
$(call silent_on_success,\
$(INFER_BIN) -a $(ANALYZER) $(INFER_OPTIONS) -o infer-out-reactive-capture --reactive-capture \
--changed-files-index $(CMAKE_DIR)/index.txt -- clang-compilation-database $<)
--changed-files-index $(CMAKE_DIR)/index.txt --clang-compilation-db-files $<)
issues.exp.test: infer-out-with-index/report.json infer-out-no-index/report.json infer-out-reactive-capture/report.json
$(INFERPRINT_BIN) -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@.with-index \

Loading…
Cancel
Save