summaryrefslogtreecommitdiffstats
path: root/clang/lib/Rewrite/Frontend
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2014-03-13 18:47:37 +0000
committerAaron Ballman <aaron@aaronballman.com>2014-03-13 18:47:37 +0000
commitdc4bea46763b5a8b7656baa24034edc9941a0aed (patch)
treec372e891f9847b780b3c52ae7abdf38611d8ad29 /clang/lib/Rewrite/Frontend
parent8d62008ecb3edd841341789112a0fcab587beff5 (diff)
downloadbcm5719-llvm-dc4bea46763b5a8b7656baa24034edc9941a0aed.tar.gz
bcm5719-llvm-dc4bea46763b5a8b7656baa24034edc9941a0aed.zip
[C++11] Replacing ObjCContainerDecl iterators prop_begin() and prop_end() with iterator_range props(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203830
Diffstat (limited to 'clang/lib/Rewrite/Frontend')
-rw-r--r--clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp33
-rw-r--r--clang/lib/Rewrite/Frontend/RewriteObjC.cpp15
2 files changed, 15 insertions, 33 deletions
diff --git a/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp b/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp
index cc6c0c7dee7..0c27af06f81 100644
--- a/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp
+++ b/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp
@@ -1160,9 +1160,8 @@ void RewriteModernObjC::RewriteCategoryDecl(ObjCCategoryDecl *CatDecl) {
ReplaceText(LocStart, 0, "// ");
}
- for (ObjCCategoryDecl::prop_iterator I = CatDecl->prop_begin(),
- E = CatDecl->prop_end(); I != E; ++I)
- RewriteProperty(*I);
+ for (auto *I : CatDecl->props())
+ RewriteProperty(I);
for (ObjCCategoryDecl::instmeth_iterator
I = CatDecl->instmeth_begin(), E = CatDecl->instmeth_end();
@@ -1194,9 +1193,8 @@ void RewriteModernObjC::RewriteProtocolDecl(ObjCProtocolDecl *PDecl) {
I != E; ++I)
RewriteMethodDeclaration(*I);
- for (ObjCInterfaceDecl::prop_iterator I = PDecl->prop_begin(),
- E = PDecl->prop_end(); I != E; ++I)
- RewriteProperty(*I);
+ for (auto *I : PDecl->props())
+ RewriteProperty(I);
// Lastly, comment out the @end.
SourceLocation LocEnd = PDecl->getAtEndRange().getBegin();
@@ -1453,9 +1451,8 @@ void RewriteModernObjC::RewriteInterfaceDecl(ObjCInterfaceDecl *ClassDecl) {
// Mark this typedef as having been written into its c++ equivalent.
ObjCWrittenInterfaces.insert(ClassDecl->getCanonicalDecl());
- for (ObjCInterfaceDecl::prop_iterator I = ClassDecl->prop_begin(),
- E = ClassDecl->prop_end(); I != E; ++I)
- RewriteProperty(*I);
+ for (auto *I : ClassDecl->props())
+ RewriteProperty(I);
for (ObjCInterfaceDecl::instmeth_iterator
I = ClassDecl->instmeth_begin(), E = ClassDecl->instmeth_end();
I != E; ++I)
@@ -7089,11 +7086,7 @@ void RewriteModernObjC::RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl,
PDecl->getNameAsString(), false);
// Protocol's property metadata.
- std::vector<ObjCPropertyDecl *> ProtocolProperties;
- for (ObjCContainerDecl::prop_iterator I = PDecl->prop_begin(),
- E = PDecl->prop_end(); I != E; ++I)
- ProtocolProperties.push_back(*I);
-
+ SmallVector<ObjCPropertyDecl *, 8> ProtocolProperties(PDecl->props());
Write_prop_list_t_initializer(*this, Context, Result, ProtocolProperties,
/* Container */0,
"_OBJC_PROTOCOL_PROPERTIES_",
@@ -7310,11 +7303,7 @@ void RewriteModernObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl,
IDecl->getNameAsString());
// Protocol's property metadata.
- std::vector<ObjCPropertyDecl *> ClassProperties;
- for (ObjCContainerDecl::prop_iterator I = CDecl->prop_begin(),
- E = CDecl->prop_end(); I != E; ++I)
- ClassProperties.push_back(*I);
-
+ SmallVector<ObjCPropertyDecl *, 8> ClassProperties(CDecl->props());
Write_prop_list_t_initializer(*this, Context, Result, ClassProperties,
/* Container */IDecl,
"_OBJC_$_PROP_LIST_",
@@ -7569,11 +7558,7 @@ void RewriteModernObjC::RewriteObjCCategoryImplDecl(ObjCCategoryImplDecl *IDecl,
FullCategoryName);
// Protocol's property metadata.
- std::vector<ObjCPropertyDecl *> ClassProperties;
- for (ObjCContainerDecl::prop_iterator I = CDecl->prop_begin(),
- E = CDecl->prop_end(); I != E; ++I)
- ClassProperties.push_back(*I);
-
+ SmallVector<ObjCPropertyDecl *, 8> ClassProperties(CDecl->props());
Write_prop_list_t_initializer(*this, Context, Result, ClassProperties,
/* Container */IDecl,
"_OBJC_$_PROP_LIST_",
diff --git a/clang/lib/Rewrite/Frontend/RewriteObjC.cpp b/clang/lib/Rewrite/Frontend/RewriteObjC.cpp
index 64f55ad439a..32c3477fa60 100644
--- a/clang/lib/Rewrite/Frontend/RewriteObjC.cpp
+++ b/clang/lib/Rewrite/Frontend/RewriteObjC.cpp
@@ -980,9 +980,8 @@ void RewriteObjC::RewriteCategoryDecl(ObjCCategoryDecl *CatDecl) {
// FIXME: handle category headers that are declared across multiple lines.
ReplaceText(LocStart, 0, "// ");
- for (ObjCCategoryDecl::prop_iterator I = CatDecl->prop_begin(),
- E = CatDecl->prop_end(); I != E; ++I)
- RewriteProperty(*I);
+ for (auto *I : CatDecl->props())
+ RewriteProperty(I);
for (ObjCCategoryDecl::instmeth_iterator
I = CatDecl->instmeth_begin(), E = CatDecl->instmeth_end();
@@ -1014,9 +1013,8 @@ void RewriteObjC::RewriteProtocolDecl(ObjCProtocolDecl *PDecl) {
I != E; ++I)
RewriteMethodDeclaration(*I);
- for (ObjCInterfaceDecl::prop_iterator I = PDecl->prop_begin(),
- E = PDecl->prop_end(); I != E; ++I)
- RewriteProperty(*I);
+ for (auto *I : PDecl->props())
+ RewriteProperty(I);
// Lastly, comment out the @end.
SourceLocation LocEnd = PDecl->getAtEndRange().getBegin();
@@ -1245,9 +1243,8 @@ void RewriteObjC::RewriteInterfaceDecl(ObjCInterfaceDecl *ClassDecl) {
}
RewriteObjCInternalStruct(ClassDecl, ResultStr);
- for (ObjCInterfaceDecl::prop_iterator I = ClassDecl->prop_begin(),
- E = ClassDecl->prop_end(); I != E; ++I)
- RewriteProperty(*I);
+ for (auto *I : ClassDecl->props())
+ RewriteProperty(I);
for (ObjCInterfaceDecl::instmeth_iterator
I = ClassDecl->instmeth_begin(), E = ClassDecl->instmeth_end();
I != E; ++I)
OpenPOWER on IntegriCloud