This is an archive of the discontinued LLVM Phabricator instance.

[lldb][import-std-module] Prefer the non-module diagnostics when in fallback mode
ClosedPublic

Authored by teemperor on Sep 29 2021, 4:56 AM.

Details

Summary

The fallback setting for import-std-module is supposed to allow running expression that require an imported
C++ module without causing any regressions for users (neither in terms of functionality nor performance).
This is done by first trying to normally parse/evaluate an expression and when an error occurred during this
first attempt, we retry with the loaded 'std' module.

When we run into a system with a 'std' module that for some reason doesn't build or otherwise causes parse errors,
then this currently means that the second parse attempt will overwrite the error diagnostics of the first parse
attempt. Given that the module build errors are outside of the scope of what the user can influence, it makes more
sense to show the errors from the first parse attempt that are only concerned with the actual user input.

Diff Detail

Event Timeline

teemperor created this revision.Sep 29 2021, 4:56 AM
teemperor requested review of this revision.Sep 29 2021, 4:56 AM
aprantl accepted this revision.Oct 1 2021, 1:57 PM

Nifty testcase!

This revision is now accepted and ready to land.Oct 1 2021, 1:57 PM