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

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


Author: kremenek
Date: Thu Aug 30 13:48:11 2007
New Revision: 41622

URL: http://llvm.org/viewvc/llvm-project?rev=41622&view=rev
Log:
Fixed a bug in constructing CFG blocks for case statement fall-through
introduced by moving "CaseStmt" pointers out of the list of statements
and into the explicit "label" associated with a CFGBlock.  --This
line, and those below, will be ignored--

M    AST/CFG.cpp

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=41622&r1=41621&r2=41622&view=diff

==============================================================================
--- cfe/trunk/AST/CFG.cpp (original)
+++ cfe/trunk/AST/CFG.cpp Thu Aug 30 13:48:11 2007
@@ -822,9 +822,11 @@
   // A SwitchCase is either a "default" or "case" statement.  We handle
   // both in the same way.  They are essentially labels, so they are the
   // first statement in a block.      
-  CFGBlock* CaseBlock = Visit(S->getSubStmt());
-  assert (CaseBlock);
-  
+
+  if (S->getSubStmt()) Visit(S->getSubStmt());
+  CFGBlock* CaseBlock = Block;
+  if (!CaseBlock) CaseBlock = createBlock();  
+    
   // Cases/Default statements partition block, so this is the top of
   // the basic block we were processing (the case/default is the label).
   CaseBlock->setLabel(S);





More information about the cfe-commits mailing list