mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Dependency Scanning] Have the scanner cache answer queries relevant to current search paths only.
The dependency scanner's cache persists across different queries and answering a subsequent query's module lookup with a module not in the query's search path is not correct. For example, suppose we are looking for a Swift module `Foo` with a set of search paths `SP`. And dependency scanner cache already contains a module `Foo`, for which we found an interface file at location `L`. If `L`∉`SP`, then we cannot re-use the cached entry because we’d be resolving the scanning query to a filesystem location that the current scanning context is not aware of. Resolves rdar://81175942
This commit is contained in:
@@ -88,18 +88,10 @@ Optional<bool> forEachModuleSearchPath(
|
||||
// Apple platforms have extra implicit framework search paths:
|
||||
// $SDKROOT/System/Library/Frameworks/ and $SDKROOT/Library/Frameworks/.
|
||||
if (Ctx.LangOpts.Target.isOSDarwin()) {
|
||||
SmallString<128> scratch;
|
||||
scratch = Ctx.SearchPathOpts.SDKPath;
|
||||
llvm::sys::path::append(scratch, "System", "Library", "Frameworks");
|
||||
if (auto result =
|
||||
callback(scratch, SearchPathKind::Framework, /*isSystem=*/true))
|
||||
return result;
|
||||
|
||||
scratch = Ctx.SearchPathOpts.SDKPath;
|
||||
llvm::sys::path::append(scratch, "Library", "Frameworks");
|
||||
if (auto result =
|
||||
callback(scratch, SearchPathKind::Framework, /*isSystem=*/true))
|
||||
return result;
|
||||
for (const auto &path : Ctx.getDarwinImplicitFrameworkSearchPaths())
|
||||
if (auto result =
|
||||
callback(path, SearchPathKind::Framework, /*isSystem=*/true))
|
||||
return result;
|
||||
}
|
||||
|
||||
for (auto importPath : Ctx.SearchPathOpts.RuntimeLibraryImportPaths) {
|
||||
|
||||
Reference in New Issue
Block a user