[llvm-commits] [llvm] r64874 - /llvm/trunk/include/llvm/Support/Timer.h

Chris Lattner sabre at nondot.org
Tue Feb 17 17:48:18 PST 2009


Author: lattner
Date: Tue Feb 17 19:48:17 2009
New Revision: 64874

URL: http://llvm.org/viewvc/llvm-project?rev=64874&view=rev
Log:
allow TimeRegion to take a potentially-null pointer to a
timer for clang.

Modified:
    llvm/trunk/include/llvm/Support/Timer.h

Modified: llvm/trunk/include/llvm/Support/Timer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Timer.h?rev=64874&r1=64873&r2=64874&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/Timer.h (original)
+++ llvm/trunk/include/llvm/Support/Timer.h Tue Feb 17 19:48:17 2009
@@ -113,14 +113,19 @@
 /// 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();
   }
 };
 





More information about the llvm-commits mailing list