virtual DeclTy *ActOnStartProtocolInterface(SourceLocation AtProtoLoc,
IdentifierInfo *ProtocolName,
SourceLocation ProtocolLoc,
- DeclTy * const *ProtoRefNames,
+ DeclTy * const *ProtoRefs,
unsigned NumProtoRefs,
SourceLocation EndProtoLoc) {
return 0;
}
// ActOnStartCategoryInterface - this action is called immdiately after
// parsing the prologue for a category interface.
- virtual DeclTy *ActOnStartCategoryInterface(
- SourceLocation AtInterfaceLoc,
- IdentifierInfo *ClassName,
- SourceLocation ClassLoc,
- IdentifierInfo *CategoryName,
- SourceLocation CategoryLoc,
- const IdentifierLocPair *ProtoRefNames,
- unsigned NumProtoRefs,
- SourceLocation EndProtoLoc) {
+ virtual DeclTy *ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
+ IdentifierInfo *ClassName,
+ SourceLocation ClassLoc,
+ IdentifierInfo *CategoryName,
+ SourceLocation CategoryLoc,
+ DeclTy * const *ProtoRefs,
+ unsigned NumProtoRefs,
+ SourceLocation EndProtoLoc) {
return 0;
}
// ActOnStartClassImplementation - this action is called immdiately after
SourceLocation lparenLoc = ConsumeParen();
SourceLocation categoryLoc, rparenLoc;
IdentifierInfo *categoryId = 0;
- llvm::SmallVector<IdentifierLocPair, 8> ProtocolRefs;
// For ObjC2, the category name is optional (not an error).
if (Tok.is(tok::identifier)) {
return 0;
}
rparenLoc = ConsumeParen();
- SourceLocation endProtoLoc;
+
// Next, we need to check for any protocol references.
- if (Tok.is(tok::less)) {
- if (ParseObjCProtocolReferences(ProtocolRefs, endProtoLoc))
- return 0;
- }
+ SourceLocation EndProtoLoc;
+ llvm::SmallVector<DeclTy *, 8> ProtocolRefs;
+ if (Tok.is(tok::less) &&
+ ParseObjCProtocolReferences(ProtocolRefs, true, EndProtoLoc))
+ return 0;
+
if (attrList) // categories don't support attributes.
Diag(Tok, diag::err_objc_no_attributes_on_category);
DeclTy *CategoryType = Actions.ActOnStartCategoryInterface(atLoc,
nameId, nameLoc, categoryId, categoryLoc,
&ProtocolRefs[0], ProtocolRefs.size(),
- endProtoLoc);
+ EndProtoLoc);
ParseObjCInterfaceDeclList(CategoryType, tok::objc_not_keyword);
DeclTy * const *ProtoRefNames, unsigned NumProtoRefs,
SourceLocation EndProtoLoc);
- virtual DeclTy *ActOnStartCategoryInterface(
- SourceLocation AtInterfaceLoc,
- IdentifierInfo *ClassName, SourceLocation ClassLoc,
- IdentifierInfo *CategoryName, SourceLocation CategoryLoc,
- const IdentifierLocPair *ProtoRefNames,
- unsigned NumProtoRefs,
- SourceLocation EndProtoLoc);
+ virtual DeclTy *ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
+ IdentifierInfo *ClassName,
+ SourceLocation ClassLoc,
+ IdentifierInfo *CategoryName,
+ SourceLocation CategoryLoc,
+ DeclTy * const *ProtoRefs,
+ unsigned NumProtoRefs,
+ SourceLocation EndProtoLoc);
virtual DeclTy *ActOnStartClassImplementation(
SourceLocation AtClassImplLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *CategoryName,
SourceLocation CategoryLoc,
- const IdentifierLocPair *ProtoRefNames,
+ DeclTy * const *ProtoRefs,
unsigned NumProtoRefs,
SourceLocation EndProtoLoc) {
ObjCInterfaceDecl *IDecl = getObjCInterfaceDecl(ClassName);
}
if (NumProtoRefs) {
- 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].first];
- if (!RefPDecl)
- Diag(ProtoRefNames[i].second, diag::err_undeclared_protocol,
- ProtoRefNames[i].first->getName());
- else {
- if (RefPDecl->isForwardDecl())
- Diag(ProtoRefNames[i].second, diag::warn_undef_protocolref,
- ProtoRefNames[i].first->getName());
- RefProtocols.push_back(RefPDecl);
- }
- }
- if (!RefProtocols.empty())
- CDecl->addReferencedProtocols(&RefProtocols[0], RefProtocols.size());
+ CDecl->addReferencedProtocols((ObjCProtocolDecl**)ProtoRefs, NumProtoRefs);
+ CDecl->setLocEnd(EndProtoLoc);
}
- CDecl->setLocEnd(EndProtoLoc);
return CDecl;
}