Classes

Ian Lance Taylor iant@google.com
Tue Apr 5 04:47:00 GMT 2011


Philip Herron <redbrain@gcc.gnu.org> writes:

> Whoops i pressed space by accident and it send the mail sorry i didnt
> get to finish this email, the questions was how would i go about
> representing:
>
> class foobar {
>   int x,y
>
>   int member_method (int);
> }
>
> So i guess you would follow your nomal record_type stuff but i am not
> sure what the field_decl should look like for the member_functions.

There is no FIELD_DECL for a method.  Instead, create a function whose
type is METHOD_TYPE rather than FUNCTION_TYPE.  Attach the function to
TYPE_METHODS for the type.  Really the only effect of those two things
are on the emitted debug info.  Other than debug info, all the special
handling of methods is done in the frontend.

Ian



More information about the Gcc-help mailing list