This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Print full Clang diagnostics when the ClangModulesDeclVendor fails to compile a module
ClosedPublic

Authored by teemperor on May 14 2020, 9:16 AM.

Details

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

Diff Detail

Event Timeline

teemperor created this revision.May 14 2020, 9:16 AM
aprantl accepted this revision.May 14 2020, 12:15 PM
aprantl added inline comments.
lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
392

"Unknown error while ..." anything more specific we can say will help figuring out at least *which step* failed.

This revision is now accepted and ready to land.May 14 2020, 12:15 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMay 15 2020, 1:35 AM