[cpp] Report issues in the cpp models as relative paths

Reviewed By: jvillard

Differential Revision: D4001979

fbshipit-source-id: 483a758
master
Dulma Churchill 8 years ago committed by Facebook Github Bot
parent 1a958d1d8b
commit caa7534a71

@ -410,6 +410,18 @@ let module IssuesJson = {
} else { } else {
file file
}; };
let make_cpp_models_path_relative file =>
if (Utils.string_is_prefix Config.cpp_models_dir file) {
if (Config.debug_mode || Config.debug_exceptions) {
Some (
DB.source_file_to_rel_path (DB.rel_source_file_from_abs_path Config.cpp_models_dir file)
)
} else {
None
}
} else {
Some file
};
/** Write bug report in JSON format */ /** Write bug report in JSON format */
let pp_issues_of_error_log fmt error_filter _ proc_loc_opt procname err_log => { let pp_issues_of_error_log fmt error_filter _ proc_loc_opt procname err_log => {
@ -431,12 +443,15 @@ let module IssuesJson = {
| Some proc_loc => proc_loc.Location.file | Some proc_loc => proc_loc.Location.file
| None => loc.Location.file | None => loc.Location.file
}; };
if (in_footprint && error_filter source_file error_desc error_name) { let file = DB.source_file_to_string source_file;
let file_opt = make_cpp_models_path_relative file;
if (
in_footprint && error_filter source_file error_desc error_name && Option.is_some file_opt
) {
let kind = Exceptions.err_kind_string ekind; let kind = Exceptions.err_kind_string ekind;
let bug_type = Localise.to_string error_name; let bug_type = Localise.to_string error_name;
let procedure_id = Procname.to_filename procname; let procedure_id = Procname.to_filename procname;
let file = DB.source_file_to_string source_file; let file = expand_links_under_buck_out (Option.get file_opt);
let file = expand_links_under_buck_out file;
let json_ml_loc = let json_ml_loc =
switch ml_loc_opt { switch ml_loc_opt {
| Some (file, lnum, cnum, enum) when Config.reports_include_ml_loc => | Some (file, lnum, cnum, enum) when Config.reports_include_ml_loc =>

@ -250,7 +250,8 @@ let models_dir =
lib_dir // specs_dir_name lib_dir // specs_dir_name
let cpp_models_dir = let cpp_models_dir =
bin_dir // Filename.parent_dir_name // "models" // "cpp" // "include" let dir = bin_dir // Filename.parent_dir_name // "models" // "cpp" // "include" in
Utils.filename_to_absolute dir (* Normalize the path *)
let wrappers_dir = let wrappers_dir =
lib_dir // "wrappers" lib_dir // "wrappers"

Loading…
Cancel
Save