================ @@ -687,4 +711,35 @@ class SymbolVisitor { } // namespace clang +// Override the default definition that would use pointer values of SymbolRefs +// to order them, which is unstable due to ASLR. +// Use the SymbolID instead which reflect the order in which the symbols were +// allocated. This is usually stable across runs leading to the stability of +// ConstraintMap and other containers using SymbolRef as keys. +template <> +struct ::llvm::ImutContainerInfo<clang::ento::SymbolRef> + : public ImutProfileInfo<clang::ento::SymbolRef> { + using value_type = + typename ImutProfileInfo<clang::ento::SymbolRef>::value_type; + using value_type_ref = + typename ImutProfileInfo<clang::ento::SymbolRef>::value_type_ref; + using key_type = value_type; + using key_type_ref = value_type_ref; + using data_type = bool; + using data_type_ref = bool; + + static key_type_ref KeyOfValue(value_type_ref D) { return D; } + static data_type_ref DataOfValue(value_type_ref) { return true; } + + static bool isEqual(key_type_ref LHS, key_type_ref RHS) { + return LHS->getSymbolID() == RHS->getSymbolID(); + } ---------------- steakhal wrote:
In these member functions, I'd prefer using directly the aliased types, such as SymbolRef - or whatever `key_type_ref`. I don't think we have solid reasons using the type aliases here and in the rest of the mfns. https://github.com/llvm/llvm-project/pull/121551 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits