diff options
author | Fangrui Song <i@maskray.me> | 2022-03-14 11:38:04 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2022-03-14 11:38:04 -0700 |
commit | 407c721ceb93863b2cb3851a6aa7686f31657e6b (patch) | |
tree | bdd1fb182702b17b1e7553413be20a9d1c7abd6c /llvm/lib/MC/ELFObjectWriter.cpp | |
parent | b0a76b016219fb6ff878eca5a986799506c98053 (diff) | |
download | llvm-407c721ceb93863b2cb3851a6aa7686f31657e6b.zip llvm-407c721ceb93863b2cb3851a6aa7686f31657e6b.tar.gz llvm-407c721ceb93863b2cb3851a6aa7686f31657e6b.tar.bz2 |
[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
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r-- | llvm/lib/MC/ELFObjectWriter.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index abcd3bb..00d18cd 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -864,13 +864,8 @@ void ELFWriter::writeSectionData(const MCAssembler &Asm, MCSection &Sec, Asm.writeSectionData(VecOS, &Section, Layout); SmallVector<char, 128> CompressedContents; - if (Error E = zlib::compress( - StringRef(UncompressedData.data(), UncompressedData.size()), - CompressedContents)) { - consumeError(std::move(E)); - W.OS << UncompressedData; - return; - } + zlib::compress(StringRef(UncompressedData.data(), UncompressedData.size()), + CompressedContents); bool ZlibStyle = MAI->compressDebugSections() == DebugCompressionType::Z; if (!maybeWriteCompression(UncompressedData.size(), CompressedContents, |