[libcxx-commits] [libcxx] [libc++][memory_resource] Applied `[[nodiscard]]` (PR #172134)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Dec 12 22:56:37 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- libcxx/include/__memory_resource/memory_resource.h libcxx/include/__memory_resource/monotonic_buffer_resource.h libcxx/include/__memory_resource/polymorphic_allocator.h libcxx/include/__memory_resource/synchronized_pool_resource.h libcxx/include/__memory_resource/unsynchronized_pool_resource.h libcxx/test/libcxx/diagnostics/memory_resource.nodiscard.verify.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/__memory_resource/monotonic_buffer_resource.h b/libcxx/include/__memory_resource/monotonic_buffer_resource.h
index 23a493438..bb2a6749c 100644
--- a/libcxx/include/__memory_resource/monotonic_buffer_resource.h
+++ b/libcxx/include/__memory_resource/monotonic_buffer_resource.h
@@ -100,7 +100,8 @@ protected:
 
   _LIBCPP_HIDE_FROM_ABI_VIRTUAL void do_deallocate(void*, size_t, size_t) override {}
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI_VIRTUAL bool do_is_equal(const memory_resource& __other) const _NOEXCEPT override {
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI_VIRTUAL bool
+  do_is_equal(const memory_resource& __other) const _NOEXCEPT override {
     return this == std::addressof(__other);
   }
 
diff --git a/libcxx/include/__memory_resource/unsynchronized_pool_resource.h b/libcxx/include/__memory_resource/unsynchronized_pool_resource.h
index 5e54995b6..3ea2c0a03 100644
--- a/libcxx/include/__memory_resource/unsynchronized_pool_resource.h
+++ b/libcxx/include/__memory_resource/unsynchronized_pool_resource.h
@@ -85,7 +85,8 @@ protected:
 
   void do_deallocate(void* __p, size_t __bytes, size_t __align) override;
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI_VIRTUAL bool do_is_equal(const memory_resource& __other) const _NOEXCEPT override {
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI_VIRTUAL bool
+  do_is_equal(const memory_resource& __other) const _NOEXCEPT override {
     return &__other == this;
   }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/172134


More information about the libcxx-commits mailing list