r293379 - Pass a char instead of a string to the find function. clang-tidy: performance-faster-string-find

Sylvestre Ledru via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 28 05:36:35 PST 2017


Author: sylvestre
Date: Sat Jan 28 07:36:34 2017
New Revision: 293379

URL: http://llvm.org/viewvc/llvm-project?rev=293379&view=rev
Log:
Pass a char instead of a string to the find function. clang-tidy: performance-faster-string-find

Modified:
    cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp
    cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp

Modified: cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp?rev=293379&r1=293378&r2=293379&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp Sat Jan 28 07:36:34 2017
@@ -4454,7 +4454,7 @@ static void BuildUniqueMethodName(std::s
   Name += "__" + MD->getSelector().getAsString();
   // Convert colons to underscores.
   std::string::size_type loc = 0;
-  while ((loc = Name.find(":", loc)) != std::string::npos)
+  while ((loc = Name.find(':', loc)) != std::string::npos)
     Name.replace(loc, 1, "_");
 }
 

Modified: cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp?rev=293379&r1=293378&r2=293379&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp Sat Jan 28 07:36:34 2017
@@ -3629,7 +3629,7 @@ static void BuildUniqueMethodName(std::s
   Name += "__" + MD->getSelector().getAsString();
   // Convert colons to underscores.
   std::string::size_type loc = 0;
-  while ((loc = Name.find(":", loc)) != std::string::npos)
+  while ((loc = Name.find(':', loc)) != std::string::npos)
     Name.replace(loc, 1, "_");
 }
 




More information about the cfe-commits mailing list