[llvm] r339465 - [MS Demangler] Demangle cv qualifiers on template args.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 10 12:57:36 PDT 2018
Author: zturner
Date: Fri Aug 10 12:57:36 2018
New Revision: 339465
URL: http://llvm.org/viewvc/llvm-project?rev=339465&view=rev
Log:
[MS Demangler] Demangle cv qualifiers on template args.
Before we wouldn't properly demangle something like
Foo<const int>. Template args have a special escape sequence
'$$C' that is optional, but if it is present contains
qualifiers. So we need to check for this and only if it
present, demangle qualifiers before demangling the type.
With this fix, we re-enable some tests that were previously
marked FIXME.
Modified:
llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
llvm/trunk/test/Demangle/ms-templates.test
Modified: llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp?rev=339465&r1=339464&r2=339465&view=diff
==============================================================================
--- llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp (original)
+++ llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp Fri Aug 10 12:57:36 2018
@@ -2101,6 +2101,10 @@ Demangler::demangleTemplateParameterList
// Array
(*Current)->ParamType =
demangleType(MangledName, QualifierMangleMode::Drop);
+ } else if (MangledName.consumeFront("$$C")) {
+ // Type has qualifiers.
+ (*Current)->ParamType =
+ demangleType(MangledName, QualifierMangleMode::Mangle);
} else if (MangledName.startsWith("$1?")) {
MangledName.consumeFront("$1");
// Pointer to symbol
Modified: llvm/trunk/test/Demangle/ms-templates.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Demangle/ms-templates.test?rev=339465&r1=339464&r2=339465&view=diff
==============================================================================
--- llvm/trunk/test/Demangle/ms-templates.test (original)
+++ llvm/trunk/test/Demangle/ms-templates.test Fri Aug 10 12:57:36 2018
@@ -10,20 +10,20 @@
??0?$Class at VTypename@@@@QEAA at XZ
; CHECK: __cdecl Class<class Typename>::Class<class Typename>(void)
-; ??0?$Class@$$CBVTypename@@@@QAE at XZ
-; FIXME: __thiscall Class<class Typename const>::Class<class Typename const>(void)
-; ??0?$Class@$$CBVTypename@@@@QEAA at XZ
-; FIXME: __thiscall Class<class Typename const>::Class<class Typename const>(void)
+??0?$Class@$$CBVTypename@@@@QAE at XZ
+; CHECK: __thiscall Class<class Typename const>::Class<class Typename const>(void)
+??0?$Class@$$CBVTypename@@@@QEAA at XZ
+; CHECK: __cdecl Class<class Typename const>::Class<class Typename const>(void)
-; ??0?$Class@$$CCVTypename@@@@QAE at XZ
-; FIXME: __thiscall Class<class Typename volatile>::Class<class Typename volatile>(void)
-; ??0?$Class@$$CCVTypename@@@@QEAA at XZ
-; FIXME: __thiscall Class<class Typename volatile>::Class<class Typename volatile>(void)
+??0?$Class@$$CCVTypename@@@@QAE at XZ
+; CHECK: __thiscall Class<class Typename volatile>::Class<class Typename volatile>(void)
+??0?$Class@$$CCVTypename@@@@QEAA at XZ
+; CHECK: __cdecl Class<class Typename volatile>::Class<class Typename volatile>(void)
-; ??0?$Class@$$CDVTypename@@@@QAE at XZ
-; FIXME: __thiscall Class<class Typename const volatile>::Class<class Typename const volatile>(void)
-; ??0?$Class@$$CDVTypename@@@@QEAA at XZ
-; FIXME: __thiscall Class<class Typename const volatile>::Class<class Typename const volatile>(void)
+??0?$Class@$$CDVTypename@@@@QAE at XZ
+; CHECK: __thiscall Class<class Typename const volatile>::Class<class Typename const volatile>(void)
+??0?$Class@$$CDVTypename@@@@QEAA at XZ
+; CHECK: __cdecl Class<class Typename const volatile>::Class<class Typename const volatile>(void)
??0?$Class at V?$Nested at VTypename@@@@@@QAE at XZ
; CHECK: __thiscall Class<class Nested<class Typename>>::Class<class Nested<class Typename>>(void)
More information about the llvm-commits
mailing list