diff options
author | Ted Kremenek <kremenek@apple.com> | 2007-08-30 18:48:11 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2007-08-30 18:48:11 +0000 |
commit | 29ccaa186ac27bcb414c5acb069f6438b27dd5e7 (patch) | |
tree | bdf63c58b3137e8e93327827e361aaa5c4b37600 | |
parent | 6b91cd9af12fe1340e48e03e9b988d9888b4889f (diff) |
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
-rw-r--r-- | AST/CFG.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
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); |