Index: include/llvm/Support/Compression.h =================================================================== --- include/llvm/Support/Compression.h +++ include/llvm/Support/Compression.h @@ -52,6 +52,8 @@ uint32_t crc32(StringRef Buffer); +StringRef toString(Status Stat); + } // End of namespace zlib } // End of namespace llvm Index: lib/Support/Compression.cpp =================================================================== --- lib/Support/Compression.cpp +++ lib/Support/Compression.cpp @@ -87,6 +87,25 @@ return ::crc32(0, (const Bytef *)Buffer.data(), Buffer.size()); } +StringRef zlib::toString(zlib::Status Stat) { + switch (Stat) { + case zlib::StatusOK: + return ""; + case zlib::StatusUnsupported: + return "zlib is unavailable"; + case zlib::StatusOutOfMemory: + return "there was not enough memory"; + case zlib::StatusBufferTooShort: + return "there was not enough room in the output buffer"; + case zlib::StatusInvalidArg: + return "invalid input parameter"; + case zlib::StatusInvalidData: + return "data was corrupted or incomplete"; + default: + llvm_unreachable("zlib status unknown"); + } +} + #else bool zlib::isAvailable() { return false; } zlib::Status zlib::compress(StringRef InputBuffer, @@ -106,5 +125,8 @@ uint32_t zlib::crc32(StringRef Buffer) { llvm_unreachable("zlib::crc32 is unavailable"); } +StringRef zlib::toString(zlib::Status Stat) { + llvm_unreachable("zlib::toString is unavailable"); +} #endif