summaryrefslogtreecommitdiffstats
path: root/lib/libcxx/src/typeinfo.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2016-09-03 18:39:32 +0000
committerpatrick <patrick@openbsd.org>2016-09-03 18:39:32 +0000
commitfe1ccca2776129541f1c4f645e4d1de89a22a031 (patch)
tree8e4fd7a09a5a15a9498fd2d88dcddbd40e999c79 /lib/libcxx/src/typeinfo.cpp
parentFixed missing null check in switchctl.c (diff)
downloadwireguard-openbsd-fe1ccca2776129541f1c4f645e4d1de89a22a031.tar.xz
wireguard-openbsd-fe1ccca2776129541f1c4f645e4d1de89a22a031.zip
Import libc++ 3.9.0
Diffstat (limited to 'lib/libcxx/src/typeinfo.cpp')
-rw-r--r--lib/libcxx/src/typeinfo.cpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/lib/libcxx/src/typeinfo.cpp b/lib/libcxx/src/typeinfo.cpp
new file mode 100644
index 00000000000..5c0a609b5e5
--- /dev/null
+++ b/lib/libcxx/src/typeinfo.cpp
@@ -0,0 +1,68 @@
+//===------------------------- typeinfo.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 <stdlib.h>
+
+#if defined(__APPLE__) || defined(LIBCXXRT) || \
+ defined(LIBCXX_BUILDING_LIBCXXABI)
+#include <cxxabi.h>
+#endif
+
+#include "typeinfo"
+
+#if !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION)
+
+std::bad_cast::bad_cast() _NOEXCEPT
+{
+}
+
+std::bad_typeid::bad_typeid() _NOEXCEPT
+{
+}
+
+#ifndef __GLIBCXX__
+
+std::bad_cast::~bad_cast() _NOEXCEPT
+{
+}
+
+const char*
+std::bad_cast::what() const _NOEXCEPT
+{
+ return "std::bad_cast";
+}
+
+std::bad_typeid::~bad_typeid() _NOEXCEPT
+{
+}
+
+const char*
+std::bad_typeid::what() const _NOEXCEPT
+{
+ return "std::bad_typeid";
+}
+
+#ifdef __APPLE__
+ // On Darwin, the cxa_bad_* functions cannot be in the lower level library
+ // because bad_cast and bad_typeid are defined in his higher level library
+ void __cxxabiv1::__cxa_bad_typeid()
+ {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ throw std::bad_typeid();
+#endif
+ }
+ void __cxxabiv1::__cxa_bad_cast()
+ {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ throw std::bad_cast();
+#endif
+ }
+#endif
+
+#endif // !__GLIBCXX__
+#endif // !LIBCXXRT && !_LIBCPPABI_VERSION