authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-02-05 10:31:16+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-04-04 06:08:09+02:00
log7ab01c9a42fa0262d67d9ff1a0ecde24fb7031e7
treeac7e366fc073b59ac1707421b998797e3d002c93
parenta89b3432563c20b344bdf3f5ec686021e7de5e23
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

libcxxabi: Update to Clang 20.


18 files changed, 344 insertions(+), 124 deletions(-)

lib/libcxxabi/include/__cxxabi_config.h+6
......@@ -103,4 +103,10 @@
103103#define _LIBCXXABI_DTOR_FUNC
104104#endif
105105
106#if __cplusplus < 201103L
107# define _LIBCXXABI_NOEXCEPT throw()
108#else
109# define _LIBCXXABI_NOEXCEPT noexcept
110#endif
111
106112#endif // ____CXXABI_CONFIG_H
lib/libcxxabi/include/cxxabi.h+14-14
......@@ -43,16 +43,16 @@ extern "C" {
4343
4444// 2.4.2 Allocating the Exception Object
4545extern _LIBCXXABI_FUNC_VIS void *
46__cxa_allocate_exception(size_t thrown_size) throw();
46__cxa_allocate_exception(size_t thrown_size) _LIBCXXABI_NOEXCEPT;
4747extern _LIBCXXABI_FUNC_VIS void
48__cxa_free_exception(void *thrown_exception) throw();
48__cxa_free_exception(void *thrown_exception) _LIBCXXABI_NOEXCEPT;
4949// This function is an LLVM extension, which mirrors the same extension in libsupc++ and libcxxrt
5050extern _LIBCXXABI_FUNC_VIS __cxa_exception*
5151#ifdef __wasm__
5252// In Wasm, a destructor returns its argument
53__cxa_init_primary_exception(void* object, std::type_info* tinfo, void*(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw();
53__cxa_init_primary_exception(void* object, std::type_info* tinfo, void*(_LIBCXXABI_DTOR_FUNC* dest)(void*)) _LIBCXXABI_NOEXCEPT;
5454#else
55__cxa_init_primary_exception(void* object, std::type_info* tinfo, void(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw();
55__cxa_init_primary_exception(void* object, std::type_info* tinfo, void(_LIBCXXABI_DTOR_FUNC* dest)(void*)) _LIBCXXABI_NOEXCEPT;
5656#endif
5757
5858// 2.4.3 Throwing the Exception Object
......@@ -66,13 +66,13 @@ __cxa_throw(void *thrown_exception, std::type_info *tinfo,
6666
6767// 2.5.3 Exception Handlers
6868extern _LIBCXXABI_FUNC_VIS void *
69__cxa_get_exception_ptr(void *exceptionObject) throw();
69__cxa_get_exception_ptr(void *exceptionObject) _LIBCXXABI_NOEXCEPT;
7070extern _LIBCXXABI_FUNC_VIS void *
71__cxa_begin_catch(void *exceptionObject) throw();
71__cxa_begin_catch(void *exceptionObject) _LIBCXXABI_NOEXCEPT;
7272extern _LIBCXXABI_FUNC_VIS void __cxa_end_catch();
7373#if defined(_LIBCXXABI_ARM_EHABI)
7474extern _LIBCXXABI_FUNC_VIS bool
75__cxa_begin_cleanup(void *exceptionObject) throw();
75__cxa_begin_cleanup(void *exceptionObject) _LIBCXXABI_NOEXCEPT;
7676extern _LIBCXXABI_FUNC_VIS void __cxa_end_cleanup();
7777#endif
7878extern _LIBCXXABI_FUNC_VIS std::type_info *__cxa_current_exception_type();
......@@ -80,7 +80,7 @@ extern _LIBCXXABI_FUNC_VIS std::type_info *__cxa_current_exception_type();
8080// GNU extension
8181// Calls `terminate` with the current exception being caught. This function is used by GCC when a `noexcept` function
8282// throws an exception inside a try/catch block and doesn't catch it.
83extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_call_terminate(void*) throw();
83extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_call_terminate(void*) _LIBCXXABI_NOEXCEPT;
8484
8585// 2.5.4 Rethrowing Exceptions
8686extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_rethrow();
......@@ -168,23 +168,23 @@ extern _LIBCXXABI_FUNC_VIS char *__cxa_demangle(const char *mangled_name,
168168
169169// Apple additions to support C++ 0x exception_ptr class
170170// These are primitives to wrap a smart pointer around an exception object
171extern _LIBCXXABI_FUNC_VIS void *__cxa_current_primary_exception() throw();
171extern _LIBCXXABI_FUNC_VIS void *__cxa_current_primary_exception() _LIBCXXABI_NOEXCEPT;
172172extern _LIBCXXABI_FUNC_VIS void
173173__cxa_rethrow_primary_exception(void *primary_exception);
174174extern _LIBCXXABI_FUNC_VIS void
175__cxa_increment_exception_refcount(void *primary_exception) throw();
175__cxa_increment_exception_refcount(void *primary_exception) _LIBCXXABI_NOEXCEPT;
176176extern _LIBCXXABI_FUNC_VIS void
177__cxa_decrement_exception_refcount(void *primary_exception) throw();
177__cxa_decrement_exception_refcount(void *primary_exception) _LIBCXXABI_NOEXCEPT;
178178
179179// Apple extension to support std::uncaught_exception()
180extern _LIBCXXABI_FUNC_VIS bool __cxa_uncaught_exception() throw();
181extern _LIBCXXABI_FUNC_VIS unsigned int __cxa_uncaught_exceptions() throw();
180extern _LIBCXXABI_FUNC_VIS bool __cxa_uncaught_exception() _LIBCXXABI_NOEXCEPT;
181extern _LIBCXXABI_FUNC_VIS unsigned int __cxa_uncaught_exceptions() _LIBCXXABI_NOEXCEPT;
182182
183183#if defined(__linux__) || defined(__Fuchsia__)
184184// Linux and Fuchsia TLS support. Not yet an official part of the Itanium ABI.
185185// https://sourceware.org/glibc/wiki/Destructor%20support%20for%20thread_local%20variables
186186extern _LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(void (*)(void *), void *,
187 void *) throw();
187 void *) _LIBCXXABI_NOEXCEPT;
188188#endif
189189
190190} // extern "C"
lib/libcxxabi/src/abort_message.cpp+3-15
......@@ -12,13 +12,8 @@
1212#include "abort_message.h"
1313
1414#ifdef __BIONIC__
15# include <android/api-level.h>
16# if __ANDROID_API__ >= 21
17# include <syslog.h>
18 extern "C" void android_set_abort_message(const char* msg);
19# else
20# include <assert.h>
21# endif // __ANDROID_API__ >= 21
15# include <syslog.h>
16extern "C" void android_set_abort_message(const char* msg);
2217#endif // __BIONIC__
2318
2419#if defined(__APPLE__) && __has_include(<CrashReporterClient.h>)
......@@ -26,7 +21,7 @@
2621# define _LIBCXXABI_USE_CRASHREPORTER_CLIENT
2722#endif
2823
29void abort_message(const char* format, ...)
24void __abort_message(const char* format, ...)
3025{
3126 // Write message to stderr. We do this before formatting into a
3227 // variable-size buffer so that we still get some information if
......@@ -59,7 +54,6 @@ void abort_message(const char* format, ...)
5954 vasprintf(&buffer, format, list);
6055 va_end(list);
6156
62# if __ANDROID_API__ >= 21
6357 // Show error in tombstone.
6458 android_set_abort_message(buffer);
6559
......@@ -67,12 +61,6 @@ void abort_message(const char* format, ...)
6761 openlog("libc++abi", 0, 0);
6862 syslog(LOG_CRIT, "%s", buffer);
6963 closelog();
70# else
71 // The good error reporting wasn't available in Android until L. Since we're
72 // about to abort anyway, just call __assert2, which will log _somewhere_
73 // (tombstone and/or logcat) in older releases.
74 __assert2(__FILE__, __LINE__, __func__, buffer);
75# endif // __ANDROID_API__ >= 21
7664#endif // __BIONIC__
7765
7866 abort();
lib/libcxxabi/src/abort_message.h+2-2
......@@ -12,7 +12,7 @@
1212#include "cxxabi.h"
1313
1414extern "C" _LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN void
15abort_message(const char *format, ...) __attribute__((format(printf, 1, 2)));
15__abort_message(const char *format, ...) __attribute__((format(printf, 1, 2)));
1616
1717#ifndef _LIBCXXABI_ASSERT
1818// zig patch: respect NDEBUG. Otherwise the file path makes it into the binary,
......@@ -24,7 +24,7 @@ abort_message(const char *format, ...) __attribute__((format(printf, 1, 2)));
2424 do { \
2525 if (!(expr)) { \
2626 char const* __msg = (msg); \
27 ::abort_message("%s:%d: %s", __FILE__, __LINE__, __msg); \
27 ::__abort_message("%s:%d: %s", __FILE__, __LINE__, __msg); \
2828 } \
2929 } while (false)
3030
lib/libcxxabi/src/cxa_default_handlers.cpp+19-20
......@@ -10,8 +10,7 @@
1010//===----------------------------------------------------------------------===//
1111
1212#include <exception>
13#include <memory>
14#include <stdlib.h>
13#include <new>
1514#include "abort_message.h"
1615#include "cxxabi.h"
1716#include "cxa_handlers.h"
......@@ -23,17 +22,7 @@
2322
2423static constinit const char* cause = "uncaught";
2524
26#ifndef _LIBCXXABI_NO_EXCEPTIONS
27// Demangle the given string, or return the string as-is in case of an error.
28static std::unique_ptr<char const, void (*)(char const*)> demangle(char const* str)
29{
30#if !defined(LIBCXXABI_NON_DEMANGLING_TERMINATE)
31 if (const char* result = __cxxabiv1::__cxa_demangle(str, nullptr, nullptr, nullptr))
32 return {result, [](char const* p) { std::free(const_cast<char*>(p)); }};
33#endif
34 return {str, [](char const*) { /* nothing to free */ }};
35}
36
25# ifndef _LIBCXXABI_NO_EXCEPTIONS
3726__attribute__((noreturn))
3827static void demangling_terminate_handler()
3928{
......@@ -42,18 +31,18 @@ static void demangling_terminate_handler()
4231
4332 // If there is no uncaught exception, just note that we're terminating
4433 if (!globals)
45 abort_message("terminating");
34 __abort_message("terminating");
4635
4736 __cxa_exception* exception_header = globals->caughtExceptions;
4837 if (!exception_header)
49 abort_message("terminating");
38 __abort_message("terminating");
5039
5140 _Unwind_Exception* unwind_exception =
5241 reinterpret_cast<_Unwind_Exception*>(exception_header + 1) - 1;
5342
5443 // If we're terminating due to a foreign exception
5544 if (!__isOurExceptionClass(unwind_exception))
56 abort_message("terminating due to %s foreign exception", cause);
45 __abort_message("terminating due to %s foreign exception", cause);
5746
5847 void* thrown_object =
5948 __getExceptionClass(unwind_exception) == kOurDependentExceptionClass ?
......@@ -61,7 +50,17 @@ static void demangling_terminate_handler()
6150 exception_header + 1;
6251 const __shim_type_info* thrown_type =
6352 static_cast<const __shim_type_info*>(exception_header->exceptionType);
64 auto name = demangle(thrown_type->name());
53
54 auto name = [str = thrown_type->name()] {
55# ifndef LIBCXXABI_NON_DEMANGLING_TERMINATE
56 if (const char* result = __cxxabiv1::__cxa_demangle(str, nullptr, nullptr, nullptr))
57 // We're about to abort(), this memory can never be freed; so it's fine
58 // to just return a raw pointer
59 return result;
60# endif
61 return str;
62 }();
63
6564 // If the uncaught exception can be caught with std::exception&
6665 const __shim_type_info* catch_type =
6766 static_cast<const __shim_type_info*>(&typeid(std::exception));
......@@ -69,19 +68,19 @@ static void demangling_terminate_handler()
6968 {
7069 // Include the what() message from the exception
7170 const std::exception* e = static_cast<const std::exception*>(thrown_object);
72 abort_message("terminating due to %s exception of type %s: %s", cause, name.get(), e->what());
71 __abort_message("terminating due to %s exception of type %s: %s", cause, name, e->what());
7372 }
7473 else
7574 {
7675 // Else just note that we're terminating due to an exception
77 abort_message("terminating due to %s exception of type %s", cause, name.get());
76 __abort_message("terminating due to %s exception of type %s", cause, name);
7877 }
7978}
8079#else // !_LIBCXXABI_NO_EXCEPTIONS
8180__attribute__((noreturn))
8281static void demangling_terminate_handler()
8382{
84 abort_message("terminating");
83 __abort_message("terminating");
8584}
8685#endif // !_LIBCXXABI_NO_EXCEPTIONS
8786
lib/libcxxabi/src/cxa_demangle.cpp-4
......@@ -28,10 +28,6 @@
2828
2929using namespace itanium_demangle;
3030
31constexpr const char *itanium_demangle::FloatData<float>::spec;
32constexpr const char *itanium_demangle::FloatData<double>::spec;
33constexpr const char *itanium_demangle::FloatData<long double>::spec;
34
3531// <discriminator> := _ <non-negative number> # when number < 10
3632// := __ <non-negative number> _ # when number >= 10
3733// extension := decimal-digit+ # at the end of string
lib/libcxxabi/src/cxa_exception_storage.cpp+6-6
......@@ -56,17 +56,17 @@ extern "C" {
5656namespace __cxxabiv1 {
5757namespace {
5858 std::__libcpp_tls_key key_;
59 std::__libcpp_exec_once_flag flag_ = _LIBCPP_EXEC_ONCE_INITIALIZER;
59 constinit std::__libcpp_exec_once_flag flag_ = _LIBCPP_EXEC_ONCE_INITIALIZER;
6060
6161 void _LIBCPP_TLS_DESTRUCTOR_CC destruct_(void *p) {
6262 __free_with_fallback(p);
6363 if (0 != std::__libcpp_tls_set(key_, NULL))
64 abort_message("cannot zero out thread value for __cxa_get_globals()");
64 __abort_message("cannot zero out thread value for __cxa_get_globals()");
6565 }
6666
6767 void construct_() {
6868 if (0 != std::__libcpp_tls_create(&key_, destruct_))
69 abort_message("cannot create thread specific key for __cxa_get_globals()");
69 __abort_message("cannot create thread specific key for __cxa_get_globals()");
7070 }
7171} // namespace
7272
......@@ -80,9 +80,9 @@ extern "C" {
8080 retVal = static_cast<__cxa_eh_globals*>(
8181 __calloc_with_fallback(1, sizeof(__cxa_eh_globals)));
8282 if (NULL == retVal)
83 abort_message("cannot allocate __cxa_eh_globals");
83 __abort_message("cannot allocate __cxa_eh_globals");
8484 if (0 != std::__libcpp_tls_set(key_, retVal))
85 abort_message("std::__libcpp_tls_set failure in __cxa_get_globals()");
85 __abort_message("std::__libcpp_tls_set failure in __cxa_get_globals()");
8686 }
8787 return retVal;
8888 }
......@@ -94,7 +94,7 @@ extern "C" {
9494 __cxa_eh_globals *__cxa_get_globals_fast() {
9595 // First time through, create the key.
9696 if (0 != std::__libcpp_execute_once(&flag_, construct_))
97 abort_message("execute once failure in __cxa_get_globals_fast()");
97 __abort_message("execute once failure in __cxa_get_globals_fast()");
9898 return static_cast<__cxa_eh_globals*>(std::__libcpp_tls_get(key_));
9999 }
100100} // extern "C"
lib/libcxxabi/src/cxa_guard_impl.h+5-5
......@@ -91,7 +91,7 @@
9191// the former.
9292#ifdef BUILDING_CXA_GUARD
9393# include "abort_message.h"
94# define ABORT_WITH_MESSAGE(...) ::abort_message(__VA_ARGS__)
94# define ABORT_WITH_MESSAGE(...) ::__abort_message(__VA_ARGS__)
9595#elif defined(TESTING_CXA_GUARD)
9696# define ABORT_WITH_MESSAGE(...) ::abort()
9797#else
......@@ -156,12 +156,12 @@ private:
156156// PlatformGetThreadID
157157//===----------------------------------------------------------------------===//
158158
159#if defined(__APPLE__) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
159#if defined(__APPLE__) && _LIBCPP_HAS_THREAD_API_PTHREAD
160160uint32_t PlatformThreadID() {
161161 static_assert(sizeof(mach_port_t) == sizeof(uint32_t), "");
162162 return static_cast<uint32_t>(pthread_mach_thread_np(std::__libcpp_thread_get_current_id()));
163163}
164#elif defined(SYS_gettid) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
164#elif defined(SYS_gettid) && _LIBCPP_HAS_THREAD_API_PTHREAD
165165uint32_t PlatformThreadID() {
166166 static_assert(sizeof(pid_t) == sizeof(uint32_t), "");
167167 return static_cast<uint32_t>(syscall(SYS_gettid));
......@@ -676,8 +676,8 @@ static_assert(CurrentImplementation != Implementation::Futex || PlatformSupports
676676
677677using SelectedImplementation = SelectImplementation<CurrentImplementation>::type;
678678
679} // end namespace
680} // end namespace __cxxabiv1
679} // namespace
680} // namespace __cxxabiv1
681681
682682#if defined(__clang__)
683683# pragma clang diagnostic pop
lib/libcxxabi/src/cxa_handlers.cpp+3-3
......@@ -33,7 +33,7 @@ __unexpected(unexpected_handler func)
3333{
3434 func();
3535 // unexpected handler should not return
36 abort_message("unexpected_handler unexpectedly returned");
36 __abort_message("unexpected_handler unexpectedly returned");
3737}
3838
3939__attribute__((noreturn))
......@@ -58,13 +58,13 @@ __terminate(terminate_handler func) noexcept
5858#endif // _LIBCXXABI_NO_EXCEPTIONS
5959 func();
6060 // handler should not return
61 abort_message("terminate_handler unexpectedly returned");
61 __abort_message("terminate_handler unexpectedly returned");
6262#ifndef _LIBCXXABI_NO_EXCEPTIONS
6363 }
6464 catch (...)
6565 {
6666 // handler should not throw exception
67 abort_message("terminate_handler unexpectedly threw an exception");
67 __abort_message("terminate_handler unexpectedly threw an exception");
6868 }
6969#endif // _LIBCXXABI_NO_EXCEPTIONS
7070}
lib/libcxxabi/src/cxa_personality.cpp+1-1
......@@ -167,7 +167,7 @@ uintptr_t readPointerHelper(const uint8_t*& p) {
167167 return static_cast<uintptr_t>(value);
168168}
169169
170} // end namespace
170} // namespace
171171
172172extern "C"
173173{
lib/libcxxabi/src/cxa_thread_atexit.cpp+1-1
......@@ -89,7 +89,7 @@ namespace {
8989 // __cxa_thread_atexit() may be called arbitrarily late (for example, from
9090 // global destructors or atexit() handlers).
9191 if (std::__libcpp_tls_create(&dtors_key, run_dtors) != 0) {
92 abort_message("std::__libcpp_tls_create() failed in __cxa_thread_atexit()");
92 __abort_message("std::__libcpp_tls_create() failed in __cxa_thread_atexit()");
9393 }
9494 }
9595
lib/libcxxabi/src/cxa_vector.cpp+1-1
......@@ -121,7 +121,7 @@ void throw_bad_array_new_length() {
121121#ifndef _LIBCXXABI_NO_EXCEPTIONS
122122 throw std::bad_array_new_length();
123123#else
124 abort_message("__cxa_vec_new failed to allocate memory");
124 __abort_message("__cxa_vec_new failed to allocate memory");
125125#endif
126126}
127127
lib/libcxxabi/src/cxa_virtual.cpp+2-2
......@@ -13,12 +13,12 @@ namespace __cxxabiv1 {
1313extern "C" {
1414_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN
1515void __cxa_pure_virtual(void) {
16 abort_message("Pure virtual function called!");
16 __abort_message("Pure virtual function called!");
1717}
1818
1919_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN
2020void __cxa_deleted_virtual(void) {
21 abort_message("Deleted virtual function called!");
21 __abort_message("Deleted virtual function called!");
2222}
2323} // extern "C"
2424} // abi
lib/libcxxabi/src/demangle/DemangleConfig.h+1-1
......@@ -15,7 +15,7 @@
1515// build systems to override this value.
1616// https://libcxx.llvm.org/UsingLibcxx.html#enabling-the-safe-libc-mode
1717#ifndef _LIBCPP_VERBOSE_ABORT
18#define _LIBCPP_VERBOSE_ABORT(...) abort_message(__VA_ARGS__)
18#define _LIBCPP_VERBOSE_ABORT(...) __abort_message(__VA_ARGS__)
1919#include "../abort_message.h"
2020#endif
2121
lib/libcxxabi/src/demangle/ItaniumDemangle.h+262-32
......@@ -19,7 +19,6 @@
1919#include "DemangleConfig.h"
2020#include "StringViewExtras.h"
2121#include "Utility.h"
22#include <__cxxabi_config.h>
2322#include <algorithm>
2423#include <cctype>
2524#include <cstdio>
......@@ -31,7 +30,7 @@
3130#include <type_traits>
3231#include <utility>
3332
34#ifdef _LIBCXXABI_COMPILER_CLANG
33#if defined(__clang__)
3534#pragma clang diagnostic push
3635#pragma clang diagnostic ignored "-Wunused-template"
3736#endif
......@@ -157,6 +156,8 @@ public:
157156 }
158157};
159158
159class NodeArray;
160
160161// Base class of all AST nodes. The AST is built by the parser, then is
161162// traversed by the printLeft/Right functions to produce a demangled string.
162163class Node {
......@@ -200,8 +201,7 @@ private:
200201
201202 Prec Precedence : 6;
202203
203 // FIXME: Make these protected.
204public:
204protected:
205205 /// Tracks if this node has a component on its right side, in which case we
206206 /// need to call printRight.
207207 Cache RHSComponentCache : 2;
......@@ -255,6 +255,9 @@ public:
255255 Kind getKind() const { return K; }
256256
257257 Prec getPrecedence() const { return Precedence; }
258 Cache getRHSComponentCache() const { return RHSComponentCache; }
259 Cache getArrayCache() const { return ArrayCache; }
260 Cache getFunctionCache() const { return FunctionCache; }
258261
259262 virtual bool hasRHSComponentSlow(OutputBuffer &) const { return false; }
260263 virtual bool hasArraySlow(OutputBuffer &) const { return false; }
......@@ -292,6 +295,13 @@ public:
292295 // implementation.
293296 virtual void printRight(OutputBuffer &) const {}
294297
298 // Print an initializer list of this type. Returns true if we printed a custom
299 // representation, false if nothing has been printed and the default
300 // representation should be used.
301 virtual bool printInitListAsType(OutputBuffer &, const NodeArray &) const {
302 return false;
303 }
304
295305 virtual std::string_view getBaseName() const { return {}; }
296306
297307 // Silence compiler warnings, this dtor will never be called.
......@@ -338,6 +348,10 @@ public:
338348 FirstElement = false;
339349 }
340350 }
351
352 // Print an array of integer literals as a string literal. Returns whether we
353 // could do so.
354 bool printAsString(OutputBuffer &OB) const;
341355};
342356
343357struct NodeArrayNode : Node {
......@@ -424,8 +438,8 @@ protected:
424438
425439public:
426440 QualType(const Node *Child_, Qualifiers Quals_)
427 : Node(KQualType, Child_->RHSComponentCache,
428 Child_->ArrayCache, Child_->FunctionCache),
441 : Node(KQualType, Child_->getRHSComponentCache(), Child_->getArrayCache(),
442 Child_->getFunctionCache()),
429443 Quals(Quals_), Child(Child_) {}
430444
431445 Qualifiers getQuals() const { return Quals; }
......@@ -554,8 +568,8 @@ struct AbiTagAttr : Node {
554568 std::string_view Tag;
555569
556570 AbiTagAttr(Node *Base_, std::string_view Tag_)
557 : Node(KAbiTagAttr, Base_->RHSComponentCache, Base_->ArrayCache,
558 Base_->FunctionCache),
571 : Node(KAbiTagAttr, Base_->getRHSComponentCache(), Base_->getArrayCache(),
572 Base_->getFunctionCache()),
559573 Base(Base_), Tag(Tag_) {}
560574
561575 template<typename Fn> void match(Fn F) const { F(Base, Tag); }
......@@ -615,7 +629,7 @@ class PointerType final : public Node {
615629
616630public:
617631 PointerType(const Node *Pointee_)
618 : Node(KPointerType, Pointee_->RHSComponentCache),
632 : Node(KPointerType, Pointee_->getRHSComponentCache()),
619633 Pointee(Pointee_) {}
620634
621635 const Node *getPointee() const { return Pointee; }
......@@ -699,7 +713,7 @@ class ReferenceType : public Node {
699713
700714public:
701715 ReferenceType(const Node *Pointee_, ReferenceKind RK_)
702 : Node(KReferenceType, Pointee_->RHSComponentCache),
716 : Node(KReferenceType, Pointee_->getRHSComponentCache()),
703717 Pointee(Pointee_), RK(RK_) {}
704718
705719 template<typename Fn> void match(Fn F) const { F(Pointee, RK); }
......@@ -742,7 +756,7 @@ class PointerToMemberType final : public Node {
742756
743757public:
744758 PointerToMemberType(const Node *ClassType_, const Node *MemberType_)
745 : Node(KPointerToMemberType, MemberType_->RHSComponentCache),
759 : Node(KPointerToMemberType, MemberType_->getRHSComponentCache()),
746760 ClassType(ClassType_), MemberType(MemberType_) {}
747761
748762 template<typename Fn> void match(Fn F) const { F(ClassType, MemberType); }
......@@ -795,6 +809,15 @@ public:
795809 OB += "]";
796810 Base->printRight(OB);
797811 }
812
813 bool printInitListAsType(OutputBuffer &OB,
814 const NodeArray &Elements) const override {
815 if (Base->getKind() == KNameType &&
816 static_cast<const NameType *>(Base)->getName() == "char") {
817 return Elements.printAsString(OB);
818 }
819 return false;
820 }
798821};
799822
800823class FunctionType final : public Node {
......@@ -1383,16 +1406,14 @@ class ParameterPack final : public Node {
13831406public:
13841407 ParameterPack(NodeArray Data_) : Node(KParameterPack), Data(Data_) {
13851408 ArrayCache = FunctionCache = RHSComponentCache = Cache::Unknown;
1386 if (std::all_of(Data.begin(), Data.end(), [](Node* P) {
1387 return P->ArrayCache == Cache::No;
1388 }))
1409 if (std::all_of(Data.begin(), Data.end(),
1410 [](Node *P) { return P->getArrayCache() == Cache::No; }))
13891411 ArrayCache = Cache::No;
1390 if (std::all_of(Data.begin(), Data.end(), [](Node* P) {
1391 return P->FunctionCache == Cache::No;
1392 }))
1412 if (std::all_of(Data.begin(), Data.end(),
1413 [](Node *P) { return P->getFunctionCache() == Cache::No; }))
13931414 FunctionCache = Cache::No;
1394 if (std::all_of(Data.begin(), Data.end(), [](Node* P) {
1395 return P->RHSComponentCache == Cache::No;
1415 if (std::all_of(Data.begin(), Data.end(), [](Node *P) {
1416 return P->getRHSComponentCache() == Cache::No;
13961417 }))
13971418 RHSComponentCache = Cache::No;
13981419 }
......@@ -2056,17 +2077,23 @@ public:
20562077class CallExpr : public Node {
20572078 const Node *Callee;
20582079 NodeArray Args;
2080 bool IsParen; // (func)(args ...) ?
20592081
20602082public:
2061 CallExpr(const Node *Callee_, NodeArray Args_, Prec Prec_)
2062 : Node(KCallExpr, Prec_), Callee(Callee_), Args(Args_) {}
2083 CallExpr(const Node *Callee_, NodeArray Args_, bool IsParen_, Prec Prec_)
2084 : Node(KCallExpr, Prec_), Callee(Callee_), Args(Args_),
2085 IsParen(IsParen_) {}
20632086
20642087 template <typename Fn> void match(Fn F) const {
2065 F(Callee, Args, getPrecedence());
2088 F(Callee, Args, IsParen, getPrecedence());
20662089 }
20672090
20682091 void printLeft(OutputBuffer &OB) const override {
2092 if (IsParen)
2093 OB.printOpen();
20692094 Callee->print(OB);
2095 if (IsParen)
2096 OB.printClose();
20702097 OB.printOpen();
20712098 Args.printWithComma(OB);
20722099 OB.printClose();
......@@ -2226,8 +2253,11 @@ public:
22262253 template<typename Fn> void match(Fn F) const { F(Ty, Inits); }
22272254
22282255 void printLeft(OutputBuffer &OB) const override {
2229 if (Ty)
2256 if (Ty) {
2257 if (Ty->printInitListAsType(OB, Inits))
2258 return;
22302259 Ty->print(OB);
2260 }
22312261 OB += '{';
22322262 Inits.printWithComma(OB);
22332263 OB += '}';
......@@ -2434,6 +2464,8 @@ public:
24342464 if (Type.size() <= 3)
24352465 OB += Type;
24362466 }
2467
2468 std::string_view value() const { return Value; }
24372469};
24382470
24392471class RequiresExpr : public Node {
......@@ -2605,6 +2637,94 @@ template<typename NodeT> struct NodeKind;
26052637 };
26062638#include "ItaniumNodes.def"
26072639
2640inline bool NodeArray::printAsString(OutputBuffer &OB) const {
2641 auto StartPos = OB.getCurrentPosition();
2642 auto Fail = [&OB, StartPos] {
2643 OB.setCurrentPosition(StartPos);
2644 return false;
2645 };
2646
2647 OB += '"';
2648 bool LastWasNumericEscape = false;
2649 for (const Node *Element : *this) {
2650 if (Element->getKind() != Node::KIntegerLiteral)
2651 return Fail();
2652 int integer_value = 0;
2653 for (char c : static_cast<const IntegerLiteral *>(Element)->value()) {
2654 if (c < '0' || c > '9' || integer_value > 25)
2655 return Fail();
2656 integer_value *= 10;
2657 integer_value += c - '0';
2658 }
2659 if (integer_value > 255)
2660 return Fail();
2661
2662 // Insert a `""` to avoid accidentally extending a numeric escape.
2663 if (LastWasNumericEscape) {
2664 if ((integer_value >= '0' && integer_value <= '9') ||
2665 (integer_value >= 'a' && integer_value <= 'f') ||
2666 (integer_value >= 'A' && integer_value <= 'F')) {
2667 OB += "\"\"";
2668 }
2669 }
2670
2671 LastWasNumericEscape = false;
2672
2673 // Determine how to print this character.
2674 switch (integer_value) {
2675 case '\a':
2676 OB += "\\a";
2677 break;
2678 case '\b':
2679 OB += "\\b";
2680 break;
2681 case '\f':
2682 OB += "\\f";
2683 break;
2684 case '\n':
2685 OB += "\\n";
2686 break;
2687 case '\r':
2688 OB += "\\r";
2689 break;
2690 case '\t':
2691 OB += "\\t";
2692 break;
2693 case '\v':
2694 OB += "\\v";
2695 break;
2696
2697 case '"':
2698 OB += "\\\"";
2699 break;
2700 case '\\':
2701 OB += "\\\\";
2702 break;
2703
2704 default:
2705 // We assume that the character is ASCII, and use a numeric escape for all
2706 // remaining non-printable ASCII characters.
2707 if (integer_value < 32 || integer_value == 127) {
2708 constexpr char Hex[] = "0123456789ABCDEF";
2709 OB += '\\';
2710 if (integer_value > 7)
2711 OB += 'x';
2712 if (integer_value >= 16)
2713 OB += Hex[integer_value >> 4];
2714 OB += Hex[integer_value & 0xF];
2715 LastWasNumericEscape = true;
2716 break;
2717 }
2718
2719 // Assume all remaining characters are directly printable.
2720 OB += (char)integer_value;
2721 break;
2722 }
2723 }
2724 OB += '"';
2725 return true;
2726}
2727
26082728template <typename Derived, typename Alloc> struct AbstractManglingParser {
26092729 const char *First;
26102730 const char *Last;
......@@ -2678,7 +2798,7 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
26782798
26792799 bool TryToParseTemplateArgs = true;
26802800 bool PermitForwardTemplateReferences = false;
2681 bool InConstraintExpr = false;
2801 bool HasIncompleteTemplateParameterTracking = false;
26822802 size_t ParsingLambdaParamsAtLevel = (size_t)-1;
26832803
26842804 unsigned NumSyntheticTemplateParameters[3] = {};
......@@ -3240,9 +3360,12 @@ const typename AbstractManglingParser<
32403360 "operator co_await"},
32413361 {"az", OperatorInfo::OfIdOp, /*Type*/ false, Node::Prec::Unary, "alignof "},
32423362 {"cc", OperatorInfo::NamedCast, false, Node::Prec::Postfix, "const_cast"},
3243 {"cl", OperatorInfo::Call, false, Node::Prec::Postfix, "operator()"},
3363 {"cl", OperatorInfo::Call, /*Paren*/ false, Node::Prec::Postfix,
3364 "operator()"},
32443365 {"cm", OperatorInfo::Binary, false, Node::Prec::Comma, "operator,"},
32453366 {"co", OperatorInfo::Prefix, false, Node::Prec::Unary, "operator~"},
3367 {"cp", OperatorInfo::Call, /*Paren*/ true, Node::Prec::Postfix,
3368 "operator()"},
32463369 {"cv", OperatorInfo::CCast, false, Node::Prec::Cast, "operator"}, // C Cast
32473370 {"dV", OperatorInfo::Binary, false, Node::Prec::Assign, "operator/="},
32483371 {"da", OperatorInfo::Del, /*Ary*/ true, Node::Prec::Unary,
......@@ -3319,7 +3442,7 @@ AbstractManglingParser<Derived, Alloc>::parseOperatorEncoding() {
33193442 return nullptr;
33203443
33213444 // We can't use lower_bound as that can link to symbols in the C++ library,
3322 // and this must remain independant of that.
3445 // and this must remain independent of that.
33233446 size_t lower = 0u, upper = NumOps - 1; // Inclusive bounds.
33243447 while (upper != lower) {
33253448 size_t middle = (upper + lower) / 2;
......@@ -4207,9 +4330,12 @@ Node *AbstractManglingParser<Derived, Alloc>::parseType() {
42074330 case 'h':
42084331 First += 2;
42094332 return make<NameType>("half");
4210 // ::= DF <number> _ # ISO/IEC TS 18661 binary floating point (N bits)
4333 // ::= DF16b # C++23 std::bfloat16_t
4334 // ::= DF <number> _ # ISO/IEC TS 18661 binary floating point (N bits)
42114335 case 'F': {
42124336 First += 2;
4337 if (consumeIf("16b"))
4338 return make<NameType>("std::bfloat16_t");
42134339 Node *DimensionNumber = make<NameType>(parseNumber());
42144340 if (!DimensionNumber)
42154341 return nullptr;
......@@ -4217,6 +4343,101 @@ Node *AbstractManglingParser<Derived, Alloc>::parseType() {
42174343 return nullptr;
42184344 return make<BinaryFPType>(DimensionNumber);
42194345 }
4346 // ::= [DS] DA # N1169 fixed-point [_Sat] T _Accum
4347 // ::= [DS] DR # N1169 fixed-point [_Sat] T _Frac
4348 // <fixed-point-size>
4349 // ::= s # short
4350 // ::= t # unsigned short
4351 // ::= i # plain
4352 // ::= j # unsigned
4353 // ::= l # long
4354 // ::= m # unsigned long
4355 case 'A': {
4356 char c = look(2);
4357 First += 3;
4358 switch (c) {
4359 case 's':
4360 return make<NameType>("short _Accum");
4361 case 't':
4362 return make<NameType>("unsigned short _Accum");
4363 case 'i':
4364 return make<NameType>("_Accum");
4365 case 'j':
4366 return make<NameType>("unsigned _Accum");
4367 case 'l':
4368 return make<NameType>("long _Accum");
4369 case 'm':
4370 return make<NameType>("unsigned long _Accum");
4371 default:
4372 return nullptr;
4373 }
4374 }
4375 case 'R': {
4376 char c = look(2);
4377 First += 3;
4378 switch (c) {
4379 case 's':
4380 return make<NameType>("short _Fract");
4381 case 't':
4382 return make<NameType>("unsigned short _Fract");
4383 case 'i':
4384 return make<NameType>("_Fract");
4385 case 'j':
4386 return make<NameType>("unsigned _Fract");
4387 case 'l':
4388 return make<NameType>("long _Fract");
4389 case 'm':
4390 return make<NameType>("unsigned long _Fract");
4391 default:
4392 return nullptr;
4393 }
4394 }
4395 case 'S': {
4396 First += 2;
4397 if (look() != 'D')
4398 return nullptr;
4399 if (look(1) == 'A') {
4400 char c = look(2);
4401 First += 3;
4402 switch (c) {
4403 case 's':
4404 return make<NameType>("_Sat short _Accum");
4405 case 't':
4406 return make<NameType>("_Sat unsigned short _Accum");
4407 case 'i':
4408 return make<NameType>("_Sat _Accum");
4409 case 'j':
4410 return make<NameType>("_Sat unsigned _Accum");
4411 case 'l':
4412 return make<NameType>("_Sat long _Accum");
4413 case 'm':
4414 return make<NameType>("_Sat unsigned long _Accum");
4415 default:
4416 return nullptr;
4417 }
4418 }
4419 if (look(1) == 'R') {
4420 char c = look(2);
4421 First += 3;
4422 switch (c) {
4423 case 's':
4424 return make<NameType>("_Sat short _Fract");
4425 case 't':
4426 return make<NameType>("_Sat unsigned short _Fract");
4427 case 'i':
4428 return make<NameType>("_Sat _Fract");
4429 case 'j':
4430 return make<NameType>("_Sat unsigned _Fract");
4431 case 'l':
4432 return make<NameType>("_Sat long _Fract");
4433 case 'm':
4434 return make<NameType>("_Sat unsigned long _Fract");
4435 default:
4436 return nullptr;
4437 }
4438 }
4439 return nullptr;
4440 }
42204441 // ::= DB <number> _ # C23 signed _BitInt(N)
42214442 // ::= DB <instantiation-dependent expression> _ # C23 signed _BitInt(N)
42224443 // ::= DU <number> _ # C23 unsigned _BitInt(N)
......@@ -4337,6 +4558,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseType() {
43374558 // parse them, take the second production.
43384559
43394560 if (TryToParseTemplateArgs && look() == 'I') {
4561 Subs.push_back(Result);
43404562 Node *TA = getDerived().parseTemplateArgs();
43414563 if (TA == nullptr)
43424564 return nullptr;
......@@ -4819,7 +5041,8 @@ template <typename Derived, typename Alloc>
48195041Node *AbstractManglingParser<Derived, Alloc>::parseConstraintExpr() {
48205042 // Within this expression, all enclosing template parameter lists are in
48215043 // scope.
4822 ScopedOverride<bool> SaveInConstraintExpr(InConstraintExpr, true);
5044 ScopedOverride<bool> SaveIncompleteTemplateParameterTracking(
5045 HasIncompleteTemplateParameterTracking, true);
48235046 return getDerived().parseExpr();
48245047}
48255048
......@@ -4888,6 +5111,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseRequiresExpr() {
48885111// ::= <binary operator-name> <expression> <expression>
48895112// ::= <ternary operator-name> <expression> <expression> <expression>
48905113// ::= cl <expression>+ E # call
5114// ::= cp <base-unresolved-name> <expression>* E # (name) (expr-list), call that would use argument-dependent lookup but for the parentheses
48915115// ::= cv <type> <expression> # conversion with one argument
48925116// ::= cv <type> _ <expression>* E # conversion with a different number of arguments
48935117// ::= [gs] nw <expression>* _ <type> E # new (expr-list) type
......@@ -5023,7 +5247,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseExpr() {
50235247 Names.push_back(E);
50245248 }
50255249 return make<CallExpr>(Callee, popTrailingNodeArray(ExprsBegin),
5026 Op->getPrecedence());
5250 /*IsParen=*/Op->getFlag(), Op->getPrecedence());
50275251 }
50285252 case OperatorInfo::CCast: {
50295253 // C Cast: (type)expr
......@@ -5210,7 +5434,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseExpr() {
52105434 }
52115435 }
52125436 return make<CallExpr>(Name, popTrailingNodeArray(ExprsBegin),
5213 Node::Prec::Postfix);
5437 /*IsParen=*/false, Node::Prec::Postfix);
52145438 }
52155439
52165440 // Only unresolved names remain.
......@@ -5677,7 +5901,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseTemplateParam() {
56775901 // substitute them all within a <constraint-expression>, so print the
56785902 // parameter numbering instead for now.
56795903 // TODO: Track all enclosing template parameters and substitute them here.
5680 if (InConstraintExpr) {
5904 if (HasIncompleteTemplateParameterTracking) {
56815905 return make<NameType>(std::string_view(Begin, First - 1 - Begin));
56825906 }
56835907
......@@ -5738,6 +5962,12 @@ Node *AbstractManglingParser<Derived, Alloc>::parseTemplateParamDecl(
57385962 }
57395963
57405964 if (consumeIf("Tk")) {
5965 // We don't track enclosing template parameter levels well enough to
5966 // reliably demangle template parameter substitutions, so print an arbitrary
5967 // string in place of a parameter for now.
5968 // TODO: Track all enclosing template parameters and demangle substitutions.
5969 ScopedOverride<bool> SaveIncompleteTemplateParameterTrackingExpr(
5970 HasIncompleteTemplateParameterTracking, true);
57415971 Node *Constraint = getDerived().parseName();
57425972 if (!Constraint)
57435973 return nullptr;
......@@ -5948,7 +6178,7 @@ struct ManglingParser : AbstractManglingParser<ManglingParser<Alloc>, Alloc> {
59486178
59496179DEMANGLE_NAMESPACE_END
59506180
5951#ifdef _LIBCXXABI_COMPILER_CLANG
6181#if defined(__clang__)
59526182#pragma clang diagnostic pop
59536183#endif
59546184
lib/libcxxabi/src/fallback_malloc.cpp+2-2
......@@ -259,7 +259,7 @@ void* __aligned_malloc_with_fallback(size_t size) {
259259#if defined(_WIN32)
260260 if (void* dest = std::__libcpp_aligned_alloc(alignof(__aligned_type), size))
261261 return dest;
262#elif defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION)
262#elif !_LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
263263 if (void* dest = ::malloc(size))
264264 return dest;
265265#else
......@@ -286,7 +286,7 @@ void __aligned_free_with_fallback(void* ptr) {
286286 if (is_fallback_ptr(ptr))
287287 fallback_free(ptr);
288288 else {
289#if defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION)
289#if !_LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
290290 ::free(ptr);
291291#else
292292 std::__libcpp_aligned_free(ptr);
lib/libcxxabi/src/private_typeinfo.cpp+6-5
......@@ -41,9 +41,11 @@
4141// Defining _LIBCXXABI_FORGIVING_DYNAMIC_CAST does not help since can_catch() calls
4242// is_equal() with use_strcmp=false so the string names are not compared.
4343
44#include <cstdint>
4544#include <cassert>
45#include <cstddef>
46#include <cstdint>
4647#include <string.h>
48
4749#include "abort_message.h"
4850
4951#ifdef _LIBCXXABI_FORGIVING_DYNAMIC_CAST
......@@ -589,10 +591,9 @@ __base_class_type_info::has_unambiguous_public_base(__dynamic_cast_info* info,
589591 // .. and reset the pointer.
590592 adjustedPtr = nullptr;
591593 }
592 __base_type->has_unambiguous_public_base(
593 info,
594 static_cast<char*>(adjustedPtr) + offset_to_base,
595 (__offset_flags & __public_mask) ? path_below : not_public_path);
594 __base_type->has_unambiguous_public_base(
595 info, reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(adjustedPtr) + offset_to_base),
596 (__offset_flags & __public_mask) ? path_below : not_public_path);
596597}
597598
598599void
lib/libcxxabi/src/stdlib_new_delete.cpp+10-10
......@@ -24,22 +24,22 @@
2424# error The _LIBCPP_WEAK macro should be already defined by libc++
2525#endif
2626
27#if defined(_LIBCXXABI_NO_EXCEPTIONS) != defined(_LIBCPP_HAS_NO_EXCEPTIONS)
27#if defined(_LIBCXXABI_NO_EXCEPTIONS) != !_LIBCPP_HAS_EXCEPTIONS
2828# error libc++ and libc++abi seem to disagree on whether exceptions are enabled
2929#endif
3030
3131inline void __throw_bad_alloc_shim() {
32#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
32#if _LIBCPP_HAS_EXCEPTIONS
3333 throw std::bad_alloc();
3434#else
35 abort_message("bad_alloc was thrown in -fno-exceptions mode");
35 __abort_message("bad_alloc was thrown in -fno-exceptions mode");
3636#endif
3737}
3838
3939#define _LIBCPP_ASSERT_SHIM(expr, str) \
4040 do { \
4141 if (!expr) \
42 abort_message(str); \
42 __abort_message(str); \
4343 } while (false)
4444
4545// ------------------ BEGIN COPY ------------------
......@@ -71,7 +71,7 @@ _LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE _LIBCPP_WEAK void* operator new(std
7171}
7272
7373_LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) noexcept {
74#ifdef _LIBCPP_HAS_NO_EXCEPTIONS
74#if !_LIBCPP_HAS_EXCEPTIONS
7575# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
7676 _LIBCPP_ASSERT_SHIM(
7777 !std::__is_function_overridden(static_cast<void* (*)(std::size_t)>(&operator new)),
......@@ -99,7 +99,7 @@ _LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE _LIBCPP_WEAK void* operator new[](s
9999}
100100
101101_LIBCPP_WEAK void* operator new[](size_t size, const std::nothrow_t&) noexcept {
102#ifdef _LIBCPP_HAS_NO_EXCEPTIONS
102#if !_LIBCPP_HAS_EXCEPTIONS
103103# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
104104 _LIBCPP_ASSERT_SHIM(
105105 !std::__is_function_overridden(static_cast<void* (*)(std::size_t)>(&operator new[])),
......@@ -134,7 +134,7 @@ _LIBCPP_WEAK void operator delete[](void* ptr, const std::nothrow_t&) noexcept {
134134
135135_LIBCPP_WEAK void operator delete[](void* ptr, size_t) noexcept { ::operator delete[](ptr); }
136136
137#if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION)
137#if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
138138
139139static void* operator_new_aligned_impl(std::size_t size, std::align_val_t alignment) {
140140 if (size == 0)
......@@ -165,7 +165,7 @@ operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC {
165165}
166166
167167_LIBCPP_WEAK void* operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept {
168# ifdef _LIBCPP_HAS_NO_EXCEPTIONS
168# if !_LIBCPP_HAS_EXCEPTIONS
169169# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
170170 _LIBCPP_ASSERT_SHIM(
171171 !std::__is_function_overridden(static_cast<void* (*)(std::size_t, std::align_val_t)>(&operator new)),
......@@ -194,7 +194,7 @@ operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC {
194194}
195195
196196_LIBCPP_WEAK void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept {
197# ifdef _LIBCPP_HAS_NO_EXCEPTIONS
197# if !_LIBCPP_HAS_EXCEPTIONS
198198# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
199199 _LIBCPP_ASSERT_SHIM(
200200 !std::__is_function_overridden(static_cast<void* (*)(std::size_t, std::align_val_t)>(&operator new[])),
......@@ -240,5 +240,5 @@ _LIBCPP_WEAK void operator delete[](void* ptr, size_t, std::align_val_t alignmen
240240 ::operator delete[](ptr, alignment);
241241}
242242
243#endif // !_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
243#endif // _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
244244// ------------------ END COPY ------------------