[clang] options rename: --compilation-database -> --buck-compilation-database, --clang-compilation-db-files -> --compilation-database

Summary: Shorter is better. `--compilation-database` was taken, renaming it to `--buck-compilation-database`.

Reviewed By: dulmarod

Differential Revision: D4567028

fbshipit-source-id: 011cd6f
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent 528f05430b
commit a8be4f1f4f

@ -53,12 +53,6 @@ def create_argparser(group_name=MODULE_NAME):
'and not for Java. Note: this flag should be used ' 'and not for Java. Note: this flag should be used '
'in combination with passing the #infer flavor ' 'in combination with passing the #infer flavor '
'to the Buck target.') 'to the Buck target.')
group.add_argument('--use-compilation-database', action='store_true',
help='Run Infer analysis through the use of the flavor '
'compilation database. Currently this is '
'supported only for the cxx_* targets of Buck '
'- e.g. cxx_library, cxx_binary - and not for '
'Java.')
group.add_argument('--xcode-developer-dir', group.add_argument('--xcode-developer-dir',
help='Specify the path to Xcode developer directory ' help='Specify the path to Xcode developer directory '
'(requires --use-flavors to work)') '(requires --use-flavors to work)')

@ -40,8 +40,8 @@ let cluster_should_be_analyzed cluster =
let pp_prolog fmt clusters = let pp_prolog fmt clusters =
let escape = Escape.escape_map (fun c -> if Char.equal c '#' then Some "\\#" else None) in let escape = Escape.escape_map (fun c -> if Char.equal c '#' then Some "\\#" else None) in
let infer_flag_of_compilation_db = function let infer_flag_of_compilation_db = function
| `Escaped f -> F.sprintf "--clang-compilation-db-files-escaped '%s'" f | `Escaped f -> F.sprintf "--compilation-database-escaped '%s'" f
| `Raw f -> F.sprintf "--clang-compilation-db-files '%s'" f in | `Raw f -> F.sprintf "--compilation-database '%s'" f in
let compilation_dbs_cmd = let compilation_dbs_cmd =
List.map ~f:infer_flag_of_compilation_db !Config.clang_compilation_dbs List.map ~f:infer_flag_of_compilation_db !Config.clang_compilation_dbs
|> String.concat ~sep:" " |> escape in |> String.concat ~sep:" " |> escape in

@ -405,7 +405,7 @@ let driver_mode_of_build_cmd build_cmd =
match build_system_of_exe_name (Filename.basename prog) with match build_system_of_exe_name (Filename.basename prog) with
| BAnalyze -> | BAnalyze ->
Analyze Analyze
| BBuck when Config.use_compilation_database <> None -> | BBuck when Option.is_some Config.buck_compilation_database ->
BuckCompilationDB BuckCompilationDB
| BJava -> | BJava ->
Javac (Javac.Java, prog, args) Javac (Javac.Java, prog, args)

