Move the accessor functions from DIExpression::iterator into a wrapper

DIExpression::Operand, so we can write range-based for loops.

Thanks to David Blaikie for the idea.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226939 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adrian Prantl
2015-01-23 21:24:41 +00:00
parent d4c7c06a39
commit d5dc4cff6a
3 changed files with 30 additions and 21 deletions

View File

@ -1406,16 +1406,15 @@ void DIVariable::printInternal(raw_ostream &OS) const {
}
void DIExpression::printInternal(raw_ostream &OS) const {
for (auto E = end(), I = begin(); I != E; ++I) {
uint64_t OpCode = *I;
OS << " [" << OperationEncodingString(OpCode);
switch (OpCode) {
for (auto Op : *this) {
OS << " [" << OperationEncodingString(Op);
switch (Op) {
case DW_OP_plus: {
OS << " " << I.getArg(1);
OS << " " << Op.getArg(1);
break;
}
case DW_OP_piece: {
OS << " offset=" << I.getArg(1) << ", size=" << I.getArg(2);
OS << " offset=" << Op.getArg(1) << ", size=" << Op.getArg(2);
break;
}
case DW_OP_deref: