Skip to content

Commit 0db995e

Browse files
[ADT] Add const to operator== in ArrayRef.h (#161321)
While I am at it, this patch adds [[nodiscard]].
1 parent 552ee3c commit 0db995e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/include/llvm/ADT/ArrayRef.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,8 @@ namespace llvm {
547547
}
548548

549549
template <typename T>
550-
inline bool operator==(SmallVectorImpl<T> &LHS, ArrayRef<T> RHS) {
550+
[[nodiscard]] inline bool operator==(const SmallVectorImpl<T> &LHS,
551+
ArrayRef<T> RHS) {
551552
return ArrayRef<T>(LHS).equals(RHS);
552553
}
553554

@@ -557,7 +558,8 @@ namespace llvm {
557558
}
558559

559560
template <typename T>
560-
inline bool operator!=(SmallVectorImpl<T> &LHS, ArrayRef<T> RHS) {
561+
[[nodiscard]] inline bool operator!=(const SmallVectorImpl<T> &LHS,
562+
ArrayRef<T> RHS) {
561563
return !(LHS == RHS);
562564
}
563565

0 commit comments

Comments
 (0)