[reactive-capture] Random fixes

Summary:
Found during testing:
1. Fix escaping in makefiles
2. Fix bunch of logging (+ add couple more)

Reviewed By: jberdine

Differential Revision: D4327056

fbshipit-source-id: 29743b6
master
Andrzej Kotulski 8 years ago committed by Facebook Github Bot
parent 9fb0636ca1
commit 95ad5b6387

@ -34,18 +34,23 @@ let try_capture (attributes : ProcAttributes.t) : ProcAttributes.t option =
(AttributesTable.load_defined_attributes ~cache_none:false attributes.proc_name) then ( (AttributesTable.load_defined_attributes ~cache_none:false attributes.proc_name) then (
(* peek at the results to know if capture succeeded, but only in debug mode *) (* peek at the results to know if capture succeeded, but only in debug mode *)
Logging.out Logging.out
"Captured file %a to get procedure %a but it wasn't found there@." "Captured file %a to get procedure %a but it wasn't found there@\n"
SourceFile.pp definition_file SourceFile.pp definition_file
Procname.pp attributes.proc_name Procname.pp attributes.proc_name
) )
) else ( ) else (
Logging.out Logging.out
"Wanted to capture file %a to get procedure %a but file was already captured@." "Wanted to capture file %a to get procedure %a but file was already captured@\n"
SourceFile.pp definition_file SourceFile.pp definition_file
Procname.pp attributes.proc_name Procname.pp attributes.proc_name
) )
in in
Option.may try_compile definition_file_opt match definition_file_opt with
| None ->
Logging.out "Couldn't find source file for %a (declared in %a)@\n"
Procname.pp attributes.proc_name
SourceFile.pp decl_file
| Some file -> try_compile file
); );
(* It's important to call load_defined_attributes again in all cases to make sure we try (* It's important to call load_defined_attributes again in all cases to make sure we try
reading from disk again no matter which condition happened. If previous call to reading from disk again no matter which condition happened. If previous call to

@ -38,14 +38,13 @@ let cluster_should_be_analyzed cluster =
let pp_prolog fmt clusters = let pp_prolog fmt clusters =
let escape = Escape.escape_map (fun c -> if c = '#' then Some "\\#" else None) in
let compilation_dbs_cmd = let compilation_dbs_cmd =
IList.map (F.sprintf "--clang-compilation-db-files %s") !Config.clang_compilation_db_files IList.map (F.sprintf "--clang-compilation-db-files '%s'") !Config.clang_compilation_db_files
|> String.concat ~sep:" " in |> String.concat ~sep:" " |> escape in
F.fprintf fmt "INFERANALYZE= %s -results_dir '%s' %s \n@." F.fprintf fmt "INFERANALYZE= %s -results_dir '%s' %s \n@."
(Config.bin_dir ^/ (CLOpt.exe_name Analyze)) (Config.bin_dir ^/ (CLOpt.exe_name Analyze))
(Escape.escape_map (escape Config.results_dir)
(fun c -> if c = '#' then Some "\\#" else None)
Config.results_dir)
compilation_dbs_cmd; compilation_dbs_cmd;
F.fprintf fmt "CLUSTERS="; F.fprintf fmt "CLUSTERS=";

@ -37,6 +37,7 @@ let parse_command_and_arguments command_and_arguments =
and as a string. We pack this information into the compilationDatabase map, and remove the and as a string. We pack this information into the compilationDatabase map, and remove the
clang invocation part, because we will use a clang wrapper. *) clang invocation part, because we will use a clang wrapper. *)
let decode_json_file (database : t) json_path = let decode_json_file (database : t) json_path =
Logging.out "parsing compilation database from %s@\n" json_path;
let exit_format_error () = let exit_format_error () =
failwith ("Json file doesn't have the expected format") in failwith ("Json file doesn't have the expected format") in
let json = Yojson.Basic.from_file json_path in let json = Yojson.Basic.from_file json_path in
@ -76,4 +77,5 @@ let decode_json_file (database : t) json_path =
let from_json_files db_json_files = let from_json_files db_json_files =
let db = empty () in let db = empty () in
IList.iter (decode_json_file db) db_json_files; IList.iter (decode_json_file db) db_json_files;
Logging.out "created database with %d entries@\n" (get_size db);
db db

Loading…
Cancel
Save