summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-02-26 00:22:58 +0000
committerTed Kremenek <kremenek@apple.com>2008-02-26 00:22:58 +0000
commitf699882a76e5181a573472568b8c9d867fcbe367 (patch)
treee0dbc6c2a2febe278aec4a3fc355f402bbcfda65
parent733f810600932d40d420c9d2522da931eee2e98d (diff)
downloadbcm5719-llvm-f699882a76e5181a573472568b8c9d867fcbe367.tar.gz
bcm5719-llvm-f699882a76e5181a573472568b8c9d867fcbe367.zip
Fixed bug in CFG construction when a CompoundStmt ended with a NullStmt.
This caused the whole body to get dropped from the CFG. llvm-svn: 47579
-rw-r--r--clang/AST/CFG.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/clang/AST/CFG.cpp b/clang/AST/CFG.cpp
index bc450989f7e..18c2074b406 100644
--- a/clang/AST/CFG.cpp
+++ b/clang/AST/CFG.cpp
@@ -447,17 +447,13 @@ CFGBlock* CFGBuilder::VisitNullStmt(NullStmt* Statement) {
}
CFGBlock* CFGBuilder::VisitCompoundStmt(CompoundStmt* C) {
- // The value returned from this function is the last created CFGBlock
- // that represents the "entry" point for the translated AST node.
- CFGBlock* LastBlock = 0;
-
- for (CompoundStmt::reverse_body_iterator I = C->body_rbegin(),
- E = C->body_rend(); I != E; ++I )
- // Add the statement to the current block.
- if (!(LastBlock=Visit(*I)))
- return NULL;
- return LastBlock;
+ for (CompoundStmt::reverse_body_iterator I=C->body_rbegin(), E=C->body_rend();
+ I != E; ++I ) {
+ Visit(*I);
+ }
+
+ return Block;
}
CFGBlock* CFGBuilder::VisitIfStmt(IfStmt* I) {
OpenPOWER on IntegriCloud