[cfe-commits] r95310 - /cfe/trunk/test/CodeGenCXX/conditional-temporaries.cpp

Anders Carlsson andersca at mac.com
Thu Feb 4 09:23:15 PST 2010


Author: andersca
Date: Thu Feb  4 11:23:15 2010
New Revision: 95310

URL: http://llvm.org/viewvc/llvm-project?rev=95310&view=rev
Log:
Improve conditional temporaries test.

Modified:
    cfe/trunk/test/CodeGenCXX/conditional-temporaries.cpp

Modified: cfe/trunk/test/CodeGenCXX/conditional-temporaries.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/conditional-temporaries.cpp?rev=95310&r1=95309&r2=95310&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/conditional-temporaries.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/conditional-temporaries.cpp Thu Feb  4 11:23:15 2010
@@ -2,11 +2,12 @@
 
 namespace {
 
-static int counter;
+static int ctorcalls;
+static int dtorcalls;
   
 struct A {
-  A() : i(0) { counter++; }
-  ~A() { counter--; }
+  A() : i(0) { ctorcalls++; }
+  ~A() { dtorcalls++; }
   int i;
 };
 
@@ -29,8 +30,20 @@
 
 }
 
-// CHECK: define i32 @_Z10getCounterv()
-int getCounter() {
-  // CHECK: ret i32 0
-  return counter;
+// CHECK: define i32 @_Z12getCtorCallsv()
+int getCtorCalls() {
+  // CHECK: ret i32 3
+  return ctorcalls;
+}
+
+// CHECK: define i32 @_Z12getDtorCallsv()
+int getDtorCalls() {
+  // CHECK: ret i32 3
+  return dtorcalls;
+}
+
+// CHECK: define zeroext i1 @_Z7successv()
+bool success() {
+  // CHECK: ret i1 true
+  return ctorcalls == dtorcalls;
 }





More information about the cfe-commits mailing list