Added support to StmtIterator to traverse the size expression of a VLA type
declared in a sizeof.  For example:

 sizeof(int[foo()]);

the expression "foo()" is an expression that is executed during the evaluation
of sizeof.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45043 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/StmtIterator.cpp b/AST/StmtIterator.cpp
index ae6de11..94a5397 100644
--- a/AST/StmtIterator.cpp
+++ b/AST/StmtIterator.cpp
@@ -31,19 +31,21 @@
 
 void StmtIteratorBase::NextVA() {
   assert (getVAPtr());
-  assert (decl);
 
   VariableArrayType* p = getVAPtr();
   p = FindVA(p->getElementType().getTypePtr());
   setVAPtr(p);
 
-  if (!p) {
+  if (!p && decl) {
     if (VarDecl* VD = dyn_cast<VarDecl>(decl)) 
       if (VD->Init)
         return;
       
     NextDecl();
   }
+  else {
+    RawVAPtr = 0;
+  }    
 }
 
 void StmtIteratorBase::NextDecl(bool ImmediateAdvance) {
@@ -94,6 +96,12 @@
   NextDecl(false);
 }
 
+StmtIteratorBase::StmtIteratorBase(VariableArrayType* t)
+: decl(NULL), RawVAPtr(VASizeMode) {
+  RawVAPtr |= reinterpret_cast<uintptr_t>(t);
+}
+
+
 Stmt*& StmtIteratorBase::GetDeclExpr() const {
   if (VariableArrayType* VAPtr = getVAPtr()) {
     assert (VAPtr->SizeExpr);