[Lldb-commits] [lldb] [lldb/Interpreter] Fix ambiguous partial command resolution (PR #101934)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Mon Aug 5 03:34:53 PDT 2024
================
@@ -1302,6 +1298,36 @@ CommandObject *CommandInterpreter::GetUserCommandObject(
return {};
}
+CommandObject *CommandInterpreter::GetAliasCommandObject(
+ llvm::StringRef cmd, StringList *matches, StringList *descriptions) const {
+ std::string cmd_str(cmd);
+ auto find_exact = [&](const CommandObject::CommandMap &map) {
+ auto found_elem = map.find(std::string(cmd));
+ if (found_elem == map.end())
+ return (CommandObject *)nullptr;
+ CommandObject *exact_cmd = found_elem->second.get();
+ if (exact_cmd) {
+ if (matches)
+ matches->AppendString(exact_cmd->GetCommandName());
+ if (descriptions)
+ descriptions->AppendString(exact_cmd->GetHelp());
+ return exact_cmd;
+ }
+ return (CommandObject *)nullptr;
----------------
Michael137 wrote:
```suggestion
if (!exact_cmd)
return nullptr;
if (matches)
matches->AppendString(exact_cmd->GetCommandName());
if (descriptions)
descriptions->AppendString(exact_cmd->GetHelp());
return exact_cmd;
```
https://github.com/llvm/llvm-project/pull/101934
More information about the lldb-commits
mailing list