[llvm] d97a5ad - [ADT] Make protected members of DenseMapBase private (NFC) (#228651)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 22:49:30 PDT 2026
Author: Kazu Hirata
Date: 2026-10-02T22:49:23-07:00
New Revision: d97a5ad5e813605511f6b165cce7a8006303b971
URL: https://github.com/llvm/llvm-project/commit/d97a5ad5e813605511f6b165cce7a8006303b971
DIFF: https://github.com/llvm/llvm-project/commit/d97a5ad5e813605511f6b165cce7a8006303b971.diff
LOG: [ADT] Make protected members of DenseMapBase private (NFC) (#228651)
Neither DenseMap nor SmallDenseMap accesses these members after #227063.
This patch also moves getMemorySize into the main public section.
Assisted-by: Antigravity
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 126a588fdcfaa..dc77237f75d93 100644
--- a/llvm/include/llvm/ADT/DenseMap.h
+++ b/llvm/include/llvm/ADT/DenseMap.h
@@ -1043,7 +1043,15 @@ class DenseMapBase : public DebugEpochBase {
return *this;
}
-protected:
+ /// Return the approximate size (in bytes) of the actual map.
+ /// This is just the raw memory used by DenseMap.
+ /// If entries are pointers to objects, the size of the referenced objects
+ /// are not included.
+ [[nodiscard]] size_t getMemorySize() const {
+ return llvm::densemap::detail::allocBytes<BucketT>(getNumBuckets());
+ }
+
+private:
StorageT Storage;
struct ExactBucketCount {};
@@ -1158,7 +1166,6 @@ class DenseMapBase : public DebugEpochBase {
}
}
-private:
/// Erase the entry at \p TheBucket and close the resulting hole via Knuth
/// TAOCP 6.4 Algorithm R.
LLVM_ATTRIBUTE_NOINLINE void eraseFromFilledBucket(BucketT *TheBucket) {
@@ -1342,15 +1349,6 @@ class DenseMapBase : public DebugEpochBase {
BucketNo = (BucketNo + 1) & Mask;
}
}
-
-public:
- /// Return the approximate size (in bytes) of the actual map.
- /// This is just the raw memory used by DenseMap.
- /// If entries are pointers to objects, the size of the referenced objects
- /// are not included.
- [[nodiscard]] size_t getMemorySize() const {
- return llvm::densemap::detail::allocBytes<BucketT>(getNumBuckets());
- }
};
/// Equality comparison for DenseMap.
More information about the llvm-commits
mailing list