From: Ted Kremenek Date: Thu, 30 Aug 2007 18:48:11 +0000 (+0000) Subject: Fixed a bug in constructing CFG blocks for case statement fall-through X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29ccaa186ac27bcb414c5acb069f6438b27dd5e7;p=clang 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41622 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/AST/CFG.cpp b/AST/CFG.cpp index a2ce8a283b..f2a1caa373 100644 --- a/AST/CFG.cpp +++ b/AST/CFG.cpp @@ -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);