@ -551,6 +551,11 @@ and buck_build_args =
~parse_mode:CLOpt.(Infer [Driver]) ~parse_mode:CLOpt.(Infer [Driver])
"Pass values as command-line arguments to invocations of `buck build` (Buck flavors only)" "Pass values as command-line arguments to invocations of `buck build` (Buck flavors only)"
and buck_compilation_database =
CLOpt.mk_symbol_opt ~long:"buck-compilation-database" ~deprecated:["-use-compilation-database"]
"Buck integration using the compilation database, with or without dependencies."
~symbols:[("deps", `Deps); ("no-deps", `NoDeps)]
and buck_out = and buck_out =
CLOpt.mk_path_opt ~long:"buck-out" CLOpt.mk_path_opt ~long:"buck-out"
~parse_mode:CLOpt.(Infer [Driver]) ~meta:"dir" "Specify the root directory of buck-out" ~parse_mode:CLOpt.(Infer [Driver]) ~meta:"dir" "Specify the root directory of buck-out"
@ -641,17 +646,6 @@ and clang_biniou_file =
and clang_compilation_dbs = ref [] and clang_compilation_dbs = ref []
and clang_compilation_db_files =
CLOpt.mk_path_list ~long:"clang-compilation-db-files"
~parse_mode:CLOpt.(Infer [Clang])
"File that contain compilation commands (can be specified multiple times)"
and clang_compilation_db_files_escaped =
CLOpt.mk_path_list ~long:"clang-compilation-db-files-escaped"
~parse_mode:CLOpt.(Infer [Clang])
"File that contain compilation commands where all entries are escaped for the shell, eg coming \
from Xcode (can be specified multiple times)"
and clang_frontend_action = and clang_frontend_action =
CLOpt.mk_symbol_opt ~long:"clang-frontend-action" CLOpt.mk_symbol_opt ~long:"clang-frontend-action"
~parse_mode:CLOpt.(Infer [Clang]) ~parse_mode:CLOpt.(Infer [Clang])
@ -672,6 +666,19 @@ and cluster =
CLOpt.mk_path_opt ~deprecated:["cluster"] ~long:"cluster" CLOpt.mk_path_opt ~deprecated:["cluster"] ~long:"cluster"
~meta:"file" "Specify a .cluster file to be analyzed" ~meta:"file" "Specify a .cluster file to be analyzed"
and compilation_database =
CLOpt.mk_path_list ~long:"compilation-database"
~deprecated:["-clang-compilation-db-files"]
~parse_mode:CLOpt.(Infer [Clang])
"File that contain compilation commands (can be specified multiple times)"
and compilation_database_escaped =
CLOpt.mk_path_list ~long:"compilation-database-escaped"
~deprecated:["-clang-compilation-db-files-escaped"]
~parse_mode:CLOpt.(Infer [Clang])
"File that contain compilation commands where all entries are escaped for the shell, eg coming \
from Xcode (can be specified multiple times)"
and compute_analytics = and compute_analytics =
CLOpt.mk_bool ~long:"compute-analytics" CLOpt.mk_bool ~long:"compute-analytics"
~default:false ~default:false
@ -1257,11 +1264,6 @@ and unsafe_malloc =
~parse_mode:CLOpt.(Infer [Clang]) ~parse_mode:CLOpt.(Infer [Clang])
"Assume that malloc(3) never returns null." "Assume that malloc(3) never returns null."
and use_compilation_database =
CLOpt.mk_symbol_opt ~long:"compilation-database" ~deprecated:["-use-compilation-database"]
"Buck integration using the compilation database, with or without dependencies."
~symbols:[("deps", `Deps); ("no-deps", `NoDeps)]
(** Set the path to the javac verbose output *) (** Set the path to the javac verbose output *)
and verbose_out = and verbose_out =
CLOpt.mk_path ~deprecated:["verbose_out"] ~long:"verbose-out" ~default:"" CLOpt.mk_path ~deprecated:["verbose_out"] ~long:"verbose-out" ~default:""
@ -1413,8 +1415,8 @@ let post_parsing_initialization () =
if is_none !seconds_per_iteration then seconds_per_iteration := seconds_timeout ; if is_none !seconds_per_iteration then seconds_per_iteration := seconds_timeout ;
clang_compilation_dbs := clang_compilation_dbs :=
List.rev_map ~f:(fun x -> `Raw x) !clang_compilation_db_files List.rev_map ~f:(fun x -> `Raw x) !compilation_database
|> List.rev_map_append ~f:(fun x -> `Escaped x) !clang_compilation_db_files_escaped; |> List.rev_map_append ~f:(fun x -> `Escaped x) !compilation_database_escaped;
match !analyzer with match !analyzer with
| Some Checkers -> checkers := true | Some Checkers -> checkers := true
@ -1463,6 +1465,7 @@ and bo_debug = !bo_debug
and buck = !buck and buck = !buck
and buck_build_args = !buck_build_args and buck_build_args = !buck_build_args
and buck_cache_mode = !buck && not !debug and buck_cache_mode = !buck && not !debug
and buck_compilation_database = !buck_compilation_database
and buck_out = !buck_out and buck_out = !buck_out
and bufferoverrun = !bufferoverrun and bufferoverrun = !bufferoverrun
and bugs_csv = !bugs_csv and bugs_csv = !bugs_csv
@ -1593,7 +1596,6 @@ and trace_join = !trace_join
and trace_rearrange = !trace_rearrange and trace_rearrange = !trace_rearrange
and type_size = !type_size and type_size = !type_size
and unsafe_malloc = !unsafe_malloc and unsafe_malloc = !unsafe_malloc
and use_compilation_database = !use_compilation_database
and whole_seconds = !whole_seconds and whole_seconds = !whole_seconds
and worklist_mode = !worklist_mode and worklist_mode = !worklist_mode
and write_dotty = !write_dotty and write_dotty = !write_dotty

@ -157,6 +157,7 @@ val bo_debug : int
val buck : bool val buck : bool
val buck_build_args : string list val buck_build_args : string list
val buck_cache_mode : bool val buck_cache_mode : bool
val buck_compilation_database : [ `Deps | `NoDeps ] option
val buck_out : string option val buck_out : string option
val bufferoverrun : bool val bufferoverrun : bool
val bugs_csv : string option val bugs_csv : string option
@ -285,7 +286,6 @@ val trace_join : bool
val trace_rearrange : bool val trace_rearrange : bool
val type_size : bool val type_size : bool
val unsafe_malloc : bool val unsafe_malloc : bool
val use_compilation_database : [ `Deps | `NoDeps ] option
val whole_seconds : bool val whole_seconds : bool
val worklist_mode : int val worklist_mode : int
val write_dotty : bool val write_dotty : bool

