aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Compression.cpp
diff options
context:
space:
mode:
authorCole Kissane <cole.kissane@gmail.com>2022-07-08 11:19:05 -0700
committerCole Kissane <cole.kissane@gmail.com>2022-07-08 11:19:07 -0700
commitea61750c35a11140e9245bd9cbeb383c37f6e031 (patch)
tree16eaa232eed9c7e6ed4669c86b381013f318b910 /llvm/lib/Support/Compression.cpp
parenteb1ffd817c3ce5120c3f9d4152de65954314a8d5 (diff)
downloadllvm-ea61750c35a11140e9245bd9cbeb383c37f6e031.zip
llvm-ea61750c35a11140e9245bd9cbeb383c37f6e031.tar.gz
llvm-ea61750c35a11140e9245bd9cbeb383c37f6e031.tar.bz2
[NFC] Refactor llvm::zlib namespace
* Refactor compression namespaces across the project, making way for a possible introduction of alternatives to zlib compression. Changes are as follows: * Relocate the `llvm::zlib` namespace to `llvm::compression::zlib`. Reviewed By: MaskRay, leonardchan, phosek Differential Revision: https://reviews.llvm.org/D128953
Diffstat (limited to 'llvm/lib/Support/Compression.cpp')
-rw-r--r--llvm/lib/Support/Compression.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Support/Compression.cpp b/llvm/lib/Support/Compression.cpp
index 983a6348..c1a64d5 100644
--- a/llvm/lib/Support/Compression.cpp
+++ b/llvm/lib/Support/Compression.cpp
@@ -22,11 +22,9 @@
#endif
using namespace llvm;
+using namespace llvm::compression;
#if LLVM_ENABLE_ZLIB
-static Error createError(StringRef Err) {
- return make_error<StringError>(Err, inconvertibleErrorCode());
-}
static StringRef convertZlibCodeToString(int Code) {
switch (Code) {
@@ -70,15 +68,17 @@ Error zlib::uncompress(StringRef InputBuffer, char *UncompressedBuffer,
// Tell MemorySanitizer that zlib output buffer is fully initialized.
// This avoids a false report when running LLVM with uninstrumented ZLib.
__msan_unpoison(UncompressedBuffer, UncompressedSize);
- return Res ? createError(convertZlibCodeToString(Res)) : Error::success();
+ return Res ? make_error<StringError>(convertZlibCodeToString(Res),
+ inconvertibleErrorCode())
+ : Error::success();
}
Error zlib::uncompress(StringRef InputBuffer,
SmallVectorImpl<char> &UncompressedBuffer,
size_t UncompressedSize) {
UncompressedBuffer.resize_for_overwrite(UncompressedSize);
- Error E =
- uncompress(InputBuffer, UncompressedBuffer.data(), UncompressedSize);
+ Error E = zlib::uncompress(InputBuffer, UncompressedBuffer.data(),
+ UncompressedSize);
UncompressedBuffer.truncate(UncompressedSize);
return E;
}