This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re : Re : Classes
Hello Phil,
you will find answer to your question here :
http://gcc.gnu.org/ml/gcc-help/2010-11/msg00090.html
Ian suggest that I see the c++ front end and do the same, but it was a little
diffucult for me ;)
that's why I do it manually : I added the instance param in the CALL_EXPR tree
code.
you find also in the post my gimple and the cp gimple they are almost the same.
Hope it helps.
Asma
----- Message d'origine ----
De : Philip Herron <redbrain@gcc.gnu.org>
À : charfi asma <charfiasma@yahoo.fr>
Cc : gcc-help@gcc.gnu.org
Envoyé le : Ven 15 avril 2011, 8h 39min 35s
Objet : Re: Re : Classes
On 5 April 2011 08:44, charfi asma <charfiasma@yahoo.fr> wrote:
>
>
> Hello Phil,
>
> have a look at those post:
>
> http://gcc.gnu.org/ml/gcc-help/2010-11/msg00019.html
> http://gcc.gnu.org/ml/gcc-help/2010-10/msg00388.html
>
> I got the same problem when I want to add a method to my class.
>
> hope it helps
>
Hey
Thanks for those links i am a little confused still not sure if i've
done everything right.
Say for example i wanted to implment this:
int main() ()
{
int D.1710;
{
struct myClass test;
myClass::set_values (&test, 3, 4);
D.1710 = 0;
return D.1710;
}
D.1710 = 0;
return D.1710;
}
void myClass::set_values(int, int) (struct myClass * const this, int a, int b)
{
this->x = a;
this->y = b;
}
Which is the gimple dump of:
class myClass
{
int x, y;
public:
void set_values (int, int);
};
void myClass::set_values (int a, int b)
{
x = a;
y = b;
}
int main ()
{
myClass test;
test.set_values (3,4);
return 0;
}
I make a RECORD_TYPE called myClass and having FIELD_DECLS for x and y.
set_values = FUNCTION_DECL....
Then i use TYPE_METHODS(myClass) = set_values
Then i dont understand how i call the method not sure how i use the
build_call_expr to do that.