[PATCH] D28679: [llvm-dwp] - Reuse object::Decompressor class

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 13 08:04:16 PST 2017


George Rimar <grimar at accesssoftek.com> writes:

>>> +  Expected<Decompressor> Dec =
>>> +      Decompressor::create(Name, Contents, false /*IsLE*/, false /*Is64Bit*/);
>>> +  if (!Dec)
>>> +    return createError(Name, Dec.takeError());
>>
>>Why not just return Dec.takeError()?
>>
>>Cheers,
>>Rafael
>
> compressfail.test initially reported something like:
> error: failure while decompressing compressed section: 'zdebug_{{.*}}.dwo'
>
> Decompressor::create() can return next text
> for this this patch:
>
> "zlib is not available"
> "corrupted compressed section header"
> "corrupted uncompressed section size"
>
> For first one "return Dec.takeError()" would probably work, but other 2 relative
> to corrupted header probably require print of section name too.
> Otherwise we end up with inconsistent error messages, like:
>
> "corrupted compressed section header" 
> vs 
> "failure while decompressing compressed section: 'zdebug_{{.*}}.dwo', <SOME REASON HERE>"

Fair enough. Looks like DWPError is just a StringError. We can make it
fancier at some point if needed, but this LGTM for now.

Cheers,
Rafael


More information about the llvm-commits mailing list