Skip to content

Conversation

kazutakahirata
Copy link
Contributor

While I am at it, this patch adds [[nodiscard]].

While I am at it, this patch adds [[nodiscard]].
@llvmbot
Copy link
Member

llvmbot commented Sep 30, 2025

@llvm/pr-subscribers-llvm-adt

Author: Kazu Hirata (kazutakahirata)

Changes

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 --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()); }

@kazutakahirata kazutakahirata merged commit 552ee3c into llvm:main Sep 30, 2025
11 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250929_ADT_AllocatorList_const branch September 30, 2025 15:57
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Oct 3, 2025
While I am at it, this patch adds [[nodiscard]].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants