diff options
author | Louis Dionne <ldionne.2@gmail.com> | 2024-04-16 10:54:28 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-16 10:54:28 -0400 |
commit | 22629bb22a1bea95eebfc9b3171005de107c38f1 (patch) | |
tree | 3b68a7e9a0184cfa8bd08a4d21ed6232970d416d /libcxx/src | |
parent | d2d4a1bbdc455a30d600743eb59fb1c69205967a (diff) | |
download | llvm-22629bb22a1bea95eebfc9b3171005de107c38f1.zip llvm-22629bb22a1bea95eebfc9b3171005de107c38f1.tar.gz llvm-22629bb22a1bea95eebfc9b3171005de107c38f1.tar.bz2 |
[libc++] Use availability to rely on key functions for bad_expected_access and bad_function_call (#87390)
This patch uses our availability machinery to allow defining a key
function for bad_function_call and bad_expected_access at all times but
only rely on it when we can. This prevents compilers from complaining
about weak vtables and reduces code bloat and the amount of work done by
the dynamic linker.
rdar://111917845
Diffstat (limited to 'libcxx/src')
-rw-r--r-- | libcxx/src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | libcxx/src/expected.cpp | 13 | ||||
-rw-r--r-- | libcxx/src/functional.cpp | 2 |
3 files changed, 14 insertions, 2 deletions
diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt index 208500e..a4a3fee 100644 --- a/libcxx/src/CMakeLists.txt +++ b/libcxx/src/CMakeLists.txt @@ -10,6 +10,7 @@ set(LIBCXX_SOURCES chrono.cpp error_category.cpp exception.cpp + expected.cpp filesystem/filesystem_clock.cpp filesystem/filesystem_error.cpp filesystem/path_parser.h diff --git a/libcxx/src/expected.cpp b/libcxx/src/expected.cpp new file mode 100644 index 0000000..f30efb5 --- /dev/null +++ b/libcxx/src/expected.cpp @@ -0,0 +1,13 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include <expected> + +_LIBCPP_BEGIN_NAMESPACE_STD +const char* bad_expected_access<void>::what() const noexcept { return "bad access to std::expected"; } +_LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/src/functional.cpp b/libcxx/src/functional.cpp index 570bb78..ef53e3e 100644 --- a/libcxx/src/functional.cpp +++ b/libcxx/src/functional.cpp @@ -10,9 +10,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION bad_function_call::~bad_function_call() noexcept {} -#endif #ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE const char* bad_function_call::what() const noexcept { return "std::bad_function_call"; } |