This is an archive of the discontinued LLVM Phabricator instance.

[lldb/Interpreter] Fix language detection for the REPL InitFile
ClosedPublic

Authored by mib on Sep 3 2020, 1:31 AM.

Details

Summary

Previously, before loading the REPL language-specific init file, lldb
checked the selected target language in which case it returned an unknown
language type with the REPL target.

Instead, the patch calls Language::GetLanguagesSupportingREPLs and
look for the first element of that set. In case lldb was not configured
with a REPL language, then, it will just stop sourcing the REPL init
file and fallback to the original logic (continuing with the default
init file).

rdar://65836048

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>

Diff Detail

Event Timeline

mib created this revision.Sep 3 2020, 1:31 AM
mib requested review of this revision.Sep 3 2020, 1:31 AM
teemperor accepted this revision.Sep 3 2020, 1:48 AM

This patch sparks joy, but the fact that this all is dead code without Swift doesn't spark joy. But as it's up to me to revive this code and the downstream Swift test looks fine, I'll sign this off. Thanks!

lldb/source/Interpreter/CommandInterpreter.cpp
2094–2099

This could now be else return to make the error control flow a bit clearer.

2095

= eLanguageTypeUnknown? I don't think we usually initialise enums with braces and it makes the default value clearer.

This revision is now accepted and ready to land.Sep 3 2020, 1:48 AM
This revision was landed with ongoing or failed builds.Sep 3 2020, 2:00 AM
This revision was automatically updated to reflect the committed changes.