[llvm] r250222 - Tweak to r250117 and change to use ErrorOr and drop isSizeValid for

Kevin Enderby via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 13 14:18:26 PDT 2015


> On Oct 13, 2015, at 2:08 PM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:
> 
>> uint64_t Archive::Child::getSize() const {
>> -  if (Parent->IsThin)
>> -    return getHeader()->getSize();
>> +  if (Parent->IsThin) {
>> +    ErrorOr<uint32_t> Size = getHeader()->getSize();
>> +    if (Size.getError())
>> +      return 0;
>> +    return Size.get();
>> +  }
>>   return Data.size() - StartOfFile;
>> }
>> 
>> uint64_t Archive::Child::getRawSize() const {
>> -  return getHeader()->getSize();
>> +  ErrorOr<uint32_t> Size = getHeader()->getSize();
>> +  if (Size.getError())
>> +    return 0;
>> +  return Size.get();
> 
> Why eat the error in these functions? Either report the error as a
> temporary solution or have them too return ErrorOr.

I didn’t know how far you wanted me to push this up the stack.  I can do that.  But there are lots of errors that are not handled well in libObject.
> 
> 
>> -# RUN: llvm-objdump -arch x86_64 -macho -disassemble \
>> -# RUN:   %p/Inputs/malformed-machos/00000031.a \
>> -# RUN:   | FileCheck -check-prefix=0031a %s
>> -
>> -# 0031a: Archive
> 
> Any idea why clang-x86-win2008-selfhost is not happy? It looks like a
> real crash.

At this time I really don’t know why it is not happy.  I will continue to work on that too but I didn’t want to leave that bot red for an error test case.

> 
> Cheers,
> Rafael



More information about the llvm-commits mailing list