diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/libs/llvm12/lib/Object/MachOUniversal.cpp | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/llvm12/lib/Object/MachOUniversal.cpp')
-rw-r--r-- | contrib/libs/llvm12/lib/Object/MachOUniversal.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/contrib/libs/llvm12/lib/Object/MachOUniversal.cpp b/contrib/libs/llvm12/lib/Object/MachOUniversal.cpp index f3ce005e6e..0433c78bce 100644 --- a/contrib/libs/llvm12/lib/Object/MachOUniversal.cpp +++ b/contrib/libs/llvm12/lib/Object/MachOUniversal.cpp @@ -12,7 +12,7 @@ #include "llvm/Object/MachOUniversal.h" #include "llvm/Object/Archive.h" -#include "llvm/Object/IRObjectFile.h" +#include "llvm/Object/IRObjectFile.h" #include "llvm/Object/MachO.h" #include "llvm/Object/ObjectFile.h" #include "llvm/Support/Casting.h" @@ -81,25 +81,25 @@ MachOUniversalBinary::ObjectForArch::getAsObjectFile() const { return ObjectFile::createMachOObjectFile(ObjBuffer, cputype, Index); } -Expected<std::unique_ptr<IRObjectFile>> -MachOUniversalBinary::ObjectForArch::getAsIRObject(LLVMContext &Ctx) const { - if (!Parent) - report_fatal_error("MachOUniversalBinary::ObjectForArch::getAsIRObject() " - "called when Parent is a nullptr"); - - StringRef ParentData = Parent->getData(); - StringRef ObjectData; - if (Parent->getMagic() == MachO::FAT_MAGIC) { - ObjectData = ParentData.substr(Header.offset, Header.size); - } else { // Parent->getMagic() == MachO::FAT_MAGIC_64 - ObjectData = ParentData.substr(Header64.offset, Header64.size); - } - StringRef ObjectName = Parent->getFileName(); - MemoryBufferRef ObjBuffer(ObjectData, ObjectName); - - return IRObjectFile::create(ObjBuffer, Ctx); -} - +Expected<std::unique_ptr<IRObjectFile>> +MachOUniversalBinary::ObjectForArch::getAsIRObject(LLVMContext &Ctx) const { + if (!Parent) + report_fatal_error("MachOUniversalBinary::ObjectForArch::getAsIRObject() " + "called when Parent is a nullptr"); + + StringRef ParentData = Parent->getData(); + StringRef ObjectData; + if (Parent->getMagic() == MachO::FAT_MAGIC) { + ObjectData = ParentData.substr(Header.offset, Header.size); + } else { // Parent->getMagic() == MachO::FAT_MAGIC_64 + ObjectData = ParentData.substr(Header64.offset, Header64.size); + } + StringRef ObjectName = Parent->getFileName(); + MemoryBufferRef ObjBuffer(ObjectData, ObjectName); + + return IRObjectFile::create(ObjBuffer, Ctx); +} + Expected<std::unique_ptr<Archive>> MachOUniversalBinary::ObjectForArch::getAsArchive() const { if (!Parent) @@ -254,15 +254,15 @@ MachOUniversalBinary::getMachOObjectForArch(StringRef ArchName) const { return O->getAsObjectFile(); } -Expected<std::unique_ptr<IRObjectFile>> -MachOUniversalBinary::getIRObjectForArch(StringRef ArchName, - LLVMContext &Ctx) const { - Expected<ObjectForArch> O = getObjectForArch(ArchName); - if (!O) - return O.takeError(); - return O->getAsIRObject(Ctx); -} - +Expected<std::unique_ptr<IRObjectFile>> +MachOUniversalBinary::getIRObjectForArch(StringRef ArchName, + LLVMContext &Ctx) const { + Expected<ObjectForArch> O = getObjectForArch(ArchName); + if (!O) + return O.takeError(); + return O->getAsIRObject(Ctx); +} + Expected<std::unique_ptr<Archive>> MachOUniversalBinary::getArchiveForArch(StringRef ArchName) const { Expected<ObjectForArch> O = getObjectForArch(ArchName); |