Skip to content

Commit c7774c6

Browse files
committed
[Serialization] Reword error message on memory or format failures
The old message `(see "While..." info below)` is misleading ever since we moved the serialization failure information to the stacktrace as the context appears before this error. Plus this message should only be shown for low-level errors when the data read is unexpected, so in cases of a corrupted swiftmodule file or when there's a collision between two different serialization formats. Let's make it more clear and direct.
1 parent 08d902f commit c7774c6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/Serialization/ModuleFile.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,12 @@ class ModuleFile
344344
fatal(expected.takeError());
345345
}
346346

347+
/// Report an unexpected format error that could happen only from a memory-level
348+
/// inconsistency. Please prefer passing an error to `fatal(llvm::Error error)` when possible.
347349
[[noreturn]] void fatal() const {
348350
fatal(llvm::make_error<llvm::StringError>(
349-
"(see \"While...\" info below)", llvm::inconvertibleErrorCode()));
351+
"Memory corruption or serialization format inconsistency.",
352+
llvm::inconvertibleErrorCode()));
350353
}
351354

352355
/// Outputs information useful for diagnostics to \p out

0 commit comments

Comments
 (0)