[llvm] [ADT] Remove DenseMap::init (NFC) (PR #168322)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 17 07:00:09 PST 2025


================
@@ -750,9 +750,9 @@ class DenseMap : public DenseMapBase<DenseMap<KeyT, ValueT, KeyInfoT, BucketT>,
 public:
   /// Create a DenseMap with an optional \p NumElementsToReserve to guarantee
   /// that this number of elements can be inserted in the map without grow().
-  explicit DenseMap(unsigned NumElementsToReserve = 0) {
-    init(NumElementsToReserve);
-  }
+  explicit DenseMap(unsigned NumElementsToReserve = 0)
+      : DenseMap(BaseT::getMinBucketToReserveForEntries(NumElementsToReserve),
+                 typename BaseT::ExactBucketCount{}) {}
----------------
kuhar wrote:

optional: We could avoid these typedefs by moving `ExactBucketCount` out of the base class to `detail`

https://github.com/llvm/llvm-project/pull/168322


More information about the llvm-commits mailing list