Re: Getting a tree node for a field of a variable

2007-01-22 Thread Ferad Zyulkyarov
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

Re: Getting a tree node for a field of a variable

2007-01-19 Thread Mike Stump
On Jan 19, 2007, at 3:42 AM, Ferad Zyulkyarov wrote: Is it possible to write a short example how a it could be referred the tree of variable field? Sure, just compile up the C code for what you want to do, run the debugger, watch what it builds and how it builds it. If you want to know wha

Re: Getting a tree node for a field of a variable

2007-01-19 Thread Ferad Zyulkyarov
Hi, Look in tree.def. Given the RECORD_TYPE node, walk down TYPE_FIELDS looking for the FIELD_DECL that you want. To assign to a field use a COMPONENT_REF. Is it possible to write a short example how a it could be referred the tree of variable field? Let's say that we have somewhere defined

Re: Getting a tree node for a field of a variable

2007-01-18 Thread Ian Lance Taylor
"Ferad Zyulkyarov" <[EMAIL PROTECTED]> writes: > Please, would you suggest me any clues on how to get a tree node for a > field of a variable within the AST. Look in tree.def. Given the RECORD_TYPE node, walk down TYPE_FIELDS looking for the FIELD_DECL that you want. To assign to a field use a

Getting a tree node for a field of a variable

2007-01-18 Thread Ferad Zyulkyarov
Hi, Please, would you suggest me any clues on how to get a tree node for a field of a variable within the AST. Let's say that somewhere I declared: MyStruct *var; What I want to do is to get a tree node of a field within "var", i.e. "var->field" What I want actually is to modify "var->field",