[DependencyScanner] Drop macro search path if not needed

When scanning swift modules and constructing their build commands, there
is no need to pass any external plugin search paths if there are no macro
dependencies for the module.

rdar://135221984
This commit is contained in:
Steven Wu
2024-09-03 13:57:57 -07:00
parent f29f67c48c
commit fcdc29500f
4 changed files with 52 additions and 1 deletions

View File

@@ -120,6 +120,18 @@ void ModuleDependencyInfo::addMacroDependency(StringRef macroModuleName,
llvm_unreachable("Unexpected dependency kind");
}
bool ModuleDependencyInfo::hasMacroDependencies() const {
if (auto sourceModule =
dyn_cast<SwiftSourceModuleDependenciesStorage>(storage.get()))
return !sourceModule->textualModuleDetails.macroDependencies.empty();
if (auto interfaceModule =
dyn_cast<SwiftInterfaceModuleDependenciesStorage>(storage.get()))
return !interfaceModule->textualModuleDetails.macroDependencies.empty();
llvm_unreachable("Unexpected dependency kind");
}
bool ModuleDependencyInfo::isTestableImport(StringRef moduleName) const {
if (auto swiftSourceDepStorage = getAsSwiftSourceModule())
return swiftSourceDepStorage->testableImports.contains(moduleName);