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

Anders Carlsson andersca at mac.com
Thu Feb 4 09:06:52 PST 2010


Author: andersca
Date: Thu Feb  4 11:06:52 2010
New Revision: 95306

URL: http://llvm.org/viewvc/llvm-project?rev=95306&view=rev
Log:
Improve 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=95306&r1=95305&r2=95306&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/conditional-temporaries.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/conditional-temporaries.cpp Thu Feb  4 11:06:52 2010
@@ -1,28 +1,36 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 -O3 | FileCheck %s
 
-struct I {
+namespace {
+
+static int counter;
+  
+struct A {
+  A() : i(0) { counter++; }
+  ~A() { counter--; }
   int i;
-  I();
-  ~I();
 };
 
-void g(int);
+void g(int) { }
+
+void f1(bool b) {
+  g(b ? A().i : 0);
+  g(b || A().i);
+  g(b && A().i);
+}
 
-volatile int i;
+struct Checker {
+  Checker() {
+    f1(true);
+    f1(false);
+  }
+};
+
+Checker c;
+
+}
 
-void f1() {
-  // CHECK: call void @_ZN1IC1Ev
-  g(i ? I().i : 0);
-  // CHECK: call void @_Z1gi
-  // CHECK: call void @_ZN1ID1Ev
-
-  // CHECK: call void @_ZN1IC1Ev
-  g(i || I().i);
-  // CHECK: call void @_Z1gi
-  // CHECK: call void @_ZN1ID1Ev
-
-  // CHECK: call void @_ZN1IC1Ev
-  g(i && I().i);
-  // CHECK: call void @_Z1gi
-  // CHECK: call void @_ZN1ID1Ev
+// CHECK: define i32 @_Z10getCounterv()
+int getCounter() {
+  // CHECK: ret i32 0
+  return counter;
 }





More information about the cfe-commits mailing list