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 e2aba6b..d8c5f1c 100644
--- a/lib/AST/CFG.cpp
+++ b/lib/AST/CFG.cpp
@@ -475,13 +475,15 @@
}
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) {