Skip to content

Commit cde8697

Browse files
committed
Merge branch 'varconst/hardening-semantics-split-verbose_trap' into varconst/hardening-semantics-introduce
2 parents debdf14 + 3ca83e6 commit cde8697

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

libcxx/include/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,6 +1571,7 @@ set(files
15711571
__cxx03/__utility/unreachable.h
15721572
__cxx03/__variant/monostate.h
15731573
__cxx03/__verbose_abort
1574+
__cxx03/__verbose_trap
15741575
__cxx03/algorithm
15751576
__cxx03/array
15761577
__cxx03/atomic

libcxx/include/__cxx03/__verbose_trap

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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___CXX03___VERBOSE_TRAP
11+
#define _LIBCPP___CXX03___VERBOSE_TRAP
12+
13+
#include <__cxx03/__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___CXX03___VERBOSE_TRAP

libcxx/include/module.modulemap.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,6 +2356,9 @@ module std [system] {
23562356
module verbose_abort {
23572357
header "__verbose_abort"
23582358
}
2359+
module verbose_trap {
2360+
header "__verbose_trap"
2361+
}
23592362
module internal_assert {
23602363
header "__assert"
23612364
export *

libcxx/vendor/llvm/default_assertion_handler.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
1414
# include <__cxx03/__config>
1515
# include <__cxx03/__verbose_abort>
16+
# include <__cxx03/__verbose_trap>
1617
#else
1718
# include <__config>
1819
# include <__log_hardening_failure>

0 commit comments

Comments
 (0)