How can i get a ref from a this pointer ?
Richard Buchmann
Richard.Buchmann@lip6.fr
Fri Nov 5 16:14:00 GMT 2004
Hello,
I'm looking for a simple way to get something like a COMPONENT_REF tree node
from an expression tree node.
CALL_EXPR node has 2 operands : (see tree.def)
Operand 0 is the function.
Operand 1 is the argument list, a list of expressions made out of a chain of TREE_LIST nodes.
In some cases, the operand 0 is an expression for 'self' parameter. This
expression is an arithmetic expression using two operands. Their both type is a
pointer.
How can i get the COMPONENT_REF tree node from this expression ?
Example :
struct bar {
bar& operator = (int)
{
return *this;
}
};
struct foo {
bar a;
bar b;
void test () {
b = 3;
};
};
In this example, there is a CALL_EXPR node for "b = 3" expression.
The first operand is a PLUS_EXPR node.
The second operand is a integer node.
The PLUS_EXPR node has 2 operands : the first is a NOP_EXPR node (this
pointer...) and the second one is an integer node (the offset).
I would like to get a COMPONENT_REF node to know what FIELD is used : a or b.
I need this information from the intermediate representation used by the C and
C++ front ends before to reach another pass.
Thank you.
Best Regards.
Richard Buchmann
More information about the Gcc
mailing list