From 2e65b3a418ead973dece7a3fb74f9b31f02f4aa4 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Sat, 9 Jan 2021 09:43:37 +0300 Subject: [PATCH] Fix possible compilation issue with gcc-11 --- include/llvm/CodeGen/LiveInterval.h | 10 +++++----- include/llvm/Support/BinaryStreamArray.h | 20 +++++++++---------- .../LiveDebugValues/VarLocBasedImpl.cpp | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/llvm/CodeGen/LiveInterval.h b/include/llvm/CodeGen/LiveInterval.h index c2b158ac1b7..8d463bbe846 100644 --- a/include/llvm/CodeGen/LiveInterval.h +++ b/include/llvm/CodeGen/LiveInterval.h @@ -724,21 +724,21 @@ namespace llvm { T *P; public: - SingleLinkedListIterator(T *P) : P(P) {} + SingleLinkedListIterator(T *P) : P(P) {} - SingleLinkedListIterator &operator++() { + SingleLinkedListIterator &operator++() { P = P->Next; return *this; } - SingleLinkedListIterator operator++(int) { + SingleLinkedListIterator operator++(int) { SingleLinkedListIterator res = *this; ++*this; return res; } - bool operator!=(const SingleLinkedListIterator &Other) const { + bool operator!=(const SingleLinkedListIterator &Other) const { return P != Other.operator->(); } - bool operator==(const SingleLinkedListIterator &Other) const { + bool operator==(const SingleLinkedListIterator &Other) const { return P == Other.operator->(); } T &operator*() const { diff --git a/include/llvm/Support/BinaryStreamArray.h b/include/llvm/Support/BinaryStreamArray.h index 148ab85169f..1bc33d13221 100644 --- a/include/llvm/Support/BinaryStreamArray.h +++ b/include/llvm/Support/BinaryStreamArray.h @@ -270,11 +270,11 @@ public: assert(Stream.getLength() % sizeof(T) == 0); } - bool operator==(const FixedStreamArray &Other) const { + bool operator==(const FixedStreamArray &Other) const { return Stream == Other.Stream; } - bool operator!=(const FixedStreamArray &Other) const { + bool operator!=(const FixedStreamArray &Other) const { return !(*this == Other); } @@ -328,10 +328,10 @@ public: FixedStreamArrayIterator(const FixedStreamArray &Array, uint32_t Index) : Array(Array), Index(Index) {} - FixedStreamArrayIterator(const FixedStreamArrayIterator &Other) + FixedStreamArrayIterator(const FixedStreamArrayIterator &Other) : Array(Other.Array), Index(Other.Index) {} - FixedStreamArrayIterator & - operator=(const FixedStreamArrayIterator &Other) { + FixedStreamArrayIterator& + operator=(const FixedStreamArrayIterator &Other) { Array = Other.Array; Index = Other.Index; return *this; @@ -340,29 +340,29 @@ public: const T &operator*() const { return Array[Index]; } const T &operator*() { return Array[Index]; } - bool operator==(const FixedStreamArrayIterator &R) const { + bool operator==(const FixedStreamArrayIterator &R) const { assert(Array == R.Array); return (Index == R.Index) && (Array == R.Array); } - FixedStreamArrayIterator &operator+=(std::ptrdiff_t N) { + FixedStreamArrayIterator &operator+=(std::ptrdiff_t N) { Index += N; return *this; } - FixedStreamArrayIterator &operator-=(std::ptrdiff_t N) { + FixedStreamArrayIterator &operator-=(std::ptrdiff_t N) { assert(std::ptrdiff_t(Index) >= N); Index -= N; return *this; } - std::ptrdiff_t operator-(const FixedStreamArrayIterator &R) const { + std::ptrdiff_t operator-(const FixedStreamArrayIterator &R) const { assert(Array == R.Array); assert(Index >= R.Index); return Index - R.Index; } - bool operator<(const FixedStreamArrayIterator &RHS) const { + bool operator<(const FixedStreamArrayIterator &RHS) const { assert(Array == RHS.Array); return Index < RHS.Index; } diff --git a/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp b/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp index 1e6d65c1895..65176ac1574 100644 --- a/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp +++ b/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp @@ -626,7 +626,7 @@ private: unsigned getRegIdx(Register Reg) const { for (unsigned Idx = 0; Idx < Locs.size(); ++Idx) if (Locs[Idx].Kind == MachineLocKind::RegisterKind && - Locs[Idx].Value.RegNo == Reg) + llvm::Register(Locs[Idx].Value.RegNo) == Reg) return Idx; llvm_unreachable("Could not find given Reg in Locs"); }