aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Compression.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2022-09-19 11:41:16 -0700
committerFangrui Song <i@maskray.me>2022-09-19 11:41:16 -0700
commit0b140d0910d1762225fd10372d84ecca1a62305d (patch)
tree1913089d3d632eda29056a366e2436fae83f2937 /llvm/lib/Support/Compression.cpp
parent41d52c5a7f7ad1acf8e84ad6d7f04813c1a5a7ec (diff)
downloadllvm-0b140d0910d1762225fd10372d84ecca1a62305d.zip
llvm-0b140d0910d1762225fd10372d84ecca1a62305d.tar.gz
llvm-0b140d0910d1762225fd10372d84ecca1a62305d.tar.bz2
[Object] Add zstd decompression support to Decompressor
llvm::object::Decompressor is used by many DWARF consumers like llvm-dwarfdump, llvm-dwp, llvm-symbolizer. Add tests to them. The lldb test can be left to D133530. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D134116
Diffstat (limited to 'llvm/lib/Support/Compression.cpp')
-rw-r--r--llvm/lib/Support/Compression.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Support/Compression.cpp b/llvm/lib/Support/Compression.cpp
index 529e617..8e57ba7 100644
--- a/llvm/lib/Support/Compression.cpp
+++ b/llvm/lib/Support/Compression.cpp
@@ -55,6 +55,17 @@ void compression::compress(Params P, ArrayRef<uint8_t> Input,
}
}
+Error compression::decompress(DebugCompressionType T, ArrayRef<uint8_t> Input,
+ uint8_t *Output, size_t UncompressedSize) {
+ switch (formatFor(T)) {
+ case compression::Format::Zlib:
+ return zlib::decompress(Input, Output, UncompressedSize);
+ case compression::Format::Zstd:
+ return zstd::decompress(Input, Output, UncompressedSize);
+ }
+ llvm_unreachable("");
+}
+
Error compression::decompress(compression::Format F, ArrayRef<uint8_t> Input,
SmallVectorImpl<uint8_t> &Output,
size_t UncompressedSize) {