typeinfo.cpp revision 232950
1//===------------------------- typeinfo.cpp -------------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9#include <stdlib.h>
10#if __APPLE__
11#include <cxxabi.h>
12#endif
13
14#include "typeinfo"
15
16#if !(defined(_LIBCPPABI_VERSION) || defined(LIBCXXRT))
17
18std::bad_cast::bad_cast() _NOEXCEPT
19{
20}
21
22std::bad_cast::~bad_cast() _NOEXCEPT
23{
24}
25
26const char*
27std::bad_cast::what() const _NOEXCEPT
28{
29  return "std::bad_cast";
30}
31
32std::bad_typeid::bad_typeid() _NOEXCEPT
33{
34}
35
36std::bad_typeid::~bad_typeid() _NOEXCEPT
37{
38}
39
40const char*
41std::bad_typeid::what() const _NOEXCEPT
42{
43  return "std::bad_typeid";
44}
45
46#if __APPLE__
47  // On Darwin, the cxa_bad_* functions cannot be in the lower level library
48  // because bad_cast and bad_typeid are defined in his higher level library
49  void __cxxabiv1::__cxa_bad_typeid() { throw std::bad_typeid(); }
50  void __cxxabiv1::__cxa_bad_cast() { throw std::bad_cast(); }
51#endif
52
53#endif  // _LIBCPPABI_VERSION
54