From c39f5491a4d4c671af3d3960a4e476b8c666e46a Mon Sep 17 00:00:00 2001 From: George Rimar Date: Tue, 17 Jan 2017 15:45:31 +0000 Subject: [Clang] - Update code to match upcoming llvm::zlib API. D28684 changed llvm::zlib to return Error instead of Status. It was accepted and committed in r292214, but then reverted in r292217 because I missed that clang code also needs to be updated. Patch do that. D28684 recommitted again as r292226 Differential revision: https://reviews.llvm.org/D28807 llvm-svn: 292227 --- clang/lib/Serialization/ASTReader.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'clang/lib/Serialization/ASTReader.cpp') diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 53224e2b493..cc78339aa7a 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -72,6 +72,7 @@ #include "llvm/Bitcode/BitstreamReader.h" #include "llvm/Support/Compression.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/Error.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/MemoryBuffer.h" @@ -1278,10 +1279,15 @@ bool ASTReader::ReadSLocEntry(int ID) { unsigned RecCode = SLocEntryCursor.readRecord(Code, Record, &Blob); if (RecCode == SM_SLOC_BUFFER_BLOB_COMPRESSED) { + if (!llvm::zlib::isAvailable()) { + Error("zlib is not available"); + return nullptr; + } SmallString<0> Uncompressed; - if (llvm::zlib::uncompress(Blob, Uncompressed, Record[0]) != - llvm::zlib::StatusOK) { - Error("could not decompress embedded file contents"); + if (llvm::Error E = + llvm::zlib::uncompress(Blob, Uncompressed, Record[0])) { + Error("could not decompress embedded file contents: " + + llvm::toString(std::move(E))); return nullptr; } return llvm::MemoryBuffer::getMemBufferCopy(Uncompressed, Name); -- cgit v1.2.3