From: Aaron Ballman Date: Thu, 13 Mar 2014 20:34:24 +0000 (+0000) Subject: [C++11] Replacing ObjCInterfaceDecl iterators protocol_loc_begin() and protocol_loc_e... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2a9429379f0d5ba033b88610e2b369767177abad;p=clang [C++11] Replacing ObjCInterfaceDecl 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203847 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index f6b71c8f68..c1a419817e 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -850,7 +850,11 @@ public: } typedef ObjCProtocolList::loc_iterator protocol_loc_iterator; + typedef llvm::iterator_range 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 { // FIXME: Should make sure no callers ever do this. if (!hasDefinition()) diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp index 96cf0e1dc1..9ad55f5f63 100644 --- a/lib/Serialization/ASTWriterDecl.cpp +++ b/lib/Serialization/ASTWriterDecl.cpp @@ -493,10 +493,8 @@ void ASTDeclWriter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) { Record.push_back(Data.ReferencedProtocols.size()); for (const auto *P : D->protocols()) Writer.AddDeclRef(P, Record); - for (ObjCInterfaceDecl::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); // Write out the protocols that are transitively referenced. Record.push_back(Data.AllReferencedProtocols.size());