]> granicus.if.org Git - clang/commitdiff
Bug fix in CFG construction: VisitCompoundStmt should return the last created block.
authorTed Kremenek <kremenek@apple.com>
Mon, 17 Mar 2008 17:19:44 +0000 (17:19 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 17 Mar 2008 17:19:44 +0000 (17:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48460 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/CFG.cpp

index e2aba6b3ff34fe3b6c5578230cb2eb97d16d8b27..d8c5f1ce6955a93b43b521859ce7be0860750890 100644 (file)
@@ -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) {