This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Getting a tree node for a field of a variable
typedef struct MyType
{
int field1;
int field2;
}
MyType *var;
Finally, I found a way to get the tree node for "var->field1" assuming
that we compile the code above. Here is an example:
tree var_decl = lookup_name(get_identifier("var"));
tree var_field1 = build_component_ref(build_indirect_ref(var_decl,
"var"), get_identifier("field1"));
"var_field1" is the "var->field1" tree node.
--
Ferad Zyulkyarov
Barcelona Supercomputing Center