From d4c728913ab0eadb46deab37623fec2ee229f176 Mon Sep 17 00:00:00 2001 From: Andrzej Kotulski Date: Fri, 14 Jul 2017 06:33:59 -0700 Subject: [PATCH] [clang] Ignore all -mllvm args passed to clang -cc1 Summary: Infer is only using clang's AST which means it can ignore flags passed to LLVM backend via `-mllvm` flag. It will make it easier to maintain compatibility between different versions of clang/LLVM (ie. when flag is not available in LLVM used by infer) Reviewed By: jvillard Differential Revision: D5423685 fbshipit-source-id: a9de681 --- infer/src/clang/ClangCommand.ml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/infer/src/clang/ClangCommand.ml b/infer/src/clang/ClangCommand.ml index bfe30a5cf..074ceebb8 100644 --- a/infer/src/clang/ClangCommand.ml +++ b/infer/src/clang/ClangCommand.ml @@ -71,7 +71,6 @@ let include_override_regex = Option.map ~f:Str.regexp Config.clang_include_to_ov let clang_cc1_cmd_sanitizer cmd = (* command line options not supported by the opensource compiler or the plugins *) let flags_blacklist = ["-fembed-bitcode-marker"; "-fno-canonical-system-headers"] in - let mllvm_flags_blacklist = ["-profile-guided-section-prefix"] in let replace_option_arg option arg = if String.equal option "-arch" && String.equal arg "armv7k" then "armv7" (* replace armv7k arch with armv7 *) @@ -107,9 +106,7 @@ let clang_cc1_cmd_sanitizer cmd = List.rev_append res_rev (List.rev post_args_rev) | flag :: tl when List.mem ~equal:String.equal flags_blacklist flag -> filter_unsupported_args_and_swap_includes (flag, res_rev) tl - | flag1 :: flag2 :: tl - when String.equal "-mllvm" flag1 - && List.exists ~f:(fun prefix -> String.is_prefix ~prefix flag2) mllvm_flags_blacklist + | flag1 :: flag2 :: tl when String.equal "-mllvm" flag1 -> filter_unsupported_args_and_swap_includes (flag2, res_rev) tl | arg :: tl -> let res_rev' = replace_option_arg prev arg :: res_rev in