[libcxx-commits] [libcxx] [libc++] Applied `[[nodiscard]]` to more Language Support classes (PR #171078)

via libcxx-commits libcxx-commits at lists.llvm.org
Sun Dec 7 21:01:42 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 ,h,cpp -- libcxx/include/__new/exceptions.h libcxx/include/__new/new_handler.h libcxx/include/typeindex libcxx/include/typeinfo libcxx/test/libcxx/diagnostics/new.nodiscard.verify.cpp libcxx/test/libcxx/language.support/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/typeinfo b/libcxx/include/typeinfo
index 8ef189a4e..e0d687132 100644
--- a/libcxx/include/typeinfo
+++ b/libcxx/include/typeinfo
@@ -97,7 +97,9 @@ public:
 
   [[__nodiscard__]] const char* name() const _NOEXCEPT;
 
-  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool before(const type_info& __arg) const _NOEXCEPT { return __compare(__arg) < 0; }
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool before(const type_info& __arg) const _NOEXCEPT {
+    return __compare(__arg) < 0;
+  }
 
   [[__nodiscard__]] size_t hash_code() const _NOEXCEPT;
 

``````````

</details>


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


More information about the libcxx-commits mailing list