typeinfo.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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 defined(__APPLE__) || defined(LIBCXXRT) || \
  11. defined(LIBCXX_BUILDING_LIBCXXABI)
  12. #include <cxxabi.h>
  13. #endif
  14. #include "typeinfo"
  15. #if !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION)
  16. #ifndef __GLIBCXX__
  17. #ifdef __APPLE__
  18. // On Darwin, the cxa_bad_* functions cannot be in the lower level library
  19. // because bad_cast and bad_typeid are defined in his higher level library
  20. void __cxxabiv1::__cxa_bad_typeid()
  21. {
  22. #ifndef _LIBCPP_NO_EXCEPTIONS
  23. throw std::bad_typeid();
  24. #endif
  25. }
  26. void __cxxabiv1::__cxa_bad_cast()
  27. {
  28. #ifndef _LIBCPP_NO_EXCEPTIONS
  29. throw std::bad_cast();
  30. #endif
  31. }
  32. #endif
  33. #endif // !__GLIBCXX__
  34. #endif // !LIBCXXRT && !_LIBCPPABI_VERSION