Timer - fix shadow variable warnings for Name/Description members. NFC.

This commit is contained in:
Simon Pilgrim 2019-11-11 17:19:01 +00:00
parent 49fb4a96e0
commit 5cfce5079b
2 changed files with 12 additions and 11 deletions

View File

@ -85,11 +85,11 @@ class Timer {
Timer **Prev = nullptr; ///< Pointer to \p Next of previous timer in group.
Timer *Next = nullptr; ///< Next timer in the group.
public:
explicit Timer(StringRef Name, StringRef Description) {
init(Name, Description);
explicit Timer(StringRef TimerName, StringRef TimerDescription) {
init(TimerName, TimerDescription);
}
Timer(StringRef Name, StringRef Description, TimerGroup &tg) {
init(Name, Description, tg);
Timer(StringRef TimerName, StringRef TimerDescription, TimerGroup &tg) {
init(TimerName, TimerDescription, tg);
}
Timer(const Timer &RHS) {
assert(!RHS.TG && "Can only copy uninitialized timers");
@ -102,8 +102,8 @@ public:
/// Create an uninitialized timer, client must use 'init'.
explicit Timer() {}
void init(StringRef Name, StringRef Description);
void init(StringRef Name, StringRef Description, TimerGroup &tg);
void init(StringRef TimerName, StringRef TimerDescription);
void init(StringRef TimerName, StringRef TimerDescription, TimerGroup &tg);
const std::string &getName() const { return Name; }
const std::string &getDescription() const { return Description; }

View File

@ -91,14 +91,15 @@ static TimerGroup *getDefaultTimerGroup() { return &*DefaultTimerGroup; }
// Timer Implementation
//===----------------------------------------------------------------------===//
void Timer::init(StringRef Name, StringRef Description) {
init(Name, Description, *getDefaultTimerGroup());
void Timer::init(StringRef TimerName, StringRef TimerDescription) {
init(TimerName, TimerDescription, *getDefaultTimerGroup());
}
void Timer::init(StringRef Name, StringRef Description, TimerGroup &tg) {
void Timer::init(StringRef TimerName, StringRef TimerDescription,
TimerGroup &tg) {
assert(!TG && "Timer already initialized");
this->Name.assign(Name.begin(), Name.end());
this->Description.assign(Description.begin(), Description.end());
Name.assign(TimerName.begin(), TimerName.end());
Description.assign(TimerDescription.begin(), TimerDescription.end());
Running = Triggered = false;
TG = &tg;
TG->addTimer(*this);