[llvm] [ADT] Add const to AllocatorList::{empty,size} (PR #161320)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 29 23:29:15 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/161320
While I am at it, this patch adds [[nodiscard]].
>From 5deeb6a82e47d060f7448df3cf13e6c14650b068 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 29 Sep 2025 09:50:17 -0700
Subject: [PATCH] [ADT] Add const to AllocatorList::{empty,size}
While I am at it, this patch adds [[nodiscard]].
---
llvm/include/llvm/ADT/AllocatorList.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/include/llvm/ADT/AllocatorList.h b/llvm/include/llvm/ADT/AllocatorList.h
index 04d0afc9d076e..2716b83ca224a 100644
--- a/llvm/include/llvm/ADT/AllocatorList.h
+++ b/llvm/include/llvm/ADT/AllocatorList.h
@@ -155,8 +155,8 @@ template <class T, class AllocatorT> class AllocatorList : AllocatorT {
std::swap(getAlloc(), RHS.getAlloc());
}
- bool empty() { return List.empty(); }
- size_t size() { return List.size(); }
+ [[nodiscard]] bool empty() const { return List.empty(); }
+ [[nodiscard]] size_t size() const { return List.size(); }
iterator begin() { return iterator(List.begin()); }
iterator end() { return iterator(List.end()); }
More information about the llvm-commits
mailing list