[llvm] [ADT] Adjust a comment for one of the DenseMap constructors (NFC) (PR #158501)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 14 12:39:49 PDT 2025


https://github.com/kazutakahirata updated https://github.com/llvm/llvm-project/pull/158501

>From 458ac4960c321c9ad1dd55f961e2f692069f8eff Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 14 Sep 2025 11:21:55 -0700
Subject: [PATCH 1/2] [ADT] Adjust a comment for one of the DenseMap
 constructors (NFC)

We now have:

  explicit SmallDenseMap(unsigned NumElementsToReservre = 0) {
    init(NumElementsToReservre);
  }

This patch adjusts the variable name in the DenseMap counterpart for
consistency and clarity.
---
 llvm/include/llvm/ADT/DenseMap.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h
index b478ce21d79e6..3226eeaea7d0b 100644
--- a/llvm/include/llvm/ADT/DenseMap.h
+++ b/llvm/include/llvm/ADT/DenseMap.h
@@ -710,9 +710,11 @@ class DenseMap : public DenseMapBase<DenseMap<KeyT, ValueT, KeyInfoT, BucketT>,
   unsigned NumBuckets;
 
 public:
-  /// Create a DenseMap with an optional \p InitialReserve that guarantee that
-  /// this number of elements can be inserted in the map without grow()
-  explicit DenseMap(unsigned InitialReserve = 0) { init(InitialReserve); }
+  /// Create a DenseMap with an optional \p NumElementsToReservre to guarantee
+  /// that this number of elements can be inserted in the map without grow().
+  explicit DenseMap(unsigned NumElementsToReservre = 0) {
+    init(NumElementsToReservre);
+  }
 
   DenseMap(const DenseMap &other) : BaseT() {
     init(0);

>From 171c8d33a8835d0ab56f6b186eb07ef3bca43e69 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 14 Sep 2025 12:38:31 -0700
Subject: [PATCH 2/2] Fix typos.

---
 llvm/include/llvm/ADT/DenseMap.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h
index 3226eeaea7d0b..e13a2cb09a412 100644
--- a/llvm/include/llvm/ADT/DenseMap.h
+++ b/llvm/include/llvm/ADT/DenseMap.h
@@ -710,10 +710,10 @@ class DenseMap : public DenseMapBase<DenseMap<KeyT, ValueT, KeyInfoT, BucketT>,
   unsigned NumBuckets;
 
 public:
-  /// Create a DenseMap with an optional \p NumElementsToReservre to guarantee
+  /// 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 NumElementsToReservre = 0) {
-    init(NumElementsToReservre);
+  explicit DenseMap(unsigned NumElementsToReserve = 0) {
+    init(NumElementsToReserve);
   }
 
   DenseMap(const DenseMap &other) : BaseT() {
@@ -889,8 +889,8 @@ class SmallDenseMap
   AlignedCharArrayUnion<BucketT[InlineBuckets], LargeRep> storage;
 
 public:
-  explicit SmallDenseMap(unsigned NumElementsToReservre = 0) {
-    init(NumElementsToReservre);
+  explicit SmallDenseMap(unsigned NumElementsToReserve = 0) {
+    init(NumElementsToReserve);
   }
 
   SmallDenseMap(const SmallDenseMap &other) : BaseT() {



More information about the llvm-commits mailing list