================
@@ -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;
----------------
steakhal wrote:

You are right that it's possible to recover the previous value, but you can't 
recover why the invalidation happened.
I think in general, having this at hand - without some bug report visitor is 
useful, even for deciding if we want to emit a bug report or not - even though 
I don't have a practical use case for this but the point is this:

When we construct a bug report, we can't have a visitor yet. So we can't make 
decisions on invalidation events, only decide to suppress reports or put some 
notes down from a visitor.

In contrast, if we had this history baked into the symbol, we can do whatever 
with it whenever we want to. It's more flexible, and more importantly, to me it 
feels more natural.

https://github.com/llvm/llvm-project/pull/207155
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to