summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2016-07-08 10:50:51 +0000
committerAlexander Kornienko <alexfh@google.com>2016-07-08 10:50:51 +0000
commitff2046a93e8fccf00bb4ffafcf651895d7494798 (patch)
treeaacec448824e834dde00cc419afbd5f02e1906ca /clang/lib/Analysis
parent828c731880360c7def89ab7e2f777653a8ed5773 (diff)
downloadbcm5719-llvm-ff2046a93e8fccf00bb4ffafcf651895d7494798.tar.gz
bcm5719-llvm-ff2046a93e8fccf00bb4ffafcf651895d7494798.zip
CFGBuilder: Fix crash when visiting a range-based for over a dependent type
Summary: CFG generation is expected to fail in this case, but it should not crash. Also added a test that reproduces the crash. Reviewers: klimek Subscribers: cfe-commits Patch by Martin Boehme! Differential Revision: http://reviews.llvm.org/D21895 llvm-svn: 274834
Diffstat (limited to 'clang/lib/Analysis')
-rw-r--r--clang/lib/Analysis/CFG.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp
index d9349fc4092..2c502cdcf4e 100644
--- a/clang/lib/Analysis/CFG.cpp
+++ b/clang/lib/Analysis/CFG.cpp
@@ -3457,6 +3457,8 @@ CFGBlock *CFGBuilder::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
// continue statements.
Block = nullptr;
Succ = addStmt(S->getInc());
+ if (badCFG)
+ return nullptr;
ContinueJumpTarget = JumpTarget(Succ, ContinueScopePos);
// The starting block for the loop increment is the block that should
OpenPOWER on IntegriCloud