]> granicus.if.org Git - clang/commit
[-cxx-abi microsoft] Mangle large integral constants correctly
authorDavid Majnemer <david.majnemer@gmail.com>
Mon, 9 Dec 2013 10:44:32 +0000 (10:44 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Mon, 9 Dec 2013 10:44:32 +0000 (10:44 +0000)
commit24df0f449fa6723b709807f5c096311b13b4665c
treed9f21245f4b3a01b537b220b47a31e41527e046a
parentc8eb003596940a4166bd86631f8ed32580b55b2c
[-cxx-abi microsoft] Mangle large integral constants correctly

Testing has revealed that large integral constants (i.e. > INT64_MAX)
are always mangled as-if they are negative, even in places where it
would not make sense for them to be negative (like non-type template
parameters of type unsigned long long).

To address this, we change the way we model number mangling: always
mangle as-if our number is an int64_t.  This should result in correct
results when we have large unsigned numbers.

N.B.  Bizarrely, things that are 32-bit displacements like vbptr offsets
are mangled as-if they are unsigned 32-bit numbers.  This is a pretty
egregious waste of space, it would be a 4x savings if we could mangle it
like a signed 32-bit number.  Instead, we explicitly cast these
displacements to uint32_t and let the mangler proceed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196771 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/AST/Mangle.h
lib/AST/MicrosoftMangle.cpp
lib/CodeGen/MicrosoftCXXABI.cpp
test/CodeGenCXX/mangle-ms-templates.cpp