summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Interpreter/CommandObject.h12
-rw-r--r--lldb/include/lldb/Interpreter/CommandObjectMultiword.h18
-rw-r--r--lldb/source/Commands/CommandObjectMultiword.cpp25
-rw-r--r--lldb/source/Interpreter/CommandObject.cpp8
4 files changed, 33 insertions, 30 deletions
diff --git a/lldb/include/lldb/Interpreter/CommandObject.h b/lldb/include/lldb/Interpreter/CommandObject.h
index 344e9b66183..e73fce86b26 100644
--- a/lldb/include/lldb/Interpreter/CommandObject.h
+++ b/lldb/include/lldb/Interpreter/CommandObject.h
@@ -152,18 +152,18 @@ public:
// hint to the help system that one cannot pass options to this command
virtual bool IsDashDashCommand() { return false; }
- virtual lldb::CommandObjectSP GetSubcommandSP(const char *sub_cmd,
+ virtual lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd,
StringList *matches = nullptr) {
return lldb::CommandObjectSP();
}
- virtual CommandObject *GetSubcommandObject(const char *sub_cmd,
+ virtual CommandObject *GetSubcommandObject(llvm::StringRef sub_cmd,
StringList *matches = nullptr) {
return nullptr;
}
- virtual void AproposAllSubCommands(const char *prefix,
- const char *search_word,
+ virtual void AproposAllSubCommands(llvm::StringRef prefix,
+ llvm::StringRef search_word,
StringList &commands_found,
StringList &commands_help) {}
@@ -177,7 +177,7 @@ public:
// transparently try and load subcommands - it will fail on
// anything but a multiword command, but it avoids us doing
// type checkings and casts
- virtual bool LoadSubCommand(const char *cmd_name,
+ virtual bool LoadSubCommand(llvm::StringRef cmd_name,
const lldb::CommandObjectSP &command_obj) {
return false;
}
@@ -324,7 +324,7 @@ public:
return 0;
}
- bool HelpTextContainsWord(const char *search_word,
+ bool HelpTextContainsWord(llvm::StringRef search_word,
bool search_short_help = true,
bool search_long_help = true,
bool search_syntax = true,
diff --git a/lldb/include/lldb/Interpreter/CommandObjectMultiword.h b/lldb/include/lldb/Interpreter/CommandObjectMultiword.h
index c36f9d139fd..947272f4212 100644
--- a/lldb/include/lldb/Interpreter/CommandObjectMultiword.h
+++ b/lldb/include/lldb/Interpreter/CommandObjectMultiword.h
@@ -38,18 +38,19 @@ public:
CommandObjectMultiword *GetAsMultiwordCommand() override { return this; }
- bool LoadSubCommand(const char *cmd_name,
+ bool LoadSubCommand(llvm::StringRef cmd_name,
const lldb::CommandObjectSP &command_obj) override;
void GenerateHelpText(Stream &output_stream) override;
- lldb::CommandObjectSP GetSubcommandSP(const char *sub_cmd,
+ lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd,
StringList *matches = nullptr) override;
- CommandObject *GetSubcommandObject(const char *sub_cmd,
+ CommandObject *GetSubcommandObject(llvm::StringRef sub_cmd,
StringList *matches = nullptr) override;
- void AproposAllSubCommands(const char *prefix, const char *search_word,
+ void AproposAllSubCommands(llvm::StringRef prefix,
+ llvm::StringRef search_word,
StringList &commands_found,
StringList &commands_help) override;
@@ -100,17 +101,18 @@ public:
void GenerateHelpText(Stream &result) override;
- lldb::CommandObjectSP GetSubcommandSP(const char *sub_cmd,
+ lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd,
StringList *matches = nullptr) override;
- CommandObject *GetSubcommandObject(const char *sub_cmd,
+ CommandObject *GetSubcommandObject(llvm::StringRef sub_cmd,
StringList *matches = nullptr) override;
- void AproposAllSubCommands(const char *prefix, const char *search_word,
+ void AproposAllSubCommands(llvm::StringRef prefix,
+ llvm::StringRef search_word,
StringList &commands_found,
StringList &commands_help) override;
- bool LoadSubCommand(const char *cmd_name,
+ bool LoadSubCommand(llvm::StringRef cmd_name,
const lldb::CommandObjectSP &command_obj) override;
bool WantsRawCommandString() override;
diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp b/lldb/source/Commands/CommandObjectMultiword.cpp
index 249863b4e8a..bcc0229ab5d 100644
--- a/lldb/source/Commands/CommandObjectMultiword.cpp
+++ b/lldb/source/Commands/CommandObjectMultiword.cpp
@@ -34,7 +34,7 @@ CommandObjectMultiword::CommandObjectMultiword(CommandInterpreter &interpreter,
CommandObjectMultiword::~CommandObjectMultiword() = default;
-CommandObjectSP CommandObjectMultiword::GetSubcommandSP(const char *sub_cmd,
+CommandObjectSP CommandObjectMultiword::GetSubcommandSP(llvm::StringRef sub_cmd,
StringList *matches) {
CommandObjectSP return_cmd_sp;
CommandObject::CommandMap::iterator pos;
@@ -69,12 +69,12 @@ CommandObjectSP CommandObjectMultiword::GetSubcommandSP(const char *sub_cmd,
}
CommandObject *
-CommandObjectMultiword::GetSubcommandObject(const char *sub_cmd,
+CommandObjectMultiword::GetSubcommandObject(llvm::StringRef sub_cmd,
StringList *matches) {
return GetSubcommandSP(sub_cmd, matches).get();
}
-bool CommandObjectMultiword::LoadSubCommand(const char *name,
+bool CommandObjectMultiword::LoadSubCommand(llvm::StringRef name,
const CommandObjectSP &cmd_obj) {
if (cmd_obj)
assert((&GetCommandInterpreter() == &cmd_obj->GetCommandInterpreter()) &&
@@ -246,8 +246,8 @@ const char *CommandObjectMultiword::GetRepeatCommand(Args &current_command_args,
return sub_command_object->GetRepeatCommand(current_command_args, index);
}
-void CommandObjectMultiword::AproposAllSubCommands(const char *prefix,
- const char *search_word,
+void CommandObjectMultiword::AproposAllSubCommands(llvm::StringRef prefix,
+ llvm::StringRef search_word,
StringList &commands_found,
StringList &commands_help) {
CommandObject::CommandMap::const_iterator pos;
@@ -265,7 +265,7 @@ void CommandObjectMultiword::AproposAllSubCommands(const char *prefix,
}
if (sub_cmd_obj->IsMultiwordObject())
- sub_cmd_obj->AproposAllSubCommands(complete_command_name.GetData(),
+ sub_cmd_obj->AproposAllSubCommands(complete_command_name.GetString(),
search_word, commands_found,
commands_help);
}
@@ -313,15 +313,16 @@ void CommandObjectProxy::GenerateHelpText(Stream &result) {
return proxy_command->GenerateHelpText(result);
}
-lldb::CommandObjectSP CommandObjectProxy::GetSubcommandSP(const char *sub_cmd,
- StringList *matches) {
+lldb::CommandObjectSP
+CommandObjectProxy::GetSubcommandSP(llvm::StringRef sub_cmd,
+ StringList *matches) {
CommandObject *proxy_command = GetProxyCommandObject();
if (proxy_command)
return proxy_command->GetSubcommandSP(sub_cmd, matches);
return lldb::CommandObjectSP();
}
-CommandObject *CommandObjectProxy::GetSubcommandObject(const char *sub_cmd,
+CommandObject *CommandObjectProxy::GetSubcommandObject(llvm::StringRef sub_cmd,
StringList *matches) {
CommandObject *proxy_command = GetProxyCommandObject();
if (proxy_command)
@@ -329,8 +330,8 @@ CommandObject *CommandObjectProxy::GetSubcommandObject(const char *sub_cmd,
return nullptr;
}
-void CommandObjectProxy::AproposAllSubCommands(const char *prefix,
- const char *search_word,
+void CommandObjectProxy::AproposAllSubCommands(llvm::StringRef prefix,
+ llvm::StringRef search_word,
StringList &commands_found,
StringList &commands_help) {
CommandObject *proxy_command = GetProxyCommandObject();
@@ -340,7 +341,7 @@ void CommandObjectProxy::AproposAllSubCommands(const char *prefix,
}
bool CommandObjectProxy::LoadSubCommand(
- const char *cmd_name, const lldb::CommandObjectSP &command_sp) {
+ llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_sp) {
CommandObject *proxy_command = GetProxyCommandObject();
if (proxy_command)
return proxy_command->LoadSubCommand(cmd_name, command_sp);
diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp
index e71c10935de..c9337a5c9f6 100644
--- a/lldb/source/Interpreter/CommandObject.cpp
+++ b/lldb/source/Interpreter/CommandObject.cpp
@@ -316,7 +316,7 @@ int CommandObject::HandleCompletion(Args &input, int &cursor_index,
}
}
-bool CommandObject::HelpTextContainsWord(const char *search_word,
+bool CommandObject::HelpTextContainsWord(llvm::StringRef search_word,
bool search_short_help,
bool search_long_help,
bool search_syntax,
@@ -341,9 +341,9 @@ bool CommandObject::HelpTextContainsWord(const char *search_word,
GetOptions()->GenerateOptionUsage(
usage_help, this,
GetCommandInterpreter().GetDebugger().GetTerminalWidth());
- if (usage_help.GetSize() > 0) {
- const char *usage_text = usage_help.GetData();
- if (strcasestr(usage_text, search_word))
+ if (!usage_help.Empty()) {
+ llvm::StringRef usage_text = usage_help.GetString();
+ if (usage_text.contains_lower(search_word))
found_word = true;
}
}
OpenPOWER on IntegriCloud