diff options
author | David Majnemer <david.majnemer@gmail.com> | 2013-12-09 04:28:34 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2013-12-09 04:28:34 +0000 |
commit | 048f90cc04a4914d6427cde22b3d185f344e8ca5 (patch) | |
tree | 92c16cc31116ffad5c7984c3e5ae22ca03d9c4e9 /clang/lib | |
parent | f6c8fe983b188dde5d4aaa14984c6c7e1208219b (diff) | |
download | bcm5719-llvm-048f90cc04a4914d6427cde22b3d185f344e8ca5.tar.gz bcm5719-llvm-048f90cc04a4914d6427cde22b3d185f344e8ca5.zip |
[-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".
llvm-svn: 196752
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/MicrosoftMangle.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index ae4fbf7f048..0599d8af813 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -1472,7 +1472,7 @@ void MicrosoftCXXNameMangler::mangleType(const UnresolvedUsingType *T, // <union-type> ::= T <name> // <struct-type> ::= U <name> // <class-type> ::= V <name> -// <enum-type> ::= W <size> <name> +// <enum-type> ::= W4 <name> void MicrosoftCXXNameMangler::mangleType(const EnumType *T, SourceRange) { mangleType(cast<TagType>(T)->getDecl()); } @@ -1492,9 +1492,7 @@ void MicrosoftCXXNameMangler::mangleType(const TagDecl *TD) { Out << 'V'; break; case TTK_Enum: - Out << 'W'; - Out << getASTContext().getTypeSizeInChars( - cast<EnumDecl>(TD)->getIntegerType()).getQuantity(); + Out << "W4"; break; } mangleName(TD); |