diff options
author | Mike Stump <mrs@apple.com> | 2010-01-20 01:30:58 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2010-01-20 01:30:58 +0000 |
commit | 845384a9387954d7deab51d66c3b1e0904bfb076 (patch) | |
tree | 40beedd4c6c51c383fbeec2a0c8646ffbdd605ad /clang/lib/Analysis/CFG.cpp | |
parent | 0bdba6cdd8b1e2dc2c1fe8ae654356ff0e2da7e0 (diff) | |
download | bcm5719-llvm-845384a9387954d7deab51d66c3b1e0904bfb076.tar.gz bcm5719-llvm-845384a9387954d7deab51d66c3b1e0904bfb076.zip |
Wire up the EH context for the catch clauses to the outer EH context. WIP.
llvm-svn: 93963
Diffstat (limited to 'clang/lib/Analysis/CFG.cpp')
-rw-r--r-- | clang/lib/Analysis/CFG.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp index 33c3f551dd9..97bf675180b 100644 --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -1598,14 +1598,12 @@ CFGBlock *CFGBuilder::VisitCXXTryStmt(CXXTryStmt *Terminator) { TrySuccessor = Block; } else TrySuccessor = Succ; - // Save the current "try" context. CFGBlock *PrevTryTerminatedBlock = TryTerminatedBlock; - SaveAndRestore<CFGBlock*> save_try(TryTerminatedBlock); // Create a new block that will contain the try statement. - TryTerminatedBlock = createBlock(false); + CFGBlock *NewTryTerminatedBlock = createBlock(false); // Add the terminator in the try block. - TryTerminatedBlock->setTerminator(Terminator); + NewTryTerminatedBlock->setTerminator(Terminator); bool HasCatchAll = false; for (unsigned h = 0; h <Terminator->getNumHandlers(); ++h) { @@ -1621,20 +1619,22 @@ CFGBlock *CFGBuilder::VisitCXXTryStmt(CXXTryStmt *Terminator) { return 0; // Add this block to the list of successors for the block with the try // statement. - AddSuccessor(TryTerminatedBlock, CatchBlock); + AddSuccessor(NewTryTerminatedBlock, CatchBlock); } if (!HasCatchAll) { if (PrevTryTerminatedBlock) - AddSuccessor(TryTerminatedBlock, PrevTryTerminatedBlock); + AddSuccessor(NewTryTerminatedBlock, PrevTryTerminatedBlock); else - AddSuccessor(TryTerminatedBlock, &cfg->getExit()); + AddSuccessor(NewTryTerminatedBlock, &cfg->getExit()); } // The code after the try is the implicit successor. Succ = TrySuccessor; - // When visiting the body, the case statements should automatically get linked - // up to the try. + // Save the current "try" context. + SaveAndRestore<CFGBlock*> save_try(TryTerminatedBlock); + TryTerminatedBlock = NewTryTerminatedBlock; + assert(Terminator->getTryBlock() && "try must contain a non-NULL body"); Block = NULL; Block = addStmt(Terminator->getTryBlock()); |