本文整理汇总了C++中AsmPrinter::emitDwarfStringOffset方法的典型用法代码示例。如果您正苦于以下问题:C++ AsmPrinter::emitDwarfStringOffset方法的具体用法?C++ AsmPrinter::emitDwarfStringOffset怎么用?C++ AsmPrinter::emitDwarfStringOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AsmPrinter
的用法示例。
在下文中一共展示了AsmPrinter::emitDwarfStringOffset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: emit
void DwarfStringPool::emit(AsmPrinter &Asm, MCSection *StrSection,
MCSection *OffsetSection, bool UseRelativeOffsets) {
if (Pool.empty())
return;
// Start the dwarf str section.
Asm.OutStreamer->SwitchSection(StrSection);
// Get all of the string pool entries and put them in an array by their ID so
// we can sort them.
SmallVector<const StringMapEntry<EntryTy> *, 64> Entries(Pool.size());
for (const auto &E : Pool)
Entries[E.getValue().Index] = &E;
for (const auto &Entry : Entries) {
assert(ShouldCreateSymbols == static_cast<bool>(Entry->getValue().Symbol) &&
"Mismatch between setting and entry");
// Emit a label for reference from debug information entries.
if (ShouldCreateSymbols)
Asm.OutStreamer->EmitLabel(Entry->getValue().Symbol);
// Emit the string itself with a terminating null byte.
Asm.OutStreamer->AddComment("string offset=" +
Twine(Entry->getValue().Offset));
Asm.OutStreamer->EmitBytes(
StringRef(Entry->getKeyData(), Entry->getKeyLength() + 1));
}
// If we've got an offset section go ahead and emit that now as well.
if (OffsetSection) {
Asm.OutStreamer->SwitchSection(OffsetSection);
unsigned size = 4; // FIXME: DWARF64 is 8.
for (const auto &Entry : Entries)
if (UseRelativeOffsets)
Asm.emitDwarfStringOffset(Entry->getValue());
else
Asm.OutStreamer->EmitIntValue(Entry->getValue().Offset, size);
}
}