From de6c3080edac8c3c56a744d3886c9d2afb9b5dae Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 10 Oct 2017 19:07:10 +0000 Subject: [PATCH] Simplify. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315347 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../RuntimeDyld/RuntimeDyldELF.cpp | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp index a079d95a50f..bf527f5ca82 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp @@ -133,11 +133,9 @@ public: }; template -std::unique_ptr> -createRTDyldELFObject(MemoryBufferRef Buffer, - const ObjectFile &SourceObject, - const LoadedELFObjectInfo &L, - std::error_code &ec) { +static std::unique_ptr> +createRTDyldELFObject(MemoryBufferRef Buffer, const ObjectFile &SourceObject, + const LoadedELFObjectInfo &L, std::error_code &ec) { typedef typename ELFFile::Elf_Shdr Elf_Shdr; typedef typename ELFDataTypeTypedefHelper::value_type addr_type; @@ -166,8 +164,8 @@ createRTDyldELFObject(MemoryBufferRef Buffer, return Obj; } -OwningBinary createELFDebugObject(const ObjectFile &Obj, - const LoadedELFObjectInfo &L) { +static OwningBinary +createELFDebugObject(const ObjectFile &Obj, const LoadedELFObjectInfo &L) { assert(Obj.isELF() && "Not an ELF object file."); std::unique_ptr Buffer = @@ -176,23 +174,19 @@ OwningBinary createELFDebugObject(const ObjectFile &Obj, std::error_code ec; std::unique_ptr DebugObj; - if (Obj.getBytesInAddress() == 4 && Obj.isLittleEndian()) { - typedef ELFType ELF32LE; + if (Obj.getBytesInAddress() == 4 && Obj.isLittleEndian()) DebugObj = createRTDyldELFObject(Buffer->getMemBufferRef(), Obj, L, ec); - } else if (Obj.getBytesInAddress() == 4 && !Obj.isLittleEndian()) { - typedef ELFType ELF32BE; + else if (Obj.getBytesInAddress() == 4 && !Obj.isLittleEndian()) DebugObj = createRTDyldELFObject(Buffer->getMemBufferRef(), Obj, L, ec); - } else if (Obj.getBytesInAddress() == 8 && !Obj.isLittleEndian()) { - typedef ELFType ELF64BE; + else if (Obj.getBytesInAddress() == 8 && !Obj.isLittleEndian()) DebugObj = createRTDyldELFObject(Buffer->getMemBufferRef(), Obj, L, ec); - } else if (Obj.getBytesInAddress() == 8 && Obj.isLittleEndian()) { - typedef ELFType ELF64LE; + else if (Obj.getBytesInAddress() == 8 && Obj.isLittleEndian()) DebugObj = createRTDyldELFObject(Buffer->getMemBufferRef(), Obj, L, ec); - } else + else llvm_unreachable("Unexpected ELF format"); assert(!ec && "Could not construct copy ELF object file"); -- 2.50.1