[PATCH] D27387: [libc++] Add a key function for bad_function_call
Shoaib Meenai via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 15 16:31:51 PST 2017
smeenai updated this revision to Diff 88627.
smeenai edited the summary of this revision.
smeenai removed a reviewer: dexonsmith.
smeenai removed a subscriber: dexonsmith.
smeenai added a comment.
Guarding behind ABI macro
https://reviews.llvm.org/D27387
Files:
include/__config
include/functional
lib/CMakeLists.txt
src/functional.cpp
Index: src/functional.cpp
===================================================================
--- /dev/null
+++ src/functional.cpp
@@ -0,0 +1,29 @@
+//===----------------------- 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 "__config"
+#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
+
+#include "functional"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+bad_function_call::~bad_function_call() _NOEXCEPT
+{
+}
+
+const char*
+bad_function_call::what() const _NOEXCEPT
+{
+ return "std::bad_function_call";
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif
Index: lib/CMakeLists.txt
===================================================================
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -178,7 +178,7 @@
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
Index: include/functional
===================================================================
--- include/functional
+++ include/functional
@@ -1388,6 +1388,12 @@
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
Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -59,6 +59,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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27387.88627.patch
Type: text/x-patch
Size: 2484 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170216/16b88533/attachment.bin>
More information about the cfe-commits
mailing list