[Lldb-commits] [lldb] bd23dff - Revert "[lldb] Compute fully qualified command names in FindCommandsForApropos"
Dave Lee via lldb-commits
lldb-commits at lists.llvm.org
Thu Jan 6 20:15:58 PST 2022
Author: Dave Lee
Date: 2022-01-06T20:15:19-08:00
New Revision: bd23dffc2c38b7cffd3811716fd373cd2b588c27
URL: https://github.com/llvm/llvm-project/commit/bd23dffc2c38b7cffd3811716fd373cd2b588c27
DIFF: https://github.com/llvm/llvm-project/commit/bd23dffc2c38b7cffd3811716fd373cd2b588c27.diff
LOG: Revert "[lldb] Compute fully qualified command names in FindCommandsForApropos"
This reverts commit b3bfd595a548cd85b12e4e83729436cb73b26f29.
Added:
Modified:
lldb/include/lldb/Interpreter/CommandInterpreter.h
lldb/source/Interpreter/CommandInterpreter.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index 3efb59fc05647..e6f0d5f9c4d43 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -649,7 +649,7 @@ class CommandInterpreter : public Broadcaster,
void FindCommandsForApropos(llvm::StringRef word, StringList &commands_found,
StringList &commands_help,
- const CommandObject::CommandMap &command_map);
+ CommandObject::CommandMap &command_map);
// An interruptible wrapper around the stream output
void PrintCommandOutput(Stream &stream, llvm::StringRef str);
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 59c23716bf89c..085b06bce0eae 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2841,10 +2841,12 @@ void CommandInterpreter::OutputHelpText(Stream &strm, llvm::StringRef word_text,
void CommandInterpreter::FindCommandsForApropos(
llvm::StringRef search_word, StringList &commands_found,
- StringList &commands_help, const CommandObject::CommandMap &command_map) {
- for (const auto &pair : command_map) {
- llvm::StringRef command_name = pair.first;
- CommandObject *cmd_obj = pair.second.get();
+ StringList &commands_help, CommandObject::CommandMap &command_map) {
+ CommandObject::CommandMap::const_iterator pos;
+
+ for (pos = command_map.begin(); pos != command_map.end(); ++pos) {
+ llvm::StringRef command_name = pos->first;
+ CommandObject *cmd_obj = pos->second.get();
const bool search_short_help = true;
const bool search_long_help = false;
@@ -2854,19 +2856,14 @@ void CommandInterpreter::FindCommandsForApropos(
cmd_obj->HelpTextContainsWord(search_word, search_short_help,
search_long_help, search_syntax,
search_options)) {
- commands_found.AppendString(command_name);
+ commands_found.AppendString(cmd_obj->GetCommandName());
commands_help.AppendString(cmd_obj->GetHelp());
}
- if (auto *multiword_cmd = cmd_obj->GetAsMultiwordCommand()) {
- StringList subcommands_found;
- FindCommandsForApropos(search_word, subcommands_found, commands_help,
- multiword_cmd->GetSubcommandDictionary());
- for (const auto &subcommand_name : subcommands_found) {
- std::string qualified_name =
- (command_name + " " + subcommand_name).str();
- commands_found.AppendString(qualified_name);
- }
+ if (cmd_obj->IsMultiwordObject()) {
+ CommandObjectMultiword *cmd_multiword = cmd_obj->GetAsMultiwordCommand();
+ FindCommandsForApropos(search_word, commands_found, commands_help,
+ cmd_multiword->GetSubcommandDictionary());
}
}
}
More information about the lldb-commits
mailing list