diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-02-26 00:22:58 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-02-26 00:22:58 +0000 |
commit | d34066c224f782056c18f154abe04ef590473fd9 (patch) | |
tree | 5c65b24d31cc0c78c8d362a73cd00030728ed6b1 | |
parent | 4dc35223157f926164b6822711269cc73287cd80 (diff) |
Fixed bug in CFG construction when a CompoundStmt ended with a NullStmt.
This caused the whole body to get dropped from the CFG.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47579 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | AST/CFG.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/AST/CFG.cpp b/AST/CFG.cpp index bc450989f7..18c2074b40 100644 --- a/AST/CFG.cpp +++ b/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) { |