allow TimeRegion to take a potentially-null pointer to a

timer for clang.

llvm-svn: 64874
This commit is contained in:
Chris Lattner 2009-02-18 01:48:17 +00:00
parent 3fc2e67140
commit 733259fd3a

View File

@ -113,14 +113,19 @@ private:
/// the relevant timer. This makes it easy to time a region of code.
///
class TimeRegion {
Timer &T;
Timer *T;
TimeRegion(const TimeRegion &); // DO NOT IMPLEMENT
public:
explicit TimeRegion(Timer &t) : T(t) {
T.startTimer();
explicit TimeRegion(Timer &t) : T(&t) {
T->startTimer();
}
explicit TimeRegion(Timer *t) : T(t) {
if (T)
T->startTimer();
}
~TimeRegion() {
T.stopTimer();
if (T)
T->stopTimer();
}
};