[llvm] r256217 - [Support] Timer: Use emplace_back() and range-based loops (NFC)
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 21 15:41:38 PST 2015
Author: vedantk
Date: Mon Dec 21 17:41:38 2015
New Revision: 256217
URL: http://llvm.org/viewvc/llvm-project?rev=256217&view=rev
Log:
[Support] Timer: Use emplace_back() and range-based loops (NFC)
Modified:
llvm/trunk/lib/Support/Timer.cpp
Modified: llvm/trunk/lib/Support/Timer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Timer.cpp?rev=256217&r1=256216&r2=256217&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Timer.cpp (original)
+++ llvm/trunk/lib/Support/Timer.cpp Mon Dec 21 17:41:38 2015
@@ -272,7 +272,7 @@ void TimerGroup::removeTimer(Timer &T) {
// If the timer was started, move its data to TimersToPrint.
if (T.Started)
- TimersToPrint.push_back(std::make_pair(T.Time, T.Name));
+ TimersToPrint.emplace_back(T.Time, T.Name);
T.TG = nullptr;
@@ -306,8 +306,8 @@ void TimerGroup::PrintQueuedTimers(raw_o
std::sort(TimersToPrint.begin(), TimersToPrint.end());
TimeRecord Total;
- for (unsigned i = 0, e = TimersToPrint.size(); i != e; ++i)
- Total += TimersToPrint[i].first;
+ for (auto &RecordNamePair : TimersToPrint)
+ Total += RecordNamePair.first;
// Print out timing header.
OS << "===" << std::string(73, '-') << "===\n";
@@ -358,7 +358,7 @@ void TimerGroup::print(raw_ostream &OS)
// reset them.
for (Timer *T = FirstTimer; T; T = T->Next) {
if (!T->Started) continue;
- TimersToPrint.push_back(std::make_pair(T->Time, T->Name));
+ TimersToPrint.emplace_back(T->Time, T->Name);
// Clear out the time.
T->Started = 0;
More information about the llvm-commits
mailing list