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

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 13 14:08:15 PDT 2015


>  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.


> -# 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.

Cheers,
Rafael


More information about the llvm-commits mailing list