]> granicus.if.org Git - clang/commitdiff
Fixed a bug in constructing CFG blocks for case statement fall-through
authorTed Kremenek <kremenek@apple.com>
Thu, 30 Aug 2007 18:48:11 +0000 (18:48 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 30 Aug 2007 18:48:11 +0000 (18:48 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41622 91177308-0d34-0410-b5e6-96231b3b80d8

AST/CFG.cpp

index a2ce8a283b6facb0a48431fde3d900b9ceb76fa1..f2a1caa373fa7343db3e0864c8dfc70814eb1d7a 100644 (file)
@@ -822,9 +822,11 @@ CFGBlock* CFGBuilder::VisitSwitchCase(SwitchCase* S) {
   // 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);