From 2860b7c2fe0bfbd1bd509222263d22d21a67fa7e Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 14 Mar 2014 16:29:14 +0000 Subject: [PATCH] [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 --- include/clang/AST/DataRecursiveASTVisitor.h | 4 +--- include/clang/AST/DeclTemplate.h | 5 +++++ 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 bool DataRecursiveASTVisitor::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 spec_iterator; + typedef llvm::iterator_range 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 \ bool RecursiveASTVisitor::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: \ -- 2.40.0