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 a2ce8a2..f2a1caa 100644
--- a/AST/CFG.cpp
+++ b/AST/CFG.cpp
@@ -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);