diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-03-11 18:17:16 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-03-11 18:17:16 +0000 |
commit | 344d4c8726e5fb7dfac42eeaef2c0df02d2059b0 (patch) | |
tree | 270ebb3af9b38c75e2ac8f3d97f53f3883387127 /lib/AST/StmtIterator.cpp | |
parent | 4fdf1faedbca40787fd277a6fbd5061fd69b2708 (diff) |
Fix StmtIterator bug reported in PR 3780 where a VLA within a DeclGroup would
not be consulted for its size expression when operator* was called in the
StmtIterator (this resulted in an assertion failure).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66679 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/StmtIterator.cpp')
-rw-r--r-- | lib/AST/StmtIterator.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/AST/StmtIterator.cpp b/lib/AST/StmtIterator.cpp index 5e42e31b28..94829c01e3 100644 --- a/lib/AST/StmtIterator.cpp +++ b/lib/AST/StmtIterator.cpp @@ -132,17 +132,17 @@ StmtIteratorBase::StmtIteratorBase(VariableArrayType* t) Stmt*& StmtIteratorBase::GetDeclExpr() const { - if (inDeclGroup()) { - VarDecl* VD = cast<VarDecl>(*DGI); - return VD->Init; - } - - assert (inDecl() || inSizeOfTypeVA()); - if (VariableArrayType* VAPtr = getVAPtr()) { assert (VAPtr->SizeExpr); return VAPtr->SizeExpr; } + + assert (inDecl() || inDeclGroup()); + + if (inDeclGroup()) { + VarDecl* VD = cast<VarDecl>(*DGI); + return VD->Init; + } assert (inDecl()); |