From 5f701b4abbc51f84da23b73da9faf955a1d4bfee Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 23 Apr 2014 00:15:12 +0000 Subject: [PATCH] Driver: Honor %INCLUDE% when built with MinGW Users are expected to pass system includes through the INCLUDE environment variable on Windows. There's no reason to change behavior based on the toolchain used to build Clang. I didn't change the registry searching code because I'm not sure it builds with mingw and I'm not set up to test it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206934 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/WindowsToolChain.cpp | 2 +- test/Driver/windows-include-env.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 test/Driver/windows-include-env.c diff --git a/lib/Driver/WindowsToolChain.cpp b/lib/Driver/WindowsToolChain.cpp index cd6d7e16fc..aba06d6ef8 100644 --- a/lib/Driver/WindowsToolChain.cpp +++ b/lib/Driver/WindowsToolChain.cpp @@ -293,7 +293,6 @@ void Windows::AddClangSystemIncludeArgs(const ArgList &DriverArgs, if (DriverArgs.hasArg(options::OPT_nostdlibinc)) return; -#ifdef _MSC_VER // Honor %INCLUDE%. It should know essential search paths with vcvarsall.bat. if (const char *cl_include_dir = getenv("INCLUDE")) { SmallVector Dirs; @@ -305,6 +304,7 @@ void Windows::AddClangSystemIncludeArgs(const ArgList &DriverArgs, return; } +#ifdef _MSC_VER std::string VSDir; std::string WindowsSDKDir; diff --git a/test/Driver/windows-include-env.c b/test/Driver/windows-include-env.c new file mode 100644 index 0000000000..5793561af3 --- /dev/null +++ b/test/Driver/windows-include-env.c @@ -0,0 +1,4 @@ +// RUN: env INCLUDE=my_system_headers %clang -c %s -### 2>&1 | FileCheck %s +// RUN: env INCLUDE=my_system_headers %clang_cl -c %s -### 2>&1 | FileCheck %s +// CHECK: "-cc1" +// CHECK: "-internal-isystem" "my_system_headers" -- 2.40.0