diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2014-03-14 13:03:32 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2014-03-14 13:03:32 +0000 |
commit | a73c85738ca5737c772a564b83a0539873c6c496 (patch) | |
tree | 27b086ab52c775cb2149b2ba0a3bd4e99acf7937 | |
parent | 19a417699fd985cb31eef88e47088d7436f149bf (diff) | |
download | bcm5719-llvm-a73c85738ca5737c772a564b83a0539873c6c496.tar.gz bcm5719-llvm-a73c85738ca5737c772a564b83a0539873c6c496.zip |
[C++11] Replacing ObjCCategoryDecl 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: 203923
-rw-r--r-- | clang/include/clang/AST/DeclObjC.h | 5 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriterDecl.cpp | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/clang/include/clang/AST/DeclObjC.h b/clang/include/clang/AST/DeclObjC.h index 2723aeda6e0..aad5d722291 100644 --- a/clang/include/clang/AST/DeclObjC.h +++ b/clang/include/clang/AST/DeclObjC.h @@ -1774,6 +1774,11 @@ public: protocol_iterator protocol_end() const { return ReferencedProtocols.end(); } unsigned protocol_size() const { return ReferencedProtocols.size(); } 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 { return ReferencedProtocols.loc_begin(); } diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp index 7a94cdaff63..0d679802edd 100644 --- a/clang/lib/Serialization/ASTWriterDecl.cpp +++ b/clang/lib/Serialization/ASTWriterDecl.cpp @@ -568,10 +568,8 @@ void ASTDeclWriter::VisitObjCCategoryDecl(ObjCCategoryDecl *D) { Record.push_back(D->protocol_size()); for (const auto *I : D->protocols()) Writer.AddDeclRef(I, Record); - for (ObjCCategoryDecl::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_CATEGORY; } |