summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/CFG.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2018-09-28 18:44:09 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2018-09-28 18:44:09 +0000
commit8baa50013c86c34a58d8327c5d1a043898b86398 (patch)
treec3e17acda6afd5e69242ee9dd6d330796f1c3670 /clang/lib/Analysis/CFG.cpp
parent8e90bad63d3a448ed680616b393a47d25280fd87 (diff)
downloadbcm5719-llvm-8baa50013c86c34a58d8327c5d1a043898b86398.tar.gz
bcm5719-llvm-8baa50013c86c34a58d8327c5d1a043898b86398.zip
[cxx2a] P0614R1: Support init-statements in range-based for loops.
We don't yet support this for the case where a range-based for loop is implicitly rewritten to an ObjC for..in statement. llvm-svn: 343350
Diffstat (limited to 'clang/lib/Analysis/CFG.cpp')
-rw-r--r--clang/lib/Analysis/CFG.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp
index 48113eb6ba5..6bb181c2253 100644
--- a/clang/lib/Analysis/CFG.cpp
+++ b/clang/lib/Analysis/CFG.cpp
@@ -4255,7 +4255,10 @@ CFGBlock *CFGBuilder::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
Block = createBlock();
addStmt(S->getBeginStmt());
addStmt(S->getEndStmt());
- return addStmt(S->getRangeStmt());
+ CFGBlock *Head = addStmt(S->getRangeStmt());
+ if (S->getInit())
+ Head = addStmt(S->getInit());
+ return Head;
}
CFGBlock *CFGBuilder::VisitExprWithCleanups(ExprWithCleanups *E,
OpenPOWER on IntegriCloud