From a3d5f0283d323e4526f85494a1cd782a4cae1917 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Thu, 23 Aug 2018 05:43:34 -0700 Subject: [PATCH] [clang] only pass `--Xclang` args to driver commands Summary: Not all clang commands are happy with all arguments, but the driver is usually the place we want to add arguments to. Reviewed By: martinoluca Differential Revision: D9421403 fbshipit-source-id: fa6d39a9b --- infer/src/clang/ClangCommand.ml | 4 +++- infer/tests/build_systems/assembly/Makefile | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/infer/src/clang/ClangCommand.ml b/infer/src/clang/ClangCommand.ml index d22350eac..b1ed8a051 100644 --- a/infer/src/clang/ClangCommand.ml +++ b/infer/src/clang/ClangCommand.ml @@ -190,7 +190,9 @@ let mk ~is_driver quoting_style ~prog ~args = let sanitized_args = filter_and_replace_unsupported_args ~blacklisted_flags:clang_blacklisted_flags ~blacklisted_flags_with_arg args - @ List.rev Config.clang_extra_flags + in + let sanitized_args = + if is_driver then sanitized_args @ List.rev Config.clang_extra_flags else sanitized_args in {exec= prog; orig_argv= sanitized_args; argv= sanitized_args; quoting_style; is_driver} diff --git a/infer/tests/build_systems/assembly/Makefile b/infer/tests/build_systems/assembly/Makefile index fe9da9376..222b5de0b 100644 --- a/infer/tests/build_systems/assembly/Makefile +++ b/infer/tests/build_systems/assembly/Makefile @@ -7,7 +7,7 @@ TESTS_DIR = ../.. ANALYZER = checkers CLANG_OPTIONS = -c -INFER_OPTIONS = --report-custom-error --developer-mode --project-root ../codetoanalyze +INFER_OPTIONS = --report-custom-error --developer-mode --project-root ../codetoanalyze --Xclang -U --Xclang __SSE2__ INFERPRINT_OPTIONS = --issues-tests SOURCES = \