Merge pull request #85010 from artemcm/AlwaysRebuildExplicitInterface

[Explicit Module Builds] Always rebuild the target module in explicit `-compile-module-from-interface` builds.
This commit is contained in:
Artem Chikin
2025-10-31 21:24:18 -04:00
committed by GitHub
6 changed files with 27 additions and 45 deletions

View File

@@ -1609,27 +1609,6 @@ bool ModuleInterfaceLoader::buildExplicitSwiftModuleFromSwiftInterface(
StringRef outputPath, bool ShouldSerializeDeps,
ArrayRef<std::string> CompiledCandidates,
DependencyTracker *tracker) {
if (!Instance.getInvocation().getIRGenOptions().AlwaysCompile) {
// 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());
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);