]> granicus.if.org Git - clang/commitdiff
fix a bug introduced in my previous patch: moving clang headers to the
authorChris Lattner <sabre@nondot.org>
Thu, 19 Feb 2009 06:48:28 +0000 (06:48 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 19 Feb 2009 06:48:28 +0000 (06:48 +0000)
"after" group instead of the system group makes it so #include <limits.h>
picks up the *system* limits.h file before clang's.  This causes a failure
on linux and is definitely not what we want.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65026 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/clang.cpp
include/clang/Driver/InitHeaderSearch.h
lib/Driver/InitHeaderSearch.cpp

index 79166fb0bdf9b68f69769c62b5854aa5bd0dde45..525c27faccc93429f405e95b2c8f5262ff9da685 100644 (file)
@@ -1098,8 +1098,11 @@ void InitializeIncludePaths(const char *Argv0, HeaderSearch &Headers,
     MainExecutablePath.eraseComponent();  // Remove /clang from foo/bin/clang
     MainExecutablePath.eraseComponent();  // Remove /bin   from foo/bin
     MainExecutablePath.appendComponent("Headers"); // Get foo/Headers
-    Init.AddPath(MainExecutablePath.c_str(), InitHeaderSearch::After,
-                 false, false, false);
+    
+    // We pass true to ignore sysroot so that we *always* look for clang headers
+    // relative to our executable, never relative to -isysroot.
+    Init.AddPath(MainExecutablePath.c_str(), InitHeaderSearch::System,
+                 false, false, false, true /*ignore sysroot*/);
   }
   
   if (!nostdinc) 
index a113456e8a5b1a2c6d9a51d0989496a5d2bddb3c..b02117e1b6bd13e289a13ed6f413f2125c075a6c 100644 (file)
@@ -50,7 +50,7 @@ public:
   /// AddPath - Add the specified path to the specified group list.
   void AddPath(const std::string &Path, IncludeDirGroup Group,
                bool isCXXAware, bool isUserSupplied,
-               bool isFramework);
+               bool isFramework, bool IgnoreSysRoot = false);
 
   /// AddEnvVarPaths - Add a list of paths from an environment variable to a
   ///  header search list.
index 4b5275d726444ffc146561f87f5208f2509dd3c8..5b0b2c2f72be6bed15dbf78ecfc19dc940be7705 100644 (file)
@@ -24,7 +24,7 @@ using namespace clang;
 
 void InitHeaderSearch::AddPath(const std::string &Path, IncludeDirGroup Group,
                                bool isCXXAware, bool isUserSupplied,
-                               bool isFramework) {
+                               bool isFramework, bool IgnoreSysRoot) {
   assert(!Path.empty() && "can't handle empty path here");
   FileManager &FM = Headers.getFileMgr();
   
@@ -32,7 +32,7 @@ void InitHeaderSearch::AddPath(const std::string &Path, IncludeDirGroup Group,
   llvm::SmallString<256> MappedPath;
   
   // Handle isysroot.
-  if (Group == System) {
+  if (Group == System && !IgnoreSysRoot) {
     // FIXME: Portability.  This should be a sys::Path interface, this doesn't
     // handle things like C:\ right, nor win32 \\network\device\blah.
     if (isysroot.size() != 1 || isysroot[0] != '/') // Add isysroot if present.