mirror of
https://github.com/darlinghq/darling-libcxx.git
synced 2024-11-23 20:09:41 +00:00
b64f8b07c1
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119395 91177308-0d34-0410-b5e6-96231b3b80d8
123 lines
2.7 KiB
C++
123 lines
2.7 KiB
C++
// -*- C++ -*-
|
|
//===-------------------------- typeinfo ----------------------------------===//
|
|
//
|
|
// 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.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef __LIBCPP_TYPEINFO
|
|
#define __LIBCPP_TYPEINFO
|
|
|
|
/*
|
|
|
|
typeinfo synopsis
|
|
|
|
namespace std {
|
|
|
|
class type_info
|
|
{
|
|
public:
|
|
virtual ~type_info();
|
|
|
|
bool operator==(const type_info& rhs) const;
|
|
bool operator!=(const type_info& rhs) const;
|
|
|
|
bool before(const type_info& rhs) const;
|
|
size_t hash_code() const throw();
|
|
const char* name() const;
|
|
|
|
type_info(const type_info& rhs) = delete;
|
|
type_info& operator=(const type_info& rhs) = delete;
|
|
};
|
|
|
|
class bad_cast
|
|
: public exception
|
|
{
|
|
public:
|
|
bad_cast() throw();
|
|
bad_cast(const bad_cast&) throw();
|
|
bad_cast& operator=(const bad_cast&) throw();
|
|
virtual const char* what() const throw();
|
|
};
|
|
|
|
class bad_typeid
|
|
: public exception
|
|
{
|
|
public:
|
|
bad_typeid() throw();
|
|
bad_typeid(const bad_typeid&) throw();
|
|
bad_typeid& operator=(const bad_typeid&) throw();
|
|
virtual const char* what() const throw();
|
|
};
|
|
|
|
} // std
|
|
|
|
*/
|
|
|
|
#include <__config>
|
|
#include <exception>
|
|
#include <cstddef>
|
|
|
|
#pragma GCC system_header
|
|
|
|
namespace std // purposefully not using versioning namespace
|
|
{
|
|
|
|
class _LIBCPP_EXCEPTION_ABI type_info
|
|
{
|
|
type_info& operator=(const type_info&);
|
|
type_info(const type_info&);
|
|
protected:
|
|
const char* __type_name;
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
explicit type_info(const char* __n)
|
|
: __type_name(__n) {}
|
|
|
|
public:
|
|
virtual ~type_info();
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
const char* name() const {return __type_name;}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
bool before(const type_info& __arg) const
|
|
{return __type_name < __arg.__type_name;}
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
size_t hash_code() const throw()
|
|
{return *reinterpret_cast<const size_t*>(&__type_name);}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
bool operator==(const type_info& __arg) const
|
|
{return __type_name == __arg.__type_name;}
|
|
_LIBCPP_INLINE_VISIBILITY
|
|
bool operator!=(const type_info& __arg) const
|
|
{return !operator==(__arg);}
|
|
|
|
};
|
|
|
|
class _LIBCPP_EXCEPTION_ABI bad_cast
|
|
: public exception
|
|
{
|
|
public:
|
|
bad_cast() throw();
|
|
virtual ~bad_cast() throw();
|
|
virtual const char* what() const throw();
|
|
};
|
|
|
|
class _LIBCPP_EXCEPTION_ABI bad_typeid
|
|
: public exception
|
|
{
|
|
public:
|
|
bad_typeid() throw();
|
|
virtual ~bad_typeid() throw();
|
|
virtual const char* what() const throw();
|
|
};
|
|
|
|
} // std
|
|
|
|
#endif // __LIBCPP_TYPEINFO
|