[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)
Arseniy Zaostrovnykh via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 3 08:46:38 PST 2025
================
@@ -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;
----------------
necto wrote:
inlined
d32f6abb0404 [NFC] Explain why isDataEqual is necessary; inline type aliases.
https://github.com/llvm/llvm-project/pull/121551
More information about the cfe-commits
mailing list