diff options
author | Chris Lattner <sabre@nondot.org> | 2007-12-09 00:39:55 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-12-09 00:39:55 +0000 |
commit | b3de9e798c0227200f1197f8f573b9e1838a42c8 (patch) | |
tree | 6418ff99f1b6df5a14ed3fb4a7b78f77b5007fe7 | |
parent | 2ea81a84e21c23914a4189e8b4002149fb7cdf43 (diff) |
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
-rw-r--r-- | Driver/clang.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
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<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) { |