[llvm] [ADT] Refactor DenseMap::insert, try_emplace, and operator[] (NFC) (PR #155204)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 25 07:10:06 PDT 2025


================
@@ -496,6 +475,18 @@ class DenseMapBase : public DebugEpochBase {
   static const KeyT getTombstoneKey() { return KeyInfoT::getTombstoneKey(); }
 
 private:
+  template <typename KeyArgT, typename... Ts>
+  std::pair<iterator, bool> try_emplace_impl(KeyArgT &&Key, Ts &&...Args) {
+    BucketT *TheBucket;
----------------
kuhar wrote:

nit: I'd initialize this just so that there isn't any intermediate state with uninitialized values that would show up in the debugger.
```suggestion
    BucketT *TheBucket = nullptr;
```


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


More information about the llvm-commits mailing list