diff options
author | Pete Cooper <peter_cooper@apple.com> | 2015-07-30 17:22:52 +0000 |
---|---|---|
committer | Pete Cooper <peter_cooper@apple.com> | 2015-07-30 17:22:52 +0000 |
commit | 34219cae4a2014d6a2cf0b6ae873f9d4089cdb40 (patch) | |
tree | a0e03d202a2dabcfb5e0ae443efe286b4410ac28 /lib/ARCMigrate/TransformActions.cpp | |
parent | b7f9d654bef32f7c42be834f182e154ca4d36260 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243663 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ARCMigrate/TransformActions.cpp')
-rw-r--r-- | lib/ARCMigrate/TransformActions.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/ARCMigrate/TransformActions.cpp b/lib/ARCMigrate/TransformActions.cpp index 9fb2f1d3ee..c628b54ed4 100644 --- a/lib/ARCMigrate/TransformActions.cpp +++ b/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; } |