[clang] [clang] Unique the QualType-keyed type pools in a UniquingSet. NFC (PR #221850)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 7 19:17:18 PDT 2026


================
@@ -218,19 +218,37 @@ struct PFPField {
   FieldDecl *Field;
 };
 
+/// UniquingSet info for pools keyed on a QualType and a bool. DenseMapInfo has
+/// no bool specialization, so we cannot use the default UniquingSetInfo.
+struct QualTypeBoolInfo {
+  using KeyTy = std::pair<QualType, bool>;
+
+  template <typename T> static KeyTy getKey(const T &N) { return N.getKey(); }
+
+  static unsigned getHashValue(const KeyTy &Key) {
+    return llvm::hash_combine(Key.first.getAsOpaquePtr(), Key.second);
+  }
+
+  template <typename T> static bool isEqual(const KeyTy &Key, const T &N) {
+    return Key == N.getKey();
+  }
+};
----------------
ChuanqiXu9 wrote:

This smells slightly odd as it looks like it can't generalize to other Type's Profile kind.

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


More information about the cfe-commits mailing list