diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-04-07 18:53:24 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-04-07 18:53:24 +0000 |
commit | 882cf066523ac39830fee169c2033461bad9af59 (patch) | |
tree | 98624ce3a4e15b81c6eb67ed677665ef48e84025 | |
parent | d8db853243d30b7afd07f9307efe6c2bc6dc44c3 (diff) | |
download | bcm5719-llvm-882cf066523ac39830fee169c2033461bad9af59.tar.gz bcm5719-llvm-882cf066523ac39830fee169c2033461bad9af59.zip |
CFG: when there is not continue or break target, mark the CFG as bad.
llvm-svn: 68533
-rw-r--r-- | clang/lib/AST/CFG.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/clang/lib/AST/CFG.cpp b/clang/lib/AST/CFG.cpp index 4ec124fe021..14c93f398e8 100644 --- a/clang/lib/AST/CFG.cpp +++ b/clang/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; } |