[PATCH] D87673: [clangd] Don't use zlib when it's unavailable.
Aleksandr Platonov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 15 01:00:24 PDT 2020
ArcsinX created this revision.
Herald added subscribers: cfe-commits, usaxena95, mstorsjo, kadircet, arphaman, jkorous.
Herald added a project: clang.
ArcsinX requested review of this revision.
Herald added subscribers: MaskRay, ilya-biryukov.
Without this patch `clangd` crashes at try to load compressed string table when `zlib` it not available.
Example:
- Build `clangd` with MinGW (zlib found)
- Build index
- Build `clangd` with Visual Studio compiler (zlib not found)
- Try to load index
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87673
Files:
clang-tools-extra/clangd/index/Serialization.cpp
Index: clang-tools-extra/clangd/index/Serialization.cpp
===================================================================
--- clang-tools-extra/clangd/index/Serialization.cpp
+++ clang-tools-extra/clangd/index/Serialization.cpp
@@ -201,11 +201,13 @@
llvm::SmallString<1> UncompressedStorage;
if (UncompressedSize == 0) // No compression
Uncompressed = R.rest();
- else {
+ else if (llvm::zlib::isAvailable()) {
if (llvm::Error E = llvm::zlib::uncompress(R.rest(), UncompressedStorage,
UncompressedSize))
return std::move(E);
Uncompressed = UncompressedStorage;
+ } else {
+ return makeError("Compressed string table, but zlib is unavailable");
}
StringTableIn Table;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87673.291820.patch
Type: text/x-patch
Size: 759 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200915/5136f87c/attachment.bin>
More information about the cfe-commits
mailing list