Index: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h =================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h @@ -508,7 +508,12 @@ /// When possible, emit a DwarfStringPool section offset without any /// relocations, and without using the symbol. Otherwise, defers to \a /// emitDwarfSymbolReference(). - void emitDwarfStringOffset(DwarfStringPoolEntryRef S) const; + void emitDwarfStringOffset(DwarfStringPoolEntry S) const; + + /// Emit the 4-byte offset of a string from the start of its section. + void emitDwarfStringOffset(DwarfStringPoolEntryRef S) const { + emitDwarfStringOffset(S.getEntry()); + } /// Get the value for DW_AT_APPLE_isa. Zero if no isa encoding specified. virtual unsigned getISAEncoding() { return 0; } Index: llvm/trunk/include/llvm/CodeGen/DwarfStringPoolEntry.h =================================================================== --- llvm/trunk/include/llvm/CodeGen/DwarfStringPoolEntry.h +++ llvm/trunk/include/llvm/CodeGen/DwarfStringPoolEntry.h @@ -41,6 +41,8 @@ unsigned getOffset() const { return I->second.Offset; } unsigned getIndex() const { return I->second.Index; } StringRef getString() const { return I->first(); } + /// Return the entire string pool entry for convenience. + DwarfStringPoolEntry getEntry() const { return I->getValue(); } bool operator==(const DwarfStringPoolEntryRef &X) const { return I == X.I; } bool operator!=(const DwarfStringPoolEntryRef &X) const { return I != X.I; } Index: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp =================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp @@ -167,14 +167,15 @@ EmitLabelDifference(Label, Label->getSection().getBeginSymbol(), 4); } -void AsmPrinter::emitDwarfStringOffset(DwarfStringPoolEntryRef S) const { +void AsmPrinter::emitDwarfStringOffset(DwarfStringPoolEntry S) const { if (MAI->doesDwarfUseRelocationsAcrossSections()) { - emitDwarfSymbolReference(S.getSymbol()); + assert(S.Symbol && "No symbol available"); + emitDwarfSymbolReference(S.Symbol); return; } // Just emit the offset directly; no need for symbol math. - EmitInt32(S.getOffset()); + EmitInt32(S.Offset); } //===----------------------------------------------------------------------===//