aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/CFG.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-04-07 18:53:24 +0000
committerTed Kremenek <kremenek@apple.com>2009-04-07 18:53:24 +0000
commit235c5ed8bee5bbcb45de1707d6988635e49b10b8 (patch)
tree4e4c6aa38a0b441537dce67c339c2209363a03c0 /lib/AST/CFG.cpp
parent8ac67a7725ef25f5df8a992277182f51316500e6 (diff)
CFG: when there is not continue or break target, mark the CFG as bad.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68533 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/CFG.cpp')
-rw-r--r--lib/AST/CFG.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/AST/CFG.cpp b/lib/AST/CFG.cpp
index 4ec124fe02..14c93f398e 100644
--- a/lib/AST/CFG.cpp
+++ b/lib/AST/CFG.cpp
@@ -1086,8 +1086,11 @@ CFGBlock* CFGBuilder::VisitContinueStmt(ContinueStmt* C) {
Block->setTerminator(C);
// If there is no target for the continue, then we are looking at an
- // incomplete AST. Handle this by not registering a successor.
- if (ContinueTargetBlock) Block->addSuccessor(ContinueTargetBlock);
+ // incomplete AST. This means the CFG cannot be constructed.
+ if (ContinueTargetBlock)
+ Block->addSuccessor(ContinueTargetBlock);
+ else
+ badCFG = true;
return Block;
}
@@ -1102,8 +1105,12 @@ CFGBlock* CFGBuilder::VisitBreakStmt(BreakStmt* B) {
Block->setTerminator(B);
// If there is no target for the break, then we are looking at an
- // incomplete AST. Handle this by not registering a successor.
- if (BreakTargetBlock) Block->addSuccessor(BreakTargetBlock);
+ // incomplete AST. This means that the CFG cannot be constructed.
+ if (BreakTargetBlock)
+ Block->addSuccessor(BreakTargetBlock);
+ else
+ badCFG = true;
+
return Block;
}