[PATCH] D130516: [llvm] compression classes

Leonard Chan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 29 12:03:51 PDT 2022


leonardchan added inline comments.


================
Comment at: llvm/lib/Support/Compression.cpp:30-32
+ZStdCompressionAlgorithm
+    *llvm::compression::ZStdCompressionAlgorithm::Instance =
+        new ZStdCompressionAlgorithm();
----------------
Perhaps for each of these, you could instead have something like:

```
ZStdCompressionAlgorithm *getZStdCompressionAlgorithm() {
  static ZStdCompressionAlgorithm* instance = new ZStdCompressionAlgorithm;
  return instance;
}
```

This way the instances are only new'd when they're actually used.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130516



More information about the llvm-commits mailing list