llvm.org GIT mirror llvm / b3f7c61
Do not use abbrev while writing NamedMDNode name. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77637 91177308-0d34-0410-b5e6-96231b3b80d8 Devang Patel 10 years ago
2 changed file(s) with 11 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
494494 const ValueEnumerator::ValueList &Vals = VE.getValues();
495495 bool StartedMetadataBlock = false;
496496 unsigned MDSAbbrev = 0;
497 unsigned String8Abbrev = 0;
498497 SmallVector Record;
499498 for (unsigned i = 0, e = Vals.size(); i != e; ++i) {
500499
529528 if (!StartedMetadataBlock) {
530529 Stream.EnterSubblock(bitc::METADATA_BLOCK_ID, 3);
531530 StartedMetadataBlock = true;
532 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
533 Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_STRING));
534 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
535 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8));
536 String8Abbrev = Stream.EmitAbbrev(Abbv);
537531 }
538532
539533 // Write name.
540 const char *StrBegin = NMD->getName().data();
541 for (unsigned i = 0, e = NMD->getName().size(); i != e; ++i)
534 std::string Str = NMD->getNameStr();
535 const char *StrBegin = Str.c_str();
536 for (unsigned i = 0, e = Str.length(); i != e; ++i)
542537 Record.push_back(StrBegin[i]);
543 Stream.EmitRecord(bitc::METADATA_NAME, Record, String8Abbrev);
538 Stream.EmitRecord(bitc::METADATA_NAME, Record, 0/*TODO*/);
544539 Record.clear();
545540
546541 // Write named metadata elements.
0 ; RUN: llvm-as < %s -f -o /dev/null
1 ; PR4654
2
3
4 @foo = constant i1 false
5 !0 = metadata !{i1 false}
6 !a = !{!0}