[llvm] [ADT] Add const to AllocatorList::{empty,size} (PR #161320)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 29 23:29:53 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-adt
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
While I am at it, this patch adds [[nodiscard]].
---
Full diff: https://github.com/llvm/llvm-project/pull/161320.diff
1 Files Affected:
- (modified) llvm/include/llvm/ADT/AllocatorList.h (+2-2)
``````````diff
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()); }
``````````
</details>
https://github.com/llvm/llvm-project/pull/161320
More information about the llvm-commits
mailing list