mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add all deserialization fatal output to the pretty stack trace
Rather than outputting diagnostics and to stderr, output all the extra
information added when deserialization fatally fails to the pretty stack
trace instead. Since the pretty stack trace is added to crash logs, this
should avoid the dance of requesting the compiler output
- Moves the previous "**** DESERIALIZATION FAILURE ..." output to the
last pretty stack trace line
- Removes the module and compiler version notes added to the fatal
diagnostic
- Adds a new effective compiler version line for all frontend failure.
Somewhat duplicates the line from the driver, but adds in the
effective version
- Adds a new line for the full misc version of the module that failed.
May double up with previous "While reading from ..." lines that are
added in various deserialization methods, but better to have it
twice than not at all
This commit is contained in:
@@ -48,6 +48,7 @@
|
||||
#include "swift/Basic/SourceManager.h"
|
||||
#include "swift/Basic/Statistic.h"
|
||||
#include "swift/Basic/UUID.h"
|
||||
#include "swift/Basic/Version.h"
|
||||
#include "swift/Option/Options.h"
|
||||
#include "swift/Frontend/Frontend.h"
|
||||
#include "swift/Frontend/AccumulatingDiagnosticConsumer.h"
|
||||
@@ -1953,6 +1954,23 @@ static void printTargetInfo(const CompilerInvocation &invocation,
|
||||
out << "}\n";
|
||||
}
|
||||
|
||||
/// A PrettyStackTraceEntry to print frontend information useful for debugging.
|
||||
class PrettyStackTraceFrontend : public llvm::PrettyStackTraceEntry {
|
||||
const LangOptions &LangOpts;
|
||||
|
||||
public:
|
||||
PrettyStackTraceFrontend(const LangOptions &langOpts)
|
||||
: LangOpts(langOpts) {}
|
||||
|
||||
void print(llvm::raw_ostream &os) const override {
|
||||
auto effective = LangOpts.EffectiveLanguageVersion;
|
||||
if (effective != version::Version::getCurrentLanguageVersion()) {
|
||||
os << "Compiling with effective version " << effective;
|
||||
}
|
||||
os << "\n";
|
||||
};
|
||||
};
|
||||
|
||||
int swift::performFrontend(ArrayRef<const char *> Args,
|
||||
const char *Argv0, void *MainAddr,
|
||||
FrontendObserver *observer) {
|
||||
@@ -2046,10 +2064,7 @@ int swift::performFrontend(ArrayRef<const char *> Args,
|
||||
return finishDiagProcessing(1, /*verifierEnabled*/ false);
|
||||
}
|
||||
|
||||
Optional<llvm::PrettyStackTraceString> allowErrorsStackTrace;
|
||||
if (Invocation.getFrontendOptions().AllowModuleWithCompilerErrors)
|
||||
allowErrorsStackTrace.emplace("While allowing modules with compiler errors "
|
||||
"enabled");
|
||||
PrettyStackTraceFrontend frontendTrace(Invocation.getLangOptions());
|
||||
|
||||
// Make an array of PrettyStackTrace objects to dump the configuration files
|
||||
// we used to parse the arguments. These are RAII objects, so they and the
|
||||
|
||||
Reference in New Issue
Block a user