Deserialization: ignore search paths pointing into the SDK. rdar://84125071

This commit is contained in:
Xi Ge
2021-12-03 21:47:39 -08:00
parent 28d7dc3add
commit 645a27f108
2 changed files with 24 additions and 3 deletions

View File

@@ -165,10 +165,15 @@ Status ModuleFile::associateWithFileContext(FileUnit *file, SourceLoc diagLoc,
return error(status);
}
for (const auto &searchPath : Core->SearchPaths) {
ctx.addSearchPath(
StringRef SDKPath = ctx.SearchPathOpts.SDKPath;
if (SDKPath.empty() ||
!Core->ModuleInputBuffer->getBufferIdentifier().startswith(SDKPath)) {
for (const auto &searchPath : Core->SearchPaths) {
ctx.addSearchPath(
ctx.SearchPathOpts.SearchPathRemapper.remapPath(searchPath.Path),
searchPath.IsFramework, searchPath.IsSystem);
searchPath.IsFramework,
searchPath.IsSystem);
}
}
auto clangImporter = static_cast<ClangImporter *>(ctx.getClangModuleLoader());