From deacbdca554298ccdf636f19c6094a8825ec6b34 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 11 Aug 2010 12:19:30 +0000 Subject: Speculatively revert r110610 " Make ObjCInterfaceDecl redeclarable, and create separate decl nodes for forward declarations and the definition," which appears to be causing significant Objective-C breakage. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110803 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/ASTContext.cpp | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'lib/AST/ASTContext.cpp') diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 83cee5cc78..7d159269c1 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -872,7 +872,7 @@ void ASTContext::ShallowCollectObjCIvars(const ObjCInterfaceDecl *OI, /// CollectNonClassIvars - /// This routine collects all other ivars which are not declared in the class. /// This includes synthesized ivars (via @synthesize) and those in -/// class's @implementation. +// class's @implementation. /// void ASTContext::CollectNonClassIvars(const ObjCInterfaceDecl *OI, llvm::SmallVectorImpl &Ivars) { @@ -2212,24 +2212,18 @@ QualType ASTContext::getObjCObjectPointerType(QualType ObjectT) { return QualType(QType, 0); } -QualType ASTContext::getObjCInterfaceType(const ObjCInterfaceDecl *Decl, - const ObjCInterfaceDecl *PrevDecl) { - assert(Decl && "Passed null for Decl param"); - - if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0); - - if (PrevDecl) { - assert(PrevDecl->TypeForDecl && "previous decl has no TypeForDecl"); - Decl->TypeForDecl = PrevDecl->TypeForDecl; - return QualType(PrevDecl->TypeForDecl, 0); - } +/// getObjCInterfaceType - Return the unique reference to the type for the +/// specified ObjC interface decl. The list of protocols is optional. +QualType ASTContext::getObjCInterfaceType(const ObjCInterfaceDecl *Decl) { + if (Decl->TypeForDecl) + return QualType(Decl->TypeForDecl, 0); - assert(!Decl->getPreviousDeclaration() && - "interface has previous declaration"); - - Decl->TypeForDecl = new (*this, TypeAlignment) ObjCInterfaceType(Decl); - Types.push_back(Decl->TypeForDecl); - return QualType(Decl->TypeForDecl, 0); + // FIXME: redeclarations? + void *Mem = Allocate(sizeof(ObjCInterfaceType), TypeAlignment); + ObjCInterfaceType *T = new (Mem) ObjCInterfaceType(Decl); + Decl->TypeForDecl = T; + Types.push_back(T); + return QualType(T, 0); } /// getTypeOfExprType - Unlike many "get" functions, we can't unique -- cgit v1.2.3-70-g09d2