[cfe-commits] r98760 - in /cfe/trunk/lib/Sema: CXXFieldCollector.h SemaDecl.cpp

John McCall rjmccall at apple.com
Wed Mar 17 12:25:57 PDT 2010


Author: rjmccall
Date: Wed Mar 17 14:25:57 2010
New Revision: 98760

URL: http://llvm.org/viewvc/llvm-project?rev=98760&view=rev
Log:
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.


Modified:
    cfe/trunk/lib/Sema/CXXFieldCollector.h
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Sema/CXXFieldCollector.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/CXXFieldCollector.h?rev=98760&r1=98759&r2=98760&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/CXXFieldCollector.h (original)
+++ cfe/trunk/lib/Sema/CXXFieldCollector.h Wed Mar 17 14:25:57 2010
@@ -58,7 +58,10 @@
   }
 
   /// 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.

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=98760&r1=98759&r2=98760&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Mar 17 14:25:57 2010
@@ -5113,11 +5113,11 @@
 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();  
 }





More information about the cfe-commits mailing list