diff options
author | Chris Lattner <sabre@nondot.org> | 2008-03-16 20:47:45 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-03-16 20:47:45 +0000 |
commit | d77aff8232b7eca4b1132d193958649e2f74aabf (patch) | |
tree | b4f1d3396f9e2b3bb6512fc55d3394a79ae88ad6 /clang/lib/AST/DeclObjC.cpp | |
parent | 1dd77af9cedc07477d60e478809908d4cfecb955 (diff) | |
download | bcm5719-llvm-d77aff8232b7eca4b1132d193958649e2f74aabf.tar.gz bcm5719-llvm-d77aff8232b7eca4b1132d193958649e2f74aabf.zip |
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.
llvm-svn: 48427
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r-- | clang/lib/AST/DeclObjC.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index 2ec93956449..cd4c6fff9fa 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/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. /// |