Add support for emitting cleanup blocks. Make EmitCompoundStatement emit cleanup blocks if necessary
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64051 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index ac97c63..fc7a7c7 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -123,7 +123,7 @@
/// (for use by the statement expression extension).
RValue CodeGenFunction::EmitCompoundStmt(const CompoundStmt &S, bool GetLast,
llvm::Value *AggLoc, bool isAggVol) {
- // FIXME: handle vla's etc.
+
CGDebugInfo *DI = CGM.getDebugInfo();
if (DI) {
EnsureInsertPoint();
@@ -131,6 +131,9 @@
DI->EmitRegionStart(CurFn, Builder);
}
+ // Keep track of the current cleanup stack depth.
+ size_t CleanupStackDepth = CleanupEntries.size();
+
// Push a null stack save value.
StackSaveValues.push_back(0);
@@ -171,6 +174,8 @@
Builder.CreateCall(F, V);
}
+ EmitCleanupBlocks(CleanupStackDepth);
+
return RV;
}