diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-12-15 18:03:09 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-12-15 18:03:09 +0000 |
commit | 53df7a1d34f21d8f2309311d1067d463e9064c60 (patch) | |
tree | c656cd7d7c1bd60325bd76cf1cae70defd8f970c /lib/Serialization/ASTReaderDecl.cpp | |
parent | 7ab8ef99e6b9064861b8d786a40560d74f96b421 (diff) |
Introduce the core infrastructure needed to model a complete
redeclaration chain for Objective-C classes, including:
- Using the first declaration as the canonical declaration.
- Using the definition as the primary DeclContext
- Making sure that all declarations have a pointer to the definition
data, and the definition knows that it is the definition.
- Serialization support for when a definition gets added to a
declaration that comes from an AST file.
However, note that we're not taking advantage of much of this code
yet, because we're still re-using ObjCInterfaceDecls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146667 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTReaderDecl.cpp')
-rw-r--r-- | lib/Serialization/ASTReaderDecl.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp index f7f93af9ce..6fc5764006 100644 --- a/lib/Serialization/ASTReaderDecl.cpp +++ b/lib/Serialization/ASTReaderDecl.cpp @@ -554,6 +554,7 @@ void ASTDeclReader::VisitObjCContainerDecl(ObjCContainerDecl *CD) { } void ASTDeclReader::VisitObjCInterfaceDecl(ObjCInterfaceDecl *ID) { + VisitRedeclarable(ID); VisitObjCContainerDecl(ID); ID->setTypeForDecl(Reader.readType(F, Record, Idx).getTypePtrOrNull()); @@ -618,10 +619,9 @@ void ASTDeclReader::VisitObjCInterfaceDecl(ObjCInterfaceDecl *ID) { // pending references were linked. Reader.PendingForwardRefs.erase(ID); #endif - } else if (Def) { - if (Def->Definition) { - ID->Definition = Def->Definition; + if (Def->Definition.getPointer()) { + ID->Definition.setPointer(Def->Definition.getPointer()); } else { // The definition is still initializing. Reader.PendingForwardRefs[Def].push_back(ID); @@ -2067,6 +2067,19 @@ void ASTDeclReader::UpdateDecl(Decl *D, ModuleFile &ModuleFile, cast<VarDecl>(D)->getMemberSpecializationInfo()->setPointOfInstantiation( Reader.ReadSourceLocation(ModuleFile, Record, Idx)); break; + + case UPD_OBJC_SET_CLASS_DEFINITIONDATA: { + ObjCInterfaceDecl *ID = cast<ObjCInterfaceDecl>(D); + ObjCInterfaceDecl *Def + = Reader.ReadDeclAs<ObjCInterfaceDecl>(ModuleFile, Record, Idx); + if (Def->Definition.getPointer()) { + ID->Definition.setPointer(Def->Definition.getPointer()); + } else { + // The definition is still initializing. + Reader.PendingForwardRefs[Def].push_back(ID); + } + break; + } } } } |