[llvm] r251794 - Avoid implicitly constructing a Archive::child_iterator.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 2 05:17:13 PST 2015


Author: rafael
Date: Mon Nov  2 07:17:11 2015
New Revision: 251794

URL: http://llvm.org/viewvc/llvm-project?rev=251794&view=rev
Log:
Avoid implicitly constructing a Archive::child_iterator.

Modified:
    llvm/trunk/lib/Object/ArchiveWriter.cpp

Modified: llvm/trunk/lib/Object/ArchiveWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/ArchiveWriter.cpp?rev=251794&r1=251793&r2=251794&view=diff
==============================================================================
--- llvm/trunk/lib/Object/ArchiveWriter.cpp (original)
+++ llvm/trunk/lib/Object/ArchiveWriter.cpp Mon Nov  2 07:17:11 2015
@@ -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<MemoryBufferRef> 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)




More information about the llvm-commits mailing list