From 8a213de1a86e5f347c6b591f52712c2fd6177cce Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 7 Oct 2008 23:35:42 +0000 Subject: [PATCH] A little more tweaking with StmtIterator and SizeOfAlignofExpr. A recent commit actually introduced a regression, not fixed a bug. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57282 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/Expr.cpp | 4 ++-- lib/AST/StmtIterator.cpp | 35 +++++++++++++++++++---------------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 78d83d8508..6cdaacd689 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -1264,10 +1264,10 @@ Stmt::child_iterator SizeOfAlignOfTypeExpr::child_begin() { if (VariableArrayType* T = dyn_cast(Ty.getTypePtr())) return child_iterator(T); else - return child_iterator((VariableArrayType*)0); + return child_iterator(); } Stmt::child_iterator SizeOfAlignOfTypeExpr::child_end() { - return child_iterator((VariableArrayType*)0); + return child_iterator(); } // ArraySubscriptExpr diff --git a/lib/AST/StmtIterator.cpp b/lib/AST/StmtIterator.cpp index 1b0e9d57c0..46882422e1 100644 --- a/lib/AST/StmtIterator.cpp +++ b/lib/AST/StmtIterator.cpp @@ -35,22 +35,25 @@ void StmtIteratorBase::NextVA() { p = FindVA(p->getElementType().getTypePtr()); setVAPtr(p); - if (!p) { - if (inDecl()) { - if (VarDecl* VD = dyn_cast(decl)) - if (VD->Init) - return; - - NextDecl(); - } - else if (inDeclGroup()) { - if (VarDecl* VD = dyn_cast(*DGI)) - if (VD->Init) - return; - - NextDecl(); - } - } else if (inSizeOfTypeVA()) { + if (p) + return; + + if (inDecl()) { + if (VarDecl* VD = dyn_cast(decl)) + if (VD->Init) + return; + + NextDecl(); + } + else if (inDeclGroup()) { + if (VarDecl* VD = dyn_cast(*DGI)) + if (VD->Init) + return; + + NextDecl(); + } + else { + assert (inSizeOfTypeVA()); assert(!decl); RawVAPtr = 0; } -- 2.40.0