diff options
| author | John McCall <rjmccall@apple.com> | 2010-03-17 19:25:57 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-03-17 19:25:57 +0000 |
| commit | 71ba5f27ded44f3dc794b2592b66a405976157dd (patch) | |
| tree | 775b1e16320d0b466fa1339706af9c44382b4bfc /clang/lib/Sema | |
| parent | 5c9b0e1a6ec2aa948e6fef51aca4235b4d4fae82 (diff) | |
| download | bcm5719-llvm-71ba5f27ded44f3dc794b2592b66a405976157dd.tar.gz bcm5719-llvm-71ba5f27ded44f3dc794b2592b66a405976157dd.zip | |
ActOnTagDefinitionError is supposed to 'unwind' ActOnTagStartDefinition, not
ActOnStartCXXMemberDeclaration. We haven't started the field collector on this
class yet, so don't stop it. Fixes a crash in the VS buildbot and a memory error
on all the others.
llvm-svn: 98760
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/CXXFieldCollector.h | 5 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/Sema/CXXFieldCollector.h b/clang/lib/Sema/CXXFieldCollector.h index 69d13515fa6..63c6ee3f74b 100644 --- a/clang/lib/Sema/CXXFieldCollector.h +++ b/clang/lib/Sema/CXXFieldCollector.h @@ -58,7 +58,10 @@ public: } /// getCurNumField - The number of fields added to the currently parsed class. - size_t getCurNumFields() const { return FieldCount.back(); } + size_t getCurNumFields() const { + assert(!FieldCount.empty() && "no currently-parsed class"); + return FieldCount.back(); + } /// getCurFields - Pointer to array of fields added to the currently parsed /// class. diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index d562a52694e..19885ba9cf6 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -5113,11 +5113,11 @@ void Sema::ActOnTagFinishDefinition(Scope *S, DeclPtrTy TagD, void Sema::ActOnTagDefinitionError(Scope *S, DeclPtrTy TagD) { AdjustDeclIfTemplate(TagD); TagDecl *Tag = cast<TagDecl>(TagD.getAs<Decl>()); - Tag->setInvalidDecl(); - if (isa<CXXRecordDecl>(Tag)) - FieldCollector->FinishClass(); + // We're undoing ActOnTagStartDefinition here, not + // ActOnStartCXXMemberDeclarations, so we don't have to mess with + // the FieldCollector. PopDeclContext(); } |

