Skip to content

Commit 0de859c

Browse files
authored
[MC] Fix operator++ for various MCRegister iterators (#81250)
Return *this from operator++. NFC, this just allows using ++Iter in an expression in future patches.
1 parent a9e546c commit 0de859c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

llvm/include/llvm/MC/MCRegisterInfo.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -572,9 +572,10 @@ class MCSubRegIndexIterator {
572572
bool isValid() const { return SRIter.isValid(); }
573573

574574
/// Moves to the next position.
575-
void operator++() {
575+
MCSubRegIndexIterator &operator++() {
576576
++SRIter;
577577
++SRIndex;
578+
return *this;
578579
}
579580
};
580581

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

690691
/// Moves to the next position.
691-
void operator++() {
692+
MCRegUnitMaskIterator &operator++() {
692693
++MaskListIter;
693694
++RUIter;
695+
return *this;
694696
}
695697
};
696698

@@ -728,10 +730,11 @@ class MCRegUnitRootIterator {
728730
}
729731

730732
/// Preincrement to move to the next root register.
731-
void operator++() {
733+
MCRegUnitRootIterator &operator++() {
732734
assert(isValid() && "Cannot move off the end of the list.");
733735
Reg0 = Reg1;
734736
Reg1 = 0;
737+
return *this;
735738
}
736739
};
737740

@@ -788,10 +791,11 @@ class MCRegAliasIterator {
788791
}
789792
}
790793

791-
void operator++() {
794+
MCRegAliasIterator &operator++() {
792795
assert(isValid() && "Cannot move off the end of the list.");
793796
do advance();
794797
while (!IncludeSelf && isValid() && *SI == Reg);
798+
return *this;
795799
}
796800
};
797801

0 commit comments

Comments
 (0)