]> granicus.if.org Git - clang/commitdiff
avoid ///usr/include/foo.h, patch by Sean Middleditch
authorChris Lattner <sabre@nondot.org>
Sun, 9 Dec 2007 00:39:55 +0000 (00:39 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 9 Dec 2007 00:39:55 +0000 (00:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44731 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/clang.cpp

index 5fa83ff71f7c0659c6c59f0e2372202dda0636fa..eb469d87ec5c00e257ba1f1ebe455550b701561d 100644 (file)
@@ -622,10 +622,17 @@ static std::vector<DirectoryLookup> IncludeGroup[4];
 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) {