widl: Move duptype and alias to parser.y.
Make duptype static and rename alias to type_new_alias.
This commit is contained in:
parent
cb8d3322be
commit
8b326c4ff8
|
@ -785,7 +785,7 @@ base_type: tBYTE { $$ = make_builtin($<str>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))
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue