I succeeded to do it as follows: tree type_decl = lookup_name(get_identifier("MyType")); tree type_ptr = build_pointer_type(TREE_TYPE(type_decl)); tree var_decl = build(VAR_DECL, get_identifier("t"), type_ptr); pushdecl(var_decl);
It may not be a perfect solution but for now it works. On 1/16/07, Ferad Zyulkyarov <[EMAIL PROTECTED]> wrote:
Hi, > Best way to figure this out is to write a simple 5 line testcase that > defines a structure type and also defines a pointer to that type, and > then step through gcc to see what it does. Try putting breakpoints in > finish_struct and build_pointer_type. I tried with the advised test case but again I could not find how to reference to the already declared type "MyType". As it sould be logically, there should be a way to get a reference to the declared type i.e. tree type_decl = lookup_name("MyType"); tree type_ptr = build_pointer_type(type_decl->type_node); tree var_decl = build(VAR_DECL, get_identifier("t"), type_ptr); I tried similar codes like the above, but I don't know how to retrieve the "type" from the type declaration. Any help, ideas are highly appreciated. Ferad Zyulkyarov
-- Ferad Zyulkyarov Barcelona Supercomputing Center