diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-08-11 12:19:30 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-08-11 12:19:30 +0000 |
commit | deacbdca554298ccdf636f19c6094a8825ec6b34 (patch) | |
tree | a25e20608fe132a81d48e79b4f1e09dab5936e16 /lib/AST/ASTContext.cpp | |
parent | 018220c343c103b7dfaa117a7a474c7a7fd6d068 (diff) |
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
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
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<ObjCIvarDecl*> &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<Type>" functions, we can't unique |