-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add all deserialization fatal output to the pretty stack trace #37743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,19 +14,17 @@ | |
#include "ModuleFileCoreTableInfo.h" | ||
#include "BCReadingExtras.h" | ||
#include "DeserializationErrors.h" | ||
#include "swift/Basic/LangOptions.h" | ||
#include "swift/Strings.h" | ||
#include "llvm/Support/MemoryBuffer.h" | ||
#include "llvm/Support/OnDiskHashTable.h" | ||
#include "llvm/Support/PrettyStackTrace.h" | ||
|
||
using namespace swift; | ||
using namespace swift::serialization; | ||
using namespace llvm::support; | ||
using llvm::Expected; | ||
|
||
StringRef swift::getNameOfModule(const ModuleFileSharedCore *MF) { | ||
return MF->getName(); | ||
} | ||
|
||
static bool checkModuleSignature(llvm::BitstreamCursor &cursor, | ||
ArrayRef<unsigned char> signature) { | ||
for (unsigned char byte : signature) { | ||
|
@@ -472,13 +470,31 @@ std::string ModuleFileSharedCore::Dependency::getPrettyPrintedPath() const { | |
return output; | ||
} | ||
|
||
void ModuleFileSharedCore::fatal(llvm::Error error) { | ||
logAllUnhandledErrors(std::move(error), llvm::errs(), | ||
"\n*** DESERIALIZATION FAILURE (please include this " | ||
"section in any bug report) ***\n"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a good change but I feel nostalgic with the idea of losing the part the nobody read There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the main issue is that most of the time the compiler output wouldn't even be seen - ie. there'd be a crash and it gets reported based on the crash log and not the output. |
||
void ModuleFileSharedCore::fatal(llvm::Error error) const { | ||
llvm::SmallString<0> errorStr; | ||
llvm::raw_svector_ostream out(errorStr); | ||
|
||
out << "*** DESERIALIZATION FAILURE ***\n"; | ||
outputDiagnosticInfo(out); | ||
out << "\n"; | ||
if (error) { | ||
handleAllErrors(std::move(error), [&](const llvm::ErrorInfoBase &ei) { | ||
ei.log(out); | ||
out << "\n"; | ||
}); | ||
} | ||
|
||
llvm::PrettyStackTraceString trace(errorStr.c_str()); | ||
abort(); | ||
} | ||
|
||
void ModuleFileSharedCore::outputDiagnosticInfo(llvm::raw_ostream &os) const { | ||
os << "module '" << Name << "' with full misc version '" << MiscVersion | ||
<< "'"; | ||
if (Bits.IsAllowModuleWithCompilerErrorsEnabled) | ||
os << " (built with -experimental-allow-module-with-compiler-errors)"; | ||
} | ||
|
||
ModuleFileSharedCore::~ModuleFileSharedCore() { } | ||
|
||
std::unique_ptr<ModuleFileSharedCore::SerializedDeclTable> | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still have the information about the Swift language compatibility version of the module somewhere in the output? This note has been useful to me at least once to quickly explain a deserialization failure due to changes in ClangImporter behaviors between two Swift versions.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above re. the effective version, as an example output:
So here we can see the version being compiled is
effective-4.2
(2.) and the module was compiled with(4.1.50)
(9.)