diff --git a/tools/widl/parser.y b/tools/widl/parser.y index e88d093dca8..5a42263d328 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -785,7 +785,7 @@ base_type: tBYTE { $$ = make_builtin($1); } case RPC_FC_HYPER: if ($$->name[0] == 'h') /* hyper, as opposed to __int64 */ { - $$ = alias($$, "MIDL_uhyper"); + $$ = type_new_alias($$, "MIDL_uhyper"); $$->sign = 0; } break; @@ -1876,7 +1876,7 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at /* set the attributes to allow set_type to do some checks on them */ name->attrs = attrs; set_type(name, decl_spec, decl, 0); - cur = alias(name->type, name->name); + cur = type_new_alias(name->type, name->name); cur->attrs = attrs; if (is_incomplete(cur)) diff --git a/tools/widl/typelib.c b/tools/widl/typelib.c index 17eaaf0e38f..e0ef86ebbe1 100644 --- a/tools/widl/typelib.c +++ b/tools/widl/typelib.c @@ -49,31 +49,6 @@ static typelib_t *typelib; -type_t *duptype(type_t *t, int dupname) -{ - type_t *d = alloc_type(); - - *d = *t; - if (dupname && t->name) - d->name = xstrdup(t->name); - - d->orig = t; - return d; -} - -type_t *alias(type_t *t, const char *name) -{ - type_t *a = duptype(t, 0); - - a->name = xstrdup(name); - a->kind = TKIND_ALIAS; - a->attrs = NULL; - a->declarray = FALSE; - init_loc_info(&a->loc_info); - - return a; -} - int is_ptr(const type_t *t) { unsigned char c = t->type; diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c index c6def4b0891..67c6f8b97c2 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -29,6 +29,17 @@ #include "typetree.h" #include "header.h" +type_t *duptype(type_t *t, int dupname) +{ + type_t *d = alloc_type(); + + *d = *t; + if (dupname && t->name) + d->name = xstrdup(t->name); + + return d; +} + type_t *type_new_function(var_list_t *args) { type_t *t = make_type(RPC_FC_FUNCTION, NULL); @@ -45,6 +56,20 @@ type_t *type_new_pointer(type_t *ref, attr_list_t *attrs) return t; } +type_t *type_new_alias(type_t *t, const char *name) +{ + type_t *a = duptype(t, 0); + + a->name = xstrdup(name); + a->kind = TKIND_ALIAS; + a->attrs = NULL; + a->declarray = FALSE; + a->orig = t; + init_loc_info(&a->loc_info); + + return a; +} + static int compute_method_indexes(type_t *iface) { int idx; diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h index d4fdf19fe66..24a15ea4eae 100644 --- a/tools/widl/typetree.h +++ b/tools/widl/typetree.h @@ -26,11 +26,15 @@ type_t *type_new_function(var_list_t *args); type_t *type_new_pointer(type_t *ref, attr_list_t *attrs); +type_t *type_new_alias(type_t *t, const char *name); void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts); void type_dispinterface_define(type_t *iface, var_list_t *props, func_list_t *methods); void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface); void type_module_define(type_t *module, statement_list_t *stmts); +/* FIXME: shouldn't need to export this */ +type_t *duptype(type_t *t, int dupname); + static inline var_list_t *type_struct_get_fields(const type_t *type) { assert(is_struct(type->type)); diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h index 2bfa641e06b..3f064525498 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h @@ -436,9 +436,6 @@ type_t *alloc_type(void); void set_all_tfswrite(int val); void clear_all_offsets(void); -type_t *duptype(type_t *t, int dupname); -type_t *alias(type_t *t, const char *name); - int is_ptr(const type_t *t); int is_array(const type_t *t); int is_var_ptr(const var_t *v);