jimingham wrote:

Replying to a bunch of Greg's comments in sum.  

The way we use the ValueObjectPrinter is that you have a ValueObject and want 
to print it, so you make a ValueObjectPrinter passing in that ValueObject, then 
tell it to print it.  We don't preserve ValueObjectPrinters or try to reuse 
them.  There's no attempt to track changes in the ValueObject, for instance if 
you changed the use dynamic setting of the underlying ValueObject that won't 
effect the ValueObjectPrinter you made before you changed the setting.  It 
doesn't track the SyntheticChildProviderGeneration, so if you changed synthetic 
child providers on that ValueObject, it wouldn't track that, etc.

I think that's a useful simplification.   We don't have to reason about 
lifecycles in the ValueObjectPrinter.   The caller is responsible for the 
lifecycle of the ValueObject being printed - and that ValueObject's 
ClusterManager is responsible for all the children & synthetic children of that 
ValueObject.  The ValueObjectPrinter gets a reference to it because it expects 
to do some work on the ValueObject and then get discarded, which is how we 
always use it.

I can put in a comment to this effect, though the fact that we're taking in a 
`ValueObject &` and not a shared pointer also implies this is the way you are 
supposed to use it.




https://github.com/llvm/llvm-project/pull/81314
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to