[clang][oops] restore previous functionality

Summary: The previous commit broke the `--foo arg` case because it matched `--foo` in the case looking for `--foo=`.

Reviewed By: mbouaziz

Differential Revision: D15670472

fbshipit-source-id: ab81c7357
master
Jules Villard 6 years ago committed by Facebook Github Bot
parent 0ef038332d
commit a3d8b9c4a4

@ -124,8 +124,12 @@ let filter_and_replace_unsupported_args ?(replace_options_arg = fun _ s -> s) ?(
aux in_argfiles' (false, at_argfile :: res_rev, changed) tl )
| flag :: tl
when List.mem ~equal:String.equal Config.clang_blacklisted_flags flag
|| List.mem ~equal:String.equal Config.clang_blacklisted_flags_with_arg
(String.split ~on:'=' flag |> List.hd |> Option.value ~default:"") ->
|| String.lsplit2 ~on:'=' flag
|> function
| Some (flag, _arg) ->
List.mem ~equal:String.equal Config.clang_blacklisted_flags_with_arg flag
| None ->
false ->
aux in_argfiles (false, res_rev, true) tl
| flag :: tl when List.mem ~equal:String.equal Config.clang_blacklisted_flags_with_arg flag ->
(* remove the flag and its arg separately in case we are at the end of an argfile *)

@ -10,8 +10,8 @@ TESTS_DIR = ../..
# a folder, is not discarded, and Clang considers it as a source file. This
# leads to an error. This weird case can be observed when -index-store-path is
# passed in a sequence like the one in CLANG_OPTIONS.
CLANG_OPTIONS = -x c -index-store-path . -c -fsanitize=builtin -fsanitize=address,builtin
INFER_OPTIONS = --report-custom-error --developer-mode --project-root ../codetoanalyze
CLANG_OPTIONS = -x c -index-store-path . -c -fsanitize=builtin -fsanitize=address,builtin -bogus=arg
INFER_OPTIONS = --report-custom-error --developer-mode --project-root ../codetoanalyze --clang-blacklisted-flags-with-arg -bogus
INFERPRINT_OPTIONS = --issues-tests
SOURCES = ../codetoanalyze/hello.c

Loading…
Cancel
Save