1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

Add support for comdats with names larger than 256 characters.

llvm-svn: 226012
This commit is contained in:
Rafael Espindola 2015-01-14 18:25:45 +00:00
parent 9eab633d6d
commit ee0c3b182d
2 changed files with 13 additions and 2 deletions

View File

@ -549,11 +549,13 @@ static unsigned getEncodedComdatSelectionKind(const Comdat &C) {
} }
static void writeComdats(const ValueEnumerator &VE, BitstreamWriter &Stream) { static void writeComdats(const ValueEnumerator &VE, BitstreamWriter &Stream) {
SmallVector<uint8_t, 64> Vals; SmallVector<uint16_t, 64> Vals;
for (const Comdat *C : VE.getComdats()) { for (const Comdat *C : VE.getComdats()) {
// COMDAT: [selection_kind, name] // COMDAT: [selection_kind, name]
Vals.push_back(getEncodedComdatSelectionKind(*C)); Vals.push_back(getEncodedComdatSelectionKind(*C));
Vals.push_back(C->getName().size()); size_t Size = C->getName().size();
assert(isUInt<16>(Size));
Vals.push_back(Size);
for (char Chr : C->getName()) for (char Chr : C->getName())
Vals.push_back((unsigned char)Chr); Vals.push_back((unsigned char)Chr);
Stream.EmitRecord(bitc::MODULE_CODE_COMDAT, Vals, /*AbbrevToUse=*/0); Stream.EmitRecord(bitc::MODULE_CODE_COMDAT, Vals, /*AbbrevToUse=*/0);

View File

@ -0,0 +1,9 @@
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
$_ZSt9make_pairIN4llvm16DenseMapIteratorINS0_14PointerIntPairIPKNS0_5ValueELj1ENS0_21PointerLikeTypeTraitsIS5_EEEENS0_19NonLocalPointerInfoENS0_12DenseMapInfoIS8_EENS0_12DenseMapPairIS9_EEEEbESt4pairINSt17__decay_and_stripIT_E6__typeENSG_IT0_E6__typeEESH_SK_ = comdat any
; CHECK: $_ZSt9make_pairIN4llvm16DenseMapIteratorINS0_14PointerIntPairIPKNS0_5ValueELj1ENS0_21PointerLikeTypeTraitsIS5_EEEENS0_19NonLocalPointerInfoENS0_12DenseMapInfoIS8_EENS0_12DenseMapPairIS9_EEEEbESt4pairINSt17__decay_and_stripIT_E6__typeENSG_IT0_E6__typeEESH_SK_ = comdat any
define void @_ZSt9make_pairIN4llvm16DenseMapIteratorINS0_14PointerIntPairIPKNS0_5ValueELj1ENS0_21PointerLikeTypeTraitsIS5_EEEENS0_19NonLocalPointerInfoENS0_12DenseMapInfoIS8_EENS0_12DenseMapPairIS9_EEEEbESt4pairINSt17__decay_and_stripIT_E6__typeENSG_IT0_E6__typeEESH_SK_() comdat {
ret void
}