Skip translation and checks from headers in specified folders

Reviewed By: jberdine

Differential Revision: D3207485

fb-gh-sync-id: aa863c3
fbshipit-source-id: aa863c3
master
Dulma Rodriguez 9 years ago committed by Facebook Github Bot 7
parent d2aca60937
commit 7671fe755f

@ -414,3 +414,12 @@ let test () =
(DB.source_file_to_rel_path source_file)
matching_s)
(Sys.getcwd ())
let skip_translation_headers =
lazy (
match
lookup_string_list "skip_translation_headers"
(Yojson.Basic.from_file (inferconfig ()))
with
| exception _ -> []
| headers -> headers)

@ -52,3 +52,5 @@ end
(** Load the config file and list the files to report on *)
val test: unit -> unit
val skip_translation_headers : string list Lazy.t

@ -76,8 +76,16 @@ let clang_to_sil_location clang_loc procdesc_opt =
| None -> !curr_file, !Config.nLOC in
Location.{line; col; file; nLOC}
let file_in_project file = match !Config.project_root with
| Some root -> string_is_prefix root file
let file_in_project file =
match !Config.project_root with
| Some root ->
let file_in_project = string_is_prefix root file in
let paths = Lazy.force Inferconfig.skip_translation_headers in
let file_should_be_skipped =
IList.exists
(fun path -> string_is_prefix (Filename.concat root path) file)
paths in
file_in_project && not (file_should_be_skipped)
| None -> false
let should_do_frontend_check (loc_start, _) =

@ -88,6 +88,10 @@ let arg_desc =
None,
"Analyze C++ methods, still experimental"
;
"-inferconfig_home",
Arg.String (fun s -> Config.inferconfig_home := Some s),
Some "dir",
"Path to the .inferconfig file";
] in
Arg.create_options_desc false "Parsing Options" desc
@ -137,6 +141,9 @@ let do_run source_path ast_path =
CFrontend_config.json := ast_filename;
CLocation.check_source_file source_path;
let source_file = CLocation.source_file_from_path source_path in
(match !Config.inferconfig_home with
| Some _ -> ()
| None -> Config.inferconfig_home := !Config.project_root);
Printf.printf "Start translation of AST from %s\n" !CFrontend_config.json;
CFrontend.do_source_file source_file ast_decl;
Printf.printf "End translation AST file %s... OK!\n" !CFrontend_config.json;

Loading…
Cancel
Save