struct foo { int i; void bar() {i=10;} };
i is not a regular variable here, it's a member of a structure.
Agreed.
No, but only because it's not really a variable, it's a structure member, and only ever accessed as such. It thus doesn't appear as a VAR_DECL (in gcc terms), it appears in component accesses as a FIELD_DECL.
Sorry, I'm still pretty new to the tree layout. So what is the easiest way to access this? referenced_vars returns the 'this' variable which is obviously a structure. My understanding is that I can access it's fields with the facilities available but 'i' is what was specifically referenced - not all of the fields. So the question is, what is the easiest way to obtain the specific field that was referenced in this case?