]> granicus.if.org Git - clang/commitdiff
ActOnTagDefinitionError is supposed to 'unwind' ActOnTagStartDefinition, not
authorJohn McCall <rjmccall@apple.com>
Wed, 17 Mar 2010 19:25:57 +0000 (19:25 +0000)
committerJohn McCall <rjmccall@apple.com>
Wed, 17 Mar 2010 19:25:57 +0000 (19:25 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98760 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/CXXFieldCollector.h
lib/Sema/SemaDecl.cpp

index 69d13515fa654331d04ef1f40b16ef307e13637e..63c6ee3f74ba2163deb4d89514925e3f982d05ac 100644 (file)
@@ -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.
index d562a52694e2d65b2bfa1ef1469dc33bbf9f89bd..19885ba9cf683bf488e04ae744a45abf49f67b7d 100644 (file)
@@ -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();  
 }