diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-02-17 22:30:56 +0000 |
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-02-17 22:30:56 +0000 |
| commit | 57bab0bc97d1e6ff118fb2f3a2a6856cbedff1de (patch) | |
| tree | f4b956c4e0629db481c1ea19f9d9558c1de0ac80 | |
| parent | 1d89a02abbaa48745066a3c3eabe2fbaa2194def (diff) | |
| download | bcm5719-llvm-57bab0bc97d1e6ff118fb2f3a2a6856cbedff1de.tar.gz bcm5719-llvm-57bab0bc97d1e6ff118fb2f3a2a6856cbedff1de.zip | |
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.
llvm-svn: 229572
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 7 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp | 5 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h | 3 |
4 files changed, 11 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 81f2329657b..a620ebba241 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -527,8 +527,11 @@ DwarfCompileUnit::constructVariableDIEImpl(const DbgVariable &DV, 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(const DbgVariable &DV, DIE &Die, 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()); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index e214591a1fd..4aa12ed2506 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1725,7 +1725,7 @@ void DwarfDebug::emitDebugLocValue(ByteStreamer &Streamer, // 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); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp index 3d1e3822c51..fcab067424e 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp @@ -240,13 +240,14 @@ bool DwarfExpression::AddMachineRegExpression(DIExpression Expr, 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); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h index d4062e8e3bc..b90b7b682ac 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h @@ -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. |

