Upgrade to 2022-era LLVM LIBCXX

This commit is contained in:
Justine Tunney 2024-05-27 02:12:27 -07:00
parent 2f4ca71f26
commit 8e68384e15
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
2078 changed files with 165657 additions and 65010 deletions

View file

@ -1,5 +1,5 @@
// -*- C++ -*-
//===--------------------------- stdexcept --------------------------------===//
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@ -41,15 +41,14 @@ public:
*/
#include "third_party/libcxx/__config"
#include "third_party/libcxx/exception"
#include "third_party/libcxx/iosfwd" // for string forward decl
#ifdef _LIBCPP_NO_EXCEPTIONS
#include "third_party/libcxx/cstdlib"
#endif
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
#include <__exception/exception.h>
#include <__verbose_abort>
#include <iosfwd> // for string forward decl
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@ -66,7 +65,7 @@ public:
__libcpp_refstring& operator=(const __libcpp_refstring& __s) _NOEXCEPT;
~__libcpp_refstring();
const char* c_str() const _NOEXCEPT {return __imp_;}
_LIBCPP_HIDE_FROM_ABI const char* c_str() const _NOEXCEPT {return __imp_;}
};
#endif // !_LIBCPP_ABI_VCRUNTIME
@ -88,9 +87,9 @@ public:
logic_error(const logic_error&) _NOEXCEPT;
logic_error& operator=(const logic_error&) _NOEXCEPT;
virtual ~logic_error() _NOEXCEPT;
~logic_error() _NOEXCEPT override;
virtual const char* what() const _NOEXCEPT;
const char* what() const _NOEXCEPT override;
#else
public:
explicit logic_error(const _VSTD::string&); // Symbol uses versioned std::string
@ -111,9 +110,9 @@ public:
runtime_error(const runtime_error&) _NOEXCEPT;
runtime_error& operator=(const runtime_error&) _NOEXCEPT;
virtual ~runtime_error() _NOEXCEPT;
~runtime_error() _NOEXCEPT override;
virtual const char* what() const _NOEXCEPT;
const char* what() const _NOEXCEPT override;
#else
public:
explicit runtime_error(const _VSTD::string&); // Symbol uses versioned std::string
@ -129,7 +128,8 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s) : logic_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
virtual ~domain_error() _NOEXCEPT;
_LIBCPP_HIDE_FROM_ABI domain_error(const domain_error&) _NOEXCEPT = default;
~domain_error() _NOEXCEPT override;
#endif
};
@ -141,7 +141,8 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s) : logic_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
virtual ~invalid_argument() _NOEXCEPT;
_LIBCPP_HIDE_FROM_ABI invalid_argument(const invalid_argument&) _NOEXCEPT = default;
~invalid_argument() _NOEXCEPT override;
#endif
};
@ -152,7 +153,8 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s) : logic_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
virtual ~length_error() _NOEXCEPT;
_LIBCPP_HIDE_FROM_ABI length_error(const length_error&) _NOEXCEPT = default;
~length_error() _NOEXCEPT override;
#endif
};
@ -164,7 +166,8 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s) : logic_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
virtual ~out_of_range() _NOEXCEPT;
_LIBCPP_HIDE_FROM_ABI out_of_range(const out_of_range&) _NOEXCEPT = default;
~out_of_range() _NOEXCEPT override;
#endif
};
@ -176,7 +179,8 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s) : runtime_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
virtual ~range_error() _NOEXCEPT;
_LIBCPP_HIDE_FROM_ABI range_error(const range_error&) _NOEXCEPT = default;
~range_error() _NOEXCEPT override;
#endif
};
@ -188,7 +192,8 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s) : runtime_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
virtual ~overflow_error() _NOEXCEPT;
_LIBCPP_HIDE_FROM_ABI overflow_error(const overflow_error&) _NOEXCEPT = default;
~overflow_error() _NOEXCEPT override;
#endif
};
@ -200,11 +205,12 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s) : runtime_error(__s) {}
#ifndef _LIBCPP_ABI_VCRUNTIME
virtual ~underflow_error() _NOEXCEPT;
_LIBCPP_HIDE_FROM_ABI underflow_error(const underflow_error&) _NOEXCEPT = default;
~underflow_error() _NOEXCEPT override;
#endif
};
} // std
} // namespace std
_LIBCPP_BEGIN_NAMESPACE_STD
@ -214,91 +220,88 @@ _LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_runtime_error(const char*);
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
void __throw_logic_error(const char*__msg)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw logic_error(__msg);
#else
((void)__msg);
_VSTD::abort();
_LIBCPP_VERBOSE_ABORT("logic_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
void __throw_domain_error(const char*__msg)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw domain_error(__msg);
#else
((void)__msg);
_VSTD::abort();
_LIBCPP_VERBOSE_ABORT("domain_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
void __throw_invalid_argument(const char*__msg)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw invalid_argument(__msg);
#else
((void)__msg);
_VSTD::abort();
_LIBCPP_VERBOSE_ABORT("invalid_argument was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
void __throw_length_error(const char*__msg)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw length_error(__msg);
#else
((void)__msg);
_VSTD::abort();
_LIBCPP_VERBOSE_ABORT("length_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
void __throw_out_of_range(const char*__msg)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw out_of_range(__msg);
#else
((void)__msg);
_VSTD::abort();
_LIBCPP_VERBOSE_ABORT("out_of_range was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
void __throw_range_error(const char*__msg)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw range_error(__msg);
#else
((void)__msg);
_VSTD::abort();
_LIBCPP_VERBOSE_ABORT("range_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
void __throw_overflow_error(const char*__msg)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw overflow_error(__msg);
#else
((void)__msg);
_VSTD::abort();
_LIBCPP_VERBOSE_ABORT("overflow_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
void __throw_underflow_error(const char*__msg)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw underflow_error(__msg);
#else
((void)__msg);
_VSTD::abort();
_LIBCPP_VERBOSE_ABORT("underflow_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_STDEXCEPT
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cstdlib>
# include <exception>
#endif
#endif // _LIBCPP_STDEXCEPT