From 4f703c656474539ba532dd1870e21d8a3f715526 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sun, 28 Sep 2025 21:36:19 -0700 Subject: [PATCH] [ADT] Add const to operator== in ArrayRef.h While I am at it, this patch adds [[nodiscard]]. --- llvm/include/llvm/ADT/ArrayRef.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/llvm/include/llvm/ADT/ArrayRef.h b/llvm/include/llvm/ADT/ArrayRef.h index fb91690bb0eb3..448d10013d371 100644 --- a/llvm/include/llvm/ADT/ArrayRef.h +++ b/llvm/include/llvm/ADT/ArrayRef.h @@ -547,7 +547,8 @@ namespace llvm { } template - inline bool operator==(SmallVectorImpl &LHS, ArrayRef RHS) { + [[nodiscard]] inline bool operator==(const SmallVectorImpl &LHS, + ArrayRef RHS) { return ArrayRef(LHS).equals(RHS); } @@ -557,7 +558,8 @@ namespace llvm { } template - inline bool operator!=(SmallVectorImpl &LHS, ArrayRef RHS) { + [[nodiscard]] inline bool operator!=(const SmallVectorImpl &LHS, + ArrayRef RHS) { return !(LHS == RHS); }