From 107eb74eed2aafce6b82244abfc8c8b4ca5c1fd1 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 2 Nov 2015 13:17:11 +0000 Subject: [PATCH] Avoid implicitly constructing a Archive::child_iterator. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251794 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Object/ArchiveWriter.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/Object/ArchiveWriter.cpp b/lib/Object/ArchiveWriter.cpp index f14cbc0d657..b68f7efa53c 100644 --- a/lib/Object/ArchiveWriter.cpp +++ b/lib/Object/ArchiveWriter.cpp @@ -346,11 +346,11 @@ llvm::writeArchive(StringRef ArcName, Buffers.push_back(std::move(MemberBufferOrErr.get())); MemberRef = Buffers.back()->getMemBufferRef(); } else { - object::Archive::child_iterator OldMember = Member.getOld(); - assert((!Thin || OldMember->getParent()->isThin()) && + const object::Archive::Child &OldMember = Member.getOld(); + assert((!Thin || OldMember.getParent()->isThin()) && "Thin archives cannot refers to member of other archives"); ErrorOr MemberBufferOrErr = - OldMember->getMemoryBufferRef(); + OldMember.getMemoryBufferRef(); if (auto EC = MemberBufferOrErr.getError()) return std::make_pair("", EC); MemberRef = MemberBufferOrErr.get(); @@ -397,11 +397,11 @@ llvm::writeArchive(StringRef ArcName, GID = Status.getGroup(); Perms = Status.permissions(); } else { - object::Archive::child_iterator OldMember = I.getOld(); - ModTime = OldMember->getLastModified(); - UID = OldMember->getUID(); - GID = OldMember->getGID(); - Perms = OldMember->getAccessMode(); + const object::Archive::Child &OldMember = I.getOld(); + ModTime = OldMember.getLastModified(); + UID = OldMember.getUID(); + GID = OldMember.getGID(); + Perms = OldMember.getAccessMode(); } if (I.isNewMember()) { @@ -411,9 +411,9 @@ llvm::writeArchive(StringRef ArcName, StringMapIndexIter, ModTime, UID, GID, Perms, Status.getSize()); } else { - object::Archive::child_iterator OldMember = I.getOld(); + const object::Archive::Child &OldMember = I.getOld(); printMemberHeader(Out, Kind, Thin, I.getName(), StringMapIndexIter, - ModTime, UID, GID, Perms, OldMember->getSize()); + ModTime, UID, GID, Perms, OldMember.getSize()); } if (!Thin) -- 2.34.1