From 8d8b8915002f4154876106433be6764c78f14411 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Thu, 22 Jan 2015 16:55:22 +0000 Subject: [PATCH] Rewrite DIExpression::printInternal() to use the iterator interface. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226836 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/DebugInfo.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp index da77c9bb6f9..4a7bc67ab58 100644 --- a/lib/IR/DebugInfo.cpp +++ b/lib/IR/DebugInfo.cpp @@ -1406,27 +1406,23 @@ void DIVariable::printInternal(raw_ostream &OS) const { } void DIExpression::printInternal(raw_ostream &OS) const { - for (unsigned I = 0; I < getNumElements(); ++I) { - uint64_t OpCode = getElement(I); + for (auto E = end(), I = begin(); I != E; ++I) { + uint64_t OpCode = *I; OS << " [" << OperationEncodingString(OpCode); switch (OpCode) { case DW_OP_plus: { - OS << " " << getElement(++I); + OS << " " << I.getArg(1); break; } case DW_OP_piece: { - unsigned Offset = getElement(++I); - unsigned Size = getElement(++I); - OS << " offset=" << Offset << ", size=" << Size; + OS << " offset=" << I.getArg(1) << ", size=" << I.getArg(2); break; } case DW_OP_deref: // No arguments. break; default: - // Else bail out early. This may be a line table entry. - OS << "Unknown]"; - return; + llvm_unreachable("unhandled operation"); } OS << "]"; } -- 2.34.1