Convert ActOnForwardProtocolDeclaration to take an ArrayRef and use a range-based for loop. NFC

llvm-svn: 250990
This commit is contained in:
Craig Topper 2015-10-22 05:00:01 +00:00
parent b5518246b2
commit 0f723bb90b
3 changed files with 8 additions and 12 deletions

View File

@ -7200,8 +7200,7 @@ public:
unsigned NumElts); unsigned NumElts);
DeclGroupPtrTy ActOnForwardProtocolDeclaration(SourceLocation AtProtoclLoc, DeclGroupPtrTy ActOnForwardProtocolDeclaration(SourceLocation AtProtoclLoc,
const IdentifierLocPair *IdentList, ArrayRef<IdentifierLocPair> IdentList,
unsigned NumElts,
AttributeList *attrList); AttributeList *attrList);
void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer, void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer,

View File

@ -2013,7 +2013,7 @@ Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc,
if (TryConsumeToken(tok::semi)) { // forward declaration of one protocol. if (TryConsumeToken(tok::semi)) { // forward declaration of one protocol.
IdentifierLocPair ProtoInfo(protocolName, nameLoc); IdentifierLocPair ProtoInfo(protocolName, nameLoc);
return Actions.ActOnForwardProtocolDeclaration(AtLoc, &ProtoInfo, 1, return Actions.ActOnForwardProtocolDeclaration(AtLoc, ProtoInfo,
attrs.getList()); attrs.getList());
} }
@ -2042,9 +2042,7 @@ Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc,
if (ExpectAndConsume(tok::semi, diag::err_expected_after, "@protocol")) if (ExpectAndConsume(tok::semi, diag::err_expected_after, "@protocol"))
return DeclGroupPtrTy(); return DeclGroupPtrTy();
return Actions.ActOnForwardProtocolDeclaration(AtLoc, return Actions.ActOnForwardProtocolDeclaration(AtLoc, ProtocolRefs,
&ProtocolRefs[0],
ProtocolRefs.size(),
attrs.getList()); attrs.getList());
} }

View File

@ -1675,17 +1675,16 @@ void Sema::DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT,
/// ActOnForwardProtocolDeclaration - Handle \@protocol foo; /// ActOnForwardProtocolDeclaration - Handle \@protocol foo;
Sema::DeclGroupPtrTy Sema::DeclGroupPtrTy
Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc, Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
const IdentifierLocPair *IdentList, ArrayRef<IdentifierLocPair> IdentList,
unsigned NumElts,
AttributeList *attrList) { AttributeList *attrList) {
SmallVector<Decl *, 8> DeclsInGroup; SmallVector<Decl *, 8> DeclsInGroup;
for (unsigned i = 0; i != NumElts; ++i) { for (const IdentifierLocPair &IdentPair : IdentList) {
IdentifierInfo *Ident = IdentList[i].first; IdentifierInfo *Ident = IdentPair.first;
ObjCProtocolDecl *PrevDecl = LookupProtocol(Ident, IdentList[i].second, ObjCProtocolDecl *PrevDecl = LookupProtocol(Ident, IdentPair.second,
ForRedeclaration); ForRedeclaration);
ObjCProtocolDecl *PDecl ObjCProtocolDecl *PDecl
= ObjCProtocolDecl::Create(Context, CurContext, Ident, = ObjCProtocolDecl::Create(Context, CurContext, Ident,
IdentList[i].second, AtProtocolLoc, IdentPair.second, AtProtocolLoc,
PrevDecl); PrevDecl);
PushOnScopeChains(PDecl, TUScope); PushOnScopeChains(PDecl, TUScope);