Skip to content

Commit dfda270

Browse files
committed
fix duplicate arguments
1 parent 99c8d22 commit dfda270

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/util/compilationDatabase.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ let load_and_preprocess ~all_cppflags filename =
7272
let suf =
7373
begin match List.findi (fun i e -> e = "-o") arguments with
7474
| (o_i, _) ->
75-
begin match List.drop o_i arguments with
76-
| (_ :: o_file :: arguments_tl) -> preprocessed_file :: arguments_tl
75+
begin match List.split_at o_i arguments with
76+
| (arguments_init, o_file :: arguments_tl) -> arguments_init @ preprocessed_file :: arguments_tl
7777
| _ -> failwith ("CompilationDatabase.preprocess: no argument found for -o option for " ^ file)
7878
end
79-
| exception Not_found -> [preprocessed_file]
79+
| exception Not_found -> arguments @ "-o" :: [preprocessed_file]
8080
end in
81-
all_cppflags @ "-E" :: "-MMD" :: "-MT" :: file :: arguments @ "-o" :: suf in
81+
all_cppflags @ "-E" :: "-MMD" :: "-MT" :: file :: suf in
8282
begin match arguments with
8383
| (arguments_program :: arguments) -> Filename.quote_command arguments_program preprocess_arguments
8484
| _ -> failwith "CompilationDatabase.preprocess: no program found for " ^ file

0 commit comments

Comments
 (0)