[cfe-commits] r68533 - /cfe/trunk/lib/AST/CFG.cpp

Ted Kremenek kremenek at apple.com
Tue Apr 7 11:53:24 PDT 2009


Author: kremenek
Date: Tue Apr  7 13:53:24 2009
New Revision: 68533

URL: http://llvm.org/viewvc/llvm-project?rev=68533&view=rev
Log:
CFG: when there is not continue or break target, mark the CFG as bad.

Modified:
    cfe/trunk/lib/AST/CFG.cpp

Modified: cfe/trunk/lib/AST/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CFG.cpp?rev=68533&r1=68532&r2=68533&view=diff

==============================================================================
--- cfe/trunk/lib/AST/CFG.cpp (original)
+++ cfe/trunk/lib/AST/CFG.cpp Tue Apr  7 13:53:24 2009
@@ -1086,8 +1086,11 @@
   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 @@
   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;  
 }





More information about the cfe-commits mailing list