[Lldb-commits] [lldb] r357198 - [NFC] find_first_of/find_last_of -> find/rfind for single char.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 28 11:10:14 PDT 2019


Author: jdevlieghere
Date: Thu Mar 28 11:10:14 2019
New Revision: 357198

URL: http://llvm.org/viewvc/llvm-project?rev=357198&view=rev
Log:
[NFC] find_first_of/find_last_of -> find/rfind for single char.

For a single char argument, find_first_of is equal to find and
find_last_of is equal to rfind. While playing around with the plugin
stuff this caused an export failure because it always got inlined except
once, which resulted in an undefined symbol.

Modified:
    lldb/trunk/source/Interpreter/CommandInterpreter.cpp
    lldb/trunk/source/Interpreter/OptionValueProperties.cpp
    lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
    lldb/trunk/source/Target/CPPLanguageRuntime.cpp

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=357198&r1=357197&r2=357198&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Thu Mar 28 11:10:14 2019
@@ -2589,7 +2589,7 @@ void CommandInterpreter::OutputHelpText(
   uint32_t chars_left = max_columns;
 
   auto nextWordLength = [](llvm::StringRef S) {
-    size_t pos = S.find_first_of(' ');
+    size_t pos = S.find(' ');
     return pos == llvm::StringRef::npos ? S.size() : pos;
   };
 

Modified: lldb/trunk/source/Interpreter/OptionValueProperties.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueProperties.cpp?rev=357198&r1=357197&r2=357198&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueProperties.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueProperties.cpp Thu Mar 28 11:10:14 2019
@@ -159,7 +159,7 @@ OptionValueProperties::GetSubValue(const
     // args if executable basename is "test" and arch is "x86_64"
     if (sub_name[1]) {
       llvm::StringRef predicate_start = sub_name.drop_front();
-      size_t pos = predicate_start.find_first_of('}');
+      size_t pos = predicate_start.find('}');
       if (pos != llvm::StringRef::npos) {
         auto predicate = predicate_start.take_front(pos);
         auto rest = predicate_start.drop_front(pos);
@@ -204,7 +204,6 @@ Status OptionValueProperties::SetSubValu
     if (Properties::IsSettingExperimental(part))
       name_contains_experimental = true;
 
-  
   lldb::OptionValueSP value_sp(GetSubValue(exe_ctx, name, will_modify, error));
   if (value_sp)
     error = value_sp->SetValueFromString(value, op);

Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp?rev=357198&r1=357197&r2=357198&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp (original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp Thu Mar 28 11:10:14 2019
@@ -109,7 +109,7 @@ PythonString PythonObject::Str() const {
 PythonObject
 PythonObject::ResolveNameWithDictionary(llvm::StringRef name,
                                         const PythonDictionary &dict) {
-  size_t dot_pos = name.find_first_of('.');
+  size_t dot_pos = name.find('.');
   llvm::StringRef piece = name.substr(0, dot_pos);
   PythonObject result = dict.GetItemForKey(PythonString(piece));
   if (dot_pos == llvm::StringRef::npos) {
@@ -133,7 +133,7 @@ PythonObject PythonObject::ResolveName(l
   // refers to the `sys` module, and `name` == "path.append", then it will find
   // the function `sys.path.append`.
 
-  size_t dot_pos = name.find_first_of('.');
+  size_t dot_pos = name.find('.');
   if (dot_pos == llvm::StringRef::npos) {
     // No dots in the name, we should be able to find the value immediately as
     // an attribute of `m_py_obj`.

Modified: lldb/trunk/source/Target/CPPLanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/CPPLanguageRuntime.cpp?rev=357198&r1=357197&r2=357198&view=diff
==============================================================================
--- lldb/trunk/source/Target/CPPLanguageRuntime.cpp (original)
+++ lldb/trunk/source/Target/CPPLanguageRuntime.cpp Thu Mar 28 11:10:14 2019
@@ -170,7 +170,7 @@ CPPLanguageRuntime::FindLibCppStdFunctio
   //
   // This covers the case of the lambda known at compile time.
   size_t first_open_angle_bracket = vtable_name.find('<') + 1;
-  size_t first_comma = vtable_name.find_first_of(',');
+  size_t first_comma = vtable_name.find(',');
 
   llvm::StringRef first_template_parameter =
       vtable_name.slice(first_open_angle_bracket, first_comma);




More information about the lldb-commits mailing list