Simplify handling of struct/union/class tags.
Instead of using two sets of Decl kinds (Struct/Union/Class and CXXStruct/CXXUnion/CXXClass), use one 'Record' and one 'CXXRecord' Decl kind and make tag kind a property of TagDecl.
Cleans up the code a bit and better reflects that Decl class structure.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57541 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclSerialization.cpp b/lib/AST/DeclSerialization.cpp
index 718885b..a0befbd 100644
--- a/lib/AST/DeclSerialization.cpp
+++ b/lib/AST/DeclSerialization.cpp
@@ -75,10 +75,8 @@
Dcl = FunctionDecl::CreateImpl(D, C);
break;
- case Class:
- case Union:
- case Struct:
- Dcl = RecordDecl::CreateImpl(k, D, C);
+ case Record:
+ Dcl = RecordDecl::CreateImpl(D, C);
break;
case Typedef:
@@ -461,6 +459,8 @@
//===----------------------------------------------------------------------===//
void RecordDecl::EmitImpl(Serializer& S) const {
+ S.EmitInt(getTagKind());
+
ScopedDecl::EmitInRec(S);
S.EmitBool(isDefinition());
S.EmitBool(hasFlexibleArrayMember());
@@ -473,11 +473,11 @@
ScopedDecl::EmitOutRec(S);
}
-RecordDecl* RecordDecl::CreateImpl(Decl::Kind DK, Deserializer& D,
- ASTContext& C) {
+RecordDecl* RecordDecl::CreateImpl(Deserializer& D, ASTContext& C) {
+ TagKind TK = TagKind(D.ReadInt());
void *Mem = C.getAllocator().Allocate<RecordDecl>();
- RecordDecl* decl = new (Mem) RecordDecl(DK, 0, SourceLocation(), NULL);
+ RecordDecl* decl = new (Mem) RecordDecl(Record, TK, 0, SourceLocation(), NULL);
decl->ScopedDecl::ReadInRec(D, C);
decl->setDefinition(D.ReadBool());