summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-05-31 20:42:43 +0000
committerReid Kleckner <rnk@google.com>2017-05-31 20:42:43 +0000
commit8ea89eaf7d1c0636059228c82c8628348770c835 (patch)
tree9db161d7e26cf50a0ab2f0bd6c3f8967ec9a58c1
parente3e2aaf68d991321c881e5b2ce002849988eeb42 (diff)
downloadbcm5719-llvm-8ea89eaf7d1c0636059228c82c8628348770c835.tar.gz
bcm5719-llvm-8ea89eaf7d1c0636059228c82c8628348770c835.zip
[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. llvm-svn: 304345
-rw-r--r--clang/include/clang/Driver/Options.td4
-rw-r--r--clang/test/Driver/cl-include.c14
2 files changed, 16 insertions, 2 deletions
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 2de4a2d1b41..12e36cc52b0 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -2084,7 +2084,7 @@ def no_cpp_precomp : Flag<["-"], "no-cpp-precomp">, Group<clang_ignored_f_Group>
def no_integrated_cpp : Flag<["-", "--"], "no-integrated-cpp">, Flags<[DriverOption]>;
def no_pedantic : Flag<["-", "--"], "no-pedantic">, Group<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/clang/test/Driver/cl-include.c b/clang/test/Driver/cl-include.c
new file mode 100644
index 00000000000..f89c483fabb
--- /dev/null
+++ b/clang/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"
OpenPOWER on IntegriCloud