From 863cc534b2ceee3b7c1edac4d23cee4b742691ea Mon Sep 17 00:00:00 2001 From: Andrzej Kotulski Date: Tue, 13 Dec 2016 09:21:43 -0800 Subject: [PATCH] [compilation db] Allow to pass multiple json files with clang-compilation-database integration Reviewed By: dulmarod Differential Revision: D4319630 fbshipit-source-id: 5d5b1af --- infer/src/backend/infer.ml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/infer/src/backend/infer.ml b/infer/src/backend/infer.ml index c3207993e..f2eef4b57 100644 --- a/infer/src/backend/infer.ml +++ b/infer/src/backend/infer.ml @@ -157,17 +157,15 @@ let capture build_cmd = function 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 -> ( + | ClangCompilationDatabase -> L.stdout "Capturing using a compilation database file...@\n"; - match Config.rest with - | arg :: _ -> - capture_with_compilation_database [arg] - | _ -> - failwith - "Error parsing arguments. Please, pass the compilation database json file as in \ - infer -- clang-compilation-database file.json." ; - Config.print_usage_exit () - ) + 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