Remove dead code trying to handle when the amount of data read is
authorChandler Carruth <chandlerc@gmail.com>
Fri, 4 Nov 2016 07:10:24 +0000 (07:10 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Fri, 4 Nov 2016 07:10:24 +0000 (07:10 +0000)
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

index 4ef6f2838c93b5460a1dfe73e6c27e414a2bca2f..67ce0d553242ac137327597cee806b1252af0ba1 100644 (file)
@@ -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);