<html>
<head>
<base href="http://llvm.org/bugs/" />
</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 --- - [-cxx-abi microsoft] Mange string literals properly"
href="http://llvm.org/bugs/show_bug.cgi?id=18248">18248</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[-cxx-abi microsoft] Mange string literals properly
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>david.majnemer@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>consider:
inline char const *g() {
static char *b = "\00\00\00";
static wchar_t const *c = L"\00";
return c ? 0 : b;
}
const char *h() { return g(); }
MSVC mangles the literal for 'b' as ??_C@_03NOLLCAOD@?$AA?$AA?$AA?$AA@
and the literal for 'c' as ??_C@_13NOLLCAOD@?$AA?$AA?$AA?$AA@
subtracting 'P' from 'NOLLCAOD' for each character and converting to hex yields
0xdebb20e3.
This appears to be a crc:
<span class="quote">>>> hex(crcmod.mkCrcFun(0x104C11DB7, initCrc=0xffffffff, rev=True, xorOut=0)("\00\00\00\00"))</span >
'0xdebb20e3L'
Here is my best bet for it's mangling:
<char-type> ::= 0 # char
::= 1 # wchar_t
::= ??? # char16_t/char32_t will need a mangling too...
<literal-length> ::= <non-negative integer> # the length of the literal
<encoded-crc> ::= <hex digit>+ @ # crc of the literal including null-terminator
<encoded-string> ::= <simple character> # uninteresting character
::= <hex digit> <hex digit> # these two nibbles encode the
byte for the character
<literal> ::= ?? _C @ _ <char-type> <literal-length> <encoded-crc>
<encoded-string></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>