From e0b4b36be6e8ace66c9273bd2ff0b60d8a69abf3 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 21 Oct 2014 23:04:55 +0000 Subject: [PATCH] Use a range loop. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220344 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-ar/llvm-ar.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp index a6517e8510d..aff8a04cce5 100644 --- a/tools/llvm-ar/llvm-ar.cpp +++ b/tools/llvm-ar/llvm-ar.cpp @@ -554,11 +554,9 @@ computeNewArchiveMembers(ArchiveOperation Operation, int InsertPos = -1; StringRef PosName = sys::path::filename(RelPos); if (OldArchive) { - for (object::Archive::child_iterator I = OldArchive->child_begin(), - E = OldArchive->child_end(); - I != E; ++I) { + for (auto &Child : OldArchive->children()) { int Pos = Ret.size(); - ErrorOr NameOrErr = I->getName(); + ErrorOr NameOrErr = Child.getName(); failIfError(NameOrErr.getError()); StringRef Name = NameOrErr.get(); if (Name == PosName) { @@ -570,10 +568,11 @@ computeNewArchiveMembers(ArchiveOperation Operation, } std::vector::iterator MemberI = Members.end(); - InsertAction Action = computeInsertAction(Operation, I, Name, MemberI); + InsertAction Action = + computeInsertAction(Operation, Child, Name, MemberI); switch (Action) { case IA_AddOldMember: - addMember(Ret, I, Name); + addMember(Ret, Child, Name); break; case IA_AddNewMeber: addMember(Ret, *MemberI, Name); @@ -581,7 +580,7 @@ computeNewArchiveMembers(ArchiveOperation Operation, case IA_Delete: break; case IA_MoveOldMember: - addMember(Moved, I, Name); + addMember(Moved, Child, Name); break; case IA_MoveNewMember: addMember(Moved, *MemberI, Name);