Skip to content

Commit f4bb6dc

Browse files
committed
[Serialization] Remark on stderr when loading a mismatching swiftmodule
Swiftmodules built by a mismatching compiler are loaded if the mismatch is only on the last digit of the compiler version. In such a case, write a remark directly to stderr to avoid showing this error in IDE but keep it for debugging purposes. rdar://105881894
1 parent fbac545 commit f4bb6dc

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -811,10 +811,6 @@ ERROR(serialization_module_incompatible_revision,Fatal,
811811
"compiled module was created by a different version of the compiler '%0'; "
812812
"rebuild %1 and try again: %2",
813813
(StringRef, Identifier, StringRef))
814-
REMARK(serialization_module_problematic_revision, none,
815-
"compiled module was created by a different version of the compiler '%0': "
816-
"%1",
817-
(StringRef, StringRef))
818814
ERROR(serialization_missing_single_dependency,Fatal,
819815
"missing required module '%0'", (StringRef))
820816
ERROR(serialization_missing_dependencies,Fatal,

lib/Serialization/SerializedModuleLoader.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -846,11 +846,13 @@ LoadedFile *SerializedModuleLoaderBase::loadAST(
846846
loadedModuleFile->mayHaveDiagnosticsPointingAtBuffer())
847847
OrphanedModuleFiles.push_back(std::move(loadedModuleFile));
848848
} else {
849-
// Report non-fatal compiler tag mismatch.
849+
// Report non-fatal compiler tag mismatch on stderr only to avoid
850+
// polluting the IDE UI.
850851
if (!loadInfo.problematicRevision.empty()) {
851-
Ctx.Diags.diagnose(*diagLoc,
852-
diag::serialization_module_problematic_revision,
853-
loadInfo.problematicRevision, moduleBufferID);
852+
llvm::errs() << "remark: compiled module was created by a different " <<
853+
"version of the compiler '" <<
854+
loadInfo.problematicRevision <<
855+
"': " << moduleBufferID << "\n";
854856
}
855857
}
856858

0 commit comments

Comments
 (0)