widl: Avoid adding duplicate type definitions if tag and typedef names are the same.

Fix handing of the following .idl snippet:

typedef [uuid(b14b6bb5-904e-4ff9-b247-bd361f7a0001)]
struct g { int g1; } g;

[uuid(b14b6bb5-904e-4ff9-b247-bd361f7a0002)]
interface test_iface : IUnknown
{
    HRESULT test([in] g *ptr);
}

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2015-11-03 13:28:53 +08:00 committed by Alexandre Julliard
parent 8e81f6d582
commit f7581c763d
1 changed files with 7 additions and 1 deletions

View File

@ -2181,7 +2181,7 @@ static void add_union_typeinfo(msft_typelib_t *typelib, type_t *tunion)
static void add_typedef_typeinfo(msft_typelib_t *typelib, type_t *tdef)
{
msft_typeinfo_t *msft_typeinfo = NULL;
int alignment, datatype1, datatype2, size;
int alignment, datatype1, datatype2, size, duplicate = 0;
type_t *type;
if (-1 < tdef->typelib_idx)
@ -2194,6 +2194,8 @@ 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);
}
else
duplicate = 1;
encode_type(typelib, get_type_vt(type), type,
&datatype1, &size, &alignment, &datatype2);
@ -2205,6 +2207,10 @@ static void add_typedef_typeinfo(msft_typelib_t *typelib, type_t *tdef)
msft_typeinfo->typeinfo->datatype2 = datatype2;
msft_typeinfo->typeinfo->typekind |= (alignment << 11 | alignment << 6);
}
/* avoid adding duplicate type definitions */
if (duplicate)
tdef->typelib_idx = type->typelib_idx;
}
static void add_coclass_typeinfo(msft_typelib_t *typelib, type_t *cls)