diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2014-03-14 16:29:14 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2014-03-14 16:29:14 +0000 |
commit | 2860b7c2fe0bfbd1bd509222263d22d21a67fa7e (patch) | |
tree | 82ce3a6c0513210cd0615141322ffce630f04fdd | |
parent | 45c55c836c3d37bd17cf6efc77fb824ddea8c42c (diff) | |
download | clang-2860b7c2fe0bfbd1bd509222263d22d21a67fa7e.tar.gz clang-2860b7c2fe0bfbd1bd509222263d22d21a67fa7e.tar.bz2 clang-2860b7c2fe0bfbd1bd509222263d22d21a67fa7e.tar.xz |
[C++11] Replacing VarTemplateDecl iterators spec_begin() and spec_end() with iterator_range specializations(). Updating all of the usages of the iterators with range-based for loops.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203942 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/DataRecursiveASTVisitor.h | 4 | ||||
-rw-r--r-- | include/clang/AST/DeclTemplate.h | 5 | ||||
-rw-r--r-- | include/clang/AST/RecursiveASTVisitor.h | 5 |
3 files changed, 7 insertions, 7 deletions
diff --git a/include/clang/AST/DataRecursiveASTVisitor.h b/include/clang/AST/DataRecursiveASTVisitor.h index 5c6c487c74..7eec752b88 100644 --- a/include/clang/AST/DataRecursiveASTVisitor.h +++ b/include/clang/AST/DataRecursiveASTVisitor.h @@ -1460,9 +1460,7 @@ template <typename Derived> bool DataRecursiveASTVisitor<Derived>::TraverseVariableInstantiations( VarTemplateDecl *D) { VarTemplateDecl::spec_iterator end = D->spec_end(); - for (VarTemplateDecl::spec_iterator it = D->spec_begin(); it != end; ++it) { - VarTemplateSpecializationDecl *SD = *it; - + for (auto *SD : D->specializations()) { switch (SD->getSpecializationKind()) { // Visit the implicit instantiations with the requested pattern. case TSK_Undeclared: diff --git a/include/clang/AST/DeclTemplate.h b/include/clang/AST/DeclTemplate.h index 60e73b6801..1be3d253f3 100644 --- a/include/clang/AST/DeclTemplate.h +++ b/include/clang/AST/DeclTemplate.h @@ -2776,6 +2776,11 @@ public: VarTemplatePartialSpecializationDecl *D); typedef SpecIterator<VarTemplateSpecializationDecl> spec_iterator; + typedef llvm::iterator_range<spec_iterator> spec_range; + + spec_range specializations() const { + return spec_range(spec_begin(), spec_end()); + } spec_iterator spec_begin() const { return makeSpecIterator(getSpecializations(), false); diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h index 52f61b2bd6..465a53cb6e 100644 --- a/include/clang/AST/RecursiveASTVisitor.h +++ b/include/clang/AST/RecursiveASTVisitor.h @@ -1501,10 +1501,7 @@ template<typename Derived> \ bool RecursiveASTVisitor<Derived>::TraverseTemplateInstantiations( \ TMPLDECLKIND##TemplateDecl *D) { \ TMPLDECLKIND##TemplateDecl::spec_iterator end = D->spec_end(); \ - for (TMPLDECLKIND##TemplateDecl::spec_iterator it = D->spec_begin(); \ - it != end; ++it) { \ - TMPLDECLKIND##TemplateSpecializationDecl* SD = *it; \ - \ + for (auto *SD : D->specializations()) { \ switch (SD->getSpecializationKind()) { \ /* Visit the implicit instantiations with the requested pattern. */ \ case TSK_Undeclared: \ |