[Dependency Scanning] Move generation of a named import path 'Identifier' out of the individual scanning workers up into the parent scanner. This operation mutates the scanner ASTContext by potentially adding new identifiers to it and is therefore not thread-safe.

This commit is contained in:
Artem Chikin
2023-12-05 10:10:54 -08:00
parent ff63a900aa
commit 674dfb3bd4
10 changed files with 48 additions and 35 deletions

View File

@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "swift/AST/ASTContext.h"
#include "swift/AST/Identifier.h"
#include "swift/AST/ModuleDependencies.h"
#include "swift/Frontend/ModuleInterfaceLoader.h"
#include "swift/Serialization/SerializedModuleLoader.h"
@@ -36,18 +37,18 @@ public:
private:
/// Retrieve the module dependencies for the module with the given name.
ModuleDependencyVector
scanFilesystemForModuleDependency(StringRef moduleName,
scanFilesystemForModuleDependency(Identifier moduleName,
const ModuleDependenciesCache &cache,
bool isTestableImport = false);
/// Retrieve the module dependencies for the Clang module with the given name.
ModuleDependencyVector
scanFilesystemForClangModuleDependency(StringRef moduleName,
scanFilesystemForClangModuleDependency(Identifier moduleName,
const ModuleDependenciesCache &cache);
/// Retrieve the module dependencies for the Swift module with the given name.
ModuleDependencyVector
scanFilesystemForSwiftModuleDependency(StringRef moduleName,
scanFilesystemForSwiftModuleDependency(Identifier moduleName,
const ModuleDependenciesCache &cache);
// An AST delegate for interface scanning.
@@ -135,6 +136,8 @@ private:
template <typename Function, typename... Args>
auto withDependencyScanningWorker(Function &&F, Args &&...ArgList);
Identifier getModuleImportIdentifier(StringRef moduleName);
private:
const CompilerInvocation &ScanCompilerInvocation;
ASTContext &ScanASTContext;