Eric Pouech : msvcrt: Fix and cleanup undecoration of templatized functions and methods.

Alexandre Julliard julliard at winehq.org
Mon Jul 18 15:45:50 CDT 2022


Module: wine
Branch: master
Commit: 464d049149a2bfb658c727bee86157f15fe35d96
URL:    https://gitlab.winehq.org/wine/wine/-/commit/464d049149a2bfb658c727bee86157f15fe35d96

Author: Eric Pouech <eric.pouech at gmail.com>
Date:   Sat Jul 16 12:20:25 2022 +0200

msvcrt: Fix and cleanup undecoration of templatized functions and methods.

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>

---

 dlls/msvcrt/tests/cpp.c |  1 +
 dlls/msvcrt/undname.c   | 18 +++++++++---------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/dlls/msvcrt/tests/cpp.c b/dlls/msvcrt/tests/cpp.c
index 8c6b059e788..c97669ffc72 100644
--- a/dlls/msvcrt/tests/cpp.c
+++ b/dlls/msvcrt/tests/cpp.c
@@ -1292,6 +1292,7 @@ static void test_demangle(void)
 /* 130 */ {"??_E?$TStrArray@$$BY0BAA at D$0BA@@@UAEPAXI at Z",
            "public: virtual void * __thiscall TStrArray<char [256],16>::`vector deleting destructor'(unsigned int)"},
 /* 131 */ {"??_R0?AVCC at DD@@@8", "class DD::CC `RTTI Type Descriptor'"},
+/* 132 */ {"??$meth at FD@DD at CC@@QAE_NK at Z", "public: bool __thiscall CC::DD::meth<short,char>(unsigned long)"},
     };
     int i, num_test = ARRAY_SIZE(test);
     char* name;
diff --git a/dlls/msvcrt/undname.c b/dlls/msvcrt/undname.c
index b07fbeb068e..a19f374016a 100644
--- a/dlls/msvcrt/undname.c
+++ b/dlls/msvcrt/undname.c
@@ -1368,13 +1368,13 @@ static BOOL symbol_demangle(struct parsed_symbol* sym)
     sym->current++;
 
     /* Then function name or operator code */
-    if (*sym->current == '?' && (sym->current[1] != '$' || sym->current[2] == '?'))
+    if (*sym->current == '?')
     {
         const char* function_name = NULL;
 
-        if (sym->current[1] == '$')
+        if (sym->current[1] == '$' && sym->current[2] == '?')
         {
-            do_after = 6;
+            do_after = 5;
             sym->current += 2;
         }
 
@@ -1506,6 +1506,11 @@ static BOOL symbol_demangle(struct parsed_symbol* sym)
                 return FALSE;
             }
             break;
+        case '$':
+            sym->current++;
+            if (!(function_name = get_template_name(sym))) goto done;
+            --sym->current;
+            break;
         default:
             /* FIXME: Other operators */
             ERR("Unknown operator: %c\n", *sym->current);
@@ -1522,7 +1527,7 @@ static BOOL symbol_demangle(struct parsed_symbol* sym)
             sym->result = (char*)function_name;
             ret = TRUE;
             goto done;
-        case 6:
+        case 5:
             {
                 char *args;
                 struct array array_pmt;
@@ -1547,8 +1552,6 @@ static BOOL symbol_demangle(struct parsed_symbol* sym)
         ret = (sym->result = get_template_name(sym)) != NULL;
         goto done;
     }
-    else if (*sym->current == '?' && sym->current[1] == '$')
-        do_after = 5;
 
     /* Either a class name, or '@' if the symbol is not a class member */
     switch (*sym->current)
@@ -1577,9 +1580,6 @@ static BOOL symbol_demangle(struct parsed_symbol* sym)
     case 3:
         sym->flags &= ~UNDNAME_NO_FUNCTION_RETURNS;
         break;
-    case 5:
-        sym->names.start++;
-        break;
     }
 
     /* Function/Data type and access level */




More information about the wine-cvs mailing list