forked from OSchip/llvm-project
Make sysroot only apply to baked in paths which start with a '/'.
llvm-svn: 119095
This commit is contained in:
parent
240028d11d
commit
c4d6fd5b03
|
@ -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";
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue