[cfe-commits] r152589 - /cfe/trunk/lib/Driver/WindowsToolChain.cpp

NAKAMURA Takumi geek4civic at gmail.com
Mon Mar 12 17:02:21 PDT 2012


Author: chapuni
Date: Mon Mar 12 19:02:21 2012
New Revision: 152589

URL: http://llvm.org/viewvc/llvm-project?rev=152589&view=rev
Log:
[msvc] Honor %INCLUDE%. It should know essential search paths with vcvarsall.bat.

FYI,

On VS10, %INCLUDE% contains;
(VS10)\VC\INCLUDE
(VS10)\VC\ATLMFC\INCLUDE
(SDK70A)\include

On VS11,
(VS11)\VC\INCLUDE
(VS11)\VC\ATLMFC\INCLUDE
(SDK80)\include\shared
(SDK80)\include\um
(SDK80)\include\winrt

FIXME: It may be enabled also on mingw.

Modified:
    cfe/trunk/lib/Driver/WindowsToolChain.cpp

Modified: cfe/trunk/lib/Driver/WindowsToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/WindowsToolChain.cpp?rev=152589&r1=152588&r2=152589&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/WindowsToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/WindowsToolChain.cpp Mon Mar 12 19:02:21 2012
@@ -318,10 +318,26 @@
   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<StringRef, 8> Dirs;
+    StringRef(cl_include_dir).split(Dirs, ";");
+    int n = 0;
+    for (SmallVectorImpl<StringRef>::iterator I = Dirs.begin(), E = Dirs.end();
+         I != E; ++I) {
+      StringRef d = *I;
+      if (d.size() == 0)
+        continue;
+      ++n;
+      addSystemInclude(DriverArgs, CC1Args, d);
+    }
+    if (n) return;
+  }
+
   std::string VSDir;
   std::string WindowsSDKDir;
 
-#ifdef _MSC_VER
   // When built with access to the proper Windows APIs, try to actually find
   // the correct include paths first.
   if (getVisualStudioDir(VSDir)) {





More information about the cfe-commits mailing list