From: Ted Kremenek Date: Mon, 17 Mar 2008 17:19:44 +0000 (+0000) Subject: Bug fix in CFG construction: VisitCompoundStmt should return the last created block. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a716d7a575c55805c4b90e07cccf61b9cc0960b8;p=clang Bug fix in CFG construction: VisitCompoundStmt should return the last created block. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48460 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/CFG.cpp b/lib/AST/CFG.cpp index e2aba6b3ff..d8c5f1ce69 100644 --- a/lib/AST/CFG.cpp +++ b/lib/AST/CFG.cpp @@ -475,13 +475,15 @@ CFGBlock* CFGBuilder::VisitNullStmt(NullStmt* Statement) { } CFGBlock* CFGBuilder::VisitCompoundStmt(CompoundStmt* C) { + + CFGBlock* LastBlock = NULL; for (CompoundStmt::reverse_body_iterator I=C->body_rbegin(), E=C->body_rend(); I != E; ++I ) { - Visit(*I); + LastBlock = Visit(*I); } - return Block; + return LastBlock; } CFGBlock* CFGBuilder::VisitIfStmt(IfStmt* I) {