[debug] Don't keep a copy of source files in the results directory

Reviewed By: akotulski

Differential Revision: D4220714

fbshipit-source-id: 527df73
master
Cristiano Calcagno 8 years ago committed by Facebook Github Bot
parent 661de290e7
commit 31e6f19ab2

@ -115,33 +115,6 @@ let load_cfg_from_file (filename: DB.filename) :option cfg =>
Serialization.from_file cfg_serializer filename;
/** save a copy in the results dir of the source files of procedures defined in the cfg,
unless an updated copy already exists */
let save_source_files cfg => {
let process_proc _ pdesc => {
let loc = Procdesc.get_loc pdesc;
let source_file = loc.Location.file;
let source_file_str = DB.source_file_to_abs_path source_file;
let dest_file = DB.source_file_in_resdir source_file;
let dest_file_str = DB.filename_to_string dest_file;
let needs_copy =
Procdesc.is_defined pdesc &&
Sys.file_exists source_file_str && (
not (Sys.file_exists dest_file_str) ||
DB.file_modified_time (DB.filename_from_string source_file_str) >
DB.file_modified_time dest_file
);
if needs_copy {
switch (copy_file source_file_str dest_file_str) {
| Some _ => ()
| None => L.err "Error cannot create copy of source file %s@." source_file_str
}
}
};
iter_proc_desc cfg process_proc
};
/** Save the .attr files for the procedures in the cfg. */
let save_attributes source_file cfg => {
let save_proc pdesc => {
@ -332,15 +305,8 @@ let mark_unchanged_pdescs cfg_new cfg_old => {
/** Save a cfg into a file */
let store_cfg_to_file
save_sources::save_sources=true
source_file::source_file
(filename: DB.filename)
(cfg: cfg) => {
let store_cfg_to_file source_file::source_file (filename: DB.filename) (cfg: cfg) => {
inline_java_synthetic_methods cfg;
if save_sources {
save_source_files cfg
};
if Config.incremental_procs {
switch (load_cfg_from_file filename) {
| Some old_cfg => mark_unchanged_pdescs cfg old_cfg

@ -24,8 +24,7 @@ let load_cfg_from_file: DB.filename => option cfg;
/** Save a cfg into a file, and save a copy of the source files if the boolean is true */
let store_cfg_to_file:
save_sources::bool? => source_file::DB.source_file => DB.filename => cfg => unit;
let store_cfg_to_file: source_file::DB.source_file => DB.filename => cfg => unit;
/** {2 Functions for manipulating an interprocedural CFG} */

@ -74,7 +74,6 @@ let remove_results_dir () =
let create_results_dir () =
create_path (Config.results_dir // Config.captured_dir_name) ;
create_path (Config.results_dir // Config.sources_dir_name) ;
create_path (Config.results_dir // Config.specs_dir_name)
let clean_results_dir () =

@ -62,11 +62,7 @@ struct
else None
let from_file_linenum hash fname linenum =
let fname_in_resdir =
DB.source_file_in_resdir fname in
let sourcefile_in_resdir =
DB.abs_source_file_from_path (DB.filename_to_string fname_in_resdir) in
from_file_linenum_original hash sourcefile_in_resdir linenum
from_file_linenum_original hash fname linenum
let from_loc hash loc =
from_file_linenum hash loc.Location.file loc.Location.line

@ -186,8 +186,6 @@ let smt_output = false
let source_file_extentions = [".java"; ".m"; ".mm"; ".c"; ".cc"; ".cpp"; ".h"]
let sources_dir_name = "sources"
let specs_dir_name = "specs"
let specs_files_suffix = ".specs"

@ -112,7 +112,6 @@ val save_compact_summaries : bool
val save_time_in_summaries : bool
val smt_output : bool
val source_file_extentions : string list
val sources_dir_name : string
val specs_dir_name : string
val specs_files_suffix : string
val start_filename : string

@ -119,17 +119,10 @@ let source_dir_get_internal_file source_dir extension =
let captured_dir =
Filename.concat Config.results_dir Config.captured_dir_name
let sources_dir =
Filename.concat Config.results_dir Config.sources_dir_name
(** get the source directory corresponding to a source file *)
let source_dir_from_source_file source_file =
Filename.concat captured_dir (source_file_encoding source_file)
(** get the path to the copy of the source file to be stored in the results directory *)
let source_file_in_resdir source_file =
Filename.concat sources_dir (source_file_encoding source_file)
(** Find the source directories in the results dir *)
let find_source_dirs () =
let source_dirs = ref [] in
@ -285,7 +278,6 @@ module Results_dir = struct
create_dir Config.results_dir;
create_dir specs_dir;
create_dir (path_to_filename Abs_root [Config.attributes_dir_name]);
create_dir (path_to_filename Abs_root [Config.sources_dir_name]);
create_dir (path_to_filename Abs_root [Config.captured_dir_name]);
if not (source_file_equal source source_file_empty) then
create_dir (path_to_filename (Abs_source_dir source) [])

@ -126,9 +126,6 @@ type source_dir
val source_dir_compare : source_dir -> source_dir -> int
(** get the absolute path to the sources dir *)
val sources_dir : string
(** expose the source dir as a string *)
val source_dir_to_string : source_dir -> string
@ -138,9 +135,6 @@ val source_dir_get_internal_file : source_dir -> string -> filename
(** get the source directory corresponding to a source file *)
val source_dir_from_source_file : source_file -> source_dir
(** get the path to the copy of the source file to be stored in the results directory *)
val source_file_in_resdir : source_file -> filename
(** directory where the results of the capture phase are stored *)
val captured_dir : filename

@ -205,8 +205,7 @@ let inhabit_call tenv (procname, receiver) cfg env =
let create_dummy_harness_file harness_name =
let dummy_file_name =
let dummy_file_dir =
if Sys.file_exists DB.sources_dir then DB.sources_dir
else Filename.get_temp_dir_name () in
Filename.get_temp_dir_name () in
let file_str =
Procname.java_get_class_name
harness_name ^ "_" ^Procname.java_get_method harness_name ^ ".java" in

Loading…
Cancel
Save