[PATCH] D33200: [lib/Object] - Minor API update for llvm::Decompressor.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 18 01:13:24 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL303331: [lib/Object] - Minor API update for llvm::Decompressor. (authored by grimar).
Changed prior to commit:
https://reviews.llvm.org/D33200?vs=99284&id=99404#toc
Repository:
rL LLVM
https://reviews.llvm.org/D33200
Files:
llvm/trunk/include/llvm/Object/Decompressor.h
llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
llvm/trunk/lib/Object/Decompressor.cpp
llvm/trunk/tools/llvm-dwp/llvm-dwp.cpp
Index: llvm/trunk/include/llvm/Object/Decompressor.h
===================================================================
--- llvm/trunk/include/llvm/Object/Decompressor.h
+++ llvm/trunk/include/llvm/Object/Decompressor.h
@@ -30,7 +30,10 @@
/// @brief Resize the buffer and uncompress section data into it.
/// @param Out Destination buffer.
- Error decompress(SmallString<32> &Out);
+ template <class T> Error Decompressor::resizeAndDecompress(T &Out) {
+ Out.resize(DecompressedSize);
+ return decompress({Out.data(), (size_t)DecompressedSize});
+ }
/// @brief Uncompress section data to raw buffer provided.
/// @param Buffer Destination buffer.
Index: llvm/trunk/lib/Object/Decompressor.cpp
===================================================================
--- llvm/trunk/lib/Object/Decompressor.cpp
+++ llvm/trunk/lib/Object/Decompressor.cpp
@@ -88,11 +88,6 @@
return (Flags & ELF::SHF_COMPRESSED) || isGnuStyle(Name);
}
-Error Decompressor::decompress(SmallString<32> &Out) {
- Out.resize(DecompressedSize);
- return decompress({Out.data(), (size_t)DecompressedSize});
-}
-
Error Decompressor::decompress(MutableArrayRef<char> Buffer) {
size_t Size = Buffer.size();
return zlib::uncompress(SectionData, Buffer.data(), Size);
Index: llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
===================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -979,7 +979,7 @@
return Decompressor.takeError();
SmallString<32> Out;
- if (auto Err = Decompressor->decompress(Out))
+ if (auto Err = Decompressor->resizeAndDecompress(Out))
return Err;
UncompressedSections.emplace_back(std::move(Out));
Index: llvm/trunk/tools/llvm-dwp/llvm-dwp.cpp
===================================================================
--- llvm/trunk/tools/llvm-dwp/llvm-dwp.cpp
+++ llvm/trunk/tools/llvm-dwp/llvm-dwp.cpp
@@ -373,7 +373,7 @@
return createError(Name, Dec.takeError());
UncompressedSections.emplace_back();
- if (Error E = Dec->decompress(UncompressedSections.back()))
+ if (Error E = Dec->resizeAndDecompress(UncompressedSections.back()))
return createError(Name, std::move(E));
Name = Name.substr(2); // Drop ".z"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33200.99404.patch
Type: text/x-patch
Size: 2307 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170518/a7d4d59e/attachment.bin>
More information about the llvm-commits
mailing list