1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00

More C++20 fixes

This commit is contained in:
xddxd 2021-04-18 15:08:30 +03:00 committed by Ivan
parent 5d8643e8eb
commit 4d88105d4a
5 changed files with 24 additions and 12 deletions

View File

@ -130,8 +130,12 @@ public:
Iterator& operator++() { ++I; return *this; }
Iterator operator++(int) { auto T = *this; ++I; return T; }
bool operator==(const ConstIterator& X) const { return I == X.I; }
bool operator!=(const ConstIterator& X) const { return I != X.I; }
friend bool operator==(const Iterator &X, const Iterator &Y) {
return X.I == Y.I;
}
friend bool operator!=(const Iterator &X, const Iterator &Y) {
return X.I != Y.I;
}
};
class ConstIterator {
@ -155,8 +159,12 @@ public:
ConstIterator& operator++() { ++I; return *this; }
ConstIterator operator++(int) { auto T = *this; ++I; return T; }
bool operator==(const ConstIterator& X) const { return I == X.I; }
bool operator!=(const ConstIterator& X) const { return I != X.I; }
friend bool operator==(const ConstIterator &X, const ConstIterator &Y) {
return X.I == Y.I;
}
friend bool operator!=(const ConstIterator &X, const ConstIterator &Y) {
return X.I != Y.I;
}
};
using iterator = Iterator;

View File

@ -731,10 +731,10 @@ namespace llvm {
++*this;
return res;
}
bool operator!=(const SingleLinkedListIterator<T> &Other) {
bool operator!=(const SingleLinkedListIterator<T> &Other) const {
return P != Other.operator->();
}
bool operator==(const SingleLinkedListIterator<T> &Other) {
bool operator==(const SingleLinkedListIterator<T> &Other) const {
return P == Other.operator->();
}
T &operator*() const {

View File

@ -50,8 +50,12 @@ public:
InstrProfIterator(InstrProfReader *Reader) : Reader(Reader) { Increment(); }
InstrProfIterator &operator++() { Increment(); return *this; }
bool operator==(const InstrProfIterator &RHS) { return Reader == RHS.Reader; }
bool operator!=(const InstrProfIterator &RHS) { return Reader != RHS.Reader; }
bool operator==(const InstrProfIterator &RHS) const {
return Reader == RHS.Reader;
}
bool operator!=(const InstrProfIterator &RHS) const {
return Reader != RHS.Reader;
}
value_type &operator*() { return Record; }
value_type *operator->() { return &Record; }
};

View File

@ -322,10 +322,10 @@ public:
return It;
}
bool operator==(const RepeatedSubstringIterator &Other) {
bool operator==(const RepeatedSubstringIterator &Other) const {
return N == Other.N;
}
bool operator!=(const RepeatedSubstringIterator &Other) {
bool operator!=(const RepeatedSubstringIterator &Other) const {
return !(*this == Other);
}

View File

@ -149,8 +149,8 @@ struct CHIArg {
// The instruction (VN) which uses the values flowing out of CHI.
Instruction *I;
bool operator==(const CHIArg &A) { return VN == A.VN; }
bool operator!=(const CHIArg &A) { return !(*this == A); }
bool operator==(const CHIArg &A) const { return VN == A.VN; }
bool operator!=(const CHIArg &A) const { return !(*this == A); }
};
using CHIIt = SmallVectorImpl<CHIArg>::iterator;