diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-10-07 23:35:42 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-10-07 23:35:42 +0000 |
commit | 8a213de1a86e5f347c6b591f52712c2fd6177cce (patch) | |
tree | c6ebe1e7cfe545cdc7238e62134dba3d34bc47e6 | |
parent | 8ffb159441e923322bef6b5dee1aaf24c738d75e (diff) |
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
-rw-r--r-- | lib/AST/Expr.cpp | 4 | ||||
-rw-r--r-- | 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<VariableArrayType>(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<VarDecl>(decl)) - if (VD->Init) - return; - - NextDecl(); - } - else if (inDeclGroup()) { - if (VarDecl* VD = dyn_cast<VarDecl>(*DGI)) - if (VD->Init) - return; - - NextDecl(); - } - } else if (inSizeOfTypeVA()) { + if (p) + return; + + if (inDecl()) { + if (VarDecl* VD = dyn_cast<VarDecl>(decl)) + if (VD->Init) + return; + + NextDecl(); + } + else if (inDeclGroup()) { + if (VarDecl* VD = dyn_cast<VarDecl>(*DGI)) + if (VD->Init) + return; + + NextDecl(); + } + else { + assert (inSizeOfTypeVA()); assert(!decl); RawVAPtr = 0; } |