Skip to content
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

Backport [lldb] Print full Clang diagnostics when the ClangModulesDeclVendor fails to compile a module #1253

Conversation

Teemperor
Copy link

Summary:
When the ClangModulesDeclVendor currently fails it just prints very basic and often incomplete diagnostics without any source locations:

(lldb) p @import Foundation
error: while importing modules:
'foo/bar.h' file not found
could not build module 'Darwin'
[...]

or even just

(lldb) p @import Foundation
error: while importing modules:
could not build module 'Darwin'
[...]

These diagnostics help neither the user nor us with figuring out what is the reason for the failure.

This patch wires up a full TextDiagnosticPrinter in the ClangModulesDeclVendor and makes
sure we always return the error stream to the user when we fail to compile our modules.

Fixes rdar://63216849

Reviewers: aprantl, jdoerfert

Reviewed By: aprantl

Subscribers: JDevlieghere

Differential Revision: https://reviews.llvm.org/D79947

(cherry picked from commit d48ef7c)

Also removed the unnecessary element-by-element copy of the std::vector
hand_imported_modules to modules_for_macros.

(cherry picked from commit 5f7a5e3)
…ails to compile a module

Summary:
When the ClangModulesDeclVendor currently fails it just prints very basic and often incomplete diagnostics without any source locations:
```
(lldb) p @import Foundation
error: while importing modules:
'foo/bar.h' file not found
could not build module 'Darwin'
[...]
```
or even just
```
(lldb) p @import Foundation
error: while importing modules:
could not build module 'Darwin'
[...]
```

These diagnostics help neither the user nor us with figuring out what is the reason for the failure.

This patch wires up a full TextDiagnosticPrinter in the ClangModulesDeclVendor and makes
sure we always return the error stream to the user when we fail to compile our modules.

Fixes rdar://63216849

Reviewers: aprantl, jdoerfert

Reviewed By: aprantl

Subscribers: JDevlieghere

Differential Revision: https://reviews.llvm.org/D79947

(cherry picked from commit d48ef7c)
@Teemperor Teemperor requested a review from fredriss May 22, 2020 15:29
@Teemperor
Copy link
Author

@swift-ci test

@fredriss fredriss merged commit 01c7d75 into swiftlang:apple/stable/20200108 Jul 2, 2020
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.

3 participants