[llvm] 58a8571 - DebugCounterList::printOptionInfo - use const auto& iterator in for-range-loop.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 9 03:38:00 PDT 2020
Author: Simon Pilgrim
Date: 2020-07-09T11:37:49+01:00
New Revision: 58a85717cce5166b0952aee4d13375dda94f7497
URL: https://github.com/llvm/llvm-project/commit/58a85717cce5166b0952aee4d13375dda94f7497
DIFF: https://github.com/llvm/llvm-project/commit/58a85717cce5166b0952aee4d13375dda94f7497.diff
LOG: DebugCounterList::printOptionInfo - use const auto& iterator in for-range-loop.
Avoids unnecessary copies and silences clang tidy warning.
Added:
Modified:
llvm/lib/Support/DebugCounter.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Support/DebugCounter.cpp b/llvm/lib/Support/DebugCounter.cpp
index 713b41969818..8c579f395282 100644
--- a/llvm/lib/Support/DebugCounter.cpp
+++ b/llvm/lib/Support/DebugCounter.cpp
@@ -31,7 +31,7 @@ class DebugCounterList : public cl::list<std::string, DebugCounter> {
// width, so we do the same.
Option::printHelpStr(HelpStr, GlobalWidth, ArgStr.size() + 6);
const auto &CounterInstance = DebugCounter::instance();
- for (auto Name : CounterInstance) {
+ for (const auto &Name : CounterInstance) {
const auto Info =
CounterInstance.getCounterInfo(CounterInstance.getCounterId(Name));
size_t NumSpaces = GlobalWidth - Info.first.size() - 8;
More information about the llvm-commits
mailing list