[all-commits] [llvm/llvm-project] 407c72: [Support] Change zlib::compress to return void

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Mar 14 11:38:17 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 407c721ceb93863b2cb3851a6aa7686f31657e6b
      https://github.com/llvm/llvm-project/commit/407c721ceb93863b2cb3851a6aa7686f31657e6b
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-03-14 (Mon, 14 Mar 2022)

  Changed paths:
    M clang-tools-extra/clangd/index/Serialization.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    M llvm/include/llvm/ProfileData/SampleProf.h
    M llvm/include/llvm/Support/Compression.h
    M llvm/lib/MC/ELFObjectWriter.cpp
    M llvm/lib/ObjCopy/ELF/ELFObject.cpp
    M llvm/lib/ObjCopy/ELF/ELFObject.h
    M llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
    M llvm/lib/ProfileData/InstrProf.cpp
    M llvm/lib/ProfileData/SampleProf.cpp
    M llvm/lib/ProfileData/SampleProfWriter.cpp
    M llvm/lib/Support/Compression.cpp
    M llvm/unittests/Support/CompressionTest.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list