]> granicus.if.org Git - clang/commitdiff
Small bug fix in CFG construction: the active block for LabelStmts comes
authorTed Kremenek <kremenek@apple.com>
Sat, 15 Mar 2008 07:45:02 +0000 (07:45 +0000)
committerTed Kremenek <kremenek@apple.com>
Sat, 15 Mar 2008 07:45:02 +0000 (07:45 +0000)
from "Block", not the CFGBlock* returned from visiting its subexpression.

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

AST/CFG.cpp

index 9bafb05daf4ca14470101efa03ddca0015017471..e2aba6b3ff34fe3b6c5578230cb2eb97d16d8b27 100644 (file)
@@ -577,7 +577,8 @@ CFGBlock* CFGBuilder::VisitReturnStmt(ReturnStmt* R) {
 
 CFGBlock* CFGBuilder::VisitLabelStmt(LabelStmt* L) {
   // Get the block of the labeled statement.  Add it to our map.
-  CFGBlock* LabelBlock = Visit(L->getSubStmt());
+  Visit(L->getSubStmt());
+  CFGBlock* LabelBlock = Block;
   
   if (!LabelBlock)            // This can happen when the body is empty, i.e.
     LabelBlock=createBlock(); // scopes that only contains NullStmts.
@@ -970,7 +971,7 @@ CFGBlock* CFGBuilder::VisitCaseStmt(CaseStmt* S) {
   // This block is now the implicit successor of other blocks.
   Succ = CaseBlock;
   
-  return CaseBlock;    
+  return CaseBlock;
 }
   
 CFGBlock* CFGBuilder::VisitDefaultStmt(DefaultStmt* S) {