widl: Precompute qualified type names, and use them for C++ interfaces.
This is what MIDL does and avoid mismatching and even fixes some compiling issues. Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
a78053743d
commit
fc533ddf32
|
@ -465,13 +465,13 @@ void write_type_left(FILE *h, const decl_spec_t *ds, enum name_type name_type, i
|
|||
case TYPE_INTERFACE:
|
||||
case TYPE_MODULE:
|
||||
case TYPE_COCLASS:
|
||||
fprintf(h, "%s", name);
|
||||
fprintf(h, "%s", type_get_qualified_name(t, name_type));
|
||||
break;
|
||||
case TYPE_RUNTIMECLASS:
|
||||
fprintf(h, "%s", type_get_name(type_runtimeclass_get_default_iface(t), name_type));
|
||||
break;
|
||||
case TYPE_DELEGATE:
|
||||
fprintf(h, "%s", type_get_name(type_delegate_get_iface(t), name_type));
|
||||
fprintf(h, "%s", type_get_qualified_name(type_delegate_get_iface(t), name_type));
|
||||
break;
|
||||
case TYPE_VOID:
|
||||
fprintf(h, "void");
|
||||
|
|
|
@ -2073,9 +2073,15 @@ type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, in
|
|||
nt = xmalloc(sizeof(struct rtype));
|
||||
nt->name = name;
|
||||
if (is_global_namespace(namespace))
|
||||
{
|
||||
type->c_name = name;
|
||||
type->qualified_name = name;
|
||||
}
|
||||
else
|
||||
{
|
||||
type->c_name = format_namespace(namespace, "__x_", "_C", name, use_abi_namespace ? "ABI" : NULL);
|
||||
type->qualified_name = format_namespace(namespace, "", "::", name, use_abi_namespace ? "ABI" : NULL);
|
||||
}
|
||||
nt->type = type;
|
||||
nt->t = t;
|
||||
nt->next = namespace->type_hash[hash];
|
||||
|
|
|
@ -51,6 +51,7 @@ type_t *make_type(enum type_type type)
|
|||
t->attrs = NULL;
|
||||
t->c_name = NULL;
|
||||
t->signature = NULL;
|
||||
t->qualified_name = NULL;
|
||||
memset(&t->details, 0, sizeof(t->details));
|
||||
t->typestring_offset = 0;
|
||||
t->ptrdesc = 0;
|
||||
|
@ -91,6 +92,19 @@ const char *type_get_name(const type_t *type, enum name_type name_type)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const char *type_get_qualified_name(const type_t *type, enum name_type name_type)
|
||||
{
|
||||
switch(name_type) {
|
||||
case NAME_DEFAULT:
|
||||
return type->qualified_name;
|
||||
case NAME_C:
|
||||
return type->c_name;
|
||||
}
|
||||
|
||||
assert(0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static size_t append_namespace(char **buf, size_t *len, size_t pos, struct namespace *namespace, const char *separator, const char *abi_prefix)
|
||||
{
|
||||
int nested = namespace && !is_global_namespace(namespace);
|
||||
|
@ -820,6 +834,7 @@ static void compute_delegate_iface_names(type_t *delegate, type_t *type, typeref
|
|||
iface->name = strmake("I%s", delegate->name);
|
||||
if (type) iface->c_name = format_parameterized_type_c_name(type, params, "I");
|
||||
else iface->c_name = format_namespace(delegate->namespace, "__x_", "_C", iface->name, use_abi_namespace ? "ABI" : NULL);
|
||||
iface->qualified_name = format_namespace(delegate->namespace, "", "::", iface->name, use_abi_namespace ? "ABI" : NULL);
|
||||
}
|
||||
|
||||
type_t *type_delegate_declare(char *name, struct namespace *namespace)
|
||||
|
|
|
@ -75,6 +75,7 @@ type_t *type_parameterized_type_specialize_declare(type_t *type, typeref_list_t
|
|||
type_t *type_parameterized_type_specialize_define(type_t *type);
|
||||
int type_is_equal(const type_t *type1, const type_t *type2);
|
||||
const char *type_get_name(const type_t *type, enum name_type name_type);
|
||||
const char *type_get_qualified_name(const type_t *type, enum name_type name_type);
|
||||
char *gen_name(void);
|
||||
extern int is_attr(const attr_list_t *list, enum attr_type t);
|
||||
|
||||
|
|
|
@ -503,6 +503,7 @@ struct _type_t {
|
|||
} details;
|
||||
const char *c_name;
|
||||
const char *signature;
|
||||
const char *qualified_name;
|
||||
unsigned int typestring_offset;
|
||||
unsigned int ptrdesc; /* used for complex structs */
|
||||
int typelib_idx;
|
||||
|
|
Loading…
Reference in New Issue