This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Create a property to store the REPL language
ClosedPublic

Authored by JDevlieghere on Jan 5 2022, 1:32 PM.

Details

Summary

Until the introduction of the C++ REPL, there was always a single REPL language. The code relied on this assumption through repl_languages.GetSingularLanguage. Now that this is no longer the case, we need a way to specify a selected/preferred REPL language. This patch does that with the help of a debugger property, taking inspiration from how we store the scripting language.

Diff Detail

Event Timeline

JDevlieghere requested review of this revision.Jan 5 2022, 1:32 PM
JDevlieghere created this revision.
JDevlieghere added a comment.EditedJan 5 2022, 1:34 PM

No test because this is NFC (NOC, non observable change?) upstream where there's only one supported REPL language. This is tested downstream in the Swift fork.

aprantl added inline comments.Jan 5 2022, 1:52 PM
lldb/source/Core/Debugger.cpp
1777

As you said in the description, this is effectively dead code. Is this to be removed in a subsequent patch?

lldb/source/Interpreter/CommandInterpreter.cpp
2265

Is this case used by anyone? Should we just error out if it's unknown?

JDevlieghere marked 2 inline comments as done.Jan 5 2022, 2:09 PM
JDevlieghere added inline comments.
lldb/source/Core/Debugger.cpp
1777

It's still relevant here (upstream) where there's only a single REPL language. The way the plugin mechanism works, anyone downstream could build LLDB with just a single REPL plugin. Because this is all done through plugins, the default REPL language is unknown. I vote to keep it around until there's a good way to set it. The latter isn't hard technically, it's just a matter of doing it in an organized way. E.g. who wins if two plugins want to be the default?

lldb/source/Interpreter/CommandInterpreter.cpp
2265

Similar answer to above.

aprantl accepted this revision.Jan 5 2022, 2:31 PM
This revision is now accepted and ready to land.Jan 5 2022, 2:31 PM
This revision was automatically updated to reflect the committed changes.
JDevlieghere marked 2 inline comments as done.
Herald added a project: Restricted Project. · View Herald TranscriptJan 5 2022, 3:04 PM