Skip to content

[SourceKit] Use diagnostics for arg parsing #21605

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

DavidGoldman
Copy link
Contributor

With this change, you will no longer receive error when parsing the compiler arguments when SourceKit fails to parse the invocation arguments.

Instead, you will receive the underlying error, like error: unable to load output file map 'output_file_map.json': No such file or directory

This is helpful to figure out which arguments in the compiler invocation are considered invalid (as opposed to a generic error).

With this change, you will no longer receive
"error when parsing the compiler arguments". Instead, you will
receive the underlying error, like
"error: unable to load output file map 'output_file_map.json': No such file or directory"
@DavidGoldman DavidGoldman changed the title SourceKit: Use diagnostics for arg parsing [SourceKit] Use diagnostics for arg parsing Jan 3, 2019
@benlangmuir
Copy link
Contributor

@swift-ci please smoke test

@benlangmuir
Copy link
Contributor

Looks like this causes sourcekit to crash when diagnostics are emitted. I believe the DiagnosticConsumer needs to have the same lifetime as the DiagnosticsEngine, but your change moves the consumer into a different stack frame.

@DavidGoldman
Copy link
Contributor Author

Updated to remove the Consumer once it's no longer needed (after the Error string has been captured)

@benlangmuir
Copy link
Contributor

@swift-ci please smoke test

@benlangmuir benlangmuir merged commit db0e273 into swiftlang:master Jan 9, 2019
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