From a323c4c3cd82b66fd89ec5032075a43e693ef3fe Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Thu, 15 Dec 2011 18:17:27 +0000 Subject: Extend ObjCInterfaceDecl::DefinitionData to contain a pointer to the definition, and implement ObjCInterfaceDecl::getDefinition() efficiently based on that. llvm-svn: 146669 --- clang/lib/AST/DeclObjC.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'clang/lib/AST/DeclObjC.cpp') diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index 1da0fab0ba4..e088c66229b 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/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); } -- cgit v1.2.3