Address taken variables and assignment counts

Hi All,

I am working with some code that involves walking the Clang AST
and have some questions. For a particular variable, say ‘x’, is there
a straight forward (in the sense that there is already code somewhere
in Clang to do it) way to determine:

  1. If ‘x’ is address taken.

  2. If ‘x’ has been assigned multiple times.


Or do I have to figure those things out in the AST walking code that
I am writing?


I don’t believe clang has machinery you can just query to retrieve this sort of information, but clang is big, so I could be wrong. :slight_smile:

That said, the uninitialized values checker needs to determine if a local variable has been assigned 0 times (and hasn’t had its address taken in a non-const context). So, that may be a good starting point for you.