[PATCH] D28684: [Support/Compression] - Change zlib API to return Error instead of custom status.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 16 07:15:47 PST 2017


George Rimar via Phabricator <reviews at reviews.llvm.org> writes:

> +static StringRef ZlibCodeToString(int Code) {
start function with a lower case. Include a verb in the name
(convert...).

> +  Error E = zlib::compress(StringRef(UncompressedNameStrings),
> +                           CompressedNameStrings, zlib::BestSizeCompression);
> +  if (E)
>      return make_error<InstrProfError>(instrprof_error::compress_failed);

This does't handle the error, does it? Do we have a test that covers it?


>  
>    return WriteStringToResult(CompressedNameStrings.size(),
> @@ -315,8 +313,8 @@
>      if (isCompressed) {
>        StringRef CompressedNameStrings(reinterpret_cast<const char *>(P),
>                                        CompressedSize);
> -      if (zlib::uncompress(CompressedNameStrings, UncompressedNameStrings,
> -                           UncompressedSize) != zlib::StatusOK)
> +      if (Error E = zlib::uncompress(CompressedNameStrings,
> +                                     UncompressedNameStrings, UncompressedSize))

Same here.

Cheers,
Rafael


More information about the llvm-commits mailing list