[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'], 'xcodebuild': ['xcodebuild'],
'mvn': ['mvn'], 'mvn': ['mvn'],
'ndk-build': ['ndk-build'], 'ndk-build': ['ndk-build'],
'clang-compilation-database': ['clang-compilation-database'],
} }

@ -38,7 +38,7 @@ let rec rmtree name =
type build_mode = type build_mode =
| Analyze | Ant | Buck | ClangCompilationDatabase | Gradle | Java | Javac | Make | Mvn | Ndk | Analyze | Ant | Buck | Gradle | Java | Javac | Make | Mvn | Ndk
| Xcode | Genrule | Xcode | Genrule
let build_mode_of_string path = let build_mode_of_string path =
@ -46,7 +46,6 @@ let build_mode_of_string path =
| "analyze" -> Analyze | "analyze" -> Analyze
| "ant" -> Ant | "ant" -> Ant
| "buck" -> Buck | "buck" -> Buck
| "clang-compilation-database" -> ClangCompilationDatabase
| "genrule" -> Genrule | "genrule" -> Genrule
| "gradle" | "gradlew" -> Gradle | "gradle" | "gradlew" -> Gradle
| "java" -> Java | "java" -> Java
@ -61,7 +60,6 @@ let string_of_build_mode = function
| Analyze -> "analyze" | Analyze -> "analyze"
| Ant -> "ant" | Ant -> "ant"
| Buck -> "buck" | Buck -> "buck"
| ClangCompilationDatabase -> "clang-compilation-database"
| Genrule -> "genrule" | Genrule -> "genrule"
| Gradle -> "gradle" | Gradle -> "gradle"
| Java -> "java" | Java -> "java"
@ -151,21 +149,12 @@ let capture_with_compilation_database db_files =
CaptureCompilationDatabase.capture_files_in_database compilation_database CaptureCompilationDatabase.capture_files_in_database compilation_database
let capture build_cmd = function 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 -> | Buck when Config.use_compilation_database <> None ->
L.stdout "Capturing using Buck's compilation database...@\n"; L.stdout "Capturing using Buck's compilation database...@\n";
let json_cdb = CaptureCompilationDatabase.get_compilation_database_files_buck () in let json_cdb = CaptureCompilationDatabase.get_compilation_database_files_buck () in
capture_with_compilation_database json_cdb 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 -> | Genrule ->
L.stdout "Capturing for Buck genrule compatibility...@\n"; L.stdout "Capturing for Buck genrule compatibility...@\n";
let infer_java = Config.bin_dir ^/ "InferJava" in let infer_java = Config.bin_dir ^/ "InferJava" in
@ -282,7 +271,7 @@ let analyze = function
| Java | Javac -> | Java | Javac ->
(* In Java and Javac modes, analysis is invoked from capture. *) (* 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 ( if (Sys.file_exists Config.(results_dir ^/ captured_dir_name)) <> `Yes then (
L.stderr "There was nothing to analyze, exiting" ; L.stderr "There was nothing to analyze, exiting" ;
Config.print_usage_exit () 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) infer-out-with-index/report.json: $(CMAKE_BUILD_DIR)/compile_commands.json $(INFER_BIN) $(SOURCES)
$(call silent_on_success,\ $(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) infer-out-no-index/report.json: $(CMAKE_BUILD_DIR)/compile_commands.json $(INFER_BIN) $(SOURCES)
$(call silent_on_success,\ $(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) infer-out-reactive-capture/report.json: $(CMAKE_BUILD_DIR)/compile_commands.json $(INFER_BIN) $(SOURCES)
$(call silent_on_success,\ $(call silent_on_success,\
$(INFER_BIN) -a $(ANALYZER) $(INFER_OPTIONS) -o infer-out-reactive-capture --reactive-capture \ $(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 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 \ $(INFERPRINT_BIN) -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@.with-index \

Loading…
Cancel
Save