/// build process. It consists of CFGBlock that specifies position in CFG graph
/// and LocalScope::const_iterator that specifies position in LocalScope graph.
struct BlockScopePosPair {
- BlockScopePosPair() {}
- BlockScopePosPair(CFGBlock* B, LocalScope::const_iterator S)
- : Block(B), ScopePos(S) {}
+ BlockScopePosPair() : block(0) {}
+ BlockScopePosPair(CFGBlock* b, LocalScope::const_iterator scopePos)
+ : block(b), scopePosition(scopePos) {}
- CFGBlock* Block;
- LocalScope::const_iterator ScopePos;
+ CFGBlock *block;
+ LocalScope::const_iterator scopePosition;
};
/// CFGBuilder - This class implements CFG construction from an AST.
for (BackpatchBlocksTy::iterator I = BackpatchBlocks.begin(),
E = BackpatchBlocks.end(); I != E; ++I ) {
- CFGBlock* B = I->Block;
+ CFGBlock* B = I->block;
GotoStmt* G = cast<GotoStmt>(B->getTerminator());
LabelMapTy::iterator LI = LabelMap.find(G->getLabel());
if (LI == LabelMap.end()) continue;
JumpTarget JT = LI->second;
- prependAutomaticObjDtorsWithTerminator(B, I->ScopePos, JT.ScopePos);
- addSuccessor(B, JT.Block);
+ prependAutomaticObjDtorsWithTerminator(B, I->scopePosition,
+ JT.scopePosition);
+ addSuccessor(B, JT.block);
}
// Add successors to the Indirect Goto Dispatch block (if we have one).
// at an incomplete AST. Handle this by not registering a successor.
if (LI == LabelMap.end()) continue;
- addSuccessor(B, LI->second.Block);
+ addSuccessor(B, LI->second.block);
}
// Create an empty entry block that has no predecessors.
// If there is no target for the break, then we are looking at an incomplete
// AST. This means that the CFG cannot be constructed.
- if (BreakJumpTarget.Block) {
- addAutomaticObjDtors(ScopePos, BreakJumpTarget.ScopePos, B);
- addSuccessor(Block, BreakJumpTarget.Block);
+ if (BreakJumpTarget.block) {
+ addAutomaticObjDtors(ScopePos, BreakJumpTarget.scopePosition, B);
+ addSuccessor(Block, BreakJumpTarget.block);
} else
badCFG = true;
BackpatchBlocks.push_back(JumpSource(Block, ScopePos));
else {
JumpTarget JT = I->second;
- addAutomaticObjDtors(ScopePos, JT.ScopePos, G);
- addSuccessor(Block, JT.Block);
+ addAutomaticObjDtors(ScopePos, JT.scopePosition, G);
+ addSuccessor(Block, JT.block);
}
return Block;
if (Stmt* C = F->getCond()) {
Block = ExitConditionBlock;
EntryConditionBlock = addStmt(C);
+ if (badCFG)
+ return 0;
assert(Block == EntryConditionBlock ||
(Block == 0 && EntryConditionBlock == Succ));
// The starting block for the loop increment is the block that should
// represent the 'loop target' for looping back to the start of the loop.
- ContinueJumpTarget.Block->setLoopTarget(F);
+ ContinueJumpTarget.block->setLoopTarget(F);
// If body is not a compound statement create implicit scope
// and add destructors.
CFGBlock* BodyBlock = addStmt(F->getBody());
if (!BodyBlock)
- BodyBlock = ContinueJumpTarget.Block;//can happen for "for (...;...;...);"
+ BodyBlock = ContinueJumpTarget.block;//can happen for "for (...;...;...);"
else if (badCFG)
return 0;
CFGBlock* BodyBlock = addStmt(W->getBody());
if (!BodyBlock)
- BodyBlock = ContinueJumpTarget.Block; // can happen for "while(...) ;"
+ BodyBlock = ContinueJumpTarget.block; // can happen for "while(...) ;"
else if (Block) {
if (badCFG)
return 0;
// If there is no target for the continue, then we are looking at an
// incomplete AST. This means the CFG cannot be constructed.
- if (ContinueJumpTarget.Block) {
- addAutomaticObjDtors(ScopePos, ContinueJumpTarget.ScopePos, C);
- addSuccessor(Block, ContinueJumpTarget.Block);
+ if (ContinueJumpTarget.block) {
+ addAutomaticObjDtors(ScopePos, ContinueJumpTarget.scopePosition, C);
+ addSuccessor(Block, ContinueJumpTarget.block);
} else
badCFG = true;