aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Compression.cpp
diff options
context:
space:
mode:
authorAmara Emerson <amara@apple.com>2022-07-14 01:11:15 -0700
committerAmara Emerson <amara@apple.com>2022-07-14 01:23:20 -0700
commit6e6be5f9504d3de7a5e94bdc3c8ba96d2f6a88a8 (patch)
tree8caa1521ff9b10fe44865e0b5a705391ef13e0ac /llvm/lib/Support/Compression.cpp
parent6db3edc8588c036680a8696e1735ffc52cb57156 (diff)
downloadllvm-6e6be5f9504d3de7a5e94bdc3c8ba96d2f6a88a8.zip
llvm-6e6be5f9504d3de7a5e94bdc3c8ba96d2f6a88a8.tar.gz
llvm-6e6be5f9504d3de7a5e94bdc3c8ba96d2f6a88a8.tar.bz2
Revert "[llvm] add zstd to llvm::compression namespace"
This reverts commit d449c600767284486615f3b79601ced15a00af61. Breaks macOS builds with this: llvm/lib/Support/Compression.cpp:24:10: fatal error: 'zstd.h' file not found
Diffstat (limited to 'llvm/lib/Support/Compression.cpp')
-rw-r--r--llvm/lib/Support/Compression.cpp65
1 files changed, 0 insertions, 65 deletions
diff --git a/llvm/lib/Support/Compression.cpp b/llvm/lib/Support/Compression.cpp
index e8fb715..2119197 100644
--- a/llvm/lib/Support/Compression.cpp
+++ b/llvm/lib/Support/Compression.cpp
@@ -20,9 +20,6 @@
#if LLVM_ENABLE_ZLIB
#include <zlib.h>
#endif
-#if LLVM_ENABLE_ZSTD
-#include <zstd.h>
-#endif
using namespace llvm;
using namespace llvm::compression;
@@ -103,65 +100,3 @@ Error zlib::uncompress(ArrayRef<uint8_t> Input,
llvm_unreachable("zlib::uncompress is unavailable");
}
#endif
-
-#if LLVM_ENABLE_ZSTD
-
-bool zstd::isAvailable() { return true; }
-
-void zstd::compress(ArrayRef<uint8_t> Input,
- SmallVectorImpl<uint8_t> &CompressedBuffer, int Level) {
- unsigned long CompressedBufferSize = ::ZSTD_compressBound(Input.size());
- CompressedBuffer.resize_for_overwrite(CompressedBufferSize);
- unsigned long CompressedSize =
- ::ZSTD_compress((char *)CompressedBuffer.data(), CompressedBufferSize,
- (const char *)Input.data(), Input.size(), Level);
- if (ZSTD_isError(CompressedSize))
- report_bad_alloc_error("Allocation failed");
- // Tell MemorySanitizer that zstd output buffer is fully initialized.
- // This avoids a false report when running LLVM with uninstrumented ZLib.
- __msan_unpoison(CompressedBuffer.data(), CompressedSize);
- if (CompressedSize < CompressedBuffer.size())
- CompressedBuffer.truncate(CompressedSize);
-}
-
-Error zstd::uncompress(ArrayRef<uint8_t> Input, uint8_t *UncompressedBuffer,
- size_t &UncompressedSize) {
- const size_t Res =
- ::ZSTD_decompress(UncompressedBuffer, UncompressedSize,
- (const uint8_t *)Input.data(), Input.size());
- UncompressedSize = Res;
- // Tell MemorySanitizer that zstd output buffer is fully initialized.
- // This avoids a false report when running LLVM with uninstrumented ZLib.
- __msan_unpoison(UncompressedBuffer, UncompressedSize);
- return ZSTD_isError(Res) ? make_error<StringError>(ZSTD_getErrorName(Res),
- inconvertibleErrorCode())
- : Error::success();
-}
-
-Error zstd::uncompress(ArrayRef<uint8_t> Input,
- SmallVectorImpl<uint8_t> &UncompressedBuffer,
- size_t UncompressedSize) {
- UncompressedBuffer.resize_for_overwrite(UncompressedSize);
- Error E =
- zstd::uncompress(Input, UncompressedBuffer.data(), UncompressedSize);
- if (UncompressedSize < UncompressedBuffer.size())
- UncompressedBuffer.truncate(UncompressedSize);
- return E;
-}
-
-#else
-bool zstd::isAvailable() { return false; }
-void zstd::compress(ArrayRef<uint8_t> Input,
- SmallVectorImpl<uint8_t> &CompressedBuffer, int Level) {
- llvm_unreachable("zstd::compress is unavailable");
-}
-Error zstd::uncompress(ArrayRef<uint8_t> Input, uint8_t *UncompressedBuffer,
- size_t &UncompressedSize) {
- llvm_unreachable("zstd::uncompress is unavailable");
-}
-Error zstd::uncompress(ArrayRef<uint8_t> Input,
- SmallVectorImpl<uint8_t> &UncompressedBuffer,
- size_t UncompressedSize) {
- llvm_unreachable("zstd::uncompress is unavailable");
-}
-#endif