[llvm] [llvm][ADT] Add invalidate method to ScopedHashTableScope (PR #193516)

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 23 10:47:02 PDT 2026


================
@@ -257,6 +279,24 @@ ScopedHashTableScope<K, V, KInfo, Allocator>::~ScopedHashTableScope() {
   }
 }
 
+template <typename K, typename V, typename KInfo, typename Allocator>
+void ScopedHashTableScope<K, V, KInfo, Allocator>::invalidate(const K &key) {
+  if (!HT.TopLevelMap.contains(key))
+    return;
+  ScopedHashTableVal<K, V> *&ThisEntry = HT.TopLevelMap[key];
----------------
joker-eph wrote:

Please avoid double map lookup using `find` instead of contains.

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


More information about the llvm-commits mailing list