[llvm-bugs] [Bug 39593] New: Bikeshedding about the demangling of string literals in the ms demangler

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 8 13:41:22 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=39593

            Bug ID: 39593
           Summary: Bikeshedding about the demangling of string literals
                    in the ms demangler
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: llvm-bugs at lists.llvm.org

llvm-undname has does a great job demangling strings. It demangles e.g.
'??_C at _01NOFIACDB@w?$AA@' to `const char * {"w"}` while undname only says
"`string'".

A while ago I asked zturner if I could send a patch to change the demangling to
`const char * {"w"}` since the symbol really _is_ the string and not a pointer
to it.

But when I wrote the patch, I thought maybe we should omit the braces too.

And then I thought the type is redundant with the "" / u"" / U"" too.

zturner, what do you think about making the demangling of the string above just
`"w"`?


In patch form, the proposal:

Index: lib/Demangle/MicrosoftDemangleNodes.cpp
===================================================================
--- lib/Demangle/MicrosoftDemangleNodes.cpp     (revision 344668)
+++ lib/Demangle/MicrosoftDemangleNodes.cpp     (working copy)
@@ -161,22 +161,21 @@
                                       OutputFlags Flags) const {
   switch (Char) {
   case CharKind::Wchar:
-    OS << "const wchar_t * {L\"";
+    OS << "L\"";
     break;
   case CharKind::Char:
-    OS << "const char * {\"";
+    OS << "\"";
     break;
   case CharKind::Char16:
-    OS << "const char16_t * {u\"";
+    OS << "u\"";
     break;
   case CharKind::Char32:
-    OS << "const char32_t * {U\"";
+    OS << "\"";
     break;
   }
   OS << DecodedString << "\"";
   if (IsTruncated)
     OS << "...";
-  OS << "}";
 }

 void IntegerLiteralNode::output(OutputStream &OS, OutputFlags Flags) const {

(needs updating a few tests too)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181108/1f6faa59/attachment.html>


More information about the llvm-bugs mailing list