summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-08-11 12:19:30 +0000
committerDouglas Gregor <dgregor@apple.com>2010-08-11 12:19:30 +0000
commit1c28331b57df1b99af4ff5dcb409cafbe171795c (patch)
treecbef2c4e46eb07858e8707ce48629bf73023ea67 /clang/lib/AST/ASTContext.cpp
parent6a98131468162950c22a866d736e66e300fb2803 (diff)
downloadbcm5719-llvm-1c28331b57df1b99af4ff5dcb409cafbe171795c.tar.gz
bcm5719-llvm-1c28331b57df1b99af4ff5dcb409cafbe171795c.zip
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. llvm-svn: 110803
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 83cee5cc783..7d159269c1b 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/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
OpenPOWER on IntegriCloud