Clean up after ourselves when there's an error parsing the base clause.
Fixes the crash-on-invalid in PR6629.

llvm-svn: 98698
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 5db8171..f4b9cf4 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5118,6 +5118,18 @@
   Consumer.HandleTagDeclDefinition(Tag);
 }
 
+void Sema::ActOnTagDefinitionError(Scope *S, DeclPtrTy TagD) {
+  AdjustDeclIfTemplate(TagD);
+  TagDecl *Tag = cast<TagDecl>(TagD.getAs<Decl>());
+
+  Tag->setInvalidDecl();
+
+  if (isa<CXXRecordDecl>(Tag))
+    FieldCollector->FinishClass();
+
+  PopDeclContext();  
+}
+
 // Note that FieldName may be null for anonymous bitfields.
 bool Sema::VerifyBitField(SourceLocation FieldLoc, IdentifierInfo *FieldName,
                           QualType FieldTy, const Expr *BitWidth,