[C++11] Replacing FunctionTemplateDecl 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: 203938
This commit is contained in:
Aaron Ballman 2014-03-14 16:05:56 +00:00
parent 2205d2a56a
commit b8733c5ba4
5 changed files with 14 additions and 17 deletions

View File

@ -1513,9 +1513,7 @@ template<typename Derived>
bool DataRecursiveASTVisitor<Derived>::TraverseFunctionInstantiations(
FunctionTemplateDecl *D) {
FunctionTemplateDecl::spec_iterator end = D->spec_end();
for (FunctionTemplateDecl::spec_iterator it = D->spec_begin(); it != end;
++it) {
FunctionDecl* FD = *it;
for (auto *FD : D->specializations()) {
switch (FD->getTemplateSpecializationKind()) {
case TSK_Undeclared:
case TSK_ImplicitInstantiation:

View File

@ -713,9 +713,9 @@ public:
}
typedef redeclarable_base::redecl_range redecl_range;
typedef redeclarable_base::redecl_iterator redecl_iterator;
using redeclarable_base::redecls_begin;
using redeclarable_base::redecls_end;
typedef redeclarable_base::redecl_iterator redecl_iterator;
using redeclarable_base::redecls_begin;
using redeclarable_base::redecls_end;
using redeclarable_base::redecls;
using redeclarable_base::getPreviousDecl;
using redeclarable_base::getMostRecentDecl;
@ -846,7 +846,11 @@ public:
}
typedef SpecIterator<FunctionTemplateSpecializationInfo> 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);
}

View File

@ -1534,9 +1534,7 @@ template<typename Derived>
bool RecursiveASTVisitor<Derived>::TraverseTemplateInstantiations(
FunctionTemplateDecl *D) {
FunctionTemplateDecl::spec_iterator end = D->spec_end();
for (FunctionTemplateDecl::spec_iterator it = D->spec_begin(); it != end;
++it) {
FunctionDecl* FD = *it;
for (auto *FD : D->specializations()) {
switch (FD->getTemplateSpecializationKind()) {
case TSK_Undeclared:
case TSK_ImplicitInstantiation:

View File

@ -885,10 +885,9 @@ void DeclPrinter::VisitTemplateDecl(const TemplateDecl *D) {
void DeclPrinter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
if (PrintInstantiation) {
TemplateParameterList *Params = D->getTemplateParameters();
for (FunctionTemplateDecl::spec_iterator I = D->spec_begin(), E = D->spec_end();
I != E; ++I) {
PrintTemplateParameters(Params, (*I)->getTemplateSpecializationArgs());
Visit(*I);
for (auto *I : D->specializations()) {
PrintTemplateParameters(Params, I->getTemplateSpecializationArgs());
Visit(I);
}
}

View File

@ -1151,11 +1151,9 @@ CollectCXXMemberFunctions(const CXXRecordDecl *RD, llvm::DIFile Unit,
// Add any template specializations that have already been seen. Like
// implicit member functions, these may have been added to a declaration
// in the case of vtable-based debug info reduction.
for (FunctionTemplateDecl::spec_iterator SI = FTD->spec_begin(),
SE = FTD->spec_end();
SI != SE; ++SI) {
for (const auto *SI : FTD->specializations()) {
llvm::DenseMap<const FunctionDecl *, llvm::WeakVH>::iterator MI =
SPCache.find(cast<CXXMethodDecl>(*SI)->getCanonicalDecl());
SPCache.find(cast<CXXMethodDecl>(SI)->getCanonicalDecl());
if (MI != SPCache.end())
EltTys.push_back(MI->second);
}