]> granicus.if.org Git - clang/commitdiff
CFG: when there is not continue or break target, mark the CFG as bad.
authorTed Kremenek <kremenek@apple.com>
Tue, 7 Apr 2009 18:53:24 +0000 (18:53 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 7 Apr 2009 18:53:24 +0000 (18:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68533 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/CFG.cpp

index 4ec124fe021750f07e7da718c17ced8ddc59103c..14c93f398e89ab09fa96d87dcfee488e1c4a6dd2 100644 (file)
@@ -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;  
 }