[libcxx-commits] [libcxx] ffda521 - [libc++] Make libc++ forward-compatible with AppleClang's definition of __builtin_verbose_trap (#99529)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 19 14:00:43 PDT 2024


Author: Louis Dionne
Date: 2024-07-19T17:00:40-04:00
New Revision: ffda5212282b0b3ff943690738b314e3ac5254c3

URL: https://github.com/llvm/llvm-project/commit/ffda5212282b0b3ff943690738b314e3ac5254c3
DIFF: https://github.com/llvm/llvm-project/commit/ffda5212282b0b3ff943690738b314e3ac5254c3.diff

LOG: [libc++] Make libc++ forward-compatible with AppleClang's definition of __builtin_verbose_trap (#99529)

AppleClang as included in the Xcode 16 beta implements
`__builtin_verbose_trap`, but it implements slightly different semantics
from the ones implemented upstream. This patch makes libc++ compatible
with either definition until we drop support for the version of
AppleClang that differs from upstream.

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 9bd831c227798..3b6d6b2cca53c 100644
--- a/libcxx/vendor/llvm/default_assertion_handler.in
+++ b/libcxx/vendor/llvm/default_assertion_handler.in
@@ -24,7 +24,13 @@
 #else
 
 #  if __has_builtin(__builtin_verbose_trap)
-#    define _LIBCPP_ASSERTION_HANDLER(message) __builtin_verbose_trap("libc++", message)
+// AppleClang shipped a slightly 
diff erent version of __builtin_verbose_trap from the upstream
+// version before upstream Clang actually got the builtin.
+#    if defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 17000
+#      define _LIBCPP_ASSERTION_HANDLER(message) __builtin_verbose_trap(message)
+#    else
+#      define _LIBCPP_ASSERTION_HANDLER(message) __builtin_verbose_trap("libc++", message)
+#    endif
 #  else
 #    define _LIBCPP_ASSERTION_HANDLER(message) ((void)message, __builtin_trap())
 #  endif


        


More information about the libcxx-commits mailing list