forked from OSchip/llvm-project
CFG: record set of C++ 'try' dispatch blocks, which could be of interest to various analyses (e.g., reachability).
llvm-svn: 138409
This commit is contained in:
parent
adfb445466
commit
6b9964d237
|
|
@ -613,6 +613,18 @@ public:
|
|||
|
||||
CFGBlock * getIndirectGotoBlock() { return IndirectGotoBlock; }
|
||||
const CFGBlock * getIndirectGotoBlock() const { return IndirectGotoBlock; }
|
||||
|
||||
typedef std::vector<const CFGBlock*>::const_iterator try_block_iterator;
|
||||
try_block_iterator try_blocks_begin() const {
|
||||
return TryDispatchBlocks.begin();
|
||||
}
|
||||
try_block_iterator try_blocks_end() const {
|
||||
return TryDispatchBlocks.end();
|
||||
}
|
||||
|
||||
void addTryDispatchBlock(const CFGBlock *block) {
|
||||
TryDispatchBlocks.push_back(block);
|
||||
}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Member templates useful for various batch operations over CFGs.
|
||||
|
|
@ -691,6 +703,10 @@ private:
|
|||
BumpVectorContext BlkBVC;
|
||||
|
||||
CFGBlockListTy Blocks;
|
||||
|
||||
/// C++ 'try' statements are modeled with an indirect dispatch block.
|
||||
/// This is the collection of such blocks present in the CFG.
|
||||
std::vector<const CFGBlock *> TryDispatchBlocks;
|
||||
|
||||
};
|
||||
} // end namespace clang
|
||||
|
|
|
|||
|
|
@ -2493,8 +2493,8 @@ CFGBlock *CFGBuilder::VisitCXXTryStmt(CXXTryStmt *Terminator) {
|
|||
Succ = TrySuccessor;
|
||||
|
||||
// Save the current "try" context.
|
||||
SaveAndRestore<CFGBlock*> save_try(TryTerminatedBlock);
|
||||
TryTerminatedBlock = NewTryTerminatedBlock;
|
||||
SaveAndRestore<CFGBlock*> save_try(TryTerminatedBlock, NewTryTerminatedBlock);
|
||||
cfg->addTryDispatchBlock(TryTerminatedBlock);
|
||||
|
||||
assert(Terminator->getTryBlock() && "try must contain a non-NULL body");
|
||||
Block = NULL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue