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 | be485b6c7d29875dee8d56a57c5ff0891ee9b2b3 (patch) | |
tree | bed7f8eb3a731aa16e9c02634213558bbd3e503f /clang/lib/AST/StmtIterator.cpp | |
parent | be0d672ac4cd654bc0836a58c04746ae99d9b257 (diff) | |
download | bcm5719-llvm-be485b6c7d29875dee8d56a57c5ff0891ee9b2b3.tar.gz bcm5719-llvm-be485b6c7d29875dee8d56a57c5ff0891ee9b2b3.zip |
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).
llvm-svn: 66679
Diffstat (limited to 'clang/lib/AST/StmtIterator.cpp')
-rw-r--r-- | clang/lib/AST/StmtIterator.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/clang/lib/AST/StmtIterator.cpp b/clang/lib/AST/StmtIterator.cpp index 5e42e31b285..94829c01e31 100644 --- a/clang/lib/AST/StmtIterator.cpp +++ b/clang/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()); |