Address more review comments for DIExpression::iterator.

- input_iterator
- define an operator->
- make constructors private were possible

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226967 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adrian Prantl
2015-01-23 23:40:47 +00:00
parent d2925c201e
commit eabbe07449
3 changed files with 44 additions and 33 deletions

View File

@ -170,6 +170,11 @@ DIExpression::iterator DIExpression::end() const {
return DIExpression::iterator();
}
const DIExpression::Operand &DIExpression::Operand::getNext() const {
iterator it(I);
return *(++it);
}
//===----------------------------------------------------------------------===//
// Predicates
//===----------------------------------------------------------------------===//
@ -606,13 +611,13 @@ bool DIExpression::Verify() const {
if (!(isExpression() && DbgNode->getNumOperands() == 1))
return false;
for (auto E = end(), I = begin(); I != E; ++I)
switch (*I) {
for (auto Op : *this)
switch (Op) {
case DW_OP_piece:
// Must be the last element of the expression.
return std::distance(I.getBase(), DIHeaderFieldIterator()) == 3;
return std::distance(Op.getBase(), DIHeaderFieldIterator()) == 3;
case DW_OP_plus:
if (std::distance(I.getBase(), DIHeaderFieldIterator()) < 2)
if (std::distance(Op.getBase(), DIHeaderFieldIterator()) < 2)
return false;
break;
case DW_OP_deref: