summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-02-07 23:50:39 +0000
committerAnders Carlsson <andersca@mac.com>2009-02-07 23:50:39 +0000
commitbe0f76a712ddfdb6c0e4e5240174c21178280fa3 (patch)
tree1682a09b33cd099efb0fb55d8556fd1ff64eb0ed /clang/lib/CodeGen/CodeGenFunction.cpp
parent4f8542f31de057295f3ce323d11f6eb7115f059d (diff)
Add support for emitting cleanup blocks. Make EmitCompoundStatement emit cleanup blocks if necessary
llvm-svn: 64051
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 4ba4d600f864..838de70218d5 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -521,3 +521,24 @@ llvm::BasicBlock *CodeGenFunction::CreateCleanupBlock()
return CleanupBlock;
}
+
+void CodeGenFunction::EmitCleanupBlocks(size_t OldCleanupStackSize)
+{
+ assert(CleanupEntries.size() >= OldCleanupStackSize &&
+ "Cleanup stack mismatch!");
+
+ while (CleanupEntries.size() > OldCleanupStackSize)
+ EmitCleanupBlock();
+}
+
+void CodeGenFunction::EmitCleanupBlock()
+{
+ CleanupEntry &CE = CleanupEntries.back();
+
+ llvm::BasicBlock *CleanupBlock = CE.CleanupBlock;
+
+ CleanupEntries.pop_back();
+
+ EmitBlock(CleanupBlock);
+}
+