From: Chris Lattner Date: Sun, 9 Dec 2007 00:39:55 +0000 (+0000) Subject: avoid ///usr/include/foo.h, patch by Sean Middleditch X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b3de9e798c0227200f1197f8f573b9e1838a42c8;p=clang 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 5fa83ff71f..eb469d87ec 100644 --- a/Driver/clang.cpp +++ b/Driver/clang.cpp @@ -622,10 +622,17 @@ static std::vector 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) {