r203919 - [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.
Aaron Ballman
aaron at aaronballman.com
Fri Mar 14 05:38:51 PDT 2014
Author: aaronballman
Date: Fri Mar 14 07:38:50 2014
New Revision: 203919
URL: http://llvm.org/viewvc/llvm-project?rev=203919&view=rev
Log:
[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.
Modified:
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=203919&r1=203918&r2=203919&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Fri Mar 14 07:38:50 2014
@@ -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();
Modified: cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterDecl.cpp?rev=203919&r1=203918&r2=203919&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterDecl.cpp Fri Mar 14 07:38:50 2014
@@ -547,10 +547,8 @@ void ASTDeclWriter::VisitObjCProtocolDec
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;
More information about the cfe-commits
mailing list