[libcxx-commits] [libcxx] [libc++][hardening][NFC] Introduce `_LIBCPP_VERBOSE_TRAP` macro. (PR #148262)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 11 10:23:46 PDT 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 HEAD~1 HEAD --extensions  -- libcxx/include/__verbose_trap
``````````

</details>

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

``````````diff
diff --git a/libcxx/include/__verbose_trap b/libcxx/include/__verbose_trap
index db77b29e6..13ea72773 100644
--- a/libcxx/include/__verbose_trap
+++ b/libcxx/include/__verbose_trap
@@ -18,19 +18,18 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#  if __has_builtin(__builtin_verbose_trap)
+#if __has_builtin(__builtin_verbose_trap)
 // AppleClang shipped a slightly different version of __builtin_verbose_trap from the upstream
 // version before upstream Clang actually got the builtin.
 // TODO: Remove once AppleClang supports the two-arguments version of the builtin.
-#    if defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 1700
-#      define _LIBCPP_VERBOSE_TRAP(message) __builtin_verbose_trap(message)
-#    else
-#      define _LIBCPP_VERBOSE_TRAP(message) __builtin_verbose_trap("libc++", message)
-#    endif
+#  if defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 1700
+#    define _LIBCPP_VERBOSE_TRAP(message) __builtin_verbose_trap(message)
 #  else
-#    define _LIBCPP_VERBOSE_TRAP(message) ((void)message, __builtin_trap())
+#    define _LIBCPP_VERBOSE_TRAP(message) __builtin_verbose_trap("libc++", message)
 #  endif
-
+#else
+#  define _LIBCPP_VERBOSE_TRAP(message) ((void)message, __builtin_trap())
+#endif
 
 _LIBCPP_END_NAMESPACE_STD
 

``````````

</details>


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


More information about the libcxx-commits mailing list