[Bitcode] Make writeComdats less strange
authorDavid Majnemer <david.majnemer@gmail.com>
Sun, 13 Mar 2016 08:01:03 +0000 (08:01 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Sun, 13 Mar 2016 08:01:03 +0000 (08:01 +0000)
It had a weird artificial limitation on the write side: the comdat name
couldn't be bigger than 2**16.  However, the reader had no such
limitation.  Make the reader and the writer agree.

llvm-svn: 263377

llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

index 84d0963..2e13958 100644 (file)
@@ -580,12 +580,12 @@ static unsigned getEncodedComdatSelectionKind(const Comdat &C) {
 }
 
 static void writeComdats(const ValueEnumerator &VE, BitstreamWriter &Stream) {
-  SmallVector<uint16_t, 64> Vals;
+  SmallVector<unsigned, 64> Vals;
   for (const Comdat *C : VE.getComdats()) {
     // COMDAT: [selection_kind, name]
     Vals.push_back(getEncodedComdatSelectionKind(*C));
     size_t Size = C->getName().size();
-    assert(isUInt<16>(Size));
+    assert(isUInt<32>(Size));
     Vals.push_back(Size);
     for (char Chr : C->getName())
       Vals.push_back((unsigned char)Chr);