Skip to content

Commit

Permalink
[MC] Fix operator++ for various MCRegister iterators (#81250)
Browse files Browse the repository at this point in the history
Return *this from operator++. NFC, this just allows using ++Iter in
an expression in future patches.
  • Loading branch information
jayfoad committed Feb 9, 2024
1 parent a9e546c commit 0de859c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions llvm/include/llvm/MC/MCRegisterInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,10 @@ class MCSubRegIndexIterator {
bool isValid() const { return SRIter.isValid(); }

/// Moves to the next position.
void operator++() {
MCSubRegIndexIterator &operator++() {
++SRIter;
++SRIndex;
return *this;
}
};

Expand Down Expand Up @@ -688,9 +689,10 @@ class MCRegUnitMaskIterator {
bool isValid() const { return RUIter.isValid(); }

/// Moves to the next position.
void operator++() {
MCRegUnitMaskIterator &operator++() {
++MaskListIter;
++RUIter;
return *this;
}
};

Expand Down Expand Up @@ -728,10 +730,11 @@ class MCRegUnitRootIterator {
}

/// Preincrement to move to the next root register.
void operator++() {
MCRegUnitRootIterator &operator++() {
assert(isValid() && "Cannot move off the end of the list.");
Reg0 = Reg1;
Reg1 = 0;
return *this;
}
};

Expand Down Expand Up @@ -788,10 +791,11 @@ class MCRegAliasIterator {
}
}

void operator++() {
MCRegAliasIterator &operator++() {
assert(isValid() && "Cannot move off the end of the list.");
do advance();
while (!IncludeSelf && isValid() && *SI == Reg);
return *this;
}
};

Expand Down

0 comments on commit 0de859c

Please sign in to comment.