widl: Add a new function, type_alias_get_aliasee to wrap the retrieval of the type that the alias aliases.

This commit is contained in:
Rob Shearman 2009-01-19 00:02:28 +00:00 committed by Alexandre Julliard
parent 4de19cff1f
commit bdb1321544
5 changed files with 24 additions and 15 deletions

View File

@ -63,7 +63,7 @@ int is_ptrchain_attr(const var_t *var, enum attr_type t)
if (is_attr(type->attrs, t))
return 1;
else if (type_is_alias(type))
type = type->orig;
type = type_alias_get_aliasee(type);
else if (is_ptr(type))
type = type_pointer_get_ref(type);
else return 0;
@ -79,7 +79,7 @@ int is_aliaschain_attr(const type_t *type, enum attr_type attr)
if (is_attr(t->attrs, attr))
return 1;
else if (type_is_alias(t))
t = t->orig;
t = type_alias_get_aliasee(t);
else return 0;
}
}
@ -424,7 +424,7 @@ void check_for_additional_prototype_types(const var_list_t *list)
}
if (type_is_alias(type))
type = type->orig;
type = type_alias_get_aliasee(type);
else if (is_ptr(type))
type = type_pointer_get_ref(type);
else if (is_array(type))
@ -472,7 +472,7 @@ static void write_generic_handle_routines(FILE *header)
static void write_typedef(FILE *header, type_t *type)
{
fprintf(header, "typedef ");
write_type_def_or_decl(header, type->orig, FALSE, "%s", type->name);
write_type_def_or_decl(header, type_alias_get_aliasee(type), FALSE, "%s", type->name);
fprintf(header, ";\n");
}

View File

@ -1443,7 +1443,7 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl,
{
ptr_attr = get_attrv(ptr->attrs, ATTR_POINTERTYPE);
if (!ptr_attr && type_is_alias(ptr))
ptr = ptr->orig;
ptr = type_alias_get_aliasee(ptr);
else
break;
}
@ -1777,7 +1777,7 @@ static void add_incomplete(type_t *t)
static void fix_type(type_t *t)
{
if (type_is_alias(t) && is_incomplete(t)) {
type_t *ot = t->orig;
type_t *ot = type_alias_get_aliasee(t);
fix_type(ot);
if (is_struct(ot->type) || is_union(ot->type))
t->details.structure = ot->details.structure;
@ -2380,9 +2380,9 @@ static void check_field_common(const type_t *container_type,
break;
}
if (type_is_alias(type))
type = type->orig;
type = type_alias_get_aliasee(type);
else if (is_ptr(type))
type = type->ref;
type = type_pointer_get_ref(type);
else if (is_array(type))
type = type_array_get_element(type);
else
@ -2442,7 +2442,7 @@ static void check_remoting_args(const var_t *func)
if (is_attr(type->attrs, ATTR_CONTEXTHANDLE))
break;
if (type_is_alias(type))
type = type->orig;
type = type_alias_get_aliasee(type);
else if (is_ptr(type))
{
ptr_level++;

View File

@ -515,7 +515,7 @@ static type_t *get_user_type(const type_t *t, const char **pname)
}
if (type_is_alias(t))
t = t->orig;
t = type_alias_get_aliasee(t);
else
return 0;
}
@ -1053,7 +1053,7 @@ size_t type_memsize(const type_t *t, unsigned int *align)
size_t size = 0;
if (type_is_alias(t))
size = type_memsize(t->orig, align);
size = type_memsize(type_alias_get_aliasee(t), align);
else if (t->declarray && is_conformant_array(t))
{
type_memsize(type_array_get_element(t), align);

View File

@ -180,6 +180,12 @@ static inline int type_is_alias(const type_t *type)
return type->is_alias;
}
static inline type_t *type_alias_get_aliasee(const type_t *type)
{
assert(type_is_alias(type));
return type->orig;
}
static inline ifref_list_t *type_coclass_get_ifaces(const type_t *type)
{
assert(type->type == RPC_FC_COCLASS);

View File

@ -981,7 +981,7 @@ static int encode_type(
/* typedef'd types without public attribute aren't included in the typelib */
while (type->typelib_idx < 0 && type_is_alias(type) && !is_attr(type->attrs, ATTR_PUBLIC))
type = type->orig;
type = type_alias_get_aliasee(type);
chat("encode_type: VT_USERDEFINED - type %p name = %s type->type %d idx %d\n", type,
type->name, type->type, type->typelib_idx);
@ -2095,8 +2095,11 @@ static void add_typedef_typeinfo(msft_typelib_t *typelib, type_t *tdef)
tdef->typelib_idx = typelib->typelib_header.nrtypeinfos;
msft_typeinfo = create_msft_typeinfo(typelib, TKIND_ALIAS, tdef->name, tdef->attrs);
encode_type(typelib, get_type_vt(tdef->orig), tdef->orig, &msft_typeinfo->typeinfo->datatype1, &msft_typeinfo->typeinfo->size,
&alignment, &msft_typeinfo->typeinfo->datatype2);
encode_type(typelib, get_type_vt(type_alias_get_aliasee(tdef)),
type_alias_get_aliasee(tdef),
&msft_typeinfo->typeinfo->datatype1,
&msft_typeinfo->typeinfo->size,
&alignment, &msft_typeinfo->typeinfo->datatype2);
msft_typeinfo->typeinfo->typekind |= (alignment << 11 | alignment << 6);
}
@ -2269,7 +2272,7 @@ static void add_entry(msft_typelib_t *typelib, const statement_t *stmt)
if (is_attr(type_entry->type->attrs, ATTR_PUBLIC))
add_typedef_typeinfo(typelib, type_entry->type);
else
add_type_typeinfo(typelib, type_entry->type->orig);
add_type_typeinfo(typelib, type_alias_get_aliasee(type_entry->type));
}
break;
}