aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclObjC.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-03-16 20:47:45 +0000
committerChris Lattner <sabre@nondot.org>2008-03-16 20:47:45 +0000
commit68c82cf61228102aba1194efef222fa1478af2a8 (patch)
tree494b30fcfa056a98dd5c9958661d1529da69fc9e /lib/AST/DeclObjC.cpp
parent61f9d41036e30ff80130f99b31c0626e3ef057cc (diff)
simplify the way ObjCCategoryDecl's get their referenced protocols list
specified. Previously, the ctor would allocate memory for the list and then it would get filled in later. Move the allocation+filling in to be more consistent with other stuff, e.g. the addMethods method. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48427 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclObjC.cpp')
-rw-r--r--lib/AST/DeclObjC.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 2ec9395644..cd4c6fff9f 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -68,10 +68,9 @@ ObjCForwardProtocolDecl::Create(ASTContext &C, SourceLocation L,
}
ObjCCategoryDecl *ObjCCategoryDecl::Create(ASTContext &C, SourceLocation L,
- unsigned numRefProtocol,
IdentifierInfo *Id) {
void *Mem = C.getAllocator().Allocate<ObjCCategoryDecl>();
- return new (Mem) ObjCCategoryDecl(L, numRefProtocol, Id);
+ return new (Mem) ObjCCategoryDecl(L, Id);
}
@@ -164,6 +163,17 @@ void ObjCProtocolDecl::addMethods(ObjCMethodDecl **insMethods,
AtEndLoc = endLoc;
}
+void ObjCCategoryDecl::setReferencedProtocolList(ObjCProtocolDecl **List,
+ unsigned NumRPs) {
+ assert(NumReferencedProtocols == 0 && "Protocol list already set");
+ if (NumRPs == 0) return;
+
+ ReferencedProtocols = new ObjCProtocolDecl*[NumRPs];
+ memcpy(ReferencedProtocols, List, NumRPs*sizeof(ObjCProtocolDecl*));
+ NumReferencedProtocols = NumRPs;
+}
+
+
/// addMethods - Insert instance and methods declarations into
/// ObjCCategoryDecl's CatInsMethods and CatClsMethods fields.
///