n2h9 wrote:

> My initial reaction is that having `SBVariableAnnotator` seems unnecessary. 
> The SB API guarantees ABI stability which means that we have to be mindful of 
> what we put in there. If annotations are per instructions, why not have a 
> getter on SBInstruction (or potentially SBInstructionList for batch 
> operations)?

That is a very good point. 

The point is that the `VariableAnnotator` class persists the state between two 
instructions to be able to track when a variable becomes out of scope. This 
works well inside `Disassembler` class because instructions are sequential and 
from the same target. `SBVariableAnnotator` was supposed to persist the state 
between two instructions as well, but the difference is that we can not 
guarantee that the client will provide sequential instructions from the same 
target.

Your suggestion makes sense, to implement a method inside `SBInstruction` to 
get annotations for the current instruction. In that case we will be only able 
to return, so called, `live` annotations. And clients can handle the logic of 
tracking when a variable becomes out of scope on their side, if they need.

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

Reply via email to