From: Craig Topper Date: Thu, 22 Oct 2015 05:00:01 +0000 (+0000) Subject: Convert ActOnForwardProtocolDeclaration to take an ArrayRef and use a range-based... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=020d93c21e87db522130781c0b20c9d4b373d461;p=clang Convert ActOnForwardProtocolDeclaration to take an ArrayRef and use a range-based for loop. NFC git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250990 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index d64a2c8ac0..6252d6ffcb 100644 --- a/include/clang/Sema/Sema.h +++ b/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/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index a4e499cf64..763bcc185a 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/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/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 163976bd1e..5b402e5f6e 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/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);