pull protocol resolution out into ActOnStartProtocolInterface.
This temporarily duplicates ParseObjCProtocolReferences, but it
will be removed in the future.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54092 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 3d4552d..7772006 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -621,8 +621,7 @@
virtual DeclTy *ActOnStartProtocolInterface(
SourceLocation AtProtoInterfaceLoc,
IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc,
- const IdentifierLocPair *ProtoRefNames,
- unsigned NumProtoRefs,
+ DeclTy * const *ProtoRefNames, unsigned NumProtoRefs,
SourceLocation EndProtoLoc);
virtual DeclTy *ActOnStartCategoryInterface(
@@ -654,8 +653,7 @@
const IdentifierLocPair *IdentList,
unsigned NumElts);
- virtual void FindProtocolDeclaration(SourceLocation TypeLoc,
- bool WarnOnDeclarations,
+ virtual void FindProtocolDeclaration(bool WarnOnDeclarations,
const IdentifierLocPair *ProtocolId,
unsigned NumProtocols,
llvm::SmallVectorImpl<DeclTy *> &Protocols);
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 9d2869b..5bafa23 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -195,11 +195,13 @@
return AliasDecl;
}
-Sema::DeclTy *Sema::ActOnStartProtocolInterface(
- SourceLocation AtProtoInterfaceLoc,
- IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc,
- const IdentifierLocPair *ProtoRefNames, unsigned NumProtoRefs,
- SourceLocation EndProtoLoc) {
+Sema::DeclTy *
+Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc,
+ IdentifierInfo *ProtocolName,
+ SourceLocation ProtocolLoc,
+ DeclTy * const *ProtoRefs,
+ unsigned NumProtoRefs,
+ SourceLocation EndProtoLoc) {
assert(ProtocolName && "Missing protocol identifier");
ObjCProtocolDecl *PDecl = ObjCProtocols[ProtocolName];
if (PDecl) {
@@ -221,21 +223,7 @@
if (NumProtoRefs) {
/// Check then save referenced protocols.
- llvm::SmallVector<ObjCProtocolDecl*, 8> 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());
- Protocols.push_back(RefPDecl);
- }
- }
- if (!Protocols.empty())
- PDecl->addReferencedProtocols(&Protocols[0], Protocols.size());
+ PDecl->addReferencedProtocols((ObjCProtocolDecl**)ProtoRefs, NumProtoRefs);
PDecl->setLocEnd(EndProtoLoc);
}
return PDecl;
@@ -245,7 +233,7 @@
/// issuer error if they are not declared. It returns list of protocol
/// declarations in its 'Protocols' argument.
void
-Sema::FindProtocolDeclaration(SourceLocation TypeLoc, bool WarnOnDeclarations,
+Sema::FindProtocolDeclaration(bool WarnOnDeclarations,
const IdentifierLocPair *ProtocolId,
unsigned NumProtocols,
llvm::SmallVectorImpl<DeclTy*> &Protocols) {