[clang] [analyzer] Introduce the invalidation artifact symbol (PR #207155)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 16 03:03:17 PDT 2026


================
@@ -132,6 +133,84 @@ class SymbolConjured : public SymbolData {
   static constexpr bool classof(Kind K) { return K == ClassKind; }
 };
 
+/// A symbol representing a value bound to a memory region as a side effect of
+/// an invalidation event (escape into an opaque function, loop widening,
+/// unmodeled atomic, etc.). Behaves like SymbolConjured but additionally
+/// carries an InvalidationCause describing why the invalidation happened, and
+/// (when known) the symbol that was bound to the region just before the
+/// invalidation. The previous symbol lets bug-report visitors reason about
+/// constraints attached to a value before it was invalidated.
+class SymbolInvalidationArtifact : public SymbolData {
+  ConstCFGElementRef Elem;
+  QualType T;
+  unsigned Count;
+  const StackFrame *SF;
+  const void *SymbolTag;
+  const InvalidationCause *Cause;
+  SymbolRef PreviousSym;
----------------
Xazax-hun wrote:

Do we need to encode the history here? Since bug report visitors walk the exploded graph anyway they can always see what the earlier symbols were for a given memory region. I am not opposed to this just want to make sure it is carrying its weight and not easily restorable from what we already store in the state. 

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


More information about the cfe-commits mailing list