diff options
author | Nico Weber <nicolasweber@gmx.de> | 2018-02-28 19:49:07 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2018-02-28 19:49:07 +0000 |
commit | 07f0a52c7fcef1bdbf3b2c0847b6c40ec2402d91 (patch) | |
tree | 0ea02cbe31325c1a2711add5222217bc11146254 | |
parent | 45f984e625956285e87be0848f5799b77530f1d4 (diff) | |
download | bcm5719-llvm-07f0a52c7fcef1bdbf3b2c0847b6c40ec2402d91.tar.gz bcm5719-llvm-07f0a52c7fcef1bdbf3b2c0847b6c40ec2402d91.zip |
[clang-cl] Implement /X
/X makes cl stop looking in %INCLUDE%. Implement this for clang-cl.
As it turns out, the return in ToolChains/MSVC.cpp, AddClangSystemIncludeArgs()
for -nostdlibinc is already in the right place (but -nostdlibinc isn't exposed
by clang-cl), so just alias /X to that.
https://reviews.llvm.org/D43888
llvm-svn: 326357
-rw-r--r-- | clang/include/clang/Driver/CLCompatOptions.td | 4 | ||||
-rw-r--r-- | clang/test/Driver/cl-include.c | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/clang/include/clang/Driver/CLCompatOptions.td b/clang/include/clang/Driver/CLCompatOptions.td index b2872d6bb87..fb9eb59af4c 100644 --- a/clang/include/clang/Driver/CLCompatOptions.td +++ b/clang/include/clang/Driver/CLCompatOptions.td @@ -166,6 +166,9 @@ def _SLASH_wd4996 : CLFlag<"wd4996">, Alias<W_Joined>, AliasArgs<["no-deprecated-declarations"]>; def _SLASH_vd : CLJoined<"vd">, HelpText<"Control vtordisp placement">, Alias<vtordisp_mode_EQ>; +def _SLASH_X : CLFlag<"X">, + HelpText<"Don't add %INCLUDE% to the include search path">, + Alias<nostdlibinc>; def _SLASH_Zc_sizedDealloc : CLFlag<"Zc:sizedDealloc">, HelpText<"Enable C++14 sized global deallocation functions">, Alias<fsized_deallocation>; @@ -388,7 +391,6 @@ def _SLASH_u : CLFlag<"u">; def _SLASH_V : CLFlag<"V">; def _SLASH_WL : CLFlag<"WL">; def _SLASH_Wp64 : CLFlag<"Wp64">; -def _SLASH_X : CLFlag<"X">; def _SLASH_Yd : CLFlag<"Yd">; def _SLASH_Yl : CLJoined<"Yl">; def _SLASH_Za : CLFlag<"Za">; diff --git a/clang/test/Driver/cl-include.c b/clang/test/Driver/cl-include.c index d3dc006e575..d0357c05370 100644 --- a/clang/test/Driver/cl-include.c +++ b/clang/test/Driver/cl-include.c @@ -10,5 +10,16 @@ // 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 suppresses all of %INCLUDE%, clang resource dirs, and -imsvc dirs. +// RUN: env INCLUDE=/my/system/inc %clang_cl -nostdinc -imsvc /my/other/inc -### -- %s 2>&1 | FileCheck %s --check-prefix=NOSTDINC +// NOSTDINC: argument unused{{.*}}-imsvc // NOSTDINC-NOT: "-internal-isystem" "/my/system/inc" +// NOSTDINC-NOT: "-internal-isystem" "{{.*}}/lib/clang/{{.*}}/include" +// NOSTDINC-NOT: "-internal-isystem" "/my/other/inc" + +// /X suppresses %INCLUDE% but not clang resource dirs or -imsvc dirs. +// RUN: env INCLUDE=/my/system/inc %clang_cl /X -imsvc /my/other/inc -### -- %s 2>&1 | FileCheck %s --check-prefix=SLASHX +// SLASHX-NOT: "argument unused{{.*}}-imsvc" +// SLASHX-NOT: "-internal-isystem" "/my/system/inc" +// SLASHX: "-internal-isystem" "{{.*}}/lib/clang/{{.*}}/include" +// SLASHX: "-internal-isystem" "/my/other/inc" |