llvm-capstone/libcxx/include
Konstantin Varlamov 8dfc67d672
[libc++][hardening] Rework how the assertion handler can be overridden. (#77883)
Previously there were two ways to override the verbose abort function
which gets called when a hardening assertion is triggered:
- compile-time: define the `_LIBCPP_VERBOSE_ABORT` macro;
- link-time: provide a definition of `__libcpp_verbose_abort` function.

This patch adds a new configure-time approach: the vendor can provide
a path to a custom header file which will get copied into the build by
CMake and included by the library. The header must provide a definition
of the
`_LIBCPP_ASSERTION_HANDLER` macro which is what will get called should
a hardening assertion fail. As of this patch, overriding
`_LIBCPP_VERBOSE_ABORT` will still work, but the previous mechanisms
will be effectively removed in a follow-up patch, making the
configure-time mechanism the sole way of overriding the default handler.

Note that `_LIBCPP_ASSERTION_HANDLER` only gets invoked when a hardening
assertion fails. It does not affect other cases where
`_LIBCPP_VERBOSE_ABORT` is currently used (e.g. when an exception is
thrown in the `-fno-exceptions` mode).

The library provides a default version of the custom header file that
will get used if it's not overridden by the vendor. That allows us to
always test the override mechanism and reduces the difference in
configuration between the pristine version of the library and
a platform-specific version.
2024-01-17 18:56:07 -08:00
..
__algorithm [libc++][hardening] Categorize more assertions. (#75918) 2024-01-05 16:29:23 -08:00
__atomic Revert "[libc++] Clang-tidy enable modernize-use-nullptr. (#76659)" (#78409) 2024-01-17 01:30:52 -08:00
__bit [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
__charconv [libc++][hardening] Categorize more assertions. (#75918) 2024-01-05 16:29:23 -08:00
__chrono [libc++][hardening] Categorize more assertions. (#75918) 2024-01-05 16:29:23 -08:00
__compare [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
__concepts [libc++][concepts] Implements concept helper __libcpp_integer (#78086) 2024-01-15 00:00:57 +02:00
__condition_variable [libc++][NFC] Refactor __enable_if return types to defaulted template parameters 2023-09-01 17:52:31 -07:00
__coroutine [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
__debug_utils [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
__exception [libc++] Rename _LIBCPP_INLINE_VISIBILITY to _LIBCPP_HIDE_FROM_ABI (#74095) 2023-12-04 10:25:14 -05:00
__expected [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
__filesystem [libc++][hardening] Categorize more assertions. (#75918) 2024-01-05 16:29:23 -08:00
__format [libc++][hardening] Categorize more assertions. (#75918) 2024-01-05 16:29:23 -08:00
__functional [libc++] Implement ranges::contains (#65148) 2023-12-19 16:34:19 -08:00
__fwd [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
__ios [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
__iterator [libc++][hardening] Categorize more assertions. (#75918) 2024-01-05 16:29:23 -08:00
__locale_dir/locale_base_api [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
__math [libc++][NFC] Replace typedefs with using in the math headers 2023-08-03 08:51:50 -07:00
__mdspan [libc++] LWG-4021 "mdspan::is_always_meow() should be noexcept", use LIBCPP_STATIC_ASSERT for noexcept strengthening (#74254) 2023-12-10 11:52:14 +01:00
__memory [libc++] Deprecate the _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS macro (#77692) 2024-01-12 09:51:14 -05:00
__memory_resource [libc++] Remove a few transitive includes (#70553) 2023-10-29 18:31:37 +01:00
__mutex [libc++] Replace uses of _VSTD:: by std:: (#74331) 2023-12-05 11:19:15 -05:00
__numeric [libc++] Fix ability to explicitly instantiate std::midpoint (#74217) 2023-12-20 11:53:19 +01:00
__random [libc++][hardening] Categorize more assertions. (#75918) 2024-01-05 16:29:23 -08:00
__ranges [libc++][hardening] Categorize more assertions. (#75918) 2024-01-05 16:29:23 -08:00
__stop_token [libc++] Implement std::condition_variable_any::wait[_for/until] overloads that take stop_token 2023-09-29 13:50:16 +01:00
__string [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
__support [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
__system_error [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
__thread [libc++][hardening] Categorize more assertions. (#75918) 2024-01-05 16:29:23 -08:00
__tuple [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
__type_traits [libc++] Use __datasizeof for __libcpp_datasizeof if available (#72104) 2023-12-24 08:45:25 +01:00
__utility [libc++][utility][NFC] Refactored safe integer cmp_xxxx functions to use the __libcpp_is_integer concept (#78115) 2024-01-16 13:17:59 +02:00
__variant [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
experimental [libc++][NFC] Refactor <experimental/simd> a bit to simplify dependencies (#76283) 2023-12-24 08:50:01 +01:00
ext [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
__assert [libc++][hardening] Rework how the assertion handler can be overridden. (#77883) 2024-01-17 18:56:07 -08:00
__availability [libc++][print] Enables it on Apple backdeployment. (#76293) 2024-01-16 19:14:33 +01:00
__bit_reference [libc++] Optimize ranges::count for __bit_iterators 2023-10-06 22:58:41 +02:00
__config [libc++] Deprecate removed features macros. (#77879) 2024-01-16 19:12:59 +01:00
__config_site.in [ASan][libc++] std::basic_string annotations (#72677) 2023-12-13 06:05:34 +01:00
__hash_table [libc++][hardening] Categorize more assertions. (#75918) 2024-01-05 16:29:23 -08:00
__locale [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
__mbstate_t.h [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
__node_handle [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
__split_buffer [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
__std_clang_module [libc++] Remove experimental pmr headers now shipped in mainline (#73172) 2023-11-27 10:54:35 -05:00
__std_mbstate_t.h [libc++] cuchar redeclares ::mbstate_t when it's in its own clang module 2023-05-01 13:48:20 -05:00
__threading_support [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
__tree [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
__undef_macros Fixing conflicting macro definitions between curses.h and the standard library. 2023-07-06 17:21:08 +00:00
__verbose_abort [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
algorithm [libcxx] adds ranges::fold_left_with_iter and ranges::fold_left (#75259) 2023-12-19 21:57:50 -08:00
any [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
array [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
atomic [libc++] Refactor atomic_{unsigned,signed}_lock_free (#73041) 2023-11-22 14:54:40 -05:00
barrier [libc++] Improves _LIBCPP_HAS_NO_THREADS guards. (#76624) 2024-01-16 19:13:40 +01:00
bit [libc++] Fix the signature of std::rotl and std::rotr 2023-08-12 08:46:11 -07:00
bitset [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
cassert [libc++] Add missing __has_include checks for C headers not provided by libc++ 2022-11-23 09:50:14 -05:00
ccomplex
cctype [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
cerrno [libc++] Diagnose when header search paths are set up incorrectly 2022-08-17 14:05:26 -04:00
cfenv [libc++] Diagnose when header search paths are set up incorrectly 2022-08-17 14:05:26 -04:00
cfloat [libc++] Diagnose when header search paths are set up incorrectly 2022-08-17 14:05:26 -04:00
charconv [libc++] Remove a few transitive includes (#70553) 2023-10-29 18:31:37 +01:00
chrono [libc++][NFC] Add a few clang-format annotations (#74352) 2023-12-04 15:17:31 -05:00
cinttypes [libc++][NFC] Fix some standard-mandated includes comments 2022-09-27 21:11:53 +02:00
ciso646
climits [libc++] Remove libc++'s own <limits.h> (#65472) 2023-10-10 11:06:43 -07:00
clocale [libc++] Diagnose when header search paths are set up incorrectly 2022-08-17 14:05:26 -04:00
CMakeLists.txt [libc++][hardening] Rework how the assertion handler can be overridden. (#77883) 2024-01-17 18:56:07 -08:00
cmath [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
codecvt [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
compare [libc++] Module fixes for __synth_three_way. 2023-04-07 18:54:09 +02:00
complex [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
complex.h [libc++] Only include_next C library headers when they exist 2022-11-17 10:30:20 -05:00
concepts [libc++] Granularize <type_traits> includes in <concepts> 2022-12-20 21:37:39 +01:00
condition_variable [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
coroutine [libc++] Granularize <type_traits> includes in <bit>, <numbers> and <coroutine> 2023-01-21 15:09:21 +01:00
csetjmp [libc++] Remove libc++'s own <setjmp.h> header (#68806) 2023-10-12 16:59:04 -07:00
csignal [libc++] Add missing __has_include checks for C headers not provided by libc++ 2022-11-23 09:50:14 -05:00
cstdarg [libc++] Add missing __has_include checks for C headers not provided by libc++ 2022-11-23 09:50:14 -05:00
cstdbool
cstddef [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
cstdint [libc++] Diagnose when header search paths are set up incorrectly 2022-08-17 14:05:26 -04:00
cstdio [libc++] Remove _LIBCPP_C_HAS_NO_GETS (#77346) 2024-01-10 13:34:03 -05:00
cstdlib [libc++] Fixes disabling wide character. 2023-08-19 19:09:16 +02:00
cstring [libc++] Move constexpr <cstring> functions into their own headers and remove unused <cstring> includes 2023-02-21 16:56:29 +01:00
ctgmath
ctime [libc++][NFC] Replace _LIBCPP_STD_VER > x with _LIBCPP_STD_VER >= x 2023-02-15 16:52:25 +01:00
ctype.h [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
cuchar [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
cwchar [libc++] Forward to std::{,w}memchr in std::find 2023-05-25 07:59:50 -07:00
cwctype [libc++] Diagnose when header search paths are set up incorrectly 2022-08-17 14:05:26 -04:00
deque [ASan][libc++] Optimization of container annotations (#76082) 2023-12-21 17:26:10 -05:00
errno.h [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
exception [libc++] Granularize <exception> 2023-03-12 22:19:41 +01:00
execution [libc++][PSTL] Add more specialized backend customization points 2023-05-11 13:54:28 -07:00
expected [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
fenv.h [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
filesystem [libc++] Remove a few transitive includes (#70553) 2023-10-29 18:31:37 +01:00
float.h [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
format [libc++] Implements Runtime format strings. (#73353) 2023-12-09 12:32:17 +01:00
forward_list [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
fstream Reapply "[libc++][streams] P1759R6: Native handles and file streams" (#77190) 2024-01-07 18:01:03 +02:00
functional [libc++] Remove a few transitive includes (#70553) 2023-10-29 18:31:37 +01:00
future [libc++] Improves _LIBCPP_HAS_NO_THREADS guards. (#76624) 2024-01-16 19:13:40 +01:00
initializer_list [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
inttypes.h [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
iomanip [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
ios [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
iosfwd [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
iostream [libc++] Merge _LIBCPP_FUNC_VIS, _LIBCPP_TYPE_VIS and _LIBCPP_EXCEPTION_ABI into _LIBCPP_EXPORTED_FROM_ABI 2023-06-15 08:56:45 -07:00
istream [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
iterator [libc++] Remove a few transitive includes (#70553) 2023-10-29 18:31:37 +01:00
latch [libc++] Improves _LIBCPP_HAS_NO_THREADS guards. (#76624) 2024-01-16 19:13:40 +01:00
libcxx.imp [libc++] Rewrite the IWYU generation (#78295) 2024-01-16 13:45:05 -05:00
limits [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
list [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
locale Revert "[libc++] Clang-tidy enable modernize-use-nullptr. (#76659)" (#78409) 2024-01-17 01:30:52 -08:00
locale.h [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
map [libc++] Fix nolint comment that became useless after running clang-format 2023-12-18 17:49:21 -05:00
math.h [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
mdspan [libc++] LWG-4021 "mdspan::is_always_meow() should be noexcept", use LIBCPP_STATIC_ASSERT for noexcept strengthening (#74254) 2023-12-10 11:52:14 +01:00
memory [libc++] Deprecates and removes shared_ptr::unqiue. (#76576) 2023-12-30 14:05:22 +01:00
memory_resource [libc++] Remove a few transitive includes (#70553) 2023-10-29 18:31:37 +01:00
module.modulemap.in [libc++][NFC] Refactor <experimental/simd> a bit to simplify dependencies (#76283) 2023-12-24 08:50:01 +01:00
mutex [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
new [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
numbers [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
numeric [libc++] Remove a few transitive includes (#70553) 2023-10-29 18:31:37 +01:00
optional [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
ostream [libc++][print] Enables it on Apple backdeployment. (#76293) 2024-01-16 19:14:33 +01:00
print [libc++][print] Includes <format>. (#76333) 2024-01-16 17:33:01 +01:00
queue [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
random [libc++] Remove <cstdlib> includes 2023-04-09 02:52:33 +02:00
ranges [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
ratio [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
regex Revert "[libc++] Fix regex_search to match $ alone with match_default flag" (#78349) 2024-01-17 13:51:29 +01:00
scoped_allocator [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
semaphore [libc++] Improves _LIBCPP_HAS_NO_THREADS guards. (#76624) 2024-01-16 19:13:40 +01:00
set [libc++][hardening] Categorize more assertions. (#75918) 2024-01-05 16:29:23 -08:00
shared_mutex [libc++] Improves _LIBCPP_HAS_NO_THREADS guards. (#76624) 2024-01-16 19:13:40 +01:00
source_location [libc++] Update <source_location> and msvc_stdlib_force_include.h (#74266) 2023-12-06 09:04:06 -05:00
span [libc++][span] P2821R5: span.at() (#74994) 2024-01-05 11:41:22 +02:00
sstream [libc++] Remove usage of internal string function in sstream (#75858) 2024-01-08 18:56:43 +01:00
stack [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
stdatomic.h [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
stdbool.h [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
stddef.h [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
stdexcept [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
stdint.h [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
stdio.h [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
stdlib.h [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
stop_token [libc++] Improves _LIBCPP_HAS_NO_THREADS guards. (#76624) 2024-01-16 19:13:40 +01:00
streambuf [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
string [ASan][libc++] Annotating std::basic_string with all allocators (#75845) 2024-01-13 18:11:53 +01:00
string_view [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
string.h [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
strstream [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
syncstream Implement syncstream (p0053) 2023-11-08 17:45:06 +01:00
system_error [libc++] Move __errc to __system_error/errc.h 2023-04-10 19:23:42 +02:00
tgmath.h [libc++] Only include_next C library headers when they exist 2022-11-17 10:30:20 -05:00
thread [libc++] Improves _LIBCPP_HAS_NO_THREADS guards. (#76624) 2024-01-16 19:13:40 +01:00
tuple [libc++] Implements P2517R1. (#77239) 2024-01-09 19:11:40 +01:00
type_traits [libc++] Untangles invoke. 2023-05-24 07:51:27 +02:00
typeindex [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
typeinfo [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
uchar.h [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
unordered_map [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
unordered_set [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
utility [libc++] P2770R0: Stashing stashing iterators for proper flattening (#66033) 2023-12-12 09:45:14 -05:00
valarray [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
variant [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
vector [ASan][libc++][NFC] refactor vector annotations arguments (#78322) 2024-01-17 08:50:10 +01:00
version Reapply "[libc++][streams] P1759R6: Native handles and file streams" (#77190) 2024-01-07 18:01:03 +02:00
wchar.h [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00
wctype.h [libc++] Format the code base (#74334) 2023-12-18 14:01:33 -05:00