[cfe-commits] r41619 - /cfe/trunk/AST/CFG.cpp

Ted Kremenek kremenek at apple.com
Thu Aug 30 11:20:57 PDT 2007


Author: kremenek
Date: Thu Aug 30 13:20:57 2007
New Revision: 41619

URL: http://llvm.org/viewvc/llvm-project?rev=41619&view=rev
Log:
Fixed bug in CFG construction involving use of labels and "empty"
blocks involving only ';' statements.  We now correctly handle the following:

void empty_label() { l1: ; }

Modified:
    cfe/trunk/AST/CFG.cpp

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

==============================================================================
--- cfe/trunk/AST/CFG.cpp (original)
+++ cfe/trunk/AST/CFG.cpp Thu Aug 30 13:20:57 2007
@@ -463,8 +463,10 @@
 CFGBlock* CFGBuilder::VisitLabelStmt(LabelStmt* L) {
   // Get the block of the labeled statement.  Add it to our map.
   CFGBlock* LabelBlock = Visit(L->getSubStmt());
-  assert (LabelBlock);    
-
+  
+  if (!LabelBlock)            // This can happen when the body is empty, i.e.
+    LabelBlock=createBlock(); // scopes that only contains NullStmts.
+  
   assert (LabelMap.find(L) == LabelMap.end() && "label already in map");
   LabelMap[ L ] = LabelBlock;
   





More information about the cfe-commits mailing list