diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index d64a2c8ac05c..6252d6ffcb23 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -7200,8 +7200,7 @@ public: unsigned NumElts); DeclGroupPtrTy ActOnForwardProtocolDeclaration(SourceLocation AtProtoclLoc, - const IdentifierLocPair *IdentList, - unsigned NumElts, + ArrayRef IdentList, AttributeList *attrList); void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer, diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index a4e499cf64ea..763bcc185aad 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -2013,7 +2013,7 @@ Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc, if (TryConsumeToken(tok::semi)) { // forward declaration of one protocol. IdentifierLocPair ProtoInfo(protocolName, nameLoc); - return Actions.ActOnForwardProtocolDeclaration(AtLoc, &ProtoInfo, 1, + return Actions.ActOnForwardProtocolDeclaration(AtLoc, ProtoInfo, attrs.getList()); } @@ -2042,9 +2042,7 @@ Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc, if (ExpectAndConsume(tok::semi, diag::err_expected_after, "@protocol")) return DeclGroupPtrTy(); - return Actions.ActOnForwardProtocolDeclaration(AtLoc, - &ProtocolRefs[0], - ProtocolRefs.size(), + return Actions.ActOnForwardProtocolDeclaration(AtLoc, ProtocolRefs, attrs.getList()); } diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 163976bd1e70..5b402e5f6ed3 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -1675,17 +1675,16 @@ void Sema::DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT, /// ActOnForwardProtocolDeclaration - Handle \@protocol foo; Sema::DeclGroupPtrTy Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc, - const IdentifierLocPair *IdentList, - unsigned NumElts, + ArrayRef IdentList, AttributeList *attrList) { SmallVector DeclsInGroup; - for (unsigned i = 0; i != NumElts; ++i) { - IdentifierInfo *Ident = IdentList[i].first; - ObjCProtocolDecl *PrevDecl = LookupProtocol(Ident, IdentList[i].second, + for (const IdentifierLocPair &IdentPair : IdentList) { + IdentifierInfo *Ident = IdentPair.first; + ObjCProtocolDecl *PrevDecl = LookupProtocol(Ident, IdentPair.second, ForRedeclaration); ObjCProtocolDecl *PDecl = ObjCProtocolDecl::Create(Context, CurContext, Ident, - IdentList[i].second, AtProtocolLoc, + IdentPair.second, AtProtocolLoc, PrevDecl); PushOnScopeChains(PDecl, TUScope);