summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.h
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-12-02 07:41:41 +0000
committerMike Stump <mrs@apple.com>2009-12-02 07:41:41 +0000
commit33270211a00a9e239900ef9bd7de8a0de2d8e82b (patch)
treed88c87d18eb6b09ae242eaf0a7fe79cbc0b46991 /clang/lib/CodeGen/CodeGenFunction.h
parentb9878ee6b6bf20e804b47769937efed4f15c51b6 (diff)
downloadbcm5719-llvm-33270211a00a9e239900ef9bd7de8a0de2d8e82b.tar.gz
bcm5719-llvm-33270211a00a9e239900ef9bd7de8a0de2d8e82b.zip
More exception handling improvements... WIP.
Highlights include: Add a helper to generate __cxa_free_exception and _ZSt9terminatev. Add a region to handle EH object deallocation for ctor failures for throw. Add a terminate handler for __cxa_end_catch. A framework for adding cleanup actions for the exceptional edges only. llvm-svn: 90305
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index 7f3204587a9..a7d28e544ea 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -109,7 +109,8 @@ public:
/// PushCleanupBlock - Push a new cleanup entry on the stack and set the
/// passed in block as the cleanup block.
void PushCleanupBlock(llvm::BasicBlock *CleanupEntryBlock,
- llvm::BasicBlock *CleanupExitBlock = 0);
+ llvm::BasicBlock *CleanupExitBlock = 0,
+ bool EHOnly = false);
/// CleanupBlockInfo - A struct representing a popped cleanup block.
struct CleanupBlockInfo {
@@ -123,9 +124,13 @@ public:
/// EndBlock - the default destination for the switch instruction.
llvm::BasicBlock *EndBlock;
+ /// EHOnly - True iff this cleanup should only be performed on the
+ /// exceptional edge.
+ bool EHOnly;
+
CleanupBlockInfo(llvm::BasicBlock *cb, llvm::BasicBlock *sb,
- llvm::BasicBlock *eb)
- : CleanupBlock(cb), SwitchBlock(sb), EndBlock(eb) {}
+ llvm::BasicBlock *eb, bool ehonly = false)
+ : CleanupBlock(cb), SwitchBlock(sb), EndBlock(eb), EHOnly(ehonly) {}
};
/// PopCleanupBlock - Will pop the cleanup entry on the stack, process all
@@ -141,11 +146,13 @@ public:
llvm::BasicBlock *CurBB;
llvm::BasicBlock *CleanupEntryBB;
llvm::BasicBlock *CleanupExitBB;
+ bool EHOnly;
public:
- DelayedCleanupBlock(CodeGenFunction &cgf)
+ DelayedCleanupBlock(CodeGenFunction &cgf, bool ehonly = false)
: CGF(cgf), CurBB(CGF.Builder.GetInsertBlock()),
- CleanupEntryBB(CGF.createBasicBlock("cleanup")), CleanupExitBB(0) {
+ CleanupEntryBB(CGF.createBasicBlock("cleanup")), CleanupExitBB(0),
+ EHOnly(ehonly) {
CGF.Builder.SetInsertPoint(CleanupEntryBB);
}
@@ -156,7 +163,7 @@ public:
}
~DelayedCleanupBlock() {
- CGF.PushCleanupBlock(CleanupEntryBB, CleanupExitBB);
+ CGF.PushCleanupBlock(CleanupEntryBB, CleanupExitBB, EHOnly);
// FIXME: This is silly, move this into the builder.
if (CurBB)
CGF.Builder.SetInsertPoint(CurBB);
@@ -303,10 +310,14 @@ private:
/// inserted into the current function yet.
std::vector<llvm::BranchInst *> BranchFixups;
+ /// EHOnly - Perform this only on the exceptional edge, not the main edge.
+ bool EHOnly;
+
explicit CleanupEntry(llvm::BasicBlock *CleanupEntryBlock,
- llvm::BasicBlock *CleanupExitBlock)
+ llvm::BasicBlock *CleanupExitBlock, bool ehonly)
: CleanupEntryBlock(CleanupEntryBlock),
- CleanupExitBlock(CleanupExitBlock) {}
+ CleanupExitBlock(CleanupExitBlock),
+ EHOnly(ehonly) {}
};
/// CleanupEntries - Stack of cleanup entries.
OpenPOWER on IntegriCloud