[llvm] r238343 - Avoid creating and destroying a std::string on every iteration.

Yaron Keren yaron.keren at gmail.com
Wed May 27 11:11:07 PDT 2015


Author: yrnkrn
Date: Wed May 27 13:11:07 2015
New Revision: 238343

URL: http://llvm.org/viewvc/llvm-project?rev=238343&view=rev
Log:
Avoid creating and destroying a std::string on every iteration.


Modified:
    llvm/trunk/lib/Support/Debug.cpp

Modified: llvm/trunk/lib/Support/Debug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Debug.cpp?rev=238343&r1=238342&r2=238343&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Debug.cpp (original)
+++ llvm/trunk/lib/Support/Debug.cpp Wed May 27 13:11:07 2015
@@ -49,9 +49,9 @@ static ManagedStatic<std::vector<std::st
 bool isCurrentDebugType(const char *DebugType) {
   if (CurrentDebugType->empty())
     return true;
-  // see if DebugType is in list. Note: do not use find() as that forces us to
+  // See if DebugType is in list. Note: do not use find() as that forces us to
   // unnecessarily create an std::string instance.
-  for (auto d : *CurrentDebugType) {
+  for (auto &d : *CurrentDebugType) {
     if (d == DebugType)
       return true;
   }





More information about the llvm-commits mailing list