beanz added a comment.

In D130055#3677743 <https://reviews.llvm.org/D130055#3677743>, @dblaikie wrote:

> Any chance this could be a generalization of 
> https://clang.llvm.org/doxygen/Consumed_8cpp_source.html ?

I'm not really familiar with that code, but at glance there seems to be some 
similarities between the cases covered by Consumed and UninitializedValues. I 
built off UninitializedValues mostly just because the existing analysis for 
builtin types seemed consistent with the analysis I needed, so the changes to 
the analysis are pretty minimal.

IIUC from skimming the code, Consumed also does IPC to track usage across call 
boundaries, which is really cool, but I don't know if it fully covers the use 
cases without annotations. For example with a tagged union the default object 
might be initialized to some known state (Uninitialized and zero'd), but the 
semantic state of the object is still "uninitialized".

I can imagine a more general implementation of these annotations to basically 
emulate the states of a state machine. Constructors setting to different 
default states, methods being annotated as to which states they are valid to 
call in, and the compiler tracking values through their possible states... that 
is probably a bit much, and certainly overkill for the problem I'm trying to 
solve.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130055/new/

https://reviews.llvm.org/D130055

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to