From: Reid Kleckner Date: Wed, 31 May 2017 20:42:43 +0000 (+0000) Subject: [clang-cl] Expose -nostdinc and -nobuiltininc X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b2e94d3c82a2c5b4a31ea51c1211abd54b3a7569;p=clang [clang-cl] Expose -nostdinc and -nobuiltininc These are already wired up to work in the MSVC toolchain header search code. However, they were unreachable from clang-cl. A user attempted to use them in https://bugs.llvm.org/show_bug.cgi?id=33205, so let's expose them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304345 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index 2de4a2d1b4..12e36cc52b 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -2084,7 +2084,7 @@ def no_cpp_precomp : Flag<["-"], "no-cpp-precomp">, Group def no_integrated_cpp : Flag<["-", "--"], "no-integrated-cpp">, Flags<[DriverOption]>; def no_pedantic : Flag<["-", "--"], "no-pedantic">, Group; def no__dead__strip__inits__and__terms : Flag<["-"], "no_dead_strip_inits_and_terms">; -def nobuiltininc : Flag<["-"], "nobuiltininc">, Flags<[CC1Option]>, +def nobuiltininc : Flag<["-"], "nobuiltininc">, Flags<[CC1Option, CoreOption]>, HelpText<"Disable builtin #include directories">; def nocudainc : Flag<["-"], "nocudainc">; def nocudalib : Flag<["-"], "nocudalib">; @@ -2096,7 +2096,7 @@ def nopie : Flag<["-"], "nopie">; def noprebind : Flag<["-"], "noprebind">; def noseglinkedit : Flag<["-"], "noseglinkedit">; def nostartfiles : Flag<["-"], "nostartfiles">; -def nostdinc : Flag<["-"], "nostdinc">; +def nostdinc : Flag<["-"], "nostdinc">, Flags<[CoreOption]>; def nostdlibinc : Flag<["-"], "nostdlibinc">; def nostdincxx : Flag<["-"], "nostdinc++">, Flags<[CC1Option]>, HelpText<"Disable standard #include directories for the C++ standard library">; diff --git a/test/Driver/cl-include.c b/test/Driver/cl-include.c new file mode 100644 index 0000000000..f89c483fab --- /dev/null +++ b/test/Driver/cl-include.c @@ -0,0 +1,14 @@ +// Note: %s must be preceded by --, otherwise it may be interpreted as a +// command-line option, e.g. on Mac where %s is commonly under /Users. + +// RUN: %clang_cl -### -- %s 2>&1 | FileCheck %s --check-prefix=BUILTIN +// BUILTIN: "-internal-isystem" "{{.*lib.*clang.*[0-9]\.[0-9].*include}}" + +// RUN: %clang_cl -nobuiltininc -### -- %s 2>&1 | FileCheck %s --check-prefix=NOBUILTIN +// NOBUILTIN-NOT: "-internal-isystem" "{{.*lib.*clang.*[0-9]\.[0-9].*include}}" + +// RUN: env INCLUDE=/my/system/inc %clang_cl -### -- %s 2>&1 | FileCheck %s --check-prefix=STDINC +// STDINC: "-internal-isystem" "/my/system/inc" + +// RUN: env INCLUDE=/my/system/inc %clang_cl -nostdinc -### -- %s 2>&1 | FileCheck %s --check-prefix=NOSTDINC +// NOSTDINC-NOT: "-internal-isystem" "/my/system/inc"