diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-18 01:48:17 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-18 01:48:17 +0000 |
commit | ccd846b73ffce9296e392e550712926845098fab (patch) | |
tree | 4b2e9caf8a21f6c4cbe6d1539b38b179bb091e71 /include/llvm/Support/Timer.h | |
parent | d2067fd730b2b266f5c244d5871a244b534e10ea (diff) | |
download | llvm-ccd846b73ffce9296e392e550712926845098fab.tar.gz llvm-ccd846b73ffce9296e392e550712926845098fab.tar.bz2 llvm-ccd846b73ffce9296e392e550712926845098fab.tar.xz |
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
Diffstat (limited to 'include/llvm/Support/Timer.h')
-rw-r--r-- | include/llvm/Support/Timer.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/include/llvm/Support/Timer.h b/include/llvm/Support/Timer.h index b9882a9708..584199f440 100644 --- a/include/llvm/Support/Timer.h +++ b/include/llvm/Support/Timer.h @@ -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(); } }; |