avoid ///usr/include/foo.h, patch by Sean Middleditch
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44731 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index 5fa83ff..eb469d8 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -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) {