diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-12-15 18:17:27 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-12-15 18:17:27 +0000 |
commit | 26fec63b14565e9e2d8c9935b276b99be950444a (patch) | |
tree | eff4e475e1f43d86fbb64d5f2be2632a98e45226 /lib | |
parent | 36370f58d8a8cc49985bf0a37d912d37eb405211 (diff) |
Extend ObjCInterfaceDecl::DefinitionData to contain a pointer to the
definition, and implement ObjCInterfaceDecl::getDefinition()
efficiently based on that.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146669 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/DeclObjC.cpp | 8 | ||||
-rw-r--r-- | lib/Serialization/ASTReaderDecl.cpp | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index 1da0fab0ba..e088c66229 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -224,14 +224,14 @@ void ObjCInterfaceDecl::mergeClassExtensionProtocolList( void ObjCInterfaceDecl::allocateDefinitionData() { assert(!hasDefinition() && "ObjC class already has a definition"); - Definition.setPointer(new (getASTContext()) DefinitionData()); - Definition.setInt(true); + Data = new (getASTContext()) DefinitionData(); + Data->Definition = this; // Update all of the declarations with a pointer to the definition. for (redecl_iterator RD = redecls_begin(), RDEnd = redecls_end(); RD != RDEnd; ++RD) { if (*RD != this) - RD->Definition.setPointer(Definition.getPointer()); + RD->Data = Data; } } @@ -684,7 +684,7 @@ ObjCInterfaceDecl:: ObjCInterfaceDecl(DeclContext *DC, SourceLocation atLoc, IdentifierInfo *Id, SourceLocation CLoc, bool FD, bool isInternal) : ObjCContainerDecl(ObjCInterface, DC, Id, CLoc, atLoc), - TypeForDecl(0), Definition(), InitiallyForwardDecl(FD) + TypeForDecl(0), Data(), InitiallyForwardDecl(FD) { setImplicit(isInternal); } diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp index 6fc5764006..4dc960bdff 100644 --- a/lib/Serialization/ASTReaderDecl.cpp +++ b/lib/Serialization/ASTReaderDecl.cpp @@ -613,15 +613,15 @@ void ASTDeclReader::VisitObjCInterfaceDecl(ObjCInterfaceDecl *ID) { for (ASTReader::ForwardRefs::iterator I = Refs.begin(), E = Refs.end(); I != E; ++I) - cast<ObjCInterfaceDecl>(*I)->Definition = ID->Definition; + cast<ObjCInterfaceDecl>(*I)->Data = ID->Data; #ifndef NDEBUG // We later check whether PendingForwardRefs is empty to make sure all // pending references were linked. Reader.PendingForwardRefs.erase(ID); #endif } else if (Def) { - if (Def->Definition.getPointer()) { - ID->Definition.setPointer(Def->Definition.getPointer()); + if (Def->Data) { + ID->Data = Def->Data; } else { // The definition is still initializing. Reader.PendingForwardRefs[Def].push_back(ID); @@ -2072,8 +2072,8 @@ void ASTDeclReader::UpdateDecl(Decl *D, ModuleFile &ModuleFile, ObjCInterfaceDecl *ID = cast<ObjCInterfaceDecl>(D); ObjCInterfaceDecl *Def = Reader.ReadDeclAs<ObjCInterfaceDecl>(ModuleFile, Record, Idx); - if (Def->Definition.getPointer()) { - ID->Definition.setPointer(Def->Definition.getPointer()); + if (Def->Data) { + ID->Data = Def->Data; } else { // The definition is still initializing. Reader.PendingForwardRefs[Def].push_back(ID); |