diff options
| author | Aaron Ballman <aaron@aaronballman.com> | 2014-03-14 16:13:33 +0000 |
|---|---|---|
| committer | Aaron Ballman <aaron@aaronballman.com> | 2014-03-14 16:13:33 +0000 |
| commit | 702fa310e591cd47e14785f1c26095920ea175ee (patch) | |
| tree | 99265e7e2f7ea4f566ed4e766809ec49bc9f7d9f | |
| parent | fea3c8afd69f7f9b234f03eb1277797ee955eed6 (diff) | |
| download | bcm5719-llvm-702fa310e591cd47e14785f1c26095920ea175ee.tar.gz bcm5719-llvm-702fa310e591cd47e14785f1c26095920ea175ee.zip | |
[C++11] Replacing ClassTemplateDecl 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: 203940
| -rw-r--r-- | clang/include/clang/AST/DataRecursiveASTVisitor.h | 4 | ||||
| -rw-r--r-- | clang/include/clang/AST/DeclTemplate.h | 5 | ||||
| -rw-r--r-- | clang/lib/AST/DeclPrinter.cpp | 7 |
3 files changed, 9 insertions, 7 deletions
diff --git a/clang/include/clang/AST/DataRecursiveASTVisitor.h b/clang/include/clang/AST/DataRecursiveASTVisitor.h index 84953007684..5c6c487c748 100644 --- a/clang/include/clang/AST/DataRecursiveASTVisitor.h +++ b/clang/include/clang/AST/DataRecursiveASTVisitor.h @@ -1413,9 +1413,7 @@ template<typename Derived> bool DataRecursiveASTVisitor<Derived>::TraverseClassInstantiations( ClassTemplateDecl *D) { ClassTemplateDecl::spec_iterator end = D->spec_end(); - for (ClassTemplateDecl::spec_iterator it = D->spec_begin(); it != end; ++it) { - ClassTemplateSpecializationDecl* 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 bbf746375d2..ef7c63beb4c 100644 --- a/clang/include/clang/AST/DeclTemplate.h +++ b/clang/include/clang/AST/DeclTemplate.h @@ -1974,6 +1974,11 @@ public: QualType getInjectedClassNameSpecialization(); typedef SpecIterator<ClassTemplateSpecializationDecl> 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/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp index c0df591b3d5..a57532cb65e 100644 --- a/clang/lib/AST/DeclPrinter.cpp +++ b/clang/lib/AST/DeclPrinter.cpp @@ -897,10 +897,9 @@ void DeclPrinter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) { void DeclPrinter::VisitClassTemplateDecl(ClassTemplateDecl *D) { if (PrintInstantiation) { TemplateParameterList *Params = D->getTemplateParameters(); - for (ClassTemplateDecl::spec_iterator I = D->spec_begin(), E = D->spec_end(); - I != E; ++I) { - PrintTemplateParameters(Params, &(*I)->getTemplateArgs()); - Visit(*I); + for (auto *I : D->specializations()) { + PrintTemplateParameters(Params, &I->getTemplateArgs()); + Visit(I); Out << '\n'; } } |

