From 202a8de09e6e8a9c1f048348a1cfba961877fc04 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Fri, 4 Nov 2016 07:10:24 +0000 Subject: [PATCH] Remove dead code trying to handle when the amount of data read is insufficient to populate the expected struct. Prior to this we already bailed out of the routine when this situation comes up, so none of this code had any effect. If someone wants to bring it back to handle these cases, fixing the earlier conditions and adding the necessary test cases that actually exercises it, they can always revert this and go from there. Both of these were noticed by PVS-Studio due to the identical (dead) condition. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285989 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-objdump/MachODump.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/tools/llvm-objdump/MachODump.cpp b/tools/llvm-objdump/MachODump.cpp index 4ef6f2838c9..67ce0d55324 100644 --- a/tools/llvm-objdump/MachODump.cpp +++ b/tools/llvm-objdump/MachODump.cpp @@ -4405,12 +4405,7 @@ static bool print_class_ro64_t(uint64_t p, struct DisassembleInfo *info, r = get_pointer_64(p, offset, left, S, info); if (r == nullptr || left < sizeof(struct class_ro64_t)) return false; - memset(&cro, '\0', sizeof(struct class_ro64_t)); - if (left < sizeof(struct class_ro64_t)) { - memcpy(&cro, r, left); - outs() << " (class_ro_t entends past the end of the section)\n"; - } else - memcpy(&cro, r, sizeof(struct class_ro64_t)); + memcpy(&cro, r, sizeof(struct class_ro64_t)); if (info->O->isLittleEndian() != sys::IsLittleEndianHost) swapStruct(cro); outs() << " flags " << format("0x%" PRIx32, cro.flags); @@ -4607,12 +4602,7 @@ static void print_class64_t(uint64_t p, struct DisassembleInfo *info) { r = get_pointer_64(p, offset, left, S, info); if (r == nullptr || left < sizeof(struct class64_t)) return; - memset(&c, '\0', sizeof(struct class64_t)); - if (left < sizeof(struct class64_t)) { - memcpy(&c, r, left); - outs() << " (class_t entends past the end of the section)\n"; - } else - memcpy(&c, r, sizeof(struct class64_t)); + memcpy(&c, r, sizeof(struct class64_t)); if (info->O->isLittleEndian() != sys::IsLittleEndianHost) swapStruct(c); -- 2.40.0