forked from OSchip/llvm-project
Add CFG support for the initializer of the condition variable of a ForStmt.
llvm-svn: 92113
This commit is contained in:
parent
1c3ab07968
commit
ec92f9492b
|
@ -888,6 +888,19 @@ CFGBlock* CFGBuilder::VisitForStmt(ForStmt* F) {
|
|||
if (Stmt* C = F->getCond()) {
|
||||
Block = ExitConditionBlock;
|
||||
EntryConditionBlock = addStmt(C);
|
||||
assert(Block == EntryConditionBlock);
|
||||
|
||||
// If this block contains a condition variable, add both the condition
|
||||
// variable and initializer to the CFG.
|
||||
if (VarDecl *VD = F->getConditionVariable()) {
|
||||
if (Expr *Init = VD->getInit()) {
|
||||
autoCreateBlock();
|
||||
AppendStmt(Block, F, AddStmtChoice::AlwaysAdd);
|
||||
EntryConditionBlock = addStmt(Init);
|
||||
assert(Block == EntryConditionBlock);
|
||||
}
|
||||
}
|
||||
|
||||
if (Block) {
|
||||
if (!FinishBlock(EntryConditionBlock))
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue