Skip to content

Commit 380515b

Browse files
ngorogiannisfacebook-github-bot
authored andcommitted
[changed files] don't fail on non-existent absolute paths
Summary: When a file is passed to infer through `--changed-files-index` which is - an absolute path - the file does not exist Then the code fails throwing an exception in the function below while trying to relativise the absolute path. The behaviour on relative paths is to skip missing files, and does not fail because Infer does not attempt to relativise them. Swallow the exception and skip the file; and so unify the behaviour across relative and absolute paths. Reviewed By: mityal Differential Revision: D16279672 fbshipit-source-id: 33b468da7
1 parent 82eb91f commit 380515b

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

infer/src/base/SourceFile.ml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,16 @@ let create ?(warn_on_error = true) path =
169169

170170
let changed_sources_from_changed_files changed_files =
171171
List.fold changed_files ~init:Set.empty ~f:(fun changed_files_set line ->
172-
let source_file = create line in
173-
let changed_files' = Set.add source_file changed_files_set in
174-
(* Add source corresponding to changed header if it exists *)
175-
match of_header source_file with
176-
| Some src ->
177-
Set.add src changed_files'
178-
| None ->
179-
changed_files' )
172+
try
173+
let source_file = create line in
174+
let changed_files' = Set.add source_file changed_files_set in
175+
(* Add source corresponding to changed header if it exists *)
176+
match of_header source_file with
177+
| Some src ->
178+
Set.add src changed_files'
179+
| None ->
180+
changed_files'
181+
with _exn -> changed_files_set )
180182

181183

182184
module SQLite = struct

0 commit comments

Comments
 (0)