Skip to content

[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

Merged
merged 2 commits into from
May 6, 2017

Conversation

akyrtzi
Copy link
Contributor

@akyrtzi akyrtzi commented May 3, 2017

Use this to avoid creating an empty serialized diagnostics file when the compiler crashes.

@akyrtzi
Copy link
Contributor Author

akyrtzi commented May 3, 2017

@swift-ci smoke test

@akyrtzi akyrtzi requested a review from jrose-apple May 3, 2017 15:42
Copy link
Contributor

@jrose-apple jrose-apple left a 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.

bool DiagnosticEngine::finishProcessing() {
bool hadError = false;
for (auto &Consumer : Consumers) {
hadError = Consumer->finishProcessing() || hadError;
Copy link
Contributor

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.
Copy link
Contributor

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.

DiagnosticEngine DE(dummyMgr);
PrintingDiagnosticConsumer PDC;
DE.addConsumer(PDC);
DE.diagnose(SourceLoc(), diag::cannot_open_serialized_file,
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good catch!

@akyrtzi
Copy link
Contributor Author

akyrtzi commented May 4, 2017

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.
@akyrtzi akyrtzi force-pushed the serialized-diagnostics-file branch from 4f66f63 to 0bb299a Compare May 6, 2017 01:27
@akyrtzi
Copy link
Contributor Author

akyrtzi commented May 6, 2017

@swift-ci smoke test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants