[cfe-commits] r44220 - /cfe/trunk/AST/CFG.cpp

Ted Kremenek kremenek at apple.com
Sun Nov 18 12:06:02 PST 2007


Author: kremenek
Date: Sun Nov 18 14:06:01 2007
New Revision: 44220

URL: http://llvm.org/viewvc/llvm-project?rev=44220&view=rev
Log:
Fixed bug in WalkaST_VisitDeclSubExprs where we failed to properly check if
the StmtIterator referring to the initializers of a chain of Decls was equal
to the "end" iterator. The particular bug manifested when an iterator was
created on a chain of decls with no initializers.

Thanks to Nuno Lopes for reporting this bug and providing a patch.

Modified:
    cfe/trunk/AST/CFG.cpp

Modified: cfe/trunk/AST/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/CFG.cpp?rev=44220&r1=44219&r2=44220&view=diff

==============================================================================
--- cfe/trunk/AST/CFG.cpp (original)
+++ cfe/trunk/AST/CFG.cpp Sun Nov 18 14:06:01 2007
@@ -332,11 +332,12 @@
 ///  we must linearize declarations to handle arbitrary control-flow induced by
 /// those expressions.  
 CFGBlock* CFGBuilder::WalkAST_VisitDeclSubExprs(StmtIterator& I) {
+  if (I == StmtIterator())
+    return Block;
+  
   Stmt* S = *I;
   ++I;
-  
-  if (I != StmtIterator())
-    WalkAST_VisitDeclSubExprs(I);
+  WalkAST_VisitDeclSubExprs(I);
   
   Block = addStmt(S);
   return Block;





More information about the cfe-commits mailing list