This is an archive of the discontinued LLVM Phabricator instance.

Fix handling of backticks in CommandObjectParsed commands
ClosedPublic

Authored by jingham on Mar 23 2023, 6:23 PM.

Details

Summary

A while back I reworked the way that backticks are handled to make backticks in aliases work, but I made two bad assumptions and broke the handling for parsed commands. The bad assumptions were:

  1. There was testing for backticks in regular commands (turns out the extant tests were all for raw commands)
  2. That the extant function that was supposed to handle backtick options did the thing you do with backtick options

2 is me not reading closely enough. The function called was m_interpreter.ProcessEmbeddedScriptCommands so I really should have seen this wasn't doing the right thing. Apparently at some point we were going to add the ability to invoke a script command and insert its text in place of the option. That's not a bad idea, but it was never actually implemented, and anyway, you can't use backticks as the demarcation - that's already taken for expression substitution.

This patch repairs that breakage, and adds some more tests for backticks in raw commands, in the arguments of parsed commands and in the option values for parsed commands.

Diff Detail

Event Timeline

jingham created this revision.Mar 23 2023, 6:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 23 2023, 6:23 PM
jingham requested review of this revision.Mar 23 2023, 6:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 23 2023, 6:23 PM
JDevlieghere accepted this revision.Mar 23 2023, 7:11 PM

LGTM

lldb/source/Interpreter/CommandInterpreter.cpp
1754–1760

You could avoid a level of indentation and a continue if you invert the condition.

lldb/source/Interpreter/CommandObject.cpp
729–738

There's a lot of entry.value() repetition here, might be worth extracting a temporary value here.

This revision is now accepted and ready to land.Mar 23 2023, 7:11 PM

I fixed those two nits on submission.