]> granicus.if.org Git - clang/commit
[-cxx-abi microsoft] Properly mangle enums
authorDavid Majnemer <david.majnemer@gmail.com>
Mon, 9 Dec 2013 04:28:34 +0000 (04:28 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Mon, 9 Dec 2013 04:28:34 +0000 (04:28 +0000)
commit4198db23b9822221986cd8f435fc4f76f9b07b49
tree23d5c4f80a0ce517525323a1192acd2589a9450a
parent8ab09ce854b99f382671e9aa6fada988963534ac
[-cxx-abi microsoft] Properly mangle enums

While testing our ability to mangle large constants (PR18175), I
incidentally discovered that we did not properly mangle enums correctly.

Previously, we would append the width of the enum in bytes after the
type-tag differentiator.

This would mean "enum : short" would be mangled as 'W2' while "enum :
char" would be mangled as 'W1'.  Upon testing this with several versions
of MSVC, I found that this did not match their behavior: they always use
'W4'.

N.B.  Quick testing uncovered that undname allows different numbers to
follow the 'W' in the following way:

'W0' -> "enum char"
'W1' -> "enum unsigned char"
'W2' -> "enum short"
'W3' -> "enum unsigned short"
'W4' -> "enum"
'W5' -> "enum unsigned int"
'W6' -> "enum long"
'W7' -> "enum unsigned long"

However this scheme appears abandoned, I cannot get MSVC to trigger it.
Furthermore, it's incomplete: it doesn't handle "bool" or "long long".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196752 91177308-0d34-0410-b5e6-96231b3b80d8
lib/AST/MicrosoftMangle.cpp
test/CodeGenCXX/mangle-ms.cpp