Skip to content

[frontend] 4.0: Add 'finishProcessing()' method for DiagnosticConsumers to do their finalization (e.g. writing to a file) #9369

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

Conversation

akyrtzi
Copy link
Contributor

@akyrtzi akyrtzi commented May 6, 2017

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

rdar://31909195

master: #9222

akyrtzi added 2 commits May 6, 2017 09:49
… do their finalization (e.g. writing to a file)

Use this to avoid creating an empty serialized diagnostics file when the compiler crashes.
@akyrtzi
Copy link
Contributor Author

akyrtzi commented May 6, 2017

@swift-ci Please test

@akyrtzi
Copy link
Contributor Author

akyrtzi commented May 8, 2017

Explanation: The Swift compiler creates the serialized diagnostics file at the beginning and if it crashes it leaves an empty file for the serialized diagnostics. When Xcode tries to read the file it uses a libclang API which crashes if the file is empty (it considers it malformed). This change makes the Swift compiler to open the serialized diagnostics file when it is read to write to it at the end, so if the compiler crashes it doesn't leave an empty file. Making the libclang API more robust is tracked via a different radar.
Scope: Affects when the compiler creates the serialized diagnostics file
Radar: rdar://31909195
Risk: Low
Testing: Added regression test to make sure there's no diagnostics file emitted if there is a compiler crash

@akyrtzi akyrtzi merged commit 5c47ac8 into swiftlang:swift-4.0-branch May 8, 2017
@akyrtzi akyrtzi deleted the serialized-diagnostics-file-4.0 branch May 8, 2017 18:00
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.

1 participant