[cfe-commits] r44731 - /cfe/trunk/Driver/clang.cpp

Chris Lattner sabre at nondot.org
Sat Dec 8 16:39:55 PST 2007


Author: lattner
Date: Sat Dec  8 18:39:55 2007
New Revision: 44731

URL: http://llvm.org/viewvc/llvm-project?rev=44731&view=rev
Log:
avoid ///usr/include/foo.h, patch by Sean Middleditch

Modified:
    cfe/trunk/Driver/clang.cpp

Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=44731&r1=44730&r2=44731&view=diff

==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Sat Dec  8 18:39:55 2007
@@ -622,10 +622,17 @@
 static void AddPath(const std::string &Path, IncludeDirGroup Group,
                     bool isCXXAware, bool isUserSupplied,
                     bool isFramework, FileManager &FM) {
+  assert(!Path.empty() && "can't handle empty path here");
+  
   const DirectoryEntry *DE;
-  if (Group == System)
-    DE = FM.getDirectory(isysroot + "/" + Path);
-  else
+  if (Group == System) {
+    if (isysroot != "/")
+      DE = FM.getDirectory(isysroot + "/" + Path);
+    else if (Path[0] == '/')
+      DE = FM.getDirectory(Path);
+    else
+      DE = FM.getDirectory("/" + Path);
+  } else
     DE = FM.getDirectory(Path);
   
   if (DE == 0) {





More information about the cfe-commits mailing list