[cfe-commits] r50816 - /cfe/trunk/lib/AST/Expr.cpp

Steve Naroff snaroff at apple.com
Wed May 7 10:35:03 PDT 2008


Author: snaroff
Date: Wed May  7 12:35:03 2008
New Revision: 50816

URL: http://llvm.org/viewvc/llvm-project?rev=50816&view=rev
Log:
Fixup InitListExpr::child_begin/end. Thanks to Ted for catching the regression.

Modified:
    cfe/trunk/lib/AST/Expr.cpp

Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=50816&r1=50815&r2=50816&view=diff

==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Wed May  7 12:35:03 2008
@@ -1366,10 +1366,12 @@
 
 // InitListExpr
 Stmt::child_iterator InitListExpr::child_begin() {
-  return reinterpret_cast<Stmt**>(&InitExprs[0]);
+  return reinterpret_cast<Stmt**>(InitExprs.size() ? 
+                                  &InitExprs[0] : 0);
 }
 Stmt::child_iterator InitListExpr::child_end() {
-  return reinterpret_cast<Stmt**>(&InitExprs[getNumInits()-1]);
+  return reinterpret_cast<Stmt**>(InitExprs.size() ? 
+                                  &InitExprs[0] + InitExprs.size() : 0);
 }
 
 // ObjCStringLiteral





More information about the cfe-commits mailing list