ucrtbase: Add support for r-value demangling in unDName.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=44202
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit a656a8b644)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
Piotr Caban 2022-02-07 17:44:46 +01:00 committed by Michael Stefaniuc
parent dadacb9fb8
commit 9c0dfffe3f
2 changed files with 26 additions and 1 deletions

View File

@ -450,6 +450,7 @@ static BOOL get_modified_type(struct datatype_t *ct, struct parsed_symbol* sym,
case 'R': str_modif = str_printf(sym, " *%s volatile", ptr_modif); break;
case 'S': str_modif = str_printf(sym, " *%s const volatile", ptr_modif); break;
case '?': str_modif = ""; break;
case '$': str_modif = str_printf(sym, " &&%s", ptr_modif); break;
default: return FALSE;
}
@ -1028,6 +1029,11 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct,
if (!demangle_datatype(sym, ct, pmt_ref, in_args)) goto done;
ct->left = str_printf(sym, "%s %s", ct->left, ptr);
}
else if (*sym->current == 'Q')
{
sym->current++;
if (!get_modified_type(ct, sym, pmt_ref, '$', in_args)) goto done;
}
break;
}
break;

View File

@ -52,7 +52,7 @@ static int (CDECL *p___std_type_info_compare)(const type_info140*, const type_in
static const char* (CDECL *p___std_type_info_name)(type_info140*, SLIST_HEADER*);
static void (CDECL *p___std_type_info_destroy_list)(SLIST_HEADER*);
static size_t (CDECL *p___std_type_info_hash)(type_info140*);
static char* (__cdecl *p___unDName)(char*,const char*,int,void*,void*,unsigned short int);
static BOOL init(void)
{
@ -72,6 +72,7 @@ static BOOL init(void)
p___std_type_info_name = (void*)GetProcAddress(module, "__std_type_info_name");
p___std_type_info_destroy_list = (void*)GetProcAddress(module, "__std_type_info_destroy_list");
p___std_type_info_hash = (void*)GetProcAddress(module, "__std_type_info_hash");
p___unDName = (void*)GetProcAddress(module, "__unDName");
return TRUE;
}
@ -189,9 +190,27 @@ static void test___std_type_info(void)
ok(hash1 != hash2, "hash1 == hash2 for different strings\n");
}
static void test___unDName(void)
{
char *name;
name = p___unDName(0, "??4QDnsDomainNameRecord@@QAEAAV0@$$QAV0@@Z", 0, malloc, free, 0);
ok(!strcmp(name, "public: class QDnsDomainNameRecord & __thiscall "
"QDnsDomainNameRecord::operator=(class QDnsDomainNameRecord &&)"),
"unDName returned %s\n", wine_dbgstr_a(name));
free(name);
name = p___unDName(0, "??4QDnsDomainNameRecord@@QAEAAV0@$$QEAV0@@Z", 0, malloc, free, 0);
ok(!strcmp(name, "public: class QDnsDomainNameRecord & __thiscall "
"QDnsDomainNameRecord::operator=(class QDnsDomainNameRecord && __ptr64)"),
"unDName returned %s\n", wine_dbgstr_a(name));
free(name);
}
START_TEST(cpp)
{
if (!init()) return;
test___std_exception();
test___std_type_info();
test___unDName();
}