diff --git a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp --- a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp +++ b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp @@ -259,29 +259,30 @@ : Members(MembersArg), FileName(FileNameArg), C(CArg) {} Error operator()(std::vector> &FileBuffers) { - Expected NMOrErr = + Expected NewMemberOrErr = NewArchiveMember::getFile(FileName, C.Deterministic); - if (!NMOrErr) - return createFileError(FileName, NMOrErr.takeError()); + if (!NewMemberOrErr) + return createFileError(FileName, NewMemberOrErr.takeError()); + auto &NewMember = *NewMemberOrErr; // For regular archives, use the basename of the object path for the member // name. - NMOrErr->MemberName = sys::path::filename(NMOrErr->MemberName); - file_magic Magic = identify_magic(NMOrErr->Buf->getBuffer()); + NewMember.MemberName = sys::path::filename(NewMember.MemberName); + file_magic Magic = identify_magic(NewMember.Buf->getBuffer()); // Flatten archives. if (Magic == file_magic::archive) - return addArchiveMembers(FileBuffers, std::move(*NMOrErr)); + return addArchiveMembers(FileBuffers, std::move(NewMember)); // Flatten universal files. if (Magic == file_magic::macho_universal_binary) - return addUniversalMembers(FileBuffers, std::move(*NMOrErr)); + return addUniversalMembers(FileBuffers, std::move(NewMember)); // Bitcode files. if (Magic == file_magic::bitcode) - return verifyAndAddIRObject(std::move(*NMOrErr)); + return verifyAndAddIRObject(std::move(NewMember)); - if (Error E = verifyAndAddMachOObject(std::move(*NMOrErr))) + if (Error E = verifyAndAddMachOObject(std::move(NewMember))) return E; return Error::success(); } @@ -353,17 +354,18 @@ } Error addChildMember(const object::Archive::Child &M) { - Expected NMOrErr = + Expected NewMemberOrErr = NewArchiveMember::getOldMember(M, C.Deterministic); - if (!NMOrErr) - return NMOrErr.takeError(); + if (!NewMemberOrErr) + return NewMemberOrErr.takeError(); + auto &NewMember = *NewMemberOrErr; - file_magic Magic = identify_magic(NMOrErr->Buf->getBuffer()); + file_magic Magic = identify_magic(NewMember.Buf->getBuffer()); if (Magic == file_magic::bitcode) - return verifyAndAddIRObject(std::move(*NMOrErr)); + return verifyAndAddIRObject(std::move(NewMember)); - if (Error E = verifyAndAddMachOObject(std::move(*NMOrErr))) + if (Error E = verifyAndAddMachOObject(std::move(NewMember))) return E; return Error::success();