summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2014-03-13 20:34:24 +0000
committerAaron Ballman <aaron@aaronballman.com>2014-03-13 20:34:24 +0000
commite937888e1c4eeafba7eab0359e00f5d28da93ecd (patch)
tree41e15ea15df88618d9a7edb2aa904b9b62cd359e /clang
parent232670fc0525548fe01f781c4863480d09cedd88 (diff)
downloadbcm5719-llvm-e937888e1c4eeafba7eab0359e00f5d28da93ecd.tar.gz
bcm5719-llvm-e937888e1c4eeafba7eab0359e00f5d28da93ecd.zip
[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.
llvm-svn: 203847
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/AST/DeclObjC.h4
-rw-r--r--clang/lib/Serialization/ASTWriterDecl.cpp6
2 files changed, 6 insertions, 4 deletions
diff --git a/clang/include/clang/AST/DeclObjC.h b/clang/include/clang/AST/DeclObjC.h
index f6b71c8f689..c1a419817e8 100644
--- a/clang/include/clang/AST/DeclObjC.h
+++ b/clang/include/clang/AST/DeclObjC.h
@@ -850,7 +850,11 @@ public:
}
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 {
// FIXME: Should make sure no callers ever do this.
if (!hasDefinition())
diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp
index 96cf0e1dc11..9ad55f5f634 100644
--- a/clang/lib/Serialization/ASTWriterDecl.cpp
+++ b/clang/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());
OpenPOWER on IntegriCloud