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 | c0768e81d38ca247fb2967bf8e197aa001c569aa (patch) | |
| tree | c4eb1b4f8ac0212bd62e3fba5af2d4c5c7c6ef7c | |
| parent | c6e61715dd692fa595933aa02f89798efd1e41ae (diff) | |
| download | bcm5719-llvm-c0768e81d38ca247fb2967bf8e197aa001c569aa.tar.gz bcm5719-llvm-c0768e81d38ca247fb2967bf8e197aa001c569aa.zip | |
[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.
llvm-svn: 203942
| -rw-r--r-- | clang/include/clang/AST/DataRecursiveASTVisitor.h | 4 | ||||
| -rw-r--r-- | clang/include/clang/AST/DeclTemplate.h | 5 | ||||
| -rw-r--r-- | clang/include/clang/AST/RecursiveASTVisitor.h | 5 |
3 files changed, 7 insertions, 7 deletions
diff --git a/clang/include/clang/AST/DataRecursiveASTVisitor.h b/clang/include/clang/AST/DataRecursiveASTVisitor.h index 5c6c487c748..7eec752b88b 100644 --- a/clang/include/clang/AST/DataRecursiveASTVisitor.h +++ b/clang/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/clang/include/clang/AST/DeclTemplate.h b/clang/include/clang/AST/DeclTemplate.h index 60e73b6801d..1be3d253f3a 100644 --- a/clang/include/clang/AST/DeclTemplate.h +++ b/clang/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/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h index 52f61b2bd65..465a53cb6e1 100644 --- a/clang/include/clang/AST/RecursiveASTVisitor.h +++ b/clang/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: \ |

