[llvm] 885546c - [ADT] Adjust parameter names for DenseMap constructors (NFC) (#158501)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 14 14:04:09 PDT 2025
Author: Kazu Hirata
Date: 2025-09-14T14:04:06-07:00
New Revision: 885546c83c1f9417d0e39679e39be3d055604db2
URL: https://github.com/llvm/llvm-project/commit/885546c83c1f9417d0e39679e39be3d055604db2
DIFF: https://github.com/llvm/llvm-project/commit/885546c83c1f9417d0e39679e39be3d055604db2.diff
LOG: [ADT] Adjust parameter names for DenseMap constructors (NFC) (#158501)
This patch ensures that both DenseMap and SmallDenseMap have:
explicit DenseMap(unsigned NumElementsToReserve = 0) {
init(NumElementsToReserve);
}
for consistency and clarity (modulo the class name, of course).
Added:
Modified:
llvm/include/llvm/ADT/DenseMap.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h
index b478ce21d79e6..e13a2cb09a412 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 NumElementsToReserve to guarantee
+ /// that this number of elements can be inserted in the map without grow().
+ explicit DenseMap(unsigned NumElementsToReserve = 0) {
+ init(NumElementsToReserve);
+ }
DenseMap(const DenseMap &other) : BaseT() {
init(0);
@@ -887,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