[llvm] [ADT] Use range-based for loops in StringMap.h (NFC) (PR #152641)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 8 06:31:53 PDT 2025


================
@@ -398,8 +401,7 @@ class LLVM_ALLOCATORHOLDER_EMPTYBASE StringMap
 
     // Zap all values, resetting the keys back to non-present (not tombstone),
     // which is safe because we're removing all elements.
-    for (unsigned I = 0, E = NumBuckets; I != E; ++I) {
-      StringMapEntryBase *&Bucket = TheTable[I];
+    for (StringMapEntryBase *&Bucket : buckets()) {
----------------
kuhar wrote:

Do we need this reference? I know the original loop uses that, but I don't see why.

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


More information about the llvm-commits mailing list