This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Classes


Hey all

I am getting my program model in my front-end devloped to be more
sensible now since all the ground work i've done is now paying off.

And i just have a few questions about creating classes in GENERIC from
what i've been reading and poking about so far you seem to make a
RECORD_TYPE then add all your VAR_DECLS as FIELD_DECL's as usual but i
am unsure how you add in member functions do you do the same thing but
simply TREE_CHAIN the field decl with the member function name and its
return type or something but i dont think that makes sense.

Not sure if that made sense well for example i want to represent:

class foobar {
  int x,y;


}



 i have a record type like:

  tree gpy_object_struct_Type = make_node (RECORD_TYPE);

  name = get_identifier("type");
  field = build_decl(BUILTINS_LOCATION, FIELD_DECL, name, integer_type_node);
  DECL_CONTEXT(field) = gpy_object_struct_Type;
  DECL_CHAIN(last_field) = field;
  last_field = field;

Then say i wanted to add a member function what should the FIELD_DECL
look like I am up far too late so its probably really obvious but i am
too sleepy to realise.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]