@ -30,21 +30,14 @@ let clang_to_sil_location trans_unit_ctx clang_loc =
Location . { line ; col ; file }
Location . { line ; col ; file }
let file_in_project file =
let file_in_project file =
(* Look at file paths before resolving them to real paths. Do it to
(* IMPORTANT: results of realpath are cached to not ruin performance *)
improve performance of most likely case when calling realpath is not needed * )
let real_root = realpath Config . project_root in
let file_in_project , used_project_root , used_file =
let real_file = realpath file in
if string_is_prefix Config . project_root file then
let file_in_project = string_is_prefix real_root real_file in
true , Config . project_root , file
else if string_is_prefix Config . project_root_realpath file then
true , Config . project_root_realpath , file
else
let real_root = Config . project_root_realpath in
let real_file = Core . Std . Filename . realpath file in
string_is_prefix real_root real_file , real_root , real_file in
let paths = Config . skip_translation_headers in
let paths = Config . skip_translation_headers in
let file_should_be_skipped =
let file_should_be_skipped =
IList . exists
IList . exists
( fun path -> string_is_prefix ( Filename . concat used_project_root path ) used _file)
( fun path -> string_is_prefix ( Filename . concat real_root path ) real_file )
paths in
paths in
file_in_project && not ( file_should_be_skipped )
file_in_project && not ( file_should_be_skipped )