This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
How can i get a ref from a this pointer ?
- From: Richard Buchmann <Richard dot Buchmann at lip6 dot fr>
- To: gcc at gcc dot gnu dot org
- Cc: richard dot buchmann at asim dot lip6 dot fr
- Date: Fri, 5 Nov 2004 17:14:10 +0100
- Subject: How can i get a ref from a this pointer ?
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