diff options
author | David Blaikie <dblaikie@gmail.com> | 2012-04-30 02:36:29 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2012-04-30 02:36:29 +0000 |
commit | 262bc18e32500558af7cb0afa205b34bd37bafed (patch) | |
tree | 6948b171ad9895169475e9f5808700781231a710 /lib/Rewrite/RewriteModernObjC.cpp | |
parent | 298038352b34c5503db418201f3ddea6e56fd0e1 (diff) |
Remove the ref/value inconsistency in filter_decl_iterator.
filter_decl_iterator had a weird mismatch where both op* and op-> returned T*
making it difficult to generalize this filtering behavior into a reusable
library of any kind.
This change errs on the side of value, making op-> return T* and op* return
T&.
(reviewed by Richard Smith)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155808 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Rewrite/RewriteModernObjC.cpp')
-rw-r--r-- | lib/Rewrite/RewriteModernObjC.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/Rewrite/RewriteModernObjC.cpp b/lib/Rewrite/RewriteModernObjC.cpp index 67f2439afb..1b6f2c8429 100644 --- a/lib/Rewrite/RewriteModernObjC.cpp +++ b/lib/Rewrite/RewriteModernObjC.cpp @@ -989,7 +989,7 @@ void RewriteModernObjC::RewriteCategoryDecl(ObjCCategoryDecl *CatDecl) { InsertText(CatDecl->getIvarLBraceLoc(), "// "); for (ObjCCategoryDecl::ivar_iterator I = CatDecl->ivar_begin(), E = CatDecl->ivar_end(); I != E; ++I) { - ObjCIvarDecl *Ivar = (*I); + ObjCIvarDecl *Ivar = &*I; SourceLocation LocStart = Ivar->getLocStart(); ReplaceText(LocStart, 0, "// "); } @@ -998,7 +998,7 @@ void RewriteModernObjC::RewriteCategoryDecl(ObjCCategoryDecl *CatDecl) { for (ObjCCategoryDecl::prop_iterator I = CatDecl->prop_begin(), E = CatDecl->prop_end(); I != E; ++I) - RewriteProperty(*I); + RewriteProperty(&*I); for (ObjCCategoryDecl::instmeth_iterator I = CatDecl->instmeth_begin(), E = CatDecl->instmeth_end(); @@ -1032,7 +1032,7 @@ void RewriteModernObjC::RewriteProtocolDecl(ObjCProtocolDecl *PDecl) { for (ObjCInterfaceDecl::prop_iterator I = PDecl->prop_begin(), E = PDecl->prop_end(); I != E; ++I) - RewriteProperty(*I); + RewriteProperty(&*I); // Lastly, comment out the @end. SourceLocation LocEnd = PDecl->getAtEndRange().getBegin(); @@ -1225,7 +1225,7 @@ void RewriteModernObjC::RewriteImplementationDecl(Decl *OID) { InsertText(IMD->getIvarLBraceLoc(), "// "); for (ObjCImplementationDecl::ivar_iterator I = IMD->ivar_begin(), E = IMD->ivar_end(); I != E; ++I) { - ObjCIvarDecl *Ivar = (*I); + ObjCIvarDecl *Ivar = &*I; SourceLocation LocStart = Ivar->getLocStart(); ReplaceText(LocStart, 0, "// "); } @@ -1268,7 +1268,7 @@ void RewriteModernObjC::RewriteImplementationDecl(Decl *OID) { I = IMD ? IMD->propimpl_begin() : CID->propimpl_begin(), E = IMD ? IMD->propimpl_end() : CID->propimpl_end(); I != E; ++I) { - RewritePropertyImplDecl(*I, IMD, CID); + RewritePropertyImplDecl(&*I, IMD, CID); } InsertText(IMD ? IMD->getLocEnd() : CID->getLocEnd(), "// "); @@ -1296,7 +1296,7 @@ void RewriteModernObjC::RewriteInterfaceDecl(ObjCInterfaceDecl *ClassDecl) { for (ObjCInterfaceDecl::prop_iterator I = ClassDecl->prop_begin(), E = ClassDecl->prop_end(); I != E; ++I) - RewriteProperty(*I); + RewriteProperty(&*I); for (ObjCInterfaceDecl::instmeth_iterator I = ClassDecl->instmeth_begin(), E = ClassDecl->instmeth_end(); I != E; ++I) @@ -3522,7 +3522,7 @@ bool RewriteModernObjC::RewriteObjCFieldDeclType(QualType &Type, Result += " {\n"; for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end(); i != e; ++i) { - FieldDecl *FD = *i; + FieldDecl *FD = &*i; RewriteObjCFieldDecl(FD, Result); } Result += "\t} "; @@ -5398,7 +5398,7 @@ Stmt *RewriteModernObjC::RewriteFunctionBodyOrGlobalInitializer(Stmt *S) { void RewriteModernObjC::RewriteRecordBody(RecordDecl *RD) { for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end(); i != e; ++i) { - FieldDecl *FD = *i; + FieldDecl *FD = &*i; if (isTopLevelBlockPointerType(FD->getType())) RewriteBlockPointerDecl(FD); if (FD->getType()->isObjCQualifiedIdType() || @@ -6589,7 +6589,7 @@ void RewriteModernObjC::RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl, std::vector<ObjCPropertyDecl *> ProtocolProperties; for (ObjCContainerDecl::prop_iterator I = PDecl->prop_begin(), E = PDecl->prop_end(); I != E; ++I) - ProtocolProperties.push_back(*I); + ProtocolProperties.push_back(&*I); Write_prop_list_t_initializer(*this, Context, Result, ProtocolProperties, /* Container */0, @@ -6760,11 +6760,11 @@ void RewriteModernObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl, for (ObjCImplDecl::propimpl_iterator Prop = IDecl->propimpl_begin(), PropEnd = IDecl->propimpl_end(); Prop != PropEnd; ++Prop) { - if ((*Prop)->getPropertyImplementation() == ObjCPropertyImplDecl::Dynamic) + if (Prop->getPropertyImplementation() == ObjCPropertyImplDecl::Dynamic) continue; - if (!(*Prop)->getPropertyIvarDecl()) + if (!Prop->getPropertyIvarDecl()) continue; - ObjCPropertyDecl *PD = (*Prop)->getPropertyDecl(); + ObjCPropertyDecl *PD = Prop->getPropertyDecl(); if (!PD) continue; if (ObjCMethodDecl *Getter = PD->getGetterMethodDecl()) @@ -6810,7 +6810,7 @@ void RewriteModernObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl, std::vector<ObjCPropertyDecl *> ClassProperties; for (ObjCContainerDecl::prop_iterator I = CDecl->prop_begin(), E = CDecl->prop_end(); I != E; ++I) - ClassProperties.push_back(*I); + ClassProperties.push_back(&*I); Write_prop_list_t_initializer(*this, Context, Result, ClassProperties, /* Container */IDecl, @@ -7024,11 +7024,11 @@ void RewriteModernObjC::RewriteObjCCategoryImplDecl(ObjCCategoryImplDecl *IDecl, for (ObjCImplDecl::propimpl_iterator Prop = IDecl->propimpl_begin(), PropEnd = IDecl->propimpl_end(); Prop != PropEnd; ++Prop) { - if ((*Prop)->getPropertyImplementation() == ObjCPropertyImplDecl::Dynamic) + if (Prop->getPropertyImplementation() == ObjCPropertyImplDecl::Dynamic) continue; - if (!(*Prop)->getPropertyIvarDecl()) + if (!Prop->getPropertyIvarDecl()) continue; - ObjCPropertyDecl *PD = (*Prop)->getPropertyDecl(); + ObjCPropertyDecl *PD = Prop->getPropertyDecl(); if (!PD) continue; if (ObjCMethodDecl *Getter = PD->getGetterMethodDecl()) @@ -7072,7 +7072,7 @@ void RewriteModernObjC::RewriteObjCCategoryImplDecl(ObjCCategoryImplDecl *IDecl, std::vector<ObjCPropertyDecl *> ClassProperties; for (ObjCContainerDecl::prop_iterator I = CDecl->prop_begin(), E = CDecl->prop_end(); I != E; ++I) - ClassProperties.push_back(*I); + ClassProperties.push_back(&*I); Write_prop_list_t_initializer(*this, Context, Result, ClassProperties, /* Container */0, |