@ -91,11 +91,11 @@ let clang_cc1_cmd_sanitizer cmd => {
} else if ( } else if (
String.is_suffix arg suffix::"dep.tmp" String.is_suffix arg suffix::"dep.tmp"
) { ) {
/* compilation-database-buck integration produces path to `dep.tmp` file that doesn't exist. Create it */ /* compilation-database Buck integration produces path to `dep.tmp` file that doesn't exist. Create it */
Unix.mkdir_p (Filename.dirname arg); Unix.mkdir_p (Filename.dirname arg);
arg arg
} else if ( } else if (
String.equal option "-dependency-file" && Option.is_some Config.use_compilation_database String.equal option "-dependency-file" && Option.is_some Config.buck_compilation_database
/* In compilation database mode, dependency files are not assumed to exist */ /* In compilation database mode, dependency files are not assumed to exist */
) { ) {
"/dev/null" "/dev/null"

@ -34,7 +34,7 @@ let check_args_for_targets args =
let add_flavor_to_targets args = let add_flavor_to_targets args =
let flavor = let flavor =
match Config.use_compilation_database with match Config.buck_compilation_database with
| Some `Deps -> "#uber-compilation-database" | Some `Deps -> "#uber-compilation-database"
| Some `NoDeps -> "#compilation-database" | Some `NoDeps -> "#compilation-database"
| _ -> assert false (* cannot happen *) in | _ -> assert false (* cannot happen *) in
@ -89,7 +89,7 @@ let run_compilation_database compilation_database should_capture_file =
let fail_on_failed_job = let fail_on_failed_job =
if Config.linters_ignore_clang_failures then false if Config.linters_ignore_clang_failures then false
else else
match Config.use_compilation_database with match Config.buck_compilation_database with
| Some `NoDeps -> Config.clang_frontend_do_lint | Some `NoDeps -> Config.clang_frontend_do_lint
| _ -> false in | _ -> false in
Process.run_jobs_in_parallel ~fail_on_failed_job jobs_stack Process.run_jobs_in_parallel ~fail_on_failed_job jobs_stack

@ -18,7 +18,7 @@ val capture_file_in_database : CompilationDatabase.t -> SourceFile.t -> unit
(** Get the compilation database files that contain the compilation given by the (** Get the compilation database files that contain the compilation given by the
buck command. It will be the compilation of the passed targets only or also buck command. It will be the compilation of the passed targets only or also
the dependencies according to the flag --use-compilation-database deps | no-deps *) the dependencies according to the flag --buck-compilation-database deps | no-deps *)
val get_compilation_database_files_buck : unit -> [> `Raw of string ] list val get_compilation_database_files_buck : unit -> [> `Raw of string ] list
(** Get the compilation database files that contain the compilation given by the (** Get the compilation database files that contain the compilation given by the

@ -31,16 +31,16 @@ infer-out/report.json:
infer-out-with-index/report.json: $(CMAKE_BUILD_DIR)/compile_commands.json $(CLANG_DEPS) $(SOURCES) infer-out-with-index/report.json: $(CMAKE_BUILD_DIR)/compile_commands.json $(CLANG_DEPS) $(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-db-files $<) $(INFER_BIN) -a $(ANALYZER) $(INFER_OPTIONS) -o infer-out-with-index --changed-files-index $(CMAKE_DIR)/index.txt --compilation-database $<)
infer-out-no-index/report.json: $(CMAKE_BUILD_DIR)/compile_commands.json $(CLANG_DEPS) $(SOURCES) infer-out-no-index/report.json: $(CMAKE_BUILD_DIR)/compile_commands.json $(CLANG_DEPS) $(SOURCES)
$(call silent_on_success,\ $(call silent_on_success,\
$(INFER_BIN) -a $(ANALYZER) $(INFER_OPTIONS) -o infer-out-no-index --clang-compilation-db-files $<) $(INFER_BIN) -a $(ANALYZER) $(INFER_OPTIONS) -o infer-out-no-index --compilation-database $<)
infer-out-reactive-capture/report.json: $(CMAKE_BUILD_DIR)/compile_commands.json $(CLANG_DEPS) $(SOURCES) infer-out-reactive-capture/report.json: $(CMAKE_BUILD_DIR)/compile_commands.json $(CLANG_DEPS) $(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-db-files $<) --changed-files-index $(CMAKE_DIR)/index.txt --compilation-database $<)
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 \

@ -29,4 +29,4 @@ infer-out/report.json: compile_commands.json $(SOURCES) Makefile \
../codetoanalyze/path\ with\ spaces/hel\ lo.c ../codetoanalyze/path\ with\ spaces/hel\ lo.c
$(call silent_on_success,\ $(call silent_on_success,\
$(INFER_BIN) -a $(ANALYZER) $(INFER_OPTIONS) --project-root $(TESTS_DIR) \ $(INFER_BIN) -a $(ANALYZER) $(INFER_OPTIONS) --project-root $(TESTS_DIR) \
--clang-compilation-db-files-escaped $<) --compilation-database-escaped $<)

@ -31,4 +31,4 @@ infer-out/report.json: compile_commands.json $(SOURCES) Makefile \
../codetoanalyze/path\ with\ spaces/hel\ lo.c ../codetoanalyze/path\ with\ spaces/hel\ lo.c
$(call silent_on_success,\ $(call silent_on_success,\
$(INFER_BIN) -a $(ANALYZER) $(INFER_OPTIONS) --project-root $(TESTS_DIR) \ $(INFER_BIN) -a $(ANALYZER) $(INFER_OPTIONS) --project-root $(TESTS_DIR) \
--clang-compilation-db-files $<) --compilation-database $<)

Loading…
Cancel
Save