[llvm] r229572 - AsmPrinter: Take range in DwarfExpression::AddExpression(), NFC
Duncan P. N. Exon Smith
dexonsmith at apple.com
Tue Feb 17 14:30:57 PST 2015
Author: dexonsmith
Date: Tue Feb 17 16:30:56 2015
New Revision: 229572
URL: http://llvm.org/viewvc/llvm-project?rev=229572&view=rev
Log:
AsmPrinter: Take range in DwarfExpression::AddExpression(), NFC
Previously `DwarfExpression::AddExpression()` relied on
default-constructing the end iterators for `DIExpression` -- once the
operands are represented explicitly via `MDExpression` (instead of via
the strange `StringRef` navigator in `DIHeaderIterator`) this won't
work. Explicitly take an iterator for the end of the range.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.h
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=229572&r1=229571&r2=229572&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Tue Feb 17 16:30:56 2015
@@ -527,8 +527,11 @@ DwarfCompileUnit::constructVariableDIEIm
const TargetFrameLowering *TFI =
Asm->TM.getSubtargetImpl()->getFrameLowering();
int Offset = TFI->getFrameIndexReference(*Asm->MF, FI, FrameReg);
+ assert(Expr != DV.getExpression().end() &&
+ "Wrong number of expressions");
DwarfExpr.AddMachineRegIndirect(FrameReg, Offset);
- DwarfExpr.AddExpression(*(Expr++));
+ DwarfExpr.AddExpression(Expr->begin(), Expr->end());
+ ++Expr;
}
addBlock(*VariableDie, dwarf::DW_AT_location, Loc);
@@ -780,7 +783,7 @@ void DwarfCompileUnit::addComplexAddress
ValidReg = DwarfExpr.AddMachineRegIndirect(Location.getReg(),
Location.getOffset());
if (ValidReg)
- DwarfExpr.AddExpression(Expr);
+ DwarfExpr.AddExpression(Expr.begin(), Expr.end());
} else
ValidReg = DwarfExpr.AddMachineRegExpression(Expr, Location.getReg());
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=229572&r1=229571&r2=229572&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Feb 17 16:30:56 2015
@@ -1725,7 +1725,7 @@ void DwarfDebug::emitDebugLocValue(ByteS
// Complex address entry.
if (Loc.getOffset()) {
DwarfExpr.AddMachineRegIndirect(Loc.getReg(), Loc.getOffset());
- DwarfExpr.AddExpression(Expr, PieceOffsetInBits);
+ DwarfExpr.AddExpression(Expr.begin(), Expr.end(), PieceOffsetInBits);
} else
DwarfExpr.AddMachineRegExpression(Expr, Loc.getReg(),
PieceOffsetInBits);
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.cpp?rev=229572&r1=229571&r2=229572&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.cpp Tue Feb 17 16:30:56 2015
@@ -240,13 +240,14 @@ bool DwarfExpression::AddMachineRegExpre
return false;
// Emit remaining elements of the expression.
- AddExpression(I, PieceOffsetInBits);
+ AddExpression(I, Expr.end(), PieceOffsetInBits);
return true;
}
void DwarfExpression::AddExpression(DIExpression::iterator I,
+ DIExpression::iterator E,
unsigned PieceOffsetInBits) {
- for (; I != DIExpression::iterator(); ++I) {
+ for (; I != E; ++I) {
switch (*I) {
case dwarf::DW_OP_bit_piece: {
unsigned OffsetInBits = I->getArg(1);
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.h?rev=229572&r1=229571&r2=229572&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.h Tue Feb 17 16:30:56 2015
@@ -96,7 +96,8 @@ public:
/// Emit a the operations remaining the DIExpressionIterator I.
/// \param PieceOffsetInBits If this is one piece out of a fragmented
/// location, this is the offset of the piece inside the entire variable.
- void AddExpression(DIExpression::iterator I, unsigned PieceOffsetInBits = 0);
+ void AddExpression(DIExpression::iterator I, DIExpression::iterator E,
+ unsigned PieceOffsetInBits = 0);
};
/// DwarfExpression implementation for .debug_loc entries.
More information about the llvm-commits
mailing list