[Dependency Scanner] Refactor the global scanning service to no longer maintain scanner cache state

Instead, each scan's 'ModuleDependenciesCache' will hold all of the data corresponding to discovered module dependencies.

The initial design presumed the possibility of sharing a global scanning cache amongs different scanner invocations, possibly even different concurrent scanner invocations.

This change also deprecates two libSwiftScan entry-points: 'swiftscan_scanner_cache_load' and 'swiftscan_scanner_cache_serialize'. They never ended up getting used, and since this code has been largely stale, we are confident they have not otherwise had users, and they do not fit with this design.

A follow-up change will re-introduce moduele dependency cache serialization on a per-query basis and bring the binary format up-to-date.
This commit is contained in:
Artem Chikin
2024-11-20 13:02:22 -08:00
parent 0234f7ab4a
commit 9055a401a3
13 changed files with 279 additions and 540 deletions

View File

@@ -209,24 +209,24 @@ using ClangModuleDetailsLayout =
/// Tries to read the dependency graph from the given buffer.
/// Returns \c true if there was an error.
bool readInterModuleDependenciesCache(llvm::MemoryBuffer &buffer,
SwiftDependencyScanningService &cache);
ModuleDependenciesCache &cache);
/// Tries to read the dependency graph from the given path name.
/// Returns true if there was an error.
bool readInterModuleDependenciesCache(llvm::StringRef path,
SwiftDependencyScanningService &cache);
ModuleDependenciesCache &cache);
/// Tries to write the dependency graph to the given path name.
/// Returns true if there was an error.
bool writeInterModuleDependenciesCache(DiagnosticEngine &diags,
llvm::vfs::OutputBackend &backend,
llvm::StringRef path,
const SwiftDependencyScanningService &cache);
const ModuleDependenciesCache &cache);
/// Tries to write out the given dependency cache with the given
/// bitstream writer.
void writeInterModuleDependenciesCache(llvm::BitstreamWriter &Out,
const SwiftDependencyScanningService &cache);
const ModuleDependenciesCache &cache);
} // end namespace module_dependency_cache_serialization
} // end namespace dependencies