[Dependency Scanning] Specify Explicit Module output path to the scanner explicitly

Instead of the code querying the compiler's built-in Clang instance, refactor the
dependency scanner to explicitly keep track of module output path. It is still
set according to '-module-cache-path' as it has been prior to this change, but
now the scanner can use a different module cache for scanning PCMs, as specified
with '-clang-scanner-module-cache-path', without affecting module output path.

Resolves rdar://113222853
This commit is contained in:
Artem Chikin
2023-08-04 13:14:44 -07:00
parent 8501f99cb2
commit 6ef79c4ba0
12 changed files with 79 additions and 55 deletions

View File

@@ -174,7 +174,7 @@ void ClangImporter::recordModuleDependencies(
auto pcmPath = moduleCacheRelativeLookupModuleOutput(
clangModuleDep.ID, ModuleOutputKind::ModuleFile,
getModuleCachePathFromClang(getClangInstance()));
cache.getModuleOutputPath());
swiftArgs.push_back("-o");
swiftArgs.push_back(pcmPath);
@@ -421,7 +421,7 @@ ClangImporter::getModuleDependencies(StringRef moduleName,
}
std::string workingDir = *optionalWorkingDir;
auto moduleCachePath = getModuleCachePathFromClang(getClangInstance());
auto moduleCachePath = cache.getModuleOutputPath();
auto lookupModuleOutput =
[moduleCachePath](const ModuleID &MID,
ModuleOutputKind MOK) -> std::string {