From 235c5ed8bee5bbcb45de1707d6988635e49b10b8 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 7 Apr 2009 18:53:24 +0000 Subject: [PATCH] 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 --- lib/AST/CFG.cpp | 15 +++++++++++---- 1 file 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; } -- 2.50.1