[Explicit Modules] On an explicit interface build, early exit if the expected output is up-to-date.

This commit is contained in:
Artem Chikin
2022-08-16 16:42:44 -07:00
parent 6ca24c9239
commit 256c0ff04a
6 changed files with 42 additions and 0 deletions

View File

@@ -1345,6 +1345,21 @@ bool ModuleInterfaceLoader::buildExplicitSwiftModuleFromSwiftInterface(
ArrayRef<std::string> CompiledCandidates,
DependencyTracker *tracker) {
// First, check if the expected output already exists and possibly up-to-date w.r.t.
// all of the dependencies it was built with. If so, early exit.
UpToDateModuleCheker checker(Instance.getASTContext(),
RequireOSSAModules_t(Instance.getSILOptions()));
ModuleRebuildInfo rebuildInfo;
SmallVector<FileDependency, 3> allDeps;
std::unique_ptr<llvm::MemoryBuffer> moduleBuffer;
if (checker.swiftModuleIsUpToDate(outputPath, rebuildInfo, allDeps, moduleBuffer)) {
if (Instance.getASTContext().LangOpts.EnableSkipExplicitInterfaceModuleBuildRemarks) {
Instance.getDiags().diagnose(SourceLoc(),
diag::explicit_interface_build_skipped, outputPath);
}
return false;
}
// Read out the compiler version.
llvm::BumpPtrAllocator alloc;
llvm::StringSaver ArgSaver(alloc);