[clang] [clang-tools-extra] [lldb] [llvm] [Support][JSON] Use `std::unordered_map` for object storage (PR #171230)

Cyndy Ishida via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 16 07:48:36 PDT 2026


================
@@ -133,8 +139,8 @@ class Object {
   bool erase(StringRef K);
   void erase(iterator I) { M.erase(I); }
 
-  iterator find(StringRef K) { return M.find_as(K); }
-  const_iterator find(StringRef K) const { return M.find_as(K); }
+  iterator find(const ObjectKey &K) { return M.find(K); }
----------------
cyndyishida wrote:

This introduces an implicit conversion at call sites that use `StringRef`, adding overhead that `DenseMap` didn't incur because it skipped the `isUTF8` iteration. The data you presented proves it's not too concerning, but it might be good to add a TODO to opt into `std::transparent` for `ObjectKey` when LLVM switches to C++20. And set this parameter type back to `StringRef`.

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


More information about the cfe-commits mailing list