[Dependency Scanning] Add ability for -scan-dependencies action to serialize and deserialize dependency scanner cache from a .moddepcache file.

Using the serialization format added in https://github.com/apple/swift/pull/37585.

- Add load/save code for the `-scan-dependencies` code-path.
- Add `libSwiftDriver` entry-points to load/store the cache of a given scanner instance.
This commit is contained in:
Artem Chikin
2021-05-25 15:00:04 -07:00
parent 23fcb4944b
commit 7e2c8e97fc
12 changed files with 360 additions and 22 deletions

View File

@@ -57,6 +57,14 @@ public:
const std::vector<BatchScanInput> &BatchInput,
const llvm::StringSet<> &PlaceholderModules);
/// Writes the current `SharedCache` instance to a specified FileSystem path.
void serializeCache(llvm::StringRef path);
/// Loads an instance of a `ModuleDependenciesCache` to serve as the `SharedCache`
/// from a specified FileSystem path.
bool loadCache(llvm::StringRef path);
/// Discard the tool's current `SharedCache` and start anew.
void resetCache();
private:
/// Using the specified invocation command, instantiate a CompilerInstance
/// that will be used for this scan.