summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/condition.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-11-24 21:15:44 +0000
committerDouglas Gregor <dgregor@apple.com>2009-11-24 21:15:44 +0000
commit5656e14d91405417182171a705ed3e3d2d6d7aa3 (patch)
tree33bb9d6fde39a94e88529a19425acfdf06f2d500 /test/CodeGenCXX/condition.cpp
parente9cbf15b2ebedebc8bb8e162bb5cf25abd70f578 (diff)
Clean up the AST for while loops and fix several problems with
cleanups for while loops: 1) Make sure that we destroy the condition variable of a while statement each time through the loop for, e.g., while (shared_ptr<WorkInt> p = getWorkItem()) { // ... } 2) Make sure that we always enter a new cleanup scope for the body of the while loop, even when there is no compound expression, e.g., while (blah) RAIIObject raii(blah+1); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89800 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/condition.cpp')
-rw-r--r--test/CodeGenCXX/condition.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/CodeGenCXX/condition.cpp b/test/CodeGenCXX/condition.cpp
index f3c8a9b769..0bb9121f7f 100644
--- a/test/CodeGenCXX/condition.cpp
+++ b/test/CodeGenCXX/condition.cpp
@@ -69,3 +69,23 @@ void switch_destruct(int z) {
// CHECK: store i32 20
z = 20;
}
+
+int foo();
+
+void while_destruct(int z) {
+ // CHECK: define void @_Z14while_destructi
+ // CHECK: while.cond:
+ while (X x = X()) {
+ // CHECK: call void @_ZN1XC1Ev
+
+ // CHECK: while.body:
+ // CHECK: store i32 21
+ z = 21;
+
+ // CHECK: while.cleanup:
+ // CHECK: call void @_ZN1XD1Ev
+ }
+ // CHECK: while.end
+ // CHECK: store i32 22
+ z = 22;
+}