<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Bikeshedding about the demangling of string literals in the ms demangler"
   href="https://bugs.llvm.org/show_bug.cgi?id=39593">39593</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Bikeshedding about the demangling of string literals in the ms demangler
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nicolasweber@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>llvm-undname has does a great job demangling strings. It demangles e.g.
'??_C@_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)</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>