[Lldb-commits] [lldb] r261861 - Improve readability and performance of ClangExpressionParser::FindFunctionInModule

Aidan Dodds via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 25 05:07:04 PST 2016


Author: aidandodds
Date: Thu Feb 25 07:07:04 2016
New Revision: 261861

URL: http://llvm.org/viewvc/llvm-project?rev=261861&view=rev
Log:
Improve readability and performance of ClangExpressionParser::FindFunctionInModule

Committed on behalf of: Luke Drummond

Differential Revision: http://reviews.llvm.org/D17274

Modified:
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp?rev=261861&r1=261860&r2=261861&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Thu Feb 25 07:07:04 2016
@@ -542,13 +542,12 @@ static bool FindFunctionInModule (ConstS
                                   llvm::Module *module,
                                   const char *orig_name)
 {
-    for (llvm::Module::iterator fi = module->getFunctionList().begin(), fe = module->getFunctionList().end();
-         fi != fe;
-         ++fi)
+    for (const auto &func : module->getFunctionList())
     {
-        if (fi->getName().str().find(orig_name) != std::string::npos)
+        const StringRef &name = func.getName();
+        if (name.find(orig_name) != StringRef::npos)
         {
-            mangled_name.SetCString(fi->getName().str().c_str());
+            mangled_name.SetString(name);
             return true;
         }
     }




More information about the lldb-commits mailing list