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
This commit is contained in:
Adrian Prantl 2015-01-22 16:55:22 +00:00
parent 71676d492a
commit 8d8b891500

View File

@ -1406,27 +1406,23 @@ void DIVariable::printInternal(raw_ostream &OS) const {
} }
void DIExpression::printInternal(raw_ostream &OS) const { void DIExpression::printInternal(raw_ostream &OS) const {
for (unsigned I = 0; I < getNumElements(); ++I) { for (auto E = end(), I = begin(); I != E; ++I) {
uint64_t OpCode = getElement(I); uint64_t OpCode = *I;
OS << " [" << OperationEncodingString(OpCode); OS << " [" << OperationEncodingString(OpCode);
switch (OpCode) { switch (OpCode) {
case DW_OP_plus: { case DW_OP_plus: {
OS << " " << getElement(++I); OS << " " << I.getArg(1);
break; break;
} }
case DW_OP_piece: { case DW_OP_piece: {
unsigned Offset = getElement(++I); OS << " offset=" << I.getArg(1) << ", size=" << I.getArg(2);
unsigned Size = getElement(++I);
OS << " offset=" << Offset << ", size=" << Size;
break; break;
} }
case DW_OP_deref: case DW_OP_deref:
// No arguments. // No arguments.
break; break;
default: default:
// Else bail out early. This may be a line table entry. llvm_unreachable("unhandled operation");
OS << "Unknown]";
return;
} }
OS << "]"; OS << "]";
} }