diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2010-11-15 00:05:18 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2010-11-15 00:05:18 +0000 |
commit | c4d6fd5b03fb0ecf8d3f54d943442ccd77c3058c (patch) | |
tree | b9eb336666a04dc68f11a3d49c3d175cc9ebce72 /clang/lib/Frontend/InitHeaderSearch.cpp | |
parent | 240028d11dd0c35ac099772c6da123999c1ab2a9 (diff) | |
download | bcm5719-llvm-c4d6fd5b03fb0ecf8d3f54d943442ccd77c3058c.tar.gz bcm5719-llvm-c4d6fd5b03fb0ecf8d3f54d943442ccd77c3058c.zip |
Make sysroot only apply to baked in paths which start with a '/'.
llvm-svn: 119095
Diffstat (limited to 'clang/lib/Frontend/InitHeaderSearch.cpp')
-rw-r--r-- | clang/lib/Frontend/InitHeaderSearch.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/clang/lib/Frontend/InitHeaderSearch.cpp b/clang/lib/Frontend/InitHeaderSearch.cpp index e47381e39d3..d51468af709 100644 --- a/clang/lib/Frontend/InitHeaderSearch.cpp +++ b/clang/lib/Frontend/InitHeaderSearch.cpp @@ -102,19 +102,17 @@ void InitHeaderSearch::AddPath(const llvm::Twine &Path, const FileSystemOptions &FSOpts = Headers.getFileSystemOpts(); // Compute the actual path, taking into consideration -isysroot. - llvm::SmallString<256> MappedPathStr; - llvm::raw_svector_ostream MappedPath(MappedPathStr); + llvm::SmallString<256> MappedPathStorage; + llvm::StringRef MappedPath = Path.toStringRef(MappedPathStorage); // Handle isysroot. - if (Group == System && !IgnoreSysRoot) { + if (Group == System && !IgnoreSysRoot && MappedPath[0] == '/') { // FIXME: Portability. This should be a sys::Path interface, this doesn't // handle things like C:\ right, nor win32 \\network\device\blah. if (isysroot.size() != 1 || isysroot[0] != '/') // Add isysroot if present. - MappedPath << isysroot; + MappedPath = (isysroot + Path).toStringRef(MappedPathStorage); } - Path.print(MappedPath); - // Compute the DirectoryLookup type. SrcMgr::CharacteristicKind Type; if (Group == Quoted || Group == Angled) @@ -126,7 +124,7 @@ void InitHeaderSearch::AddPath(const llvm::Twine &Path, // If the directory exists, add it. - if (const DirectoryEntry *DE = FM.getDirectory(MappedPath.str(), FSOpts)) { + if (const DirectoryEntry *DE = FM.getDirectory(MappedPath, FSOpts)) { IncludeGroup[Group].push_back(DirectoryLookup(DE, Type, isUserSupplied, isFramework)); return; @@ -135,7 +133,7 @@ void InitHeaderSearch::AddPath(const llvm::Twine &Path, // Check to see if this is an apple-style headermap (which are not allowed to // be frameworks). if (!isFramework) { - if (const FileEntry *FE = FM.getFile(MappedPath.str(), FSOpts)) { + if (const FileEntry *FE = FM.getFile(MappedPath, FSOpts)) { if (const HeaderMap *HM = Headers.CreateHeaderMap(FE)) { // It is a headermap, add it to the search path. IncludeGroup[Group].push_back(DirectoryLookup(HM, Type,isUserSupplied)); @@ -145,8 +143,7 @@ void InitHeaderSearch::AddPath(const llvm::Twine &Path, } if (Verbose) - llvm::errs() << "ignoring nonexistent directory \"" - << MappedPath.str() << "\"\n"; + llvm::errs() << "ignoring nonexistent directory \"" << MappedPath << "\"\n"; } |