Now that deserializing a definition of a C++ class/Objective-C
class/Objective-C protocol suffices get all of the redeclarations of
that declaration wired to the definition, we no longer need to record
the identity of the definition in every declaration. Instead, just
record a bit to indicate whether a particular declaration is the
definition.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148224 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp
index 0b55d73..8829dc6 100644
--- a/lib/Serialization/ASTWriterDecl.cpp
+++ b/lib/Serialization/ASTWriterDecl.cpp
@@ -454,10 +454,8 @@
   VisitObjCContainerDecl(D);
   Writer.AddTypeRef(QualType(D->getTypeForDecl(), 0), Record);
 
-  ObjCInterfaceDecl *Def = D->getDefinition();
-  Writer.AddDeclRef(Def, Record);
-  
-  if (D == Def) {
+  Record.push_back(D->isThisDeclarationADefinition());
+  if (D->isThisDeclarationADefinition()) {
     // Write the DefinitionData
     ObjCInterfaceDecl::DefinitionData &Data = D->data();
     
@@ -520,10 +518,8 @@
   VisitRedeclarable(D);
   VisitObjCContainerDecl(D);
   
-  ObjCProtocolDecl *Def = D->getDefinition();
-  Writer.AddDeclRef(Def, Record);
-
-  if (D == Def) {
+  Record.push_back(D->isThisDeclarationADefinition());
+  if (D->isThisDeclarationADefinition()) {
     Record.push_back(D->protocol_size());
     for (ObjCProtocolDecl::protocol_iterator
          I = D->protocol_begin(), IEnd = D->protocol_end(); I != IEnd; ++I)
@@ -905,12 +901,8 @@
 
 void ASTDeclWriter::VisitCXXRecordDecl(CXXRecordDecl *D) {
   VisitRecordDecl(D);
-
-  CXXRecordDecl *DefinitionDecl = 0;
-  if (D->DefinitionData)
-    DefinitionDecl = D->DefinitionData->Definition;
-  Writer.AddDeclRef(DefinitionDecl, Record);
-  if (D == DefinitionDecl)
+  Record.push_back(D->isThisDeclarationADefinition());
+  if (D->isThisDeclarationADefinition())
     Writer.AddCXXDefinitionData(D, Record);
 
   enum {