summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libcxx/include/__config4
-rw-r--r--libcxx/include/functional6
-rw-r--r--libcxx/lib/CMakeLists.txt2
-rw-r--r--libcxx/src/functional.cpp26
4 files changed, 37 insertions, 1 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 9b48a70ffd5..c847418602a 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -58,6 +58,10 @@
// `pointer_safety` and `get_pointer_safety()` will no longer be available
// in C++03.
#define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE
+// Define a key function for `bad_function_call` in the library, to centralize
+// its vtable and typeinfo to libc++ rather than having all other libraries
+// using that class define their own copies.
+#define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
#elif _LIBCPP_ABI_VERSION == 1
#if !defined(_WIN32)
// Enable compiling copies of now inline methods into the dylib to support
diff --git a/libcxx/include/functional b/libcxx/include/functional
index 977ada67f33..fecac4e41f8 100644
--- a/libcxx/include/functional
+++ b/libcxx/include/functional
@@ -1389,6 +1389,12 @@ mem_fn(_Rp _Tp::* __pm) _NOEXCEPT
class _LIBCPP_EXCEPTION_ABI bad_function_call
: public exception
{
+#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
+public:
+ virtual ~bad_function_call() _NOEXCEPT;
+
+ virtual const char* what() const _NOEXCEPT;
+#endif
};
_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
diff --git a/libcxx/lib/CMakeLists.txt b/libcxx/lib/CMakeLists.txt
index 66bb14c89a1..a8dd4eb8aef 100644
--- a/libcxx/lib/CMakeLists.txt
+++ b/libcxx/lib/CMakeLists.txt
@@ -177,7 +177,7 @@ endif()
split_list(LIBCXX_COMPILE_FLAGS)
split_list(LIBCXX_LINK_FLAGS)
-# Add a object library that contains the compiled source files.
+# Add an object library that contains the compiled source files.
add_library(cxx_objects OBJECT ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
if(WIN32 AND NOT MINGW)
target_compile_definitions(cxx_objects
diff --git a/libcxx/src/functional.cpp b/libcxx/src/functional.cpp
new file mode 100644
index 00000000000..5c2646f01b2
--- /dev/null
+++ b/libcxx/src/functional.cpp
@@ -0,0 +1,26 @@
+//===----------------------- functional.cpp -------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "functional"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
+bad_function_call::~bad_function_call() _NOEXCEPT
+{
+}
+
+const char*
+bad_function_call::what() const _NOEXCEPT
+{
+ return "std::bad_function_call";
+}
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
OpenPOWER on IntegriCloud