Skip to content

Commit a3f4517

Browse files
committed
Move member comparison operators to free functions
1 parent a08bf30 commit a3f4517

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,13 @@ static uint64_t getFragmentOffsetInBits(const DIExpression &Expr) {
262262
return Fragment ? Fragment->OffsetInBits : 0;
263263
}
264264

265-
bool FrameIndexExpr::operator<(const FrameIndexExpr &Other) const {
266-
return getFragmentOffsetInBits(*Expr) < getFragmentOffsetInBits(*Other.Expr);
265+
bool llvm::operator<(const FrameIndexExpr &LHS, const FrameIndexExpr &RHS) {
266+
return getFragmentOffsetInBits(*LHS.Expr) <
267+
getFragmentOffsetInBits(*RHS.Expr);
267268
}
268269

269-
bool EntryValueInfo::operator<(const EntryValueInfo &Other) const {
270-
return getFragmentOffsetInBits(Expr) < getFragmentOffsetInBits(Other.Expr);
270+
bool llvm::operator<(const EntryValueInfo &LHS, const EntryValueInfo &RHS) {
271+
return getFragmentOffsetInBits(LHS.Expr) < getFragmentOffsetInBits(RHS.Expr);
271272
}
272273

273274
Loc::Single::Single(DbgValueLoc ValueLoc)

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ struct FrameIndexExpr {
109109
const DIExpression *Expr;
110110

111111
/// Operator enabling sorting based on fragment offset.
112-
bool operator<(const FrameIndexExpr &Other) const;
112+
friend bool operator<(const FrameIndexExpr &LHS, const FrameIndexExpr &RHS);
113113
};
114114

115115
/// Represents an entry-value location, or a fragment of one.
@@ -118,7 +118,7 @@ struct EntryValueInfo {
118118
const DIExpression &Expr;
119119

120120
/// Operator enabling sorting based on fragment offset.
121-
bool operator<(const EntryValueInfo &Other) const;
121+
friend bool operator<(const EntryValueInfo &LHS, const EntryValueInfo &RHS);
122122
};
123123

124124
// Namespace for alternatives of a DbgVariable.

0 commit comments

Comments
 (0)