summaryrefslogtreecommitdiffstats
path: root/clang/lib/ARCMigrate/TransformActions.cpp
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2015-07-30 17:22:52 +0000
committerPete Cooper <peter_cooper@apple.com>2015-07-30 17:22:52 +0000
commit57d3f145025c4ad6f946d64a3a05f93ffb5fb405 (patch)
tree4d9fa1ec72bb46d38d7b8b8795d3ac07ed5d585b /clang/lib/ARCMigrate/TransformActions.cpp
parent7a0c3a92c0c768eb6cf4cdad565ed9173cac0e75 (diff)
downloadbcm5719-llvm-57d3f145025c4ad6f946d64a3a05f93ffb5fb405.tar.gz
bcm5719-llvm-57d3f145025c4ad6f946d64a3a05f93ffb5fb405.zip
Use llvm::reverse to make a bunch of loops use foreach. NFC.
In llvm commit r243581, a reverse range adapter was added which allows us to change code such as for (auto I = Fields.rbegin(), E = Fields.rend(); I != E; ++I) { in to for (const FieldDecl *I : llvm::reverse(Fields)) This commit changes a few of the places in clang which are eligible to use this new adapter. llvm-svn: 243663
Diffstat (limited to 'clang/lib/ARCMigrate/TransformActions.cpp')
-rw-r--r--clang/lib/ARCMigrate/TransformActions.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/ARCMigrate/TransformActions.cpp b/clang/lib/ARCMigrate/TransformActions.cpp
index 9fb2f1d3eea..c628b54ed41 100644
--- a/clang/lib/ARCMigrate/TransformActions.cpp
+++ b/clang/lib/ARCMigrate/TransformActions.cpp
@@ -505,11 +505,10 @@ void TransformActionsImpl::commitClearDiagnostic(ArrayRef<unsigned> IDs,
void TransformActionsImpl::addInsertion(SourceLocation loc, StringRef text) {
SourceManager &SM = Ctx.getSourceManager();
loc = SM.getExpansionLoc(loc);
- for (std::list<CharRange>::reverse_iterator
- I = Removals.rbegin(), E = Removals.rend(); I != E; ++I) {
- if (!SM.isBeforeInTranslationUnit(loc, I->End))
+ for (const CharRange &I : llvm::reverse(Removals)) {
+ if (!SM.isBeforeInTranslationUnit(loc, I.End))
break;
- if (I->Begin.isBeforeInTranslationUnitThan(loc))
+ if (I.Begin.isBeforeInTranslationUnitThan(loc))
return;
}
OpenPOWER on IntegriCloud