| 1 | // -*- C++ -*- |
| 2 | //===----------------------------------------------------------------------===// |
| 3 | // |
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | // See https://llvm.org/LICENSE.txt for license information. |
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef _LIBCPP___VERBOSE_TRAP |
| 11 | #define _LIBCPP___VERBOSE_TRAP |
| 12 | |
| 13 | #include <__config> |
| 14 | |
| 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 16 | # pragma GCC system_header |
| 17 | #endif |
| 18 | |
| 19 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 20 | |
| 21 | #if __has_builtin(__builtin_verbose_trap) |
| 22 | // AppleClang shipped a slightly different version of __builtin_verbose_trap from the upstream |
| 23 | // version before upstream Clang actually got the builtin. |
| 24 | // TODO: Remove once AppleClang supports the two-arguments version of the builtin. |
| 25 | # if defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 1700 |
| 26 | # define _LIBCPP_VERBOSE_TRAP(message) __builtin_verbose_trap(message) |
| 27 | # else |
| 28 | # define _LIBCPP_VERBOSE_TRAP(message) __builtin_verbose_trap("libc++", message) |
| 29 | # endif |
| 30 | #else |
| 31 | # define _LIBCPP_VERBOSE_TRAP(message) ((void)message, __builtin_trap()) |
| 32 | #endif |
| 33 | |
| 34 | _LIBCPP_END_NAMESPACE_STD |
| 35 | |
| 36 | #endif // _LIBCPP___VERBOSE_TRAP |
| 37 | |