[C++11] Replacing ObjCProtocolDecl iterators protocol_loc_begin() and protocol_loc_end() with iterator_range protocol_locs(). Updating all of the usages of the iterators with range-based for loops.

llvm-svn: 203919
This commit is contained in:
Aaron Ballman 2014-03-14 12:38:50 +00:00
parent a74c7914ad
commit a964ec1f14
2 changed files with 7 additions and 4 deletions

View File

@ -1571,6 +1571,11 @@ public:
return data().ReferencedProtocols.end();
}
typedef ObjCProtocolList::loc_iterator protocol_loc_iterator;
typedef llvm::iterator_range<protocol_loc_iterator> protocol_loc_range;
protocol_loc_range protocol_locs() const {
return protocol_loc_range(protocol_loc_begin(), protocol_loc_end());
}
protocol_loc_iterator protocol_loc_begin() const {
if (!hasDefinition())
return protocol_loc_iterator();

View File

@ -547,10 +547,8 @@ void ASTDeclWriter::VisitObjCProtocolDecl(ObjCProtocolDecl *D) {
Record.push_back(D->protocol_size());
for (const auto *I : D->protocols())
Writer.AddDeclRef(I, Record);
for (ObjCProtocolDecl::protocol_loc_iterator PL = D->protocol_loc_begin(),
PLEnd = D->protocol_loc_end();
PL != PLEnd; ++PL)
Writer.AddSourceLocation(*PL, Record);
for (const auto &PL : D->protocol_locs())
Writer.AddSourceLocation(PL, Record);
}
Code = serialization::DECL_OBJC_PROTOCOL;