From 95ad5b6387c22430fe1d70f608320e8ae89fc3e0 Mon Sep 17 00:00:00 2001 From: Andrzej Kotulski Date: Thu, 15 Dec 2016 05:32:42 -0800 Subject: [PATCH] [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 --- infer/src/backend/OndemandCapture.ml | 11 ++++++++--- infer/src/backend/clusterMakefile.ml | 9 ++++----- infer/src/integration/CompilationDatabase.ml | 2 ++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/infer/src/backend/OndemandCapture.ml b/infer/src/backend/OndemandCapture.ml index 201c2e1bd..975a2b5e3 100644 --- a/infer/src/backend/OndemandCapture.ml +++ b/infer/src/backend/OndemandCapture.ml @@ -34,18 +34,23 @@ let try_capture (attributes : ProcAttributes.t) : ProcAttributes.t option = (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 *) 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 Procname.pp attributes.proc_name ) ) else ( 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 Procname.pp attributes.proc_name ) 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 reading from disk again no matter which condition happened. If previous call to diff --git a/infer/src/backend/clusterMakefile.ml b/infer/src/backend/clusterMakefile.ml index 3b9dab2e8..83c0b7dfb 100644 --- a/infer/src/backend/clusterMakefile.ml +++ b/infer/src/backend/clusterMakefile.ml @@ -38,14 +38,13 @@ let cluster_should_be_analyzed cluster = let pp_prolog fmt clusters = + let escape = Escape.escape_map (fun c -> if c = '#' then Some "\\#" else None) in let compilation_dbs_cmd = - IList.map (F.sprintf "--clang-compilation-db-files %s") !Config.clang_compilation_db_files - |> String.concat ~sep:" " in + IList.map (F.sprintf "--clang-compilation-db-files '%s'") !Config.clang_compilation_db_files + |> String.concat ~sep:" " |> escape in F.fprintf fmt "INFERANALYZE= %s -results_dir '%s' %s \n@." (Config.bin_dir ^/ (CLOpt.exe_name Analyze)) - (Escape.escape_map - (fun c -> if c = '#' then Some "\\#" else None) - Config.results_dir) + (escape Config.results_dir) compilation_dbs_cmd; F.fprintf fmt "CLUSTERS="; diff --git a/infer/src/integration/CompilationDatabase.ml b/infer/src/integration/CompilationDatabase.ml index 71a9d464a..a4a4ceab7 100644 --- a/infer/src/integration/CompilationDatabase.ml +++ b/infer/src/integration/CompilationDatabase.ml @@ -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 clang invocation part, because we will use a clang wrapper. *) let decode_json_file (database : t) json_path = + Logging.out "parsing compilation database from %s@\n" json_path; let exit_format_error () = failwith ("Json file doesn't have the expected format") 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 db = empty () in IList.iter (decode_json_file db) db_json_files; + Logging.out "created database with %d entries@\n" (get_size db); db