Avoid creating and destroying a std::string on every iteration.
authorYaron Keren <yaron.keren@gmail.com>
Wed, 27 May 2015 18:11:07 +0000 (18:11 +0000)
committerYaron Keren <yaron.keren@gmail.com>
Wed, 27 May 2015 18:11:07 +0000 (18:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238343 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Debug.cpp

index eb99242914c2537bc497b02d86ec1c73338379bc..47751fce3fcdca4c74853d288e038adb6300c492 100644 (file)
@@ -49,9 +49,9 @@ static ManagedStatic<std::vector<std::string>> CurrentDebugType;
 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;
   }