summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclObjC.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
commitd77aff8232b7eca4b1132d193958649e2f74aabf (patch)
treeb4f1d3396f9e2b3bb6512fc55d3394a79ae88ad6 /clang/lib/Sema/SemaDeclObjC.cpp
parent1dd77af9cedc07477d60e478809908d4cfecb955 (diff)
downloadbcm5719-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/Sema/SemaDeclObjC.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 7bdfd9e014d..e07d3c59e67 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -281,8 +281,7 @@ Sema::DeclTy *Sema::ActOnStartCategoryInterface(
ObjCInterfaceDecl *IDecl = getObjCInterfaceDecl(ClassName);
ObjCCategoryDecl *CDecl =
- ObjCCategoryDecl::Create(Context, AtInterfaceLoc, NumProtoRefs,
- CategoryName);
+ ObjCCategoryDecl::Create(Context, AtInterfaceLoc, CategoryName);
CDecl->setClassInterface(IDecl);
/// Check that class of this category is already completely declared.
@@ -304,7 +303,8 @@ Sema::DeclTy *Sema::ActOnStartCategoryInterface(
}
if (NumProtoRefs) {
- /// Check then save referenced protocols
+ llvm::SmallVector<ObjCProtocolDecl*, 32> RefProtocols;
+ /// Check and then save the referenced protocols.
for (unsigned int i = 0; i != NumProtoRefs; i++) {
ObjCProtocolDecl* RefPDecl = ObjCProtocols[ProtoRefNames[i]];
if (!RefPDecl || RefPDecl->isForwardDecl()) {
@@ -312,10 +312,13 @@ Sema::DeclTy *Sema::ActOnStartCategoryInterface(
ProtoRefNames[i]->getName(),
CategoryName->getName());
}
- CDecl->setCatReferencedProtocols(i, RefPDecl);
+ if (RefPDecl)
+ RefProtocols.push_back(RefPDecl);
}
- CDecl->setLocEnd(EndProtoLoc);
+ if (!RefProtocols.empty())
+ CDecl->setReferencedProtocolList(&RefProtocols[0], RefProtocols.size());
}
+ CDecl->setLocEnd(EndProtoLoc);
return CDecl;
}
OpenPOWER on IntegriCloud