[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

Arseniy Zaostrovnykh via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 3 00:54:14 PST 2025


================
@@ -401,7 +401,22 @@ class RangeSet {
   friend class Factory;
 };
 
-using ConstraintMap = llvm::ImmutableMap<SymbolRef, RangeSet>;
+struct ConstraintKVInfo : llvm::ImutKeyValueInfo<SymbolRef, RangeSet> {
+  static inline bool isEqual(key_type_ref L, key_type_ref R) {
+    return L->getAllocID() == R->getAllocID();
+  }
+
+  static inline bool isLess(key_type_ref L, key_type_ref R) {
+    return L->getAllocID() < R->getAllocID();
+  }
+
+  static inline void Profile(llvm::FoldingSetNodeID &ID, value_type_ref V) {
+    ID.AddInteger(V.first->getAllocID());
+    ID.Add(V.second);
+  }
+};
+
+using ConstraintMap = llvm::ImmutableMap<SymbolRef, RangeSet, ConstraintKVInfo>;
----------------
necto wrote:

Done in https://github.com/llvm/llvm-project/pull/121551

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


More information about the cfe-commits mailing list