| author | |
| committer | |
| log | 7ab01c9a42fa0262d67d9ff1a0ecde24fb7031e7 |
| tree | ac7e366fc073b59ac1707421b998797e3d002c93 |
| parent | a89b3432563c20b344bdf3f5ec686021e7de5e23 |
| signature |
18 files changed, 344 insertions(+), 124 deletions(-)
lib/libcxxabi/include/__cxxabi_config.h+6| ... | ... | @@ -103,4 +103,10 @@ |
| 103 | 103 | #define _LIBCXXABI_DTOR_FUNC |
| 104 | 104 | #endif |
| 105 | 105 | |
| 106 | #if __cplusplus < 201103L | |
| 107 | # define _LIBCXXABI_NOEXCEPT throw() | |
| 108 | #else | |
| 109 | # define _LIBCXXABI_NOEXCEPT noexcept | |
| 110 | #endif | |
| 111 | ||
| 106 | 112 | #endif // ____CXXABI_CONFIG_H |
lib/libcxxabi/include/cxxabi.h+14-14| ... | ... | @@ -43,16 +43,16 @@ extern "C" { |
| 43 | 43 | |
| 44 | 44 | // 2.4.2 Allocating the Exception Object |
| 45 | 45 | extern _LIBCXXABI_FUNC_VIS void * |
| 46 | __cxa_allocate_exception(size_t thrown_size) throw(); | |
| 46 | __cxa_allocate_exception(size_t thrown_size) _LIBCXXABI_NOEXCEPT; | |
| 47 | 47 | extern _LIBCXXABI_FUNC_VIS void |
| 48 | __cxa_free_exception(void *thrown_exception) throw(); | |
| 48 | __cxa_free_exception(void *thrown_exception) _LIBCXXABI_NOEXCEPT; | |
| 49 | 49 | // This function is an LLVM extension, which mirrors the same extension in libsupc++ and libcxxrt |
| 50 | 50 | extern _LIBCXXABI_FUNC_VIS __cxa_exception* |
| 51 | 51 | #ifdef __wasm__ |
| 52 | 52 | // 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; | |
| 54 | 54 | #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; | |
| 56 | 56 | #endif |
| 57 | 57 | |
| 58 | 58 | // 2.4.3 Throwing the Exception Object |
| ... | ... | @@ -66,13 +66,13 @@ __cxa_throw(void *thrown_exception, std::type_info *tinfo, |
| 66 | 66 | |
| 67 | 67 | // 2.5.3 Exception Handlers |
| 68 | 68 | extern _LIBCXXABI_FUNC_VIS void * |
| 69 | __cxa_get_exception_ptr(void *exceptionObject) throw(); | |
| 69 | __cxa_get_exception_ptr(void *exceptionObject) _LIBCXXABI_NOEXCEPT; | |
| 70 | 70 | extern _LIBCXXABI_FUNC_VIS void * |
| 71 | __cxa_begin_catch(void *exceptionObject) throw(); | |
| 71 | __cxa_begin_catch(void *exceptionObject) _LIBCXXABI_NOEXCEPT; | |
| 72 | 72 | extern _LIBCXXABI_FUNC_VIS void __cxa_end_catch(); |
| 73 | 73 | #if defined(_LIBCXXABI_ARM_EHABI) |
| 74 | 74 | extern _LIBCXXABI_FUNC_VIS bool |
| 75 | __cxa_begin_cleanup(void *exceptionObject) throw(); | |
| 75 | __cxa_begin_cleanup(void *exceptionObject) _LIBCXXABI_NOEXCEPT; | |
| 76 | 76 | extern _LIBCXXABI_FUNC_VIS void __cxa_end_cleanup(); |
| 77 | 77 | #endif |
| 78 | 78 | extern _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(); |
| 80 | 80 | // GNU extension |
| 81 | 81 | // Calls `terminate` with the current exception being caught. This function is used by GCC when a `noexcept` function |
| 82 | 82 | // throws an exception inside a try/catch block and doesn't catch it. |
| 83 | extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_call_terminate(void*) throw(); | |
| 83 | extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_call_terminate(void*) _LIBCXXABI_NOEXCEPT; | |
| 84 | 84 | |
| 85 | 85 | // 2.5.4 Rethrowing Exceptions |
| 86 | 86 | extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_rethrow(); |
| ... | ... | @@ -168,23 +168,23 @@ extern _LIBCXXABI_FUNC_VIS char *__cxa_demangle(const char *mangled_name, |
| 168 | 168 | |
| 169 | 169 | // Apple additions to support C++ 0x exception_ptr class |
| 170 | 170 | // These are primitives to wrap a smart pointer around an exception object |
| 171 | extern _LIBCXXABI_FUNC_VIS void *__cxa_current_primary_exception() throw(); | |
| 171 | extern _LIBCXXABI_FUNC_VIS void *__cxa_current_primary_exception() _LIBCXXABI_NOEXCEPT; | |
| 172 | 172 | extern _LIBCXXABI_FUNC_VIS void |
| 173 | 173 | __cxa_rethrow_primary_exception(void *primary_exception); |
| 174 | 174 | extern _LIBCXXABI_FUNC_VIS void |
| 175 | __cxa_increment_exception_refcount(void *primary_exception) throw(); | |
| 175 | __cxa_increment_exception_refcount(void *primary_exception) _LIBCXXABI_NOEXCEPT; | |
| 176 | 176 | extern _LIBCXXABI_FUNC_VIS void |
| 177 | __cxa_decrement_exception_refcount(void *primary_exception) throw(); | |
| 177 | __cxa_decrement_exception_refcount(void *primary_exception) _LIBCXXABI_NOEXCEPT; | |
| 178 | 178 | |
| 179 | 179 | // Apple extension to support std::uncaught_exception() |
| 180 | extern _LIBCXXABI_FUNC_VIS bool __cxa_uncaught_exception() throw(); | |
| 181 | extern _LIBCXXABI_FUNC_VIS unsigned int __cxa_uncaught_exceptions() throw(); | |
| 180 | extern _LIBCXXABI_FUNC_VIS bool __cxa_uncaught_exception() _LIBCXXABI_NOEXCEPT; | |
| 181 | extern _LIBCXXABI_FUNC_VIS unsigned int __cxa_uncaught_exceptions() _LIBCXXABI_NOEXCEPT; | |
| 182 | 182 | |
| 183 | 183 | #if defined(__linux__) || defined(__Fuchsia__) |
| 184 | 184 | // Linux and Fuchsia TLS support. Not yet an official part of the Itanium ABI. |
| 185 | 185 | // https://sourceware.org/glibc/wiki/Destructor%20support%20for%20thread_local%20variables |
| 186 | 186 | extern _LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(void (*)(void *), void *, |
| 187 | void *) throw(); | |
| 187 | void *) _LIBCXXABI_NOEXCEPT; | |
| 188 | 188 | #endif |
| 189 | 189 | |
| 190 | 190 | } // extern "C" |
lib/libcxxabi/src/abort_message.cpp+3-15| ... | ... | @@ -12,13 +12,8 @@ |
| 12 | 12 | #include "abort_message.h" |
| 13 | 13 | |
| 14 | 14 | #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> | |
| 16 | extern "C" void android_set_abort_message(const char* msg); | |
| 22 | 17 | #endif // __BIONIC__ |
| 23 | 18 | |
| 24 | 19 | #if defined(__APPLE__) && __has_include(<CrashReporterClient.h>) |
| ... | ... | @@ -26,7 +21,7 @@ |
| 26 | 21 | # define _LIBCXXABI_USE_CRASHREPORTER_CLIENT |
| 27 | 22 | #endif |
| 28 | 23 | |
| 29 | void abort_message(const char* format, ...) | |
| 24 | void __abort_message(const char* format, ...) | |
| 30 | 25 | { |
| 31 | 26 | // Write message to stderr. We do this before formatting into a |
| 32 | 27 | // variable-size buffer so that we still get some information if |
| ... | ... | @@ -59,7 +54,6 @@ void abort_message(const char* format, ...) |
| 59 | 54 | vasprintf(&buffer, format, list); |
| 60 | 55 | va_end(list); |
| 61 | 56 | |
| 62 | # if __ANDROID_API__ >= 21 | |
| 63 | 57 | // Show error in tombstone. |
| 64 | 58 | android_set_abort_message(buffer); |
| 65 | 59 | |
| ... | ... | @@ -67,12 +61,6 @@ void abort_message(const char* format, ...) |
| 67 | 61 | openlog("libc++abi", 0, 0); |
| 68 | 62 | syslog(LOG_CRIT, "%s", buffer); |
| 69 | 63 | 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 | |
| 76 | 64 | #endif // __BIONIC__ |
| 77 | 65 | |
| 78 | 66 | abort(); |
lib/libcxxabi/src/abort_message.h+2-2| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | #include "cxxabi.h" |
| 13 | 13 | |
| 14 | 14 | extern "C" _LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN void |
| 15 | abort_message(const char *format, ...) __attribute__((format(printf, 1, 2))); | |
| 15 | __abort_message(const char *format, ...) __attribute__((format(printf, 1, 2))); | |
| 16 | 16 | |
| 17 | 17 | #ifndef _LIBCXXABI_ASSERT |
| 18 | 18 | // 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))); |
| 24 | 24 | do { \ |
| 25 | 25 | if (!(expr)) { \ |
| 26 | 26 | char const* __msg = (msg); \ |
| 27 | ::abort_message("%s:%d: %s", __FILE__, __LINE__, __msg); \ | |
| 27 | ::__abort_message("%s:%d: %s", __FILE__, __LINE__, __msg); \ | |
| 28 | 28 | } \ |
| 29 | 29 | } while (false) |
| 30 | 30 |
lib/libcxxabi/src/cxa_default_handlers.cpp+19-20| ... | ... | @@ -10,8 +10,7 @@ |
| 10 | 10 | //===----------------------------------------------------------------------===// |
| 11 | 11 | |
| 12 | 12 | #include <exception> |
| 13 | #include <memory> | |
| 14 | #include <stdlib.h> | |
| 13 | #include <new> | |
| 15 | 14 | #include "abort_message.h" |
| 16 | 15 | #include "cxxabi.h" |
| 17 | 16 | #include "cxa_handlers.h" |
| ... | ... | @@ -23,17 +22,7 @@ |
| 23 | 22 | |
| 24 | 23 | static constinit const char* cause = "uncaught"; |
| 25 | 24 | |
| 26 | #ifndef _LIBCXXABI_NO_EXCEPTIONS | |
| 27 | // Demangle the given string, or return the string as-is in case of an error. | |
| 28 | static 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 | |
| 37 | 26 | __attribute__((noreturn)) |
| 38 | 27 | static void demangling_terminate_handler() |
| 39 | 28 | { |
| ... | ... | @@ -42,18 +31,18 @@ static void demangling_terminate_handler() |
| 42 | 31 | |
| 43 | 32 | // If there is no uncaught exception, just note that we're terminating |
| 44 | 33 | if (!globals) |
| 45 | abort_message("terminating"); | |
| 34 | __abort_message("terminating"); | |
| 46 | 35 | |
| 47 | 36 | __cxa_exception* exception_header = globals->caughtExceptions; |
| 48 | 37 | if (!exception_header) |
| 49 | abort_message("terminating"); | |
| 38 | __abort_message("terminating"); | |
| 50 | 39 | |
| 51 | 40 | _Unwind_Exception* unwind_exception = |
| 52 | 41 | reinterpret_cast<_Unwind_Exception*>(exception_header + 1) - 1; |
| 53 | 42 | |
| 54 | 43 | // If we're terminating due to a foreign exception |
| 55 | 44 | if (!__isOurExceptionClass(unwind_exception)) |
| 56 | abort_message("terminating due to %s foreign exception", cause); | |
| 45 | __abort_message("terminating due to %s foreign exception", cause); | |
| 57 | 46 | |
| 58 | 47 | void* thrown_object = |
| 59 | 48 | __getExceptionClass(unwind_exception) == kOurDependentExceptionClass ? |
| ... | ... | @@ -61,7 +50,17 @@ static void demangling_terminate_handler() |
| 61 | 50 | exception_header + 1; |
| 62 | 51 | const __shim_type_info* thrown_type = |
| 63 | 52 | 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 | ||
| 65 | 64 | // If the uncaught exception can be caught with std::exception& |
| 66 | 65 | const __shim_type_info* catch_type = |
| 67 | 66 | static_cast<const __shim_type_info*>(&typeid(std::exception)); |
| ... | ... | @@ -69,19 +68,19 @@ static void demangling_terminate_handler() |
| 69 | 68 | { |
| 70 | 69 | // Include the what() message from the exception |
| 71 | 70 | 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()); | |
| 73 | 72 | } |
| 74 | 73 | else |
| 75 | 74 | { |
| 76 | 75 | // 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); | |
| 78 | 77 | } |
| 79 | 78 | } |
| 80 | 79 | #else // !_LIBCXXABI_NO_EXCEPTIONS |
| 81 | 80 | __attribute__((noreturn)) |
| 82 | 81 | static void demangling_terminate_handler() |
| 83 | 82 | { |
| 84 | abort_message("terminating"); | |
| 83 | __abort_message("terminating"); | |
| 85 | 84 | } |
| 86 | 85 | #endif // !_LIBCXXABI_NO_EXCEPTIONS |
| 87 | 86 |
lib/libcxxabi/src/cxa_demangle.cpp-4| ... | ... | @@ -28,10 +28,6 @@ |
| 28 | 28 | |
| 29 | 29 | using namespace itanium_demangle; |
| 30 | 30 | |
| 31 | constexpr const char *itanium_demangle::FloatData<float>::spec; | |
| 32 | constexpr const char *itanium_demangle::FloatData<double>::spec; | |
| 33 | constexpr const char *itanium_demangle::FloatData<long double>::spec; | |
| 34 | ||
| 35 | 31 | // <discriminator> := _ <non-negative number> # when number < 10 |
| 36 | 32 | // := __ <non-negative number> _ # when number >= 10 |
| 37 | 33 | // extension := decimal-digit+ # at the end of string |
lib/libcxxabi/src/cxa_exception_storage.cpp+6-6| ... | ... | @@ -56,17 +56,17 @@ extern "C" { |
| 56 | 56 | namespace __cxxabiv1 { |
| 57 | 57 | namespace { |
| 58 | 58 | 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; | |
| 60 | 60 | |
| 61 | 61 | void _LIBCPP_TLS_DESTRUCTOR_CC destruct_(void *p) { |
| 62 | 62 | __free_with_fallback(p); |
| 63 | 63 | 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()"); | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | void construct_() { |
| 68 | 68 | 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()"); | |
| 70 | 70 | } |
| 71 | 71 | } // namespace |
| 72 | 72 | |
| ... | ... | @@ -80,9 +80,9 @@ extern "C" { |
| 80 | 80 | retVal = static_cast<__cxa_eh_globals*>( |
| 81 | 81 | __calloc_with_fallback(1, sizeof(__cxa_eh_globals))); |
| 82 | 82 | if (NULL == retVal) |
| 83 | abort_message("cannot allocate __cxa_eh_globals"); | |
| 83 | __abort_message("cannot allocate __cxa_eh_globals"); | |
| 84 | 84 | 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()"); | |
| 86 | 86 | } |
| 87 | 87 | return retVal; |
| 88 | 88 | } |
| ... | ... | @@ -94,7 +94,7 @@ extern "C" { |
| 94 | 94 | __cxa_eh_globals *__cxa_get_globals_fast() { |
| 95 | 95 | // First time through, create the key. |
| 96 | 96 | 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()"); | |
| 98 | 98 | return static_cast<__cxa_eh_globals*>(std::__libcpp_tls_get(key_)); |
| 99 | 99 | } |
| 100 | 100 | } // extern "C" |
lib/libcxxabi/src/cxa_guard_impl.h+5-5| ... | ... | @@ -91,7 +91,7 @@ |
| 91 | 91 | // the former. |
| 92 | 92 | #ifdef BUILDING_CXA_GUARD |
| 93 | 93 | # include "abort_message.h" |
| 94 | # define ABORT_WITH_MESSAGE(...) ::abort_message(__VA_ARGS__) | |
| 94 | # define ABORT_WITH_MESSAGE(...) ::__abort_message(__VA_ARGS__) | |
| 95 | 95 | #elif defined(TESTING_CXA_GUARD) |
| 96 | 96 | # define ABORT_WITH_MESSAGE(...) ::abort() |
| 97 | 97 | #else |
| ... | ... | @@ -156,12 +156,12 @@ private: |
| 156 | 156 | // PlatformGetThreadID |
| 157 | 157 | //===----------------------------------------------------------------------===// |
| 158 | 158 | |
| 159 | #if defined(__APPLE__) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD) | |
| 159 | #if defined(__APPLE__) && _LIBCPP_HAS_THREAD_API_PTHREAD | |
| 160 | 160 | uint32_t PlatformThreadID() { |
| 161 | 161 | static_assert(sizeof(mach_port_t) == sizeof(uint32_t), ""); |
| 162 | 162 | return static_cast<uint32_t>(pthread_mach_thread_np(std::__libcpp_thread_get_current_id())); |
| 163 | 163 | } |
| 164 | #elif defined(SYS_gettid) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD) | |
| 164 | #elif defined(SYS_gettid) && _LIBCPP_HAS_THREAD_API_PTHREAD | |
| 165 | 165 | uint32_t PlatformThreadID() { |
| 166 | 166 | static_assert(sizeof(pid_t) == sizeof(uint32_t), ""); |
| 167 | 167 | return static_cast<uint32_t>(syscall(SYS_gettid)); |
| ... | ... | @@ -676,8 +676,8 @@ static_assert(CurrentImplementation != Implementation::Futex || PlatformSupports |
| 676 | 676 | |
| 677 | 677 | using SelectedImplementation = SelectImplementation<CurrentImplementation>::type; |
| 678 | 678 | |
| 679 | } // end namespace | |
| 680 | } // end namespace __cxxabiv1 | |
| 679 | } // namespace | |
| 680 | } // namespace __cxxabiv1 | |
| 681 | 681 | |
| 682 | 682 | #if defined(__clang__) |
| 683 | 683 | # pragma clang diagnostic pop |
lib/libcxxabi/src/cxa_handlers.cpp+3-3| ... | ... | @@ -33,7 +33,7 @@ __unexpected(unexpected_handler func) |
| 33 | 33 | { |
| 34 | 34 | func(); |
| 35 | 35 | // unexpected handler should not return |
| 36 | abort_message("unexpected_handler unexpectedly returned"); | |
| 36 | __abort_message("unexpected_handler unexpectedly returned"); | |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | __attribute__((noreturn)) |
| ... | ... | @@ -58,13 +58,13 @@ __terminate(terminate_handler func) noexcept |
| 58 | 58 | #endif // _LIBCXXABI_NO_EXCEPTIONS |
| 59 | 59 | func(); |
| 60 | 60 | // handler should not return |
| 61 | abort_message("terminate_handler unexpectedly returned"); | |
| 61 | __abort_message("terminate_handler unexpectedly returned"); | |
| 62 | 62 | #ifndef _LIBCXXABI_NO_EXCEPTIONS |
| 63 | 63 | } |
| 64 | 64 | catch (...) |
| 65 | 65 | { |
| 66 | 66 | // handler should not throw exception |
| 67 | abort_message("terminate_handler unexpectedly threw an exception"); | |
| 67 | __abort_message("terminate_handler unexpectedly threw an exception"); | |
| 68 | 68 | } |
| 69 | 69 | #endif // _LIBCXXABI_NO_EXCEPTIONS |
| 70 | 70 | } |
lib/libcxxabi/src/cxa_personality.cpp+1-1| ... | ... | @@ -167,7 +167,7 @@ uintptr_t readPointerHelper(const uint8_t*& p) { |
| 167 | 167 | return static_cast<uintptr_t>(value); |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | } // end namespace | |
| 170 | } // namespace | |
| 171 | 171 | |
| 172 | 172 | extern "C" |
| 173 | 173 | { |
lib/libcxxabi/src/cxa_thread_atexit.cpp+1-1| ... | ... | @@ -89,7 +89,7 @@ namespace { |
| 89 | 89 | // __cxa_thread_atexit() may be called arbitrarily late (for example, from |
| 90 | 90 | // global destructors or atexit() handlers). |
| 91 | 91 | 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()"); | |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 |
lib/libcxxabi/src/cxa_vector.cpp+1-1| ... | ... | @@ -121,7 +121,7 @@ void throw_bad_array_new_length() { |
| 121 | 121 | #ifndef _LIBCXXABI_NO_EXCEPTIONS |
| 122 | 122 | throw std::bad_array_new_length(); |
| 123 | 123 | #else |
| 124 | abort_message("__cxa_vec_new failed to allocate memory"); | |
| 124 | __abort_message("__cxa_vec_new failed to allocate memory"); | |
| 125 | 125 | #endif |
| 126 | 126 | } |
| 127 | 127 |
lib/libcxxabi/src/cxa_virtual.cpp+2-2| ... | ... | @@ -13,12 +13,12 @@ namespace __cxxabiv1 { |
| 13 | 13 | extern "C" { |
| 14 | 14 | _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN |
| 15 | 15 | void __cxa_pure_virtual(void) { |
| 16 | abort_message("Pure virtual function called!"); | |
| 16 | __abort_message("Pure virtual function called!"); | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN |
| 20 | 20 | void __cxa_deleted_virtual(void) { |
| 21 | abort_message("Deleted virtual function called!"); | |
| 21 | __abort_message("Deleted virtual function called!"); | |
| 22 | 22 | } |
| 23 | 23 | } // extern "C" |
| 24 | 24 | } // abi |
lib/libcxxabi/src/demangle/DemangleConfig.h+1-1| ... | ... | @@ -15,7 +15,7 @@ |
| 15 | 15 | // build systems to override this value. |
| 16 | 16 | // https://libcxx.llvm.org/UsingLibcxx.html#enabling-the-safe-libc-mode |
| 17 | 17 | #ifndef _LIBCPP_VERBOSE_ABORT |
| 18 | #define _LIBCPP_VERBOSE_ABORT(...) abort_message(__VA_ARGS__) | |
| 18 | #define _LIBCPP_VERBOSE_ABORT(...) __abort_message(__VA_ARGS__) | |
| 19 | 19 | #include "../abort_message.h" |
| 20 | 20 | #endif |
| 21 | 21 |
lib/libcxxabi/src/demangle/ItaniumDemangle.h+262-32| ... | ... | @@ -19,7 +19,6 @@ |
| 19 | 19 | #include "DemangleConfig.h" |
| 20 | 20 | #include "StringViewExtras.h" |
| 21 | 21 | #include "Utility.h" |
| 22 | #include <__cxxabi_config.h> | |
| 23 | 22 | #include <algorithm> |
| 24 | 23 | #include <cctype> |
| 25 | 24 | #include <cstdio> |
| ... | ... | @@ -31,7 +30,7 @@ |
| 31 | 30 | #include <type_traits> |
| 32 | 31 | #include <utility> |
| 33 | 32 | |
| 34 | #ifdef _LIBCXXABI_COMPILER_CLANG | |
| 33 | #if defined(__clang__) | |
| 35 | 34 | #pragma clang diagnostic push |
| 36 | 35 | #pragma clang diagnostic ignored "-Wunused-template" |
| 37 | 36 | #endif |
| ... | ... | @@ -157,6 +156,8 @@ public: |
| 157 | 156 | } |
| 158 | 157 | }; |
| 159 | 158 | |
| 159 | class NodeArray; | |
| 160 | ||
| 160 | 161 | // Base class of all AST nodes. The AST is built by the parser, then is |
| 161 | 162 | // traversed by the printLeft/Right functions to produce a demangled string. |
| 162 | 163 | class Node { |
| ... | ... | @@ -200,8 +201,7 @@ private: |
| 200 | 201 | |
| 201 | 202 | Prec Precedence : 6; |
| 202 | 203 | |
| 203 | // FIXME: Make these protected. | |
| 204 | public: | |
| 204 | protected: | |
| 205 | 205 | /// Tracks if this node has a component on its right side, in which case we |
| 206 | 206 | /// need to call printRight. |
| 207 | 207 | Cache RHSComponentCache : 2; |
| ... | ... | @@ -255,6 +255,9 @@ public: |
| 255 | 255 | Kind getKind() const { return K; } |
| 256 | 256 | |
| 257 | 257 | Prec getPrecedence() const { return Precedence; } |
| 258 | Cache getRHSComponentCache() const { return RHSComponentCache; } | |
| 259 | Cache getArrayCache() const { return ArrayCache; } | |
| 260 | Cache getFunctionCache() const { return FunctionCache; } | |
| 258 | 261 | |
| 259 | 262 | virtual bool hasRHSComponentSlow(OutputBuffer &) const { return false; } |
| 260 | 263 | virtual bool hasArraySlow(OutputBuffer &) const { return false; } |
| ... | ... | @@ -292,6 +295,13 @@ public: |
| 292 | 295 | // implementation. |
| 293 | 296 | virtual void printRight(OutputBuffer &) const {} |
| 294 | 297 | |
| 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 | ||
| 295 | 305 | virtual std::string_view getBaseName() const { return {}; } |
| 296 | 306 | |
| 297 | 307 | // Silence compiler warnings, this dtor will never be called. |
| ... | ... | @@ -338,6 +348,10 @@ public: |
| 338 | 348 | FirstElement = false; |
| 339 | 349 | } |
| 340 | 350 | } |
| 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; | |
| 341 | 355 | }; |
| 342 | 356 | |
| 343 | 357 | struct NodeArrayNode : Node { |
| ... | ... | @@ -424,8 +438,8 @@ protected: |
| 424 | 438 | |
| 425 | 439 | public: |
| 426 | 440 | 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()), | |
| 429 | 443 | Quals(Quals_), Child(Child_) {} |
| 430 | 444 | |
| 431 | 445 | Qualifiers getQuals() const { return Quals; } |
| ... | ... | @@ -554,8 +568,8 @@ struct AbiTagAttr : Node { |
| 554 | 568 | std::string_view Tag; |
| 555 | 569 | |
| 556 | 570 | 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()), | |
| 559 | 573 | Base(Base_), Tag(Tag_) {} |
| 560 | 574 | |
| 561 | 575 | template<typename Fn> void match(Fn F) const { F(Base, Tag); } |
| ... | ... | @@ -615,7 +629,7 @@ class PointerType final : public Node { |
| 615 | 629 | |
| 616 | 630 | public: |
| 617 | 631 | PointerType(const Node *Pointee_) |
| 618 | : Node(KPointerType, Pointee_->RHSComponentCache), | |
| 632 | : Node(KPointerType, Pointee_->getRHSComponentCache()), | |
| 619 | 633 | Pointee(Pointee_) {} |
| 620 | 634 | |
| 621 | 635 | const Node *getPointee() const { return Pointee; } |
| ... | ... | @@ -699,7 +713,7 @@ class ReferenceType : public Node { |
| 699 | 713 | |
| 700 | 714 | public: |
| 701 | 715 | ReferenceType(const Node *Pointee_, ReferenceKind RK_) |
| 702 | : Node(KReferenceType, Pointee_->RHSComponentCache), | |
| 716 | : Node(KReferenceType, Pointee_->getRHSComponentCache()), | |
| 703 | 717 | Pointee(Pointee_), RK(RK_) {} |
| 704 | 718 | |
| 705 | 719 | template<typename Fn> void match(Fn F) const { F(Pointee, RK); } |
| ... | ... | @@ -742,7 +756,7 @@ class PointerToMemberType final : public Node { |
| 742 | 756 | |
| 743 | 757 | public: |
| 744 | 758 | PointerToMemberType(const Node *ClassType_, const Node *MemberType_) |
| 745 | : Node(KPointerToMemberType, MemberType_->RHSComponentCache), | |
| 759 | : Node(KPointerToMemberType, MemberType_->getRHSComponentCache()), | |
| 746 | 760 | ClassType(ClassType_), MemberType(MemberType_) {} |
| 747 | 761 | |
| 748 | 762 | template<typename Fn> void match(Fn F) const { F(ClassType, MemberType); } |
| ... | ... | @@ -795,6 +809,15 @@ public: |
| 795 | 809 | OB += "]"; |
| 796 | 810 | Base->printRight(OB); |
| 797 | 811 | } |
| 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 | } | |
| 798 | 821 | }; |
| 799 | 822 | |
| 800 | 823 | class FunctionType final : public Node { |
| ... | ... | @@ -1383,16 +1406,14 @@ class ParameterPack final : public Node { |
| 1383 | 1406 | public: |
| 1384 | 1407 | ParameterPack(NodeArray Data_) : Node(KParameterPack), Data(Data_) { |
| 1385 | 1408 | 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; })) | |
| 1389 | 1411 | 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; })) | |
| 1393 | 1414 | 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; | |
| 1396 | 1417 | })) |
| 1397 | 1418 | RHSComponentCache = Cache::No; |
| 1398 | 1419 | } |
| ... | ... | @@ -2056,17 +2077,23 @@ public: |
| 2056 | 2077 | class CallExpr : public Node { |
| 2057 | 2078 | const Node *Callee; |
| 2058 | 2079 | NodeArray Args; |
| 2080 | bool IsParen; // (func)(args ...) ? | |
| 2059 | 2081 | |
| 2060 | 2082 | public: |
| 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_) {} | |
| 2063 | 2086 | |
| 2064 | 2087 | template <typename Fn> void match(Fn F) const { |
| 2065 | F(Callee, Args, getPrecedence()); | |
| 2088 | F(Callee, Args, IsParen, getPrecedence()); | |
| 2066 | 2089 | } |
| 2067 | 2090 | |
| 2068 | 2091 | void printLeft(OutputBuffer &OB) const override { |
| 2092 | if (IsParen) | |
| 2093 | OB.printOpen(); | |
| 2069 | 2094 | Callee->print(OB); |
| 2095 | if (IsParen) | |
| 2096 | OB.printClose(); | |
| 2070 | 2097 | OB.printOpen(); |
| 2071 | 2098 | Args.printWithComma(OB); |
| 2072 | 2099 | OB.printClose(); |
| ... | ... | @@ -2226,8 +2253,11 @@ public: |
| 2226 | 2253 | template<typename Fn> void match(Fn F) const { F(Ty, Inits); } |
| 2227 | 2254 | |
| 2228 | 2255 | void printLeft(OutputBuffer &OB) const override { |
| 2229 | if (Ty) | |
| 2256 | if (Ty) { | |
| 2257 | if (Ty->printInitListAsType(OB, Inits)) | |
| 2258 | return; | |
| 2230 | 2259 | Ty->print(OB); |
| 2260 | } | |
| 2231 | 2261 | OB += '{'; |
| 2232 | 2262 | Inits.printWithComma(OB); |
| 2233 | 2263 | OB += '}'; |
| ... | ... | @@ -2434,6 +2464,8 @@ public: |
| 2434 | 2464 | if (Type.size() <= 3) |
| 2435 | 2465 | OB += Type; |
| 2436 | 2466 | } |
| 2467 | ||
| 2468 | std::string_view value() const { return Value; } | |
| 2437 | 2469 | }; |
| 2438 | 2470 | |
| 2439 | 2471 | class RequiresExpr : public Node { |
| ... | ... | @@ -2605,6 +2637,94 @@ template<typename NodeT> struct NodeKind; |
| 2605 | 2637 | }; |
| 2606 | 2638 | #include "ItaniumNodes.def" |
| 2607 | 2639 | |
| 2640 | inline 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 | ||
| 2608 | 2728 | template <typename Derived, typename Alloc> struct AbstractManglingParser { |
| 2609 | 2729 | const char *First; |
| 2610 | 2730 | const char *Last; |
| ... | ... | @@ -2678,7 +2798,7 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser { |
| 2678 | 2798 | |
| 2679 | 2799 | bool TryToParseTemplateArgs = true; |
| 2680 | 2800 | bool PermitForwardTemplateReferences = false; |
| 2681 | bool InConstraintExpr = false; | |
| 2801 | bool HasIncompleteTemplateParameterTracking = false; | |
| 2682 | 2802 | size_t ParsingLambdaParamsAtLevel = (size_t)-1; |
| 2683 | 2803 | |
| 2684 | 2804 | unsigned NumSyntheticTemplateParameters[3] = {}; |
| ... | ... | @@ -3240,9 +3360,12 @@ const typename AbstractManglingParser< |
| 3240 | 3360 | "operator co_await"}, |
| 3241 | 3361 | {"az", OperatorInfo::OfIdOp, /*Type*/ false, Node::Prec::Unary, "alignof "}, |
| 3242 | 3362 | {"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()"}, | |
| 3244 | 3365 | {"cm", OperatorInfo::Binary, false, Node::Prec::Comma, "operator,"}, |
| 3245 | 3366 | {"co", OperatorInfo::Prefix, false, Node::Prec::Unary, "operator~"}, |
| 3367 | {"cp", OperatorInfo::Call, /*Paren*/ true, Node::Prec::Postfix, | |
| 3368 | "operator()"}, | |
| 3246 | 3369 | {"cv", OperatorInfo::CCast, false, Node::Prec::Cast, "operator"}, // C Cast |
| 3247 | 3370 | {"dV", OperatorInfo::Binary, false, Node::Prec::Assign, "operator/="}, |
| 3248 | 3371 | {"da", OperatorInfo::Del, /*Ary*/ true, Node::Prec::Unary, |
| ... | ... | @@ -3319,7 +3442,7 @@ AbstractManglingParser<Derived, Alloc>::parseOperatorEncoding() { |
| 3319 | 3442 | return nullptr; |
| 3320 | 3443 | |
| 3321 | 3444 | // 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. | |
| 3323 | 3446 | size_t lower = 0u, upper = NumOps - 1; // Inclusive bounds. |
| 3324 | 3447 | while (upper != lower) { |
| 3325 | 3448 | size_t middle = (upper + lower) / 2; |
| ... | ... | @@ -4207,9 +4330,12 @@ Node *AbstractManglingParser<Derived, Alloc>::parseType() { |
| 4207 | 4330 | case 'h': |
| 4208 | 4331 | First += 2; |
| 4209 | 4332 | 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) | |
| 4211 | 4335 | case 'F': { |
| 4212 | 4336 | First += 2; |
| 4337 | if (consumeIf("16b")) | |
| 4338 | return make<NameType>("std::bfloat16_t"); | |
| 4213 | 4339 | Node *DimensionNumber = make<NameType>(parseNumber()); |
| 4214 | 4340 | if (!DimensionNumber) |
| 4215 | 4341 | return nullptr; |
| ... | ... | @@ -4217,6 +4343,101 @@ Node *AbstractManglingParser<Derived, Alloc>::parseType() { |
| 4217 | 4343 | return nullptr; |
| 4218 | 4344 | return make<BinaryFPType>(DimensionNumber); |
| 4219 | 4345 | } |
| 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 | } | |
| 4220 | 4441 | // ::= DB <number> _ # C23 signed _BitInt(N) |
| 4221 | 4442 | // ::= DB <instantiation-dependent expression> _ # C23 signed _BitInt(N) |
| 4222 | 4443 | // ::= DU <number> _ # C23 unsigned _BitInt(N) |
| ... | ... | @@ -4337,6 +4558,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseType() { |
| 4337 | 4558 | // parse them, take the second production. |
| 4338 | 4559 | |
| 4339 | 4560 | if (TryToParseTemplateArgs && look() == 'I') { |
| 4561 | Subs.push_back(Result); | |
| 4340 | 4562 | Node *TA = getDerived().parseTemplateArgs(); |
| 4341 | 4563 | if (TA == nullptr) |
| 4342 | 4564 | return nullptr; |
| ... | ... | @@ -4819,7 +5041,8 @@ template <typename Derived, typename Alloc> |
| 4819 | 5041 | Node *AbstractManglingParser<Derived, Alloc>::parseConstraintExpr() { |
| 4820 | 5042 | // Within this expression, all enclosing template parameter lists are in |
| 4821 | 5043 | // scope. |
| 4822 | ScopedOverride<bool> SaveInConstraintExpr(InConstraintExpr, true); | |
| 5044 | ScopedOverride<bool> SaveIncompleteTemplateParameterTracking( | |
| 5045 | HasIncompleteTemplateParameterTracking, true); | |
| 4823 | 5046 | return getDerived().parseExpr(); |
| 4824 | 5047 | } |
| 4825 | 5048 | |
| ... | ... | @@ -4888,6 +5111,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseRequiresExpr() { |
| 4888 | 5111 | // ::= <binary operator-name> <expression> <expression> |
| 4889 | 5112 | // ::= <ternary operator-name> <expression> <expression> <expression> |
| 4890 | 5113 | // ::= 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 | |
| 4891 | 5115 | // ::= cv <type> <expression> # conversion with one argument |
| 4892 | 5116 | // ::= cv <type> _ <expression>* E # conversion with a different number of arguments |
| 4893 | 5117 | // ::= [gs] nw <expression>* _ <type> E # new (expr-list) type |
| ... | ... | @@ -5023,7 +5247,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseExpr() { |
| 5023 | 5247 | Names.push_back(E); |
| 5024 | 5248 | } |
| 5025 | 5249 | return make<CallExpr>(Callee, popTrailingNodeArray(ExprsBegin), |
| 5026 | Op->getPrecedence()); | |
| 5250 | /*IsParen=*/Op->getFlag(), Op->getPrecedence()); | |
| 5027 | 5251 | } |
| 5028 | 5252 | case OperatorInfo::CCast: { |
| 5029 | 5253 | // C Cast: (type)expr |
| ... | ... | @@ -5210,7 +5434,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseExpr() { |
| 5210 | 5434 | } |
| 5211 | 5435 | } |
| 5212 | 5436 | return make<CallExpr>(Name, popTrailingNodeArray(ExprsBegin), |
| 5213 | Node::Prec::Postfix); | |
| 5437 | /*IsParen=*/false, Node::Prec::Postfix); | |
| 5214 | 5438 | } |
| 5215 | 5439 | |
| 5216 | 5440 | // Only unresolved names remain. |
| ... | ... | @@ -5677,7 +5901,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseTemplateParam() { |
| 5677 | 5901 | // substitute them all within a <constraint-expression>, so print the |
| 5678 | 5902 | // parameter numbering instead for now. |
| 5679 | 5903 | // TODO: Track all enclosing template parameters and substitute them here. |
| 5680 | if (InConstraintExpr) { | |
| 5904 | if (HasIncompleteTemplateParameterTracking) { | |
| 5681 | 5905 | return make<NameType>(std::string_view(Begin, First - 1 - Begin)); |
| 5682 | 5906 | } |
| 5683 | 5907 | |
| ... | ... | @@ -5738,6 +5962,12 @@ Node *AbstractManglingParser<Derived, Alloc>::parseTemplateParamDecl( |
| 5738 | 5962 | } |
| 5739 | 5963 | |
| 5740 | 5964 | 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); | |
| 5741 | 5971 | Node *Constraint = getDerived().parseName(); |
| 5742 | 5972 | if (!Constraint) |
| 5743 | 5973 | return nullptr; |
| ... | ... | @@ -5948,7 +6178,7 @@ struct ManglingParser : AbstractManglingParser<ManglingParser<Alloc>, Alloc> { |
| 5948 | 6178 | |
| 5949 | 6179 | DEMANGLE_NAMESPACE_END |
| 5950 | 6180 | |
| 5951 | #ifdef _LIBCXXABI_COMPILER_CLANG | |
| 6181 | #if defined(__clang__) | |
| 5952 | 6182 | #pragma clang diagnostic pop |
| 5953 | 6183 | #endif |
| 5954 | 6184 |
lib/libcxxabi/src/fallback_malloc.cpp+2-2| ... | ... | @@ -259,7 +259,7 @@ void* __aligned_malloc_with_fallback(size_t size) { |
| 259 | 259 | #if defined(_WIN32) |
| 260 | 260 | if (void* dest = std::__libcpp_aligned_alloc(alignof(__aligned_type), size)) |
| 261 | 261 | return dest; |
| 262 | #elif defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) | |
| 262 | #elif !_LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION | |
| 263 | 263 | if (void* dest = ::malloc(size)) |
| 264 | 264 | return dest; |
| 265 | 265 | #else |
| ... | ... | @@ -286,7 +286,7 @@ void __aligned_free_with_fallback(void* ptr) { |
| 286 | 286 | if (is_fallback_ptr(ptr)) |
| 287 | 287 | fallback_free(ptr); |
| 288 | 288 | else { |
| 289 | #if defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) | |
| 289 | #if !_LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION | |
| 290 | 290 | ::free(ptr); |
| 291 | 291 | #else |
| 292 | 292 | std::__libcpp_aligned_free(ptr); |
lib/libcxxabi/src/private_typeinfo.cpp+6-5| ... | ... | @@ -41,9 +41,11 @@ |
| 41 | 41 | // Defining _LIBCXXABI_FORGIVING_DYNAMIC_CAST does not help since can_catch() calls |
| 42 | 42 | // is_equal() with use_strcmp=false so the string names are not compared. |
| 43 | 43 | |
| 44 | #include <cstdint> | |
| 45 | 44 | #include <cassert> |
| 45 | #include <cstddef> | |
| 46 | #include <cstdint> | |
| 46 | 47 | #include <string.h> |
| 48 | ||
| 47 | 49 | #include "abort_message.h" |
| 48 | 50 | |
| 49 | 51 | #ifdef _LIBCXXABI_FORGIVING_DYNAMIC_CAST |
| ... | ... | @@ -589,10 +591,9 @@ __base_class_type_info::has_unambiguous_public_base(__dynamic_cast_info* info, |
| 589 | 591 | // .. and reset the pointer. |
| 590 | 592 | adjustedPtr = nullptr; |
| 591 | 593 | } |
| 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); | |
| 596 | 597 | } |
| 597 | 598 | |
| 598 | 599 | void |
lib/libcxxabi/src/stdlib_new_delete.cpp+10-10| ... | ... | @@ -24,22 +24,22 @@ |
| 24 | 24 | # error The _LIBCPP_WEAK macro should be already defined by libc++ |
| 25 | 25 | #endif |
| 26 | 26 | |
| 27 | #if defined(_LIBCXXABI_NO_EXCEPTIONS) != defined(_LIBCPP_HAS_NO_EXCEPTIONS) | |
| 27 | #if defined(_LIBCXXABI_NO_EXCEPTIONS) != !_LIBCPP_HAS_EXCEPTIONS | |
| 28 | 28 | # error libc++ and libc++abi seem to disagree on whether exceptions are enabled |
| 29 | 29 | #endif |
| 30 | 30 | |
| 31 | 31 | inline void __throw_bad_alloc_shim() { |
| 32 | #ifndef _LIBCPP_HAS_NO_EXCEPTIONS | |
| 32 | #if _LIBCPP_HAS_EXCEPTIONS | |
| 33 | 33 | throw std::bad_alloc(); |
| 34 | 34 | #else |
| 35 | abort_message("bad_alloc was thrown in -fno-exceptions mode"); | |
| 35 | __abort_message("bad_alloc was thrown in -fno-exceptions mode"); | |
| 36 | 36 | #endif |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | #define _LIBCPP_ASSERT_SHIM(expr, str) \ |
| 40 | 40 | do { \ |
| 41 | 41 | if (!expr) \ |
| 42 | abort_message(str); \ | |
| 42 | __abort_message(str); \ | |
| 43 | 43 | } while (false) |
| 44 | 44 | |
| 45 | 45 | // ------------------ BEGIN COPY ------------------ |
| ... | ... | @@ -71,7 +71,7 @@ _LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE _LIBCPP_WEAK void* operator new(std |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | _LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) noexcept { |
| 74 | #ifdef _LIBCPP_HAS_NO_EXCEPTIONS | |
| 74 | #if !_LIBCPP_HAS_EXCEPTIONS | |
| 75 | 75 | # if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION |
| 76 | 76 | _LIBCPP_ASSERT_SHIM( |
| 77 | 77 | !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 |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | _LIBCPP_WEAK void* operator new[](size_t size, const std::nothrow_t&) noexcept { |
| 102 | #ifdef _LIBCPP_HAS_NO_EXCEPTIONS | |
| 102 | #if !_LIBCPP_HAS_EXCEPTIONS | |
| 103 | 103 | # if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION |
| 104 | 104 | _LIBCPP_ASSERT_SHIM( |
| 105 | 105 | !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 { |
| 134 | 134 | |
| 135 | 135 | _LIBCPP_WEAK void operator delete[](void* ptr, size_t) noexcept { ::operator delete[](ptr); } |
| 136 | 136 | |
| 137 | #if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) | |
| 137 | #if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION | |
| 138 | 138 | |
| 139 | 139 | static void* operator_new_aligned_impl(std::size_t size, std::align_val_t alignment) { |
| 140 | 140 | if (size == 0) |
| ... | ... | @@ -165,7 +165,7 @@ operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC { |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | _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 | |
| 169 | 169 | # if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION |
| 170 | 170 | _LIBCPP_ASSERT_SHIM( |
| 171 | 171 | !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 { |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | _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 | |
| 198 | 198 | # if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION |
| 199 | 199 | _LIBCPP_ASSERT_SHIM( |
| 200 | 200 | !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 |
| 240 | 240 | ::operator delete[](ptr, alignment); |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | #endif // !_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION | |
| 243 | #endif // _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION | |
| 244 | 244 | // ------------------ END COPY ------------------ |