Commit Graph

8 Commits

Author SHA1 Message Date
Nico Weber bd0a790826 [ms] Fix mangling of char16_t and char32_t to be compatible with MSVC.
MSVC limits char16_t and char32_t string literal names to 32 bytes of character
data, not to 32 characters. wchar_t string literal names on the other hand can
get up to 64 bytes of character data.

https://reviews.llvm.org/D48781


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336097 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-02 12:31:20 +00:00
Reid Kleckner c45a02c8a8 [MS] Don't escape MS C++ names with \01
It is not needed after LLVM r327734. Now it will be easier to copy-paste
IR symbol names from Clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327738 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-16 20:36:49 +00:00
David Majnemer a144208ca4 MS ABI: Mangle u8 string literals
UTF8 string literals are mangled just like ASCII string literals.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222591 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-21 23:56:50 +00:00
David Majnemer cf426329e1 MS ABI: Mangle char16_t and char32_t string literals
We previously had support for char and wchar_t string literals.  VS 2015
added support for char16_t and char32_t.

String literals must be mangled in the MS ABI in order for them to be
deduplicated across translation units: their linker has no notion of
mergeable section.  Instead, they use the mangled name to make a COMDAT
for the string literal; the COMDAT will merge with other COMDATs in
other object files.

This allows strings in object files generated by clang to get merged
with strings in object files generated by MSVC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222564 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-21 19:57:25 +00:00
David Majnemer b1f71ddfcf MS ABI: Add a test for Unicode literals
This adds coverage for Unicode code points which are encoded with
non-zero values in the upper half of the wchar_t.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205251 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-31 21:46:09 +00:00
David Majnemer 7b7df1d85b MS ABI: Eliminate Duplicate Strings
COFF doesn't have mergeable sections so LLVM/clang's normal tactics for
string deduplication will not have any effect.

To remedy this we place each string inside it's own section and mark
the section as IMAGE_COMDAT_SELECT_ANY.  However, we can only do this if the
string has an external name that we can generate from it's contents.

To be compatible with MSVC, we must use their scheme.  Otherwise identical
strings in translation units from clang may not be deduplicated with
translation units in MSVC.

This fixes PR18248.

N.B. We will not attempt to do anything with a string literal which is not of
type 'char' or 'wchar_t' because their compiler does not support unicode
string literals as of this date.  Further, we avoid doing this if
either -fwritable-strings or -fsanitize=address are present.

This reverts commit r204596.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204675 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-24 21:43:36 +00:00
Timur Iskhodzhanov 03a3654a37 Revert r204562,204566,204586,204587 as they broke ASan on Windows
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204596 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-24 10:31:09 +00:00
David Majnemer 8003a11f68 MS ABI: Add tests, other cleanups for r204562
This commit cleans up a few accidents:
- Do not rely on the order in which StringLiteral lays out bytes.
- Use a more efficient mechanism for handling so-called
  "special-mappings" when mangling string literals.
- There is no need to allocate a copy of the mangled name.
- Add the test written for r204562.

Thanks to Richard Smith for pointing these out!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204586 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-24 05:53:08 +00:00