summaryrefslogtreecommitdiff
path: root/llvm/lib/Support/DebugCounter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/DebugCounter.cpp')
-rw-r--r--llvm/lib/Support/DebugCounter.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Support/DebugCounter.cpp b/llvm/lib/Support/DebugCounter.cpp
index 1e3ec300964ca..8c579f395282e 100644
--- a/llvm/lib/Support/DebugCounter.cpp
+++ b/llvm/lib/Support/DebugCounter.cpp
@@ -31,7 +31,7 @@ private:
// 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;
@@ -85,7 +85,7 @@ void DebugCounter::push_back(const std::string &Val) {
// add it to the counter values.
if (CounterPair.first.endswith("-skip")) {
auto CounterName = CounterPair.first.drop_back(5);
- unsigned CounterID = getCounterId(CounterName);
+ unsigned CounterID = getCounterId(std::string(CounterName));
if (!CounterID) {
errs() << "DebugCounter Error: " << CounterName
<< " is not a registered counter\n";
@@ -98,7 +98,7 @@ void DebugCounter::push_back(const std::string &Val) {
Counter.IsSet = true;
} else if (CounterPair.first.endswith("-count")) {
auto CounterName = CounterPair.first.drop_back(6);
- unsigned CounterID = getCounterId(CounterName);
+ unsigned CounterID = getCounterId(std::string(CounterName));
if (!CounterID) {
errs() << "DebugCounter Error: " << CounterName
<< " is not a registered counter\n";
@@ -123,7 +123,7 @@ void DebugCounter::print(raw_ostream &OS) const {
auto &Us = instance();
OS << "Counters and values:\n";
for (auto &CounterName : CounterNames) {
- unsigned CounterID = getCounterId(CounterName);
+ unsigned CounterID = getCounterId(std::string(CounterName));
OS << left_justify(RegisteredCounters[CounterID], 32) << ": {"
<< Us.Counters[CounterID].Count << "," << Us.Counters[CounterID].Skip
<< "," << Us.Counters[CounterID].StopAfter << "}\n";