[libcxx-commits] [libcxx] 1e96b4a - [libc++][hardening] Use `__builtin_verbose_trap` if it's available. (#84870)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jul 12 12:06:29 PDT 2024
Author: Konstantin Varlamov
Date: 2024-07-12T15:06:25-04:00
New Revision: 1e96b4ad00f54dfbe9c4b22a95bef5fed0203e07
URL: https://github.com/llvm/llvm-project/commit/1e96b4ad00f54dfbe9c4b22a95bef5fed0203e07
DIFF: https://github.com/llvm/llvm-project/commit/1e96b4ad00f54dfbe9c4b22a95bef5fed0203e07.diff
LOG: [libc++][hardening] Use `__builtin_verbose_trap` if it's available. (#84870)
Keep falling back to `__builtin_trap` on older versions of Clang.
Co-authored-by: Louis Dionne <ldionne.2 at gmail.com>
Added:
Modified:
libcxx/vendor/llvm/default_assertion_handler.in
Removed:
################################################################################
diff --git a/libcxx/vendor/llvm/default_assertion_handler.in b/libcxx/vendor/llvm/default_assertion_handler.in
index 8bc0553c078b3..9bd831c227798 100644
--- a/libcxx/vendor/llvm/default_assertion_handler.in
+++ b/libcxx/vendor/llvm/default_assertion_handler.in
@@ -23,8 +23,11 @@
#else
-// TODO(hardening): use `__builtin_verbose_trap(message)` once that becomes available.
-# define _LIBCPP_ASSERTION_HANDLER(message) ((void)message, __builtin_trap())
+# if __has_builtin(__builtin_verbose_trap)
+# define _LIBCPP_ASSERTION_HANDLER(message) __builtin_verbose_trap("libc++", message)
+# else
+# define _LIBCPP_ASSERTION_HANDLER(message) ((void)message, __builtin_trap())
+# endif
#endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
More information about the libcxx-commits
mailing list