diff options
Diffstat (limited to 'clang/lib/Analysis/CFG.cpp')
-rw-r--r-- | clang/lib/Analysis/CFG.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp index 66019329a3b..8a5c2e19f7e 100644 --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -3169,7 +3169,13 @@ CFGBlock *CFGBuilder::VisitForStmt(ForStmt *F) { if (VarDecl *VD = F->getConditionVariable()) { if (Expr *Init = VD->getInit()) { autoCreateBlock(); - appendStmt(Block, F->getConditionVariableDeclStmt()); + const DeclStmt *DS = F->getConditionVariableDeclStmt(); + assert(DS->isSingleDecl()); + findConstructionContexts( + ConstructionContextLayer::create(cfg->getBumpVectorContext(), + const_cast<DeclStmt *>(DS)), + Init); + appendStmt(Block, DS); EntryConditionBlock = addStmt(Init); assert(Block == EntryConditionBlock); maybeAddScopeBeginForVarDecl(EntryConditionBlock, VD, C); @@ -3494,7 +3500,13 @@ CFGBlock *CFGBuilder::VisitWhileStmt(WhileStmt *W) { if (VarDecl *VD = W->getConditionVariable()) { if (Expr *Init = VD->getInit()) { autoCreateBlock(); - appendStmt(Block, W->getConditionVariableDeclStmt()); + const DeclStmt *DS = W->getConditionVariableDeclStmt(); + assert(DS->isSingleDecl()); + findConstructionContexts( + ConstructionContextLayer::create(cfg->getBumpVectorContext(), + const_cast<DeclStmt *>(DS)), + Init); + appendStmt(Block, DS); EntryConditionBlock = addStmt(Init); assert(Block == EntryConditionBlock); maybeAddScopeBeginForVarDecl(EntryConditionBlock, VD, C); |