[Support] Change zlib::compress to return void
authorFangrui Song <i@maskray.me>
Mon, 14 Mar 2022 18:38:04 +0000 (11:38 -0700)
committerFangrui Song <i@maskray.me>
Mon, 14 Mar 2022 18:38:04 +0000 (11:38 -0700)
commit407c721ceb93863b2cb3851a6aa7686f31657e6b
treebdd1fb182702b17b1e7553413be20a9d1c7abd6c
parentb0a76b016219fb6ff878eca5a986799506c98053
[Support] Change zlib::compress to return void

With a sufficiently large output buffer, the only failure is Z_MEM_ERROR.
Check it and call the noreturn report_bad_alloc_error if applicable.
resize_for_overwrite may call report_bad_alloc_error as well.

Now that there is no other error type, we can replace the return type with void
and simplify call sites.

Reviewed By: ikudrin

Differential Revision: https://reviews.llvm.org/D121512
13 files changed:
clang-tools-extra/clangd/index/Serialization.cpp
clang/lib/Serialization/ASTWriter.cpp
llvm/include/llvm/ProfileData/SampleProf.h
llvm/include/llvm/Support/Compression.h
llvm/lib/MC/ELFObjectWriter.cpp
llvm/lib/ObjCopy/ELF/ELFObject.cpp
llvm/lib/ObjCopy/ELF/ELFObject.h
llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
llvm/lib/ProfileData/InstrProf.cpp
llvm/lib/ProfileData/SampleProf.cpp
llvm/lib/ProfileData/SampleProfWriter.cpp
llvm/lib/Support/Compression.cpp
llvm/unittests/Support/CompressionTest.cpp