[Lldb-commits] [lldb] r287157 - Make Apropos functions accept StringRefs.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 16 13:45:04 PST 2016


Author: zturner
Date: Wed Nov 16 15:45:04 2016
New Revision: 287157

URL: http://llvm.org/viewvc/llvm-project?rev=287157&view=rev
Log:
Make Apropos functions accept StringRefs.

Modified:
    lldb/trunk/include/lldb/Core/UserSettingsController.h
    lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
    lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h
    lldb/trunk/source/Core/UserSettingsController.cpp
    lldb/trunk/source/Interpreter/CommandInterpreter.cpp
    lldb/trunk/source/Interpreter/OptionValueProperties.cpp

Modified: lldb/trunk/include/lldb/Core/UserSettingsController.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/UserSettingsController.h?rev=287157&r1=287156&r2=287157&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/UserSettingsController.h (original)
+++ lldb/trunk/include/lldb/Core/UserSettingsController.h Wed Nov 16 15:45:04 2016
@@ -1,5 +1,4 @@
-//====-- UserSettingsController.h --------------------------------*- C++
-//-*-===//
+//====-- UserSettingsController.h --------------------------------*- C++-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -63,7 +62,7 @@ public:
   virtual void DumpAllDescriptions(CommandInterpreter &interpreter,
                                    Stream &strm) const;
 
-  size_t Apropos(const char *keyword,
+  size_t Apropos(llvm::StringRef keyword,
                  std::vector<const Property *> &matching_properties) const;
 
   lldb::OptionValuePropertiesSP GetSubProperty(const ExecutionContext *exe_ctx,

Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=287157&r1=287156&r2=287157&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Wed Nov 16 15:45:04 2016
@@ -407,7 +407,7 @@ public:
 
   bool GetSynchronous();
 
-  void FindCommandsForApropos(const char *word, StringList &commands_found,
+  void FindCommandsForApropos(llvm::StringRef word, StringList &commands_found,
                               StringList &commands_help,
                               bool search_builtin_commands,
                               bool search_user_commands,
@@ -517,7 +517,7 @@ private:
   CommandObject *ResolveCommandImpl(std::string &command_line,
                                     CommandReturnObject &result);
 
-  void FindCommandsForApropos(const char *word, StringList &commands_found,
+  void FindCommandsForApropos(llvm::StringRef word, StringList &commands_found,
                               StringList &commands_help,
                               CommandObject::CommandMap &command_map);
 

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h?rev=287157&r1=287156&r2=287157&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h Wed Nov 16 15:45:04 2016
@@ -62,7 +62,7 @@ public:
   virtual void DumpAllDescriptions(CommandInterpreter &interpreter,
                                    Stream &strm) const;
 
-  void Apropos(const char *keyword,
+  void Apropos(llvm::StringRef keyword,
                std::vector<const Property *> &matching_properties) const;
 
   void Initialize(const PropertyDefinition *setting_definitions);

Modified: lldb/trunk/source/Core/UserSettingsController.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/UserSettingsController.cpp?rev=287157&r1=287156&r2=287157&view=diff
==============================================================================
--- lldb/trunk/source/Core/UserSettingsController.cpp (original)
+++ lldb/trunk/source/Core/UserSettingsController.cpp Wed Nov 16 15:45:04 2016
@@ -73,7 +73,7 @@ Error Properties::DumpPropertyValue(cons
 }
 
 size_t
-Properties::Apropos(const char *keyword,
+Properties::Apropos(llvm::StringRef keyword,
                     std::vector<const Property *> &matching_properties) const {
   OptionValuePropertiesSP properties_sp(GetValueProperties());
   if (properties_sp) {

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=287157&r1=287156&r2=287157&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Wed Nov 16 15:45:04 2016
@@ -2596,19 +2596,19 @@ void CommandInterpreter::OutputHelpText(
 }
 
 void CommandInterpreter::FindCommandsForApropos(
-    const char *search_word, StringList &commands_found,
+    llvm::StringRef search_word, StringList &commands_found,
     StringList &commands_help, CommandObject::CommandMap &command_map) {
   CommandObject::CommandMap::const_iterator pos;
 
   for (pos = command_map.begin(); pos != command_map.end(); ++pos) {
-    const char *command_name = pos->first.c_str();
+    llvm::StringRef command_name = pos->first;
     CommandObject *cmd_obj = pos->second.get();
 
     const bool search_short_help = true;
     const bool search_long_help = false;
     const bool search_syntax = false;
     const bool search_options = false;
-    if (strcasestr(command_name, search_word) ||
+    if (command_name.contains_lower(search_word) ||
         cmd_obj->HelpTextContainsWord(search_word, search_short_help,
                                       search_long_help, search_syntax,
                                       search_options)) {
@@ -2624,7 +2624,7 @@ void CommandInterpreter::FindCommandsFor
   }
 }
 
-void CommandInterpreter::FindCommandsForApropos(const char *search_word,
+void CommandInterpreter::FindCommandsForApropos(llvm::StringRef search_word,
                                                 StringList &commands_found,
                                                 StringList &commands_help,
                                                 bool search_builtin_commands,

Modified: lldb/trunk/source/Interpreter/OptionValueProperties.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueProperties.cpp?rev=287157&r1=287156&r2=287157&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueProperties.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueProperties.cpp Wed Nov 16 15:45:04 2016
@@ -1,5 +1,4 @@
-//===-- OptionValueProperties.cpp ---------------------------------*- C++
-//-*-===//
+//===-- OptionValueProperties.cpp --------------------------------*- C++-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -635,7 +634,7 @@ void OptionValueProperties::DumpAllDescr
 }
 
 void OptionValueProperties::Apropos(
-    const char *keyword,
+    llvm::StringRef keyword,
     std::vector<const Property *> &matching_properties) const {
   const size_t num_properties = m_properties.size();
   StreamString strm;




More information about the lldb-commits mailing list