mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-14 15:28:20 +00:00
allow TimeRegion to take a potentially-null pointer to a
timer for clang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64874 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -113,14 +113,19 @@ private:
|
|||||||
/// the relevant timer. This makes it easy to time a region of code.
|
/// the relevant timer. This makes it easy to time a region of code.
|
||||||
///
|
///
|
||||||
class TimeRegion {
|
class TimeRegion {
|
||||||
Timer &T;
|
Timer *T;
|
||||||
TimeRegion(const TimeRegion &); // DO NOT IMPLEMENT
|
TimeRegion(const TimeRegion &); // DO NOT IMPLEMENT
|
||||||
public:
|
public:
|
||||||
explicit TimeRegion(Timer &t) : T(t) {
|
explicit TimeRegion(Timer &t) : T(&t) {
|
||||||
T.startTimer();
|
T->startTimer();
|
||||||
|
}
|
||||||
|
explicit TimeRegion(Timer *t) : T(t) {
|
||||||
|
if (T)
|
||||||
|
T->startTimer();
|
||||||
}
|
}
|
||||||
~TimeRegion() {
|
~TimeRegion() {
|
||||||
T.stopTimer();
|
if (T)
|
||||||
|
T->stopTimer();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user