diff options
-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) { |