[C++11] Replacing ObjCCategoryDecl iterators ivar_begin() and ivar_end() with iterator_range ivars(). Updating all of the usages of the iterators with range-based for loops.

llvm-svn: 203924
This commit is contained in:
Aaron Ballman 2014-03-14 13:13:27 +00:00
parent a73c85738c
commit 865fbcdd8d
2 changed files with 5 additions and 4 deletions

View File

@ -1797,6 +1797,9 @@ public:
bool IsClassExtension() const { return getIdentifier() == 0; }
typedef specific_decl_iterator<ObjCIvarDecl> ivar_iterator;
typedef llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>> ivar_range;
ivar_range ivars() const { return ivar_range(ivar_begin(), ivar_end()); }
ivar_iterator ivar_begin() const {
return ivar_iterator(decls_begin());
}

View File

@ -1052,11 +1052,9 @@ void DeclPrinter::VisitObjCCategoryDecl(ObjCCategoryDecl *PID) {
if (PID->ivar_size() > 0) {
Out << "{\n";
Indentation += Policy.Indentation;
for (ObjCCategoryDecl::ivar_iterator I = PID->ivar_begin(),
E = PID->ivar_end(); I != E; ++I) {
for (const auto *I : PID->ivars())
Indent() << I->getASTContext().getUnqualifiedObjCPointerType(I->getType()).
getAsString(Policy) << ' ' << **I << ";\n";
}
getAsString(Policy) << ' ' << *I << ";\n";
Indentation -= Policy.Indentation;
Out << "}\n";
}