]> granicus.if.org Git - clang/commitdiff
Fixed bug in CFG construction when a CompoundStmt ended with a NullStmt.
authorTed Kremenek <kremenek@apple.com>
Tue, 26 Feb 2008 00:22:58 +0000 (00:22 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 26 Feb 2008 00:22:58 +0000 (00:22 +0000)
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

AST/CFG.cpp

index bc450989f7e975b4123bb964302dec30ed615bc7..18c2074b406f4f1d0bc607d9fef5f219b114d73f 100644 (file)
@@ -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) {