Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 16 additions & 18 deletions include/swift/DependencyScan/ModuleDependencyScanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,14 @@ class ModuleDependencyIssueReporter {
class ModuleDependencyScanner {
public:
ModuleDependencyScanner(SwiftDependencyScanningService &ScanningService,
ModuleDependenciesCache &Cache,
const CompilerInvocation &ScanCompilerInvocation,
const SILOptions &SILOptions,
ASTContext &ScanASTContext,
DependencyTracker &DependencyTracker,
std::shared_ptr<llvm::cas::ObjectStore> CAS,
std::shared_ptr<llvm::cas::ActionCache> ActionCache,
DiagnosticEngine &diags, bool ParallelScan);
DiagnosticEngine &Diagnostics, bool ParallelScan);

/// Identify the scanner invocation's main module's dependencies
llvm::ErrorOr<ModuleDependencyInfo>
Expand All @@ -231,8 +232,7 @@ class ModuleDependencyScanner {
/// Resolve module dependencies of the given module, computing a full
/// transitive closure dependency graph.
std::vector<ModuleDependencyID>
performDependencyScan(ModuleDependencyID rootModuleID,
ModuleDependenciesCache &cache);
performDependencyScan(ModuleDependencyID rootModuleID);

/// How many filesystem lookups were performed by the scanner
unsigned getNumLookups() { return NumLookups; }
Expand Down Expand Up @@ -275,47 +275,46 @@ class ModuleDependencyScanner {
/// that have one
ModuleDependencyIDSetVector
resolveImportedModuleDependencies(
const ModuleDependencyID &rootModuleID, ModuleDependenciesCache &cache);
const ModuleDependencyID &rootModuleID);
void resolveSwiftModuleDependencies(
const ModuleDependencyID &rootModuleID, ModuleDependenciesCache &cache,
const ModuleDependencyID &rootModuleID,
ModuleDependencyIDSetVector &discoveredSwiftModules);
void resolveAllClangModuleDependencies(
ArrayRef<ModuleDependencyID> swiftModules, ModuleDependenciesCache &cache,
ArrayRef<ModuleDependencyID> swiftModules,
ModuleDependencyIDSetVector &discoveredClangModules);
void resolveHeaderDependencies(
ArrayRef<ModuleDependencyID> swiftModules, ModuleDependenciesCache &cache,
ArrayRef<ModuleDependencyID> swiftModules,
ModuleDependencyIDSetVector &discoveredHeaderDependencyClangModules);
void resolveSwiftOverlayDependencies(
ArrayRef<ModuleDependencyID> swiftModules, ModuleDependenciesCache &cache,
ArrayRef<ModuleDependencyID> swiftModules,
ModuleDependencyIDSetVector &discoveredDependencies);

/// Resolve all of a given module's imports to a Swift module, if one exists.
void resolveSwiftImportsForModule(
const ModuleDependencyID &moduleID, ModuleDependenciesCache &cache,
const ModuleDependencyID &moduleID,
ModuleDependencyIDSetVector &importedSwiftDependencies);

/// If a module has a bridging header or other header inputs, execute a
/// dependency scan on it and record the dependencies.
void resolveHeaderDependenciesForModule(
const ModuleDependencyID &moduleID, ModuleDependenciesCache &cache,
const ModuleDependencyID &moduleID,
ModuleDependencyIDSetVector &headerClangModuleDependencies);

/// Resolve all module dependencies comprised of Swift overlays
/// of this module's Clang module dependencies.
void resolveSwiftOverlayDependenciesForModule(
const ModuleDependencyID &moduleID, ModuleDependenciesCache &cache,
const ModuleDependencyID &moduleID,
ModuleDependencyIDSetVector &swiftOverlayDependencies);

/// Identify all cross-import overlay module dependencies of the
/// source module under scan and apply an action for each.
void resolveCrossImportOverlayDependencies(
StringRef mainModuleName, ModuleDependenciesCache &cache,
StringRef mainModuleName,
llvm::function_ref<void(ModuleDependencyID)> action);

/// Perform Bridging Header Chaining.
llvm::Error
performBridgingHeaderChaining(const ModuleDependencyID &rootModuleID,
ModuleDependenciesCache &cache,
ModuleDependencyIDSetVector &allModules);

/// Bridge Clang dependency scanner's dependency node
Expand Down Expand Up @@ -351,7 +350,6 @@ class ModuleDependencyScanner {
void performParallelClangModuleLookup(
const ImportStatementInfoMap &unresolvedImportsMap,
const ImportStatementInfoMap &unresolvedOptionalImportsMap,
ModuleDependenciesCache &cache,
BatchClangModuleLookupResult &result);

/// Given a result of a batch Clang module dependency lookup,
Expand All @@ -371,7 +369,6 @@ class ModuleDependencyScanner {
const ImportStatementInfoMap &unresolvedImportsMap,
const ImportStatementInfoMap &unresolvedOptionalImportsMap,
ArrayRef<ModuleDependencyID> swiftModuleDependents,
ModuleDependenciesCache &cache,
ModuleDependencyIDSetVector &allDiscoveredClangModules,
std::vector<std::pair<ModuleDependencyID, ScannerImportStatementInfo>>
&failedToResolveImports,
Expand All @@ -381,7 +378,6 @@ class ModuleDependencyScanner {
/// Re-query some failed-to-resolve Clang imports from cache
/// in chance they were brought in as transitive dependencies.
void reQueryMissedModulesFromCache(
ModuleDependenciesCache &cache,
const std::vector<
std::pair<ModuleDependencyID, ScannerImportStatementInfo>>
&failedToResolveImports,
Expand All @@ -395,8 +391,7 @@ class ModuleDependencyScanner {
/// the module, if one is found.
std::optional<std::pair<ModuleDependencyID, std::string>>
attemptToFindResolvingSerializedSearchPath(
const ScannerImportStatementInfo &moduleImport,
const ModuleDependenciesCache &cache);
const ScannerImportStatementInfo &moduleImport);

private:
const CompilerInvocation &ScanCompilerInvocation;
Expand All @@ -407,6 +402,9 @@ class ModuleDependencyScanner {
std::string ModuleOutputPath;
/// The location of where the explicitly-built SDK modules will be output to
std::string SDKModuleOutputPath;

/// Reference to a module dependency cache
ModuleDependenciesCache &DependencyCache;

/// The available pool of workers for filesystem module search
unsigned NumThreads;
Expand Down
Loading