msvcrt: undname: correctly handle multi-dimensional arrays.

Based on a patch from Ulrich Küttler.
This commit is contained in:
Eric Pouech 2008-04-28 21:18:26 +02:00 committed by Alexandre Julliard
parent a940218c0b
commit 2e1775620a
2 changed files with 41 additions and 0 deletions

View File

@ -985,6 +985,10 @@ static void test_demangle(void)
{"?$AAA@?C@", "AAA<`template-parameter-2'>"}, {"?$AAA@?C@", "AAA<`template-parameter-2'>"},
{"?$AAA@PAUBBB@@", "AAA<struct BBB *>"}, {"?$AAA@PAUBBB@@", "AAA<struct BBB *>"},
{"??$ccccc@PAVaaa@@@bar@bb@foo@@DGPAV0@PAV0@PAVee@@IPAPAVaaa@@1@Z", "private: static class bar * __stdcall foo::bb::bar::ccccc<class aaa *>(class bar *,class ee *,unsigned int,class aaa **,class ee *)"}, {"??$ccccc@PAVaaa@@@bar@bb@foo@@DGPAV0@PAV0@PAVee@@IPAPAVaaa@@1@Z", "private: static class bar * __stdcall foo::bb::bar::ccccc<class aaa *>(class bar *,class ee *,unsigned int,class aaa **,class ee *)"},
{"?f@T@@QAEHQCY1BE@BO@D@Z", "public: int __thiscall T::f(char (volatile * const)[20][30])"},
{"?f@T@@QAEHQAY2BE@BO@CI@D@Z", "public: int __thiscall T::f(char (* const)[20][30][40])"},
{"?f@T@@QAEHQAY1BE@BO@$$CBD@Z", "public: int __thiscall T::f(char const (* const)[20][30])"},
}; };
int i, num_test = (sizeof(test)/sizeof(test[0])); int i, num_test = (sizeof(test)/sizeof(test[0]));
char* name; char* name;

View File

@ -24,6 +24,7 @@
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include "msvcrt.h" #include "msvcrt.h"
#include "wine/debug.h" #include "wine/debug.h"
@ -431,6 +432,31 @@ static BOOL get_modified_type(struct datatype_t *ct, struct parsed_symbol* sym,
unsigned mark = sym->stack.num; unsigned mark = sym->stack.num;
struct datatype_t sub_ct; struct datatype_t sub_ct;
/* multidimensional arrays */
if (*sym->current == 'Y')
{
const char* n1;
int num;
sym->current++;
if (!(n1 = get_number(sym))) return FALSE;
num = atoi(n1);
if (str_modif[0] == ' ' && !modifier)
str_modif++;
if (modifier)
{
str_modif = str_printf(sym, " (%s%s)", modifier, str_modif);
modifier = NULL;
}
else
str_modif = str_printf(sym, " (%s)", str_modif);
while (num--)
str_modif = str_printf(sym, "%s[%s]", str_modif, get_number(sym));
}
/* Recurse to get the referred-to type */ /* Recurse to get the referred-to type */
if (!demangle_datatype(sym, &sub_ct, pmt_ref, FALSE)) if (!demangle_datatype(sym, &sub_ct, pmt_ref, FALSE))
return FALSE; return FALSE;
@ -872,6 +898,17 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct,
ct->left = str_printf(sym, "`non-type-template-parameter%s'", ptr); ct->left = str_printf(sym, "`non-type-template-parameter%s'", ptr);
} }
break; break;
case '$':
if (*sym->current == 'C')
{
const char* ptr;
sym->current++;
if (!get_modifier(*sym->current++, &ptr)) goto done;
if (!demangle_datatype(sym, ct, pmt_ref, in_args)) goto done;
ct->left = str_printf(sym, "%s %s", ct->left, ptr);
}
break;
} }
break; break;
default : default :