[PATCH] D130516: compression classes

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 27 15:16:30 PDT 2022


dblaikie added inline comments.


================
Comment at: clang-tools-extra/clangd/index/Serialization.cpp:32
+llvm::compression::CompressionAlgorithm *StringTableCompressionScheme =
+    new llvm::compression::ZlibCompressionAlgorithm();
+
----------------
ckissane wrote:
> dblaikie wrote:
> > We're generally trying to avoid global ctors in LLVM. So at most this should be a static local variable in a function that accesses the algorithm (though perhaps these "compression algorithm" classes shouldn't be accessible directly, and only through singleton accessors in the defined alongside - like there's no reason for LLVM to contain more than one instance of ZlibCompressionAlgorithm, I think?)
> your idea seems correct to me, however
> some algorithms, such as zstd, support running in multiple threads, so this might influence our decision.
So long as the compression algorithm objects are stateless, this would be acceptable - such objects would be thread safe for multiple concurrent users.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130516/new/

https://reviews.llvm.org/D130516



More information about the cfe-commits mailing list