-void DwarfUnit::addIndexedString(DIE &Die, dwarf::Attribute Attribute,
- StringRef String) {
- unsigned idx = DU->getStringPool().getIndex(*Asm, String);
- DIEValue *Value = new (DIEValueAllocator) DIEInteger(idx);
- DIEValue *Str = new (DIEValueAllocator) DIEString(Value, String);
- Die.addValue(Attribute, dwarf::DW_FORM_GNU_str_index, Str);
-}
-
-/// addLocalString - Add a string attribute data and value. This is guaranteed
-/// to be in the local string pool instead of indirected.
-void DwarfUnit::addLocalString(DIE &Die, dwarf::Attribute Attribute,
- StringRef String) {
- const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
- MCSymbol *Symb = DU->getStringPool().getSymbol(*Asm, String);
- DIEValue *Value;
- if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
- Value = new (DIEValueAllocator) DIELabel(Symb);
- else
- Value = new (DIEValueAllocator)
- DIEDelta(Symb, TLOF.getDwarfStrSection()->getBeginSymbol());
- DIEValue *Str = new (DIEValueAllocator) DIEString(Value, String);
- Die.addValue(Attribute, dwarf::DW_FORM_strp, Str);
-}
-
-/// addLabel - Add a Dwarf label attribute data and value.
-///
-void DwarfUnit::addLabel(DIE &Die, dwarf::Attribute Attribute, dwarf::Form Form,
- const MCSymbol *Label) {
- DIEValue *Value = new (DIEValueAllocator) DIELabel(Label);
- Die.addValue(Attribute, Form, Value);
+DIE::value_iterator DwarfUnit::addLabel(DIE &Die, dwarf::Attribute Attribute,
+ dwarf::Form Form,
+ const MCSymbol *Label) {
+ return Die.addValue(DIEValueAllocator, Attribute, Form, DIELabel(Label));