-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[frontend] Add 'finishProcessing()' method for DiagnosticConsumers to do their finalization (e.g. writing to a file) #9222
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
Conversation
@swift-ci smoke test |
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.
Looks okay. It's kind of messy, but I don't see an obvious way to do better.
lib/AST/DiagnosticEngine.cpp
Outdated
bool DiagnosticEngine::finishProcessing() { | ||
bool hadError = false; | ||
for (auto &Consumer : Consumers) { | ||
hadError = Consumer->finishProcessing() || hadError; |
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.
Nitpick: |=
?
EC, | ||
llvm::sys::fs::F_None)); | ||
if (EC) { | ||
// Create a temporary diagnostics engine to print the error to stderr. |
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.
I feel like there should be some shorter way to do this, since you have it twice. But that can happen later.
lib/FrontendTool/FrontendTool.cpp
Outdated
DiagnosticEngine DE(dummyMgr); | ||
PrintingDiagnosticConsumer PDC; | ||
DE.addConsumer(PDC); | ||
DE.diagnose(SourceLoc(), diag::cannot_open_serialized_file, |
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.
This should be "cannot_open_file", right?
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.
Yes, good catch!
This is blocked on #9260 |
… do their finalization (e.g. writing to a file) Use this to avoid creating an empty serialized diagnostics file when the compiler crashes.
4f66f63
to
0bb299a
Compare
@swift-ci smoke test |
Use this to avoid creating an empty serialized diagnostics file when the compiler crashes.