summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/AST/DataRecursiveASTVisitor.h4
-rw-r--r--clang/include/clang/AST/DeclTemplate.h5
-rw-r--r--clang/include/clang/AST/RecursiveASTVisitor.h5
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: \
OpenPOWER on IntegriCloud