This is an archive of the discontinued LLVM Phabricator instance.

[llvm] fix zlib buffer truncate edge cases and fix nits in tests
ClosedPublic

Authored by ckissane on Jul 13 2022, 2:57 PM.

Details

Summary
  • add check before truncating (un)compressed data buffer if the buffer is already a perfect length, to avoid triggering truncate assertion in edge case.
  • explictly coerce LLVM_ENABLE_ZLIB to a 0 or 1 value in OFF case, to match current ON, FORCE_ON behavior.
  • fix code style nits in zlib tests

Diff Detail

Event Timeline

ckissane created this revision.Jul 13 2022, 2:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2022, 2:57 PM
ckissane requested review of this revision.Jul 13 2022, 2:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2022, 2:57 PM

@MaskRay in this revision I handle the nits that you had noted about my zstd testing in https://reviews.llvm.org/D128465, that also apply for the existing zlib code.

phosek accepted this revision.Jul 13 2022, 3:00 PM

LGTM

llvm/unittests/Support/CompressionTest.cpp
26

I'd probably omit changes to this file since they're not really necessary (and not even described in your commit message).

This revision is now accepted and ready to land.Jul 13 2022, 3:00 PM
ckissane edited the summary of this revision. (Show Details)Jul 13 2022, 3:04 PM
ckissane added inline comments.
llvm/unittests/Support/CompressionTest.cpp
26

@MaskRay noted them on the matching zstd test code on my other patch so I'm going to add it to my commit message.

This revision was landed with ongoing or failed builds.Jul 13 2022, 3:08 PM
This revision was automatically updated to reflect the committed changes.