forked from OSchip/llvm-project
[C++11] Replacing ObjCImplementationDecl 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: 203932
This commit is contained in:
parent
c32573b2d4
commit
d6d25de46e
|
@ -2109,6 +2109,9 @@ public:
|
|||
SourceLocation getIvarRBraceLoc() const { return IvarRBraceLoc; }
|
||||
|
||||
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());
|
||||
}
|
||||
|
|
|
@ -1239,19 +1239,17 @@ ObjCIvarDecl *ObjCInterfaceDecl::all_declared_ivar_begin() {
|
|||
data().IvarListMissingImplementation = false;
|
||||
if (!ImplDecl->ivar_empty()) {
|
||||
SmallVector<SynthesizeIvarChunk, 16> layout;
|
||||
for (ObjCImplementationDecl::ivar_iterator I = ImplDecl->ivar_begin(),
|
||||
E = ImplDecl->ivar_end(); I != E; ++I) {
|
||||
ObjCIvarDecl *IV = *I;
|
||||
for (auto *IV : ImplDecl->ivars()) {
|
||||
if (IV->getSynthesize() && !IV->isInvalidDecl()) {
|
||||
layout.push_back(SynthesizeIvarChunk(
|
||||
IV->getASTContext().getTypeSize(IV->getType()), IV));
|
||||
continue;
|
||||
}
|
||||
if (!data().IvarList)
|
||||
data().IvarList = *I;
|
||||
data().IvarList = IV;
|
||||
else
|
||||
curIvar->setNextIvar(*I);
|
||||
curIvar = *I;
|
||||
curIvar->setNextIvar(IV);
|
||||
curIvar = IV;
|
||||
}
|
||||
|
||||
if (!layout.empty()) {
|
||||
|
|
|
@ -961,10 +961,9 @@ void DeclPrinter::VisitObjCImplementationDecl(ObjCImplementationDecl *OID) {
|
|||
if (OID->ivar_size() > 0) {
|
||||
Out << "{\n";
|
||||
Indentation += Policy.Indentation;
|
||||
for (ObjCImplementationDecl::ivar_iterator I = OID->ivar_begin(),
|
||||
E = OID->ivar_end(); I != E; ++I) {
|
||||
for (const auto *I : OID->ivars()) {
|
||||
Indent() << I->getASTContext().getUnqualifiedObjCPointerType(I->getType()).
|
||||
getAsString(Policy) << ' ' << **I << ";\n";
|
||||
getAsString(Policy) << ' ' << *I << ";\n";
|
||||
}
|
||||
Indentation -= Policy.Indentation;
|
||||
Out << "}\n";
|
||||
|
|
|
@ -5384,10 +5384,8 @@ void RewriteObjCFragileABI::RewriteObjCClassMetaData(ObjCImplementationDecl *IDe
|
|||
ObjCInterfaceDecl::ivar_iterator IVI, IVE;
|
||||
SmallVector<ObjCIvarDecl *, 8> IVars;
|
||||
if (!IDecl->ivar_empty()) {
|
||||
for (ObjCInterfaceDecl::ivar_iterator
|
||||
IV = IDecl->ivar_begin(), IVEnd = IDecl->ivar_end();
|
||||
IV != IVEnd; ++IV)
|
||||
IVars.push_back(*IV);
|
||||
for (auto *IV : IDecl->ivars())
|
||||
IVars.push_back(IV);
|
||||
IVI = IDecl->ivar_begin();
|
||||
IVE = IDecl->ivar_end();
|
||||
} else {
|
||||
|
|
|
@ -165,11 +165,8 @@ public:
|
|||
|
||||
// Index the ivars first to make sure the synthesized ivars are indexed
|
||||
// before indexing the methods that can reference them.
|
||||
for (ObjCImplementationDecl::ivar_iterator
|
||||
IvarI = D->ivar_begin(),
|
||||
IvarE = D->ivar_end(); IvarI != IvarE; ++IvarI) {
|
||||
IndexCtx.indexDecl(*IvarI);
|
||||
}
|
||||
for (const auto *IvarI : D->ivars())
|
||||
IndexCtx.indexDecl(IvarI);
|
||||
for (const auto *I : D->decls()) {
|
||||
if (!isa<ObjCIvarDecl>(I))
|
||||
IndexCtx.indexDecl(I);
|
||||
|
|
Loading…
Reference in New Issue