[llvm] r226836 - Rewrite DIExpression::printInternal() to use the iterator interface.
Adrian Prantl
aprantl at apple.com
Thu Jan 22 08:55:22 PST 2015
Author: adrian
Date: Thu Jan 22 10:55:22 2015
New Revision: 226836
URL: http://llvm.org/viewvc/llvm-project?rev=226836&view=rev
Log:
Rewrite DIExpression::printInternal() to use the iterator interface.
NFC.
Modified:
llvm/trunk/lib/IR/DebugInfo.cpp
Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=226836&r1=226835&r2=226836&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Thu Jan 22 10:55:22 2015
@@ -1406,27 +1406,23 @@ void DIVariable::printInternal(raw_ostre
}
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 << "]";
}
More information about the llvm-commits
mailing list