typeinfo.cpp revision 227825
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
16std::bad_cast::bad_cast() _NOEXCEPT
17{
18}
19
20std::bad_cast::~bad_cast() _NOEXCEPT
21{
22}
23
24const char*
25std::bad_cast::what() const _NOEXCEPT
26{
27  return "std::bad_cast";
28}
29
30std::bad_typeid::bad_typeid() _NOEXCEPT
31{
32}
33
34std::bad_typeid::~bad_typeid() _NOEXCEPT
35{
36}
37
38const char*
39std::bad_typeid::what() const _NOEXCEPT
40{
41  return "std::bad_typeid";
42}
43
44#if __APPLE__
45  // On Darwin, the cxa_bad_* functions cannot be in the lower level library
46  // because bad_cast and bad_typeid are defined in his higher level library
47  void __cxxabiv1::__cxa_bad_typeid() { throw std::bad_typeid(); }
48  void __cxxabiv1::__cxa_bad_cast() { throw std::bad_cast(); }
49#endif
50
51