authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-08-03 12:20:01+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-09-05 14:54:30+02:00
logb0ce1c53cc852503e00da3cebc99bee719a54372
treeab19e6254be22ff6b6202f2840c19fd505248ce8
parentf42133aba77c81e02968e58d7bf75706eab0ec5b
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

libcxxabi: update to LLVM 23


19 files changed, 131 insertions(+), 95 deletions(-)

lib/libcxxabi/include/__cxxabi_config.h+6
...@@ -128,4 +128,10 @@...@@ -128,4 +128,10 @@
128# define _LIBCXXABI_NOEXCEPT noexcept128# define _LIBCXXABI_NOEXCEPT noexcept
129#endif129#endif
130130
131#if defined(__POINTER_FIELD_PROTECTION_ABI__)
132# define _LIBCXXABI_DISABLE_POINTER_FIELD_PROTECTION [[_Clang::__no_field_protection__]]
133#else
134# define _LIBCXXABI_DISABLE_POINTER_FIELD_PROTECTION
135#endif
136
131#endif // ____CXXABI_CONFIG_H137#endif // ____CXXABI_CONFIG_H
lib/libcxxabi/include/cxxabi.h+10-11
...@@ -19,8 +19,7 @@...@@ -19,8 +19,7 @@
1919
20#include <__cxxabi_config.h>20#include <__cxxabi_config.h>
2121
22#define _LIBCPPABI_VERSION 1500022#define _LIBCPPABI_VERSION 230000
23#define _LIBCXXABI_NORETURN __attribute__((noreturn))
24#define _LIBCXXABI_ALWAYS_COLD __attribute__((cold))23#define _LIBCXXABI_ALWAYS_COLD __attribute__((cold))
2524
26#ifdef __cplusplus25#ifdef __cplusplus
...@@ -31,7 +30,7 @@ class _LIBCXXABI_TYPE_VIS type_info; // forward declaration...@@ -31,7 +30,7 @@ class _LIBCXXABI_TYPE_VIS type_info; // forward declaration
31#else30#else
32class type_info; // forward declaration31class type_info; // forward declaration
33#endif32#endif
34}33} // namespace std
3534
3635
37// runtime routines use C calling conventions, but are in __cxxabiv1 namespace36// runtime routines use C calling conventions, but are in __cxxabiv1 namespace
...@@ -56,7 +55,7 @@ __cxa_init_primary_exception(void* object, std::type_info* tinfo, void(_LIBCXXAB...@@ -56,7 +55,7 @@ __cxa_init_primary_exception(void* object, std::type_info* tinfo, void(_LIBCXXAB
56#endif55#endif
5756
58// 2.4.3 Throwing the Exception Object57// 2.4.3 Throwing the Exception Object
59extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void58[[__noreturn__]] extern _LIBCXXABI_FUNC_VIS void
60__cxa_throw(void *thrown_exception, std::type_info *tinfo,59__cxa_throw(void *thrown_exception, std::type_info *tinfo,
61#ifdef __wasm__60#ifdef __wasm__
62 void *(_LIBCXXABI_DTOR_FUNC *dest)(void *));61 void *(_LIBCXXABI_DTOR_FUNC *dest)(void *));
...@@ -80,22 +79,22 @@ extern _LIBCXXABI_FUNC_VIS std::type_info *__cxa_current_exception_type();...@@ -80,22 +79,22 @@ extern _LIBCXXABI_FUNC_VIS std::type_info *__cxa_current_exception_type();
80// GNU extension79// GNU extension
81// Calls `terminate` with the current exception being caught. This function is used by GCC when a `noexcept` function80// Calls `terminate` with the current exception being caught. This function is used by GCC when a `noexcept` function
82// throws an exception inside a try/catch block and doesn't catch it.81// throws an exception inside a try/catch block and doesn't catch it.
83extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_call_terminate(void*) _LIBCXXABI_NOEXCEPT;82[[__noreturn__]] extern _LIBCXXABI_FUNC_VIS void __cxa_call_terminate(void*) _LIBCXXABI_NOEXCEPT;
8483
85// 2.5.4 Rethrowing Exceptions84// 2.5.4 Rethrowing Exceptions
86extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_rethrow();85[[__noreturn__]] extern _LIBCXXABI_FUNC_VIS void __cxa_rethrow();
8786
88// 2.6 Auxiliary Runtime APIs87// 2.6 Auxiliary Runtime APIs
89extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_cast(void);88[[__noreturn__]] extern _LIBCXXABI_FUNC_VIS void __cxa_bad_cast(void);
90extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_typeid(void);89[[__noreturn__]] extern _LIBCXXABI_FUNC_VIS void __cxa_bad_typeid(void);
91extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void90[[__noreturn__]] extern _LIBCXXABI_FUNC_VIS void
92__cxa_throw_bad_array_new_length(void);91__cxa_throw_bad_array_new_length(void);
9392
94// 3.2.6 Pure Virtual Function API93// 3.2.6 Pure Virtual Function API
95extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_pure_virtual(void);94[[__noreturn__]] extern _LIBCXXABI_FUNC_VIS void __cxa_pure_virtual(void);
9695
97// 3.2.7 Deleted Virtual Function API96// 3.2.7 Deleted Virtual Function API
98extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_deleted_virtual(void);97[[__noreturn__]] extern _LIBCXXABI_FUNC_VIS void __cxa_deleted_virtual(void);
9998
100// 3.3.2 One-time Construction API99// 3.3.2 One-time Construction API
101#if defined(_LIBCXXABI_GUARD_ABI_ARM)100#if defined(_LIBCXXABI_GUARD_ABI_ARM)
lib/libcxxabi/src/abort_message.h+1-1
...@@ -11,7 +11,7 @@...@@ -11,7 +11,7 @@
1111
12#include "cxxabi.h"12#include "cxxabi.h"
1313
14extern "C" _LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN void14extern "C" [[noreturn]] _LIBCXXABI_HIDDEN void
15__abort_message(const char *format, ...) __attribute__((format(printf, 1, 2)));15__abort_message(const char *format, ...) __attribute__((format(printf, 1, 2)));
1616
17#ifndef _LIBCXXABI_ASSERT17#ifndef _LIBCXXABI_ASSERT
lib/libcxxabi/src/cxa_aux_runtime.cpp+3-3
...@@ -16,7 +16,7 @@...@@ -16,7 +16,7 @@
1616
17namespace __cxxabiv1 {17namespace __cxxabiv1 {
18extern "C" {18extern "C" {
19_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_cast(void) {19[[noreturn]] _LIBCXXABI_FUNC_VIS void __cxa_bad_cast(void) {
20#ifndef _LIBCXXABI_NO_EXCEPTIONS20#ifndef _LIBCXXABI_NO_EXCEPTIONS
21 throw std::bad_cast();21 throw std::bad_cast();
22#else22#else
...@@ -24,7 +24,7 @@ _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_cast(void) {...@@ -24,7 +24,7 @@ _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_cast(void) {
24#endif24#endif
25}25}
2626
27_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_typeid(void) {27[[noreturn]] _LIBCXXABI_FUNC_VIS void __cxa_bad_typeid(void) {
28#ifndef _LIBCXXABI_NO_EXCEPTIONS28#ifndef _LIBCXXABI_NO_EXCEPTIONS
29 throw std::bad_typeid();29 throw std::bad_typeid();
30#else30#else
...@@ -32,7 +32,7 @@ _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_typeid(void) {...@@ -32,7 +32,7 @@ _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_typeid(void) {
32#endif32#endif
33}33}
3434
35_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void35[[noreturn]] _LIBCXXABI_FUNC_VIS void
36__cxa_throw_bad_array_new_length(void) {36__cxa_throw_bad_array_new_length(void) {
37#ifndef _LIBCXXABI_NO_EXCEPTIONS37#ifndef _LIBCXXABI_NO_EXCEPTIONS
38 throw std::bad_array_new_length();38 throw std::bad_array_new_length();
lib/libcxxabi/src/cxa_default_handlers.cpp+4-6
...@@ -24,8 +24,7 @@...@@ -24,8 +24,7 @@
24static constinit const char* cause = "uncaught";24static constinit const char* cause = "uncaught";
2525
26# ifndef _LIBCXXABI_NO_EXCEPTIONS26# ifndef _LIBCXXABI_NO_EXCEPTIONS
27__attribute__((noreturn))27[[noreturn]] static void demangling_terminate_handler()
28static void demangling_terminate_handler()
29{28{
30 using namespace __cxxabiv1;29 using namespace __cxxabiv1;
31 __cxa_eh_globals* globals = __cxa_get_globals_fast();30 __cxa_eh_globals* globals = __cxa_get_globals_fast();
...@@ -78,15 +77,14 @@ static void demangling_terminate_handler()...@@ -78,15 +77,14 @@ static void demangling_terminate_handler()
78 }77 }
79}78}
80#else // !_LIBCXXABI_NO_EXCEPTIONS79#else // !_LIBCXXABI_NO_EXCEPTIONS
81__attribute__((noreturn))80[[noreturn]] static void demangling_terminate_handler()
82static void demangling_terminate_handler()
83{81{
82 (void)cause;
84 __abort_message("terminating");83 __abort_message("terminating");
85}84}
86#endif // !_LIBCXXABI_NO_EXCEPTIONS85#endif // !_LIBCXXABI_NO_EXCEPTIONS
8786
88__attribute__((noreturn))87[[noreturn]] static void demangling_unexpected_handler()
89static void demangling_unexpected_handler()
90{88{
91 cause = "unexpected";89 cause = "unexpected";
92 std::terminate();90 std::terminate();
lib/libcxxabi/src/cxa_exception.cpp+1-1
...@@ -140,7 +140,7 @@ exception_cleanup_func(_Unwind_Reason_Code reason, _Unwind_Exception* unwind_exc...@@ -140,7 +140,7 @@ exception_cleanup_func(_Unwind_Reason_Code reason, _Unwind_Exception* unwind_exc
140 __cxa_decrement_exception_refcount(unwind_exception + 1);140 __cxa_decrement_exception_refcount(unwind_exception + 1);
141}141}
142142
143static _LIBCXXABI_NORETURN void failed_throw(__cxa_exception* exception_header) {143[[noreturn]] static void failed_throw(__cxa_exception* exception_header) {
144// Section 2.5.3 says:144// Section 2.5.3 says:
145// * For purposes of this ABI, several things are considered exception handlers:145// * For purposes of this ABI, several things are considered exception handlers:
146// ** A terminate() call due to a throw.146// ** A terminate() call due to a throw.
lib/libcxxabi/src/cxa_guard_impl.h+1-1
...@@ -637,7 +637,7 @@ struct GlobalStatic {...@@ -637,7 +637,7 @@ struct GlobalStatic {
637 static T instance;637 static T instance;
638};638};
639template <class T>639template <class T>
640_LIBCPP_CONSTINIT T GlobalStatic<T>::instance = {};640constinit T GlobalStatic<T>::instance = {};
641641
642enum class Implementation { NoThreads, GlobalMutex, Futex };642enum class Implementation { NoThreads, GlobalMutex, Futex };
643643
lib/libcxxabi/src/cxa_handlers.cpp+2-4
...@@ -36,8 +36,7 @@ __unexpected(unexpected_handler func)...@@ -36,8 +36,7 @@ __unexpected(unexpected_handler func)
36 __abort_message("unexpected_handler unexpectedly returned");36 __abort_message("unexpected_handler unexpectedly returned");
37}37}
3838
39__attribute__((noreturn))39[[noreturn]] void
40void
41unexpected()40unexpected()
42{41{
43 __unexpected(get_unexpected());42 __unexpected(get_unexpected());
...@@ -69,8 +68,7 @@ __terminate(terminate_handler func) noexcept...@@ -69,8 +68,7 @@ __terminate(terminate_handler func) noexcept
69#endif // _LIBCXXABI_NO_EXCEPTIONS68#endif // _LIBCXXABI_NO_EXCEPTIONS
70}69}
7170
72__attribute__((noreturn))71[[noreturn]] void
73void
74terminate() noexcept72terminate() noexcept
75{73{
76#ifndef _LIBCXXABI_NO_EXCEPTIONS74#ifndef _LIBCXXABI_NO_EXCEPTIONS
lib/libcxxabi/src/cxa_handlers.h+2-2
...@@ -19,11 +19,11 @@...@@ -19,11 +19,11 @@
19namespace std19namespace std
20{20{
2121
22_LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN22[[noreturn]] _LIBCXXABI_HIDDEN
23void23void
24__unexpected(unexpected_handler func);24__unexpected(unexpected_handler func);
2525
26_LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN26[[noreturn]] _LIBCXXABI_HIDDEN
27void27void
28__terminate(terminate_handler func) noexcept;28__terminate(terminate_handler func) noexcept;
2929
lib/libcxxabi/src/cxa_personality.cpp+3-15
...@@ -23,7 +23,7 @@...@@ -23,7 +23,7 @@
2323
24#if __has_feature(ptrauth_calls)24#if __has_feature(ptrauth_calls)
2525
26// CXXABI depends on defintions in libunwind as pointer auth couples the26// CXXABI depends on definitions in libunwind as pointer auth couples the
27// definitions27// definitions
28# include "libunwind.h"28# include "libunwind.h"
2929
...@@ -67,15 +67,6 @@...@@ -67,15 +67,6 @@
67# pragma clang diagnostic ignored "-Wmissing-prototypes"67# pragma clang diagnostic ignored "-Wmissing-prototypes"
68#endif68#endif
6969
70// TODO: This is a temporary workaround for libc++abi to recognize that it's being
71// built against LLVM's libunwind. LLVM's libunwind started reporting _LIBUNWIND_VERSION
72// in LLVM 15 -- we can remove this workaround after shipping LLVM 17. Once we remove
73// this workaround, it won't be possible to build libc++abi against libunwind headers
74// from LLVM 14 and before anymore.
75#if defined(____LIBUNWIND_CONFIG_H__) && !defined(_LIBUNWIND_VERSION)
76# define _LIBUNWIND_VERSION
77#endif
78
79#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)70#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
80#include <windows.h>71#include <windows.h>
81#include <winnt.h>72#include <winnt.h>
...@@ -1125,9 +1116,7 @@ __gxx_personality_seh0(PEXCEPTION_RECORD ms_exc, void *this_frame,...@@ -1125,9 +1116,7 @@ __gxx_personality_seh0(PEXCEPTION_RECORD ms_exc, void *this_frame,
11251116
1126#else1117#else
11271118
1128// zig patch: https://github.com/llvm/llvm-project/issues/1942321119extern "C" _Unwind_Reason_Code __gnu_unwind_frame(_Unwind_Exception*, _Unwind_Context*);
1129extern "C" _Unwind_Reason_Code __gnu_unwind_frame(_Unwind_Exception*,
1130 _Unwind_Context*);
11311120
1132// Helper function to unwind one frame.1121// Helper function to unwind one frame.
1133// ARM EHABI 7.3 and 7.4: If the personality function returns _URC_CONTINUE_UNWIND, the1122// ARM EHABI 7.3 and 7.4: If the personality function returns _URC_CONTINUE_UNWIND, the
...@@ -1283,8 +1272,7 @@ __gxx_personality_v0(_Unwind_State state,...@@ -1283,8 +1272,7 @@ __gxx_personality_v0(_Unwind_State state,
1283#endif1272#endif
12841273
12851274
1286__attribute__((noreturn))1275[[noreturn]] _LIBCXXABI_FUNC_VIS void
1287_LIBCXXABI_FUNC_VIS void
1288__cxa_call_unexpected(void* arg)1276__cxa_call_unexpected(void* arg)
1289{1277{
1290 _Unwind_Exception* unwind_exception = static_cast<_Unwind_Exception*>(arg);1278 _Unwind_Exception* unwind_exception = static_cast<_Unwind_Exception*>(arg);
lib/libcxxabi/src/cxa_vector.cpp+1-2
...@@ -116,8 +116,7 @@ namespace {...@@ -116,8 +116,7 @@ namespace {
116//116//
117117
118namespace {118namespace {
119_LIBCXXABI_NORETURN119[[noreturn]] void throw_bad_array_new_length() {
120void throw_bad_array_new_length() {
121#ifndef _LIBCXXABI_NO_EXCEPTIONS120#ifndef _LIBCXXABI_NO_EXCEPTIONS
122 throw std::bad_array_new_length();121 throw std::bad_array_new_length();
123#else122#else
lib/libcxxabi/src/cxa_virtual.cpp+2-2
...@@ -11,12 +11,12 @@...@@ -11,12 +11,12 @@
1111
12namespace __cxxabiv1 {12namespace __cxxabiv1 {
13extern "C" {13extern "C" {
14_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN14[[noreturn]] _LIBCXXABI_FUNC_VIS
15void __cxa_pure_virtual(void) {15void __cxa_pure_virtual(void) {
16 __abort_message("Pure virtual function called!");16 __abort_message("Pure virtual function called!");
17}17}
1818
19_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN19[[noreturn]] _LIBCXXABI_FUNC_VIS
20void __cxa_deleted_virtual(void) {20void __cxa_deleted_virtual(void) {
21 __abort_message("Deleted virtual function called!");21 __abort_message("Deleted virtual function called!");
22}22}
lib/libcxxabi/src/demangle/ItaniumDemangle.h+54
...@@ -1537,6 +1537,27 @@ public:...@@ -1537,6 +1537,27 @@ public:
1537 }1537 }
1538};1538};
15391539
1540class PackIndexing final : public Node {
1541 const Node *Pattern;
1542 const Node *Index;
1543
1544public:
1545 PackIndexing(const Node *Pattern_, const Node *Index_)
1546 : Node(KPackIndexing), Pattern(Pattern_), Index(Index_) {}
1547
1548 template <typename Fn> void match(Fn F) const { F(Pattern, Index); }
1549
1550 void printLeft(OutputBuffer &OB) const override {
1551 OB.printOpen('(');
1552 ParameterPackExpansion PPE(Pattern);
1553 PPE.printLeft(OB);
1554 OB.printClose(')');
1555 OB.printOpen('[');
1556 OB.printLeft(*Index);
1557 OB.printClose(']');
1558 }
1559};
1560
1540class TemplateArgs final : public Node {1561class TemplateArgs final : public Node {
1541 NodeArray Params;1562 NodeArray Params;
1542 Node *Requires;1563 Node *Requires;
...@@ -4531,6 +4552,18 @@ Node *AbstractManglingParser<Derived, Alloc>::parseType() {...@@ -4531,6 +4552,18 @@ Node *AbstractManglingParser<Derived, Alloc>::parseType() {
4531 Result = make<ParameterPackExpansion>(Child);4552 Result = make<ParameterPackExpansion>(Child);
4532 break;4553 break;
4533 }4554 }
4555 // ::= Dy <type> <expression> # pack indexing (C++26)
4556 case 'y': {
4557 First += 2;
4558 Node *Pattern = getDerived().parseType();
4559 if (!Pattern)
4560 return nullptr;
4561 Node *Index = getDerived().parseExpr();
4562 if (!Index)
4563 return nullptr;
4564 Result = make<PackIndexing>(Pattern, Index);
4565 break;
4566 }
4534 // Exception specifier on a function type.4567 // Exception specifier on a function type.
4535 case 'o':4568 case 'o':
4536 case 'O':4569 case 'O':
...@@ -5375,6 +5408,16 @@ Node *AbstractManglingParser<Derived, Alloc>::parseExpr() {...@@ -5375,6 +5408,16 @@ Node *AbstractManglingParser<Derived, Alloc>::parseExpr() {
5375 return nullptr;5408 return nullptr;
5376 return make<ParameterPackExpansion>(Child);5409 return make<ParameterPackExpansion>(Child);
5377 }5410 }
5411 if (consumeIf("sy")) {
5412 Node *Pattern = look() == 'T' ? getDerived().parseTemplateParam()
5413 : getDerived().parseFunctionParam();
5414 if (Pattern == nullptr)
5415 return nullptr;
5416 Node *Index = getDerived().parseExpr();
5417 if (Index == nullptr)
5418 return nullptr;
5419 return make<PackIndexing>(Pattern, Index);
5420 }
5378 if (consumeIf("sZ")) {5421 if (consumeIf("sZ")) {
5379 if (look() == 'T') {5422 if (look() == 'T') {
5380 Node *R = getDerived().parseTemplateParam();5423 Node *R = getDerived().parseTemplateParam();
...@@ -6157,8 +6200,17 @@ AbstractManglingParser<Derived, Alloc>::parseTemplateArgs(bool TagTemplates) {...@@ -6157,8 +6200,17 @@ AbstractManglingParser<Derived, Alloc>::parseTemplateArgs(bool TagTemplates) {
6157// extension ::= ___Z <encoding> _block_invoke6200// extension ::= ___Z <encoding> _block_invoke
6158// extension ::= ___Z <encoding> _block_invoke<decimal-digit>+6201// extension ::= ___Z <encoding> _block_invoke<decimal-digit>+
6159// extension ::= ___Z <encoding> _block_invoke_<decimal-digit>+6202// extension ::= ___Z <encoding> _block_invoke_<decimal-digit>+
6203// extension ::= __alloc_token__Z <encoding>
6204// extension ::= __alloc_token_<decimal-digit>+__Z <encoding>
6160template <typename Derived, typename Alloc>6205template <typename Derived, typename Alloc>
6161Node *AbstractManglingParser<Derived, Alloc>::parse(bool ParseParams) {6206Node *AbstractManglingParser<Derived, Alloc>::parse(bool ParseParams) {
6207 bool AllocToken = consumeIf("__alloc_token_");
6208 if (AllocToken) {
6209 const char *Saved = First;
6210 if (parseNumber().empty() || !consumeIf('_'))
6211 First = Saved;
6212 }
6213
6162 if (consumeIf("_Z") || consumeIf("__Z")) {6214 if (consumeIf("_Z") || consumeIf("__Z")) {
6163 Node *Encoding = getDerived().parseEncoding(ParseParams);6215 Node *Encoding = getDerived().parseEncoding(ParseParams);
6164 if (Encoding == nullptr)6216 if (Encoding == nullptr)
...@@ -6168,6 +6220,8 @@ Node *AbstractManglingParser<Derived, Alloc>::parse(bool ParseParams) {...@@ -6168,6 +6220,8 @@ Node *AbstractManglingParser<Derived, Alloc>::parse(bool ParseParams) {
6168 make<DotSuffix>(Encoding, std::string_view(First, Last - First));6220 make<DotSuffix>(Encoding, std::string_view(First, Last - First));
6169 First = Last;6221 First = Last;
6170 }6222 }
6223 if (AllocToken)
6224 Encoding = make<DotSuffix>(Encoding, ".alloc_token");
6171 if (numLeft() != 0)6225 if (numLeft() != 0)
6172 return nullptr;6226 return nullptr;
6173 return Encoding;6227 return Encoding;
lib/libcxxabi/src/demangle/ItaniumNodes.def+1-1
...@@ -100,5 +100,5 @@ NODE(ExprRequirement)...@@ -100,5 +100,5 @@ NODE(ExprRequirement)
100NODE(TypeRequirement)100NODE(TypeRequirement)
101NODE(NestedRequirement)101NODE(NestedRequirement)
102NODE(ExplicitObjectParameter)102NODE(ExplicitObjectParameter)
103103NODE(PackIndexing)
104#undef NODE104#undef NODE
lib/libcxxabi/src/demangle/Utility.h+1-1
...@@ -31,7 +31,7 @@ class Node;...@@ -31,7 +31,7 @@ class Node;
3131
32// Stream that AST nodes write their string representation into after the AST32// Stream that AST nodes write their string representation into after the AST
33// has been parsed.33// has been parsed.
34class OutputBuffer {34class DEMANGLE_ABI OutputBuffer {
35 char *Buffer = nullptr;35 char *Buffer = nullptr;
36 size_t CurrentPosition = 0;36 size_t CurrentPosition = 0;
37 size_t BufferCapacity = 0;37 size_t BufferCapacity = 0;
lib/libcxxabi/src/fallback_malloc.cpp+2-2
...@@ -35,9 +35,9 @@ namespace {...@@ -35,9 +35,9 @@ namespace {
3535
36// When POSIX threads are not available, make the mutex operations a nop36// When POSIX threads are not available, make the mutex operations a nop
37#ifndef _LIBCXXABI_HAS_NO_THREADS37#ifndef _LIBCXXABI_HAS_NO_THREADS
38static _LIBCPP_CONSTINIT std::__libcpp_mutex_t heap_mutex = _LIBCPP_MUTEX_INITIALIZER;38static constinit std::__libcpp_mutex_t heap_mutex = _LIBCPP_MUTEX_INITIALIZER;
39#else39#else
40static _LIBCPP_CONSTINIT void* heap_mutex = 0;40static constinit void* heap_mutex = 0;
41#endif41#endif
4242
43class mutexor {43class mutexor {
lib/libcxxabi/src/private_typeinfo.cpp+18-20
...@@ -99,28 +99,27 @@ struct derived_object_info {...@@ -99,28 +99,27 @@ struct derived_object_info {
99};99};
100100
101/// A helper function that gets (dynamic_ptr, dynamic_type, offset_to_derived) from static_ptr.101/// A helper function that gets (dynamic_ptr, dynamic_type, offset_to_derived) from static_ptr.
102void dyn_cast_get_derived_info(derived_object_info* info, const void* static_ptr)102derived_object_info dyn_cast_get_derived_info(const void* static_ptr) {
103{103 derived_object_info info;
104#if __has_feature(cxx_abi_relative_vtable)104#if __has_feature(cxx_abi_relative_vtable)
105 // The vtable address will point to the first virtual function, which is 8105 // The vtable address will point to the first virtual function, which is 8
106 // bytes after the start of the vtable (4 for the offset from top + 4 for106 // bytes after the start of the vtable (4 for the offset from top + 4 for
107 // the typeinfo component).107 // the typeinfo component).
108 const int32_t* vtable =108 const int32_t* vtable = *reinterpret_cast<const int32_t* const*>(static_ptr);
109 *reinterpret_cast<const int32_t* const*>(static_ptr);109 info.offset_to_derived = static_cast<std::ptrdiff_t>(vtable[-2]);
110 info->offset_to_derived = static_cast<std::ptrdiff_t>(vtable[-2]);110 info.dynamic_ptr = static_cast<const char*>(static_ptr) + info.offset_to_derived;
111 info->dynamic_ptr = static_cast<const char*>(static_ptr) + info->offset_to_derived;111
112112 // The typeinfo component is now a relative offset to a proxy.
113 // The typeinfo component is now a relative offset to a proxy.113 int32_t offset_to_ti_proxy = vtable[-1];
114 int32_t offset_to_ti_proxy = vtable[-1];114 const uint8_t* ptr_to_ti_proxy = reinterpret_cast<const uint8_t*>(vtable) + offset_to_ti_proxy;
115 const uint8_t* ptr_to_ti_proxy =115 info.dynamic_type = *(reinterpret_cast<const __class_type_info* const*>(ptr_to_ti_proxy));
116 reinterpret_cast<const uint8_t*>(vtable) + offset_to_ti_proxy;
117 info->dynamic_type = *(reinterpret_cast<const __class_type_info* const*>(ptr_to_ti_proxy));
118#else116#else
119 void** vtable = strip_vtable(*static_cast<void** const*>(static_ptr));117 void** vtable = strip_vtable(*static_cast<void** const*>(static_ptr));
120 info->offset_to_derived = reinterpret_cast<ptrdiff_t>(vtable[-2]);118 info.offset_to_derived = reinterpret_cast<ptrdiff_t>(vtable[-2]);
121 info->dynamic_ptr = static_cast<const char*>(static_ptr) + info->offset_to_derived;119 info.dynamic_ptr = static_cast<const char*>(static_ptr) + info.offset_to_derived;
122 info->dynamic_type = static_cast<const __class_type_info*>(vtable[-1]);120 info.dynamic_type = static_cast<const __class_type_info*>(vtable[-1]);
123#endif121#endif
122 return info;
124}123}
125124
126/// A helper function for __dynamic_cast that casts a base sub-object pointer125/// A helper function for __dynamic_cast that casts a base sub-object pointer
...@@ -915,8 +914,7 @@ __dynamic_cast(const void *static_ptr, const __class_type_info *static_type,...@@ -915,8 +914,7 @@ __dynamic_cast(const void *static_ptr, const __class_type_info *static_type,
915 const __class_type_info *dst_type,914 const __class_type_info *dst_type,
916 std::ptrdiff_t src2dst_offset) {915 std::ptrdiff_t src2dst_offset) {
917 // Get (dynamic_ptr, dynamic_type) from static_ptr916 // Get (dynamic_ptr, dynamic_type) from static_ptr
918 derived_object_info derived_info;917 derived_object_info derived_info = dyn_cast_get_derived_info(static_ptr);
919 dyn_cast_get_derived_info(&derived_info, static_ptr);
920918
921 // Initialize answer to nullptr. This will be changed from the search919 // Initialize answer to nullptr. This will be changed from the search
922 // results if a non-null answer is found. Regardless, this is what will920 // results if a non-null answer is found. Regardless, this is what will
lib/libcxxabi/src/private_typeinfo.h+3-3
...@@ -145,7 +145,7 @@ public:...@@ -145,7 +145,7 @@ public:
145// Has one non-virtual public base class at offset zero145// Has one non-virtual public base class at offset zero
146class _LIBCXXABI_TYPE_VIS __si_class_type_info : public __class_type_info {146class _LIBCXXABI_TYPE_VIS __si_class_type_info : public __class_type_info {
147public:147public:
148 const __class_type_info *__base_type;148 _LIBCXXABI_DISABLE_POINTER_FIELD_PROTECTION const __class_type_info* __base_type;
149149
150 _LIBCXXABI_HIDDEN virtual ~__si_class_type_info();150 _LIBCXXABI_HIDDEN virtual ~__si_class_type_info();
151151
...@@ -204,7 +204,7 @@ public:...@@ -204,7 +204,7 @@ public:
204class _LIBCXXABI_TYPE_VIS __pbase_type_info : public __shim_type_info {204class _LIBCXXABI_TYPE_VIS __pbase_type_info : public __shim_type_info {
205public:205public:
206 unsigned int __flags;206 unsigned int __flags;
207 const __shim_type_info *__pointee;207 _LIBCXXABI_DISABLE_POINTER_FIELD_PROTECTION const __shim_type_info* __pointee;
208208
209 enum __masks {209 enum __masks {
210 __const_mask = 0x1,210 __const_mask = 0x1,
...@@ -245,7 +245,7 @@ public:...@@ -245,7 +245,7 @@ public:
245class _LIBCXXABI_TYPE_VIS __pointer_to_member_type_info245class _LIBCXXABI_TYPE_VIS __pointer_to_member_type_info
246 : public __pbase_type_info {246 : public __pbase_type_info {
247public:247public:
248 const __class_type_info *__context;248 _LIBCXXABI_DISABLE_POINTER_FIELD_PROTECTION const __class_type_info* __context;
249249
250 _LIBCXXABI_HIDDEN virtual ~__pointer_to_member_type_info();250 _LIBCXXABI_HIDDEN virtual ~__pointer_to_member_type_info();
251 _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *,251 _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *,
lib/libcxxabi/src/stdlib_new_delete.cpp+16-20
...@@ -20,10 +20,6 @@...@@ -20,10 +20,6 @@
20# error The _THROW_BAD_ALLOC macro should be already defined by libc++20# error The _THROW_BAD_ALLOC macro should be already defined by libc++
21#endif21#endif
2222
23#ifndef _LIBCPP_WEAK
24# error The _LIBCPP_WEAK macro should be already defined by libc++
25#endif
26
27#if defined(_LIBCXXABI_NO_EXCEPTIONS) != !_LIBCPP_HAS_EXCEPTIONS23#if defined(_LIBCXXABI_NO_EXCEPTIONS) != !_LIBCPP_HAS_EXCEPTIONS
28# error libc++ and libc++abi seem to disagree on whether exceptions are enabled24# error libc++ and libc++abi seem to disagree on whether exceptions are enabled
29#endif25#endif
...@@ -70,7 +66,7 @@ OVERRIDABLE_FUNCTION void* operator new(std::size_t size) _THROW_BAD_ALLOC {...@@ -70,7 +66,7 @@ OVERRIDABLE_FUNCTION void* operator new(std::size_t size) _THROW_BAD_ALLOC {
70 return p;66 return p;
71}67}
7268
73_LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) noexcept {69[[gnu::weak]] void* operator new(size_t size, const std::nothrow_t&) noexcept {
74#if !_LIBCPP_HAS_EXCEPTIONS70#if !_LIBCPP_HAS_EXCEPTIONS
75# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION71# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
76 _LIBCPP_ASSERT_SHIM(72 _LIBCPP_ASSERT_SHIM(
...@@ -96,7 +92,7 @@ _LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) noexcept {...@@ -96,7 +92,7 @@ _LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) noexcept {
9692
97OVERRIDABLE_FUNCTION void* operator new[](size_t size) _THROW_BAD_ALLOC { return ::operator new(size); }93OVERRIDABLE_FUNCTION void* operator new[](size_t size) _THROW_BAD_ALLOC { return ::operator new(size); }
9894
99_LIBCPP_WEAK void* operator new[](size_t size, const std::nothrow_t&) noexcept {95[[gnu::weak]] void* operator new[](size_t size, const std::nothrow_t&) noexcept {
100#if !_LIBCPP_HAS_EXCEPTIONS96#if !_LIBCPP_HAS_EXCEPTIONS
101# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION97# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
102 _LIBCPP_ASSERT_SHIM(98 _LIBCPP_ASSERT_SHIM(
...@@ -120,17 +116,17 @@ _LIBCPP_WEAK void* operator new[](size_t size, const std::nothrow_t&) noexcept {...@@ -120,17 +116,17 @@ _LIBCPP_WEAK void* operator new[](size_t size, const std::nothrow_t&) noexcept {
120#endif116#endif
121}117}
122118
123_LIBCPP_WEAK void operator delete(void* ptr) noexcept { std::free(ptr); }119[[gnu::weak]] void operator delete(void* ptr) noexcept { std::free(ptr); }
124120
125_LIBCPP_WEAK void operator delete(void* ptr, const std::nothrow_t&) noexcept { ::operator delete(ptr); }121[[gnu::weak]] void operator delete(void* ptr, const std::nothrow_t&) noexcept { ::operator delete(ptr); }
126122
127_LIBCPP_WEAK void operator delete(void* ptr, size_t) noexcept { ::operator delete(ptr); }123[[gnu::weak]] void operator delete(void* ptr, size_t) noexcept { ::operator delete(ptr); }
128124
129_LIBCPP_WEAK void operator delete[](void* ptr) noexcept { ::operator delete(ptr); }125[[gnu::weak]] void operator delete[](void* ptr) noexcept { ::operator delete(ptr); }
130126
131_LIBCPP_WEAK void operator delete[](void* ptr, const std::nothrow_t&) noexcept { ::operator delete[](ptr); }127[[gnu::weak]] void operator delete[](void* ptr, const std::nothrow_t&) noexcept { ::operator delete[](ptr); }
132128
133_LIBCPP_WEAK void operator delete[](void* ptr, size_t) noexcept { ::operator delete[](ptr); }129[[gnu::weak]] void operator delete[](void* ptr, size_t) noexcept { ::operator delete[](ptr); }
134130
135#if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION131#if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
136132
...@@ -161,7 +157,7 @@ OVERRIDABLE_FUNCTION void* operator new(std::size_t size, std::align_val_t align...@@ -161,7 +157,7 @@ OVERRIDABLE_FUNCTION void* operator new(std::size_t size, std::align_val_t align
161 return p;157 return p;
162}158}
163159
164_LIBCPP_WEAK void* operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept {160[[gnu::weak]] void* operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept {
165# if !_LIBCPP_HAS_EXCEPTIONS161# if !_LIBCPP_HAS_EXCEPTIONS
166# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION162# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
167 _LIBCPP_ASSERT_SHIM(163 _LIBCPP_ASSERT_SHIM(
...@@ -189,7 +185,7 @@ OVERRIDABLE_FUNCTION void* operator new[](size_t size, std::align_val_t alignmen...@@ -189,7 +185,7 @@ OVERRIDABLE_FUNCTION void* operator new[](size_t size, std::align_val_t alignmen
189 return ::operator new(size, alignment);185 return ::operator new(size, alignment);
190}186}
191187
192_LIBCPP_WEAK void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept {188[[gnu::weak]] void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept {
193# if !_LIBCPP_HAS_EXCEPTIONS189# if !_LIBCPP_HAS_EXCEPTIONS
194# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION190# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
195 _LIBCPP_ASSERT_SHIM(191 _LIBCPP_ASSERT_SHIM(
...@@ -213,25 +209,25 @@ _LIBCPP_WEAK void* operator new[](size_t size, std::align_val_t alignment, const...@@ -213,25 +209,25 @@ _LIBCPP_WEAK void* operator new[](size_t size, std::align_val_t alignment, const
213# endif209# endif
214}210}
215211
216_LIBCPP_WEAK void operator delete(void* ptr, std::align_val_t) noexcept { std::__libcpp_aligned_free(ptr); }212[[gnu::weak]] void operator delete(void* ptr, std::align_val_t) noexcept { std::__libcpp_aligned_free(ptr); }
217213
218_LIBCPP_WEAK void operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept {214[[gnu::weak]] void operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept {
219 ::operator delete(ptr, alignment);215 ::operator delete(ptr, alignment);
220}216}
221217
222_LIBCPP_WEAK void operator delete(void* ptr, size_t, std::align_val_t alignment) noexcept {218[[gnu::weak]] void operator delete(void* ptr, size_t, std::align_val_t alignment) noexcept {
223 ::operator delete(ptr, alignment);219 ::operator delete(ptr, alignment);
224}220}
225221
226_LIBCPP_WEAK void operator delete[](void* ptr, std::align_val_t alignment) noexcept {222[[gnu::weak]] void operator delete[](void* ptr, std::align_val_t alignment) noexcept {
227 ::operator delete(ptr, alignment);223 ::operator delete(ptr, alignment);
228}224}
229225
230_LIBCPP_WEAK void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept {226[[gnu::weak]] void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept {
231 ::operator delete[](ptr, alignment);227 ::operator delete[](ptr, alignment);
232}228}
233229
234_LIBCPP_WEAK void operator delete[](void* ptr, size_t, std::align_val_t alignment) noexcept {230[[gnu::weak]] void operator delete[](void* ptr, size_t, std::align_val_t alignment) noexcept {
235 ::operator delete[](ptr, alignment);231 ::operator delete[](ptr, alignment);
236}232}
237233