Author: zturner Date: Sat Nov 12 20:50:32 2016 New Revision: 286742 URL: http://llvm.org/viewvc/llvm-project?rev=286742&view=rev Log: Change some more CommandObject functions to StringRef.
Modified: lldb/trunk/include/lldb/Interpreter/CommandObject.h lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h lldb/trunk/source/Commands/CommandObjectMultiword.cpp lldb/trunk/source/Interpreter/CommandObject.cpp Modified: lldb/trunk/include/lldb/Interpreter/CommandObject.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObject.h?rev=286742&r1=286741&r2=286742&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandObject.h (original) +++ lldb/trunk/include/lldb/Interpreter/CommandObject.h Sat Nov 12 20:50:32 2016 @@ -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, Modified: lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h?rev=286742&r1=286741&r2=286742&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h (original) +++ lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h Sat Nov 12 20:50:32 2016 @@ -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; Modified: lldb/trunk/source/Commands/CommandObjectMultiword.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMultiword.cpp?rev=286742&r1=286741&r2=286742&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectMultiword.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectMultiword.cpp Sat Nov 12 20:50:32 2016 @@ -34,7 +34,7 @@ CommandObjectMultiword::CommandObjectMul 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:: } 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::GetR 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::AproposAllS } 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::GenerateHelpTex 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::GetSu 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::AproposAllSubCo } 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); Modified: lldb/trunk/source/Interpreter/CommandObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=286742&r1=286741&r2=286742&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandObject.cpp (original) +++ lldb/trunk/source/Interpreter/CommandObject.cpp Sat Nov 12 20:50:32 2016 @@ -316,7 +316,7 @@ int CommandObject::HandleCompletion(Args } } -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 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; } } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits