003 File Manager
Current Path:
/usr/src/contrib/llvm-project/libcxx/include
usr
/
src
/
contrib
/
llvm-project
/
libcxx
/
include
/
📁
..
📄
__bit_reference
(51.94 KB)
📄
__bsd_locale_defaults.h
(2.06 KB)
📄
__bsd_locale_fallbacks.h
(3.94 KB)
📄
__config
(51.99 KB)
📄
__debug
(7.77 KB)
📄
__errc
(9.13 KB)
📄
__functional_03
(43.5 KB)
📄
__functional_base
(17.4 KB)
📄
__functional_base_03
(6.38 KB)
📄
__hash_table
(101.98 KB)
📄
__libcpp_version
(6 B)
📄
__locale
(48.08 KB)
📄
__mutex_base
(16.04 KB)
📄
__node_handle
(5.93 KB)
📄
__nullptr
(1.69 KB)
📄
__split_buffer
(21.9 KB)
📄
__sso_allocator
(2.49 KB)
📄
__std_stream
(10.32 KB)
📄
__string
(46.11 KB)
📄
__threading_support
(20.64 KB)
📄
__tree
(102.38 KB)
📄
__tuple
(20.19 KB)
📄
__undef_macros
(1.02 KB)
📄
algorithm
(199 KB)
📄
any
(18.58 KB)
📄
array
(20.44 KB)
📄
atomic
(96.81 KB)
📄
barrier
(9.98 KB)
📄
bit
(14.13 KB)
📄
bitset
(33 KB)
📄
cassert
(559 B)
📄
ccomplex
(640 B)
📄
cctype
(1.72 KB)
📄
cerrno
(669 B)
📄
cfenv
(1.56 KB)
📄
cfloat
(1.39 KB)
📄
charconv
(17.95 KB)
📄
chrono
(113.59 KB)
📄
cinttypes
(3.44 KB)
📄
ciso646
(595 B)
📄
climits
(907 B)
📄
clocale
(998 B)
📄
cmath
(16.71 KB)
📄
codecvt
(20.12 KB)
📄
compare
(30.14 KB)
📄
complex
(45.51 KB)
📄
complex.h
(739 B)
📄
concepts
(4.63 KB)
📄
condition_variable
(7.43 KB)
📄
csetjmp
(813 B)
📄
csignal
(964 B)
📄
cstdarg
(903 B)
📄
cstdbool
(721 B)
📄
cstddef
(5.29 KB)
📄
cstdint
(2.73 KB)
📄
cstdio
(4.31 KB)
📄
cstdlib
(4.69 KB)
📄
cstring
(2.49 KB)
📄
ctgmath
(650 B)
📄
ctime
(1.67 KB)
📄
ctype.h
(1.12 KB)
📄
cwchar
(6.14 KB)
📄
cwctype
(1.65 KB)
📄
deque
(106.34 KB)
📄
errno.h
(6.19 KB)
📄
exception
(9.25 KB)
📄
execution
(595 B)
📁
experimental
📁
ext
📄
fenv.h
(1.82 KB)
📄
filesystem
(80.17 KB)
📄
float.h
(1.58 KB)
📄
forward_list
(61.11 KB)
📄
fstream
(53.05 KB)
📄
functional
(99.54 KB)
📄
future
(70.91 KB)
📄
initializer_list
(2.78 KB)
📄
inttypes.h
(3.8 KB)
📄
iomanip
(17.85 KB)
📄
ios
(24.99 KB)
📄
iosfwd
(8.27 KB)
📄
iostream
(1.36 KB)
📄
istream
(46.73 KB)
📄
iterator
(70.11 KB)
📄
latch
(2.35 KB)
📄
limits
(39.71 KB)
📄
limits.h
(1.44 KB)
📄
list
(78.48 KB)
📄
locale
(150.64 KB)
📄
locale.h
(776 B)
📄
map
(82.59 KB)
📄
math.h
(48.03 KB)
📄
memory
(160.89 KB)
📄
module.modulemap
(12.1 KB)
📄
mutex
(17.25 KB)
📄
new
(13.79 KB)
📄
numbers
(6.74 KB)
📄
numeric
(20.08 KB)
📄
optional
(41.59 KB)
📄
ostream
(32.02 KB)
📄
queue
(27.47 KB)
📄
random
(221.29 KB)
📄
ratio
(16.04 KB)
📄
regex
(219.62 KB)
📄
scoped_allocator
(25.14 KB)
📄
semaphore
(6.52 KB)
📄
set
(55.98 KB)
📄
setjmp.h
(802 B)
📄
shared_mutex
(14.75 KB)
📄
span
(22.41 KB)
📄
sstream
(32.59 KB)
📄
stack
(9.86 KB)
📄
stdbool.h
(815 B)
📄
stddef.h
(1.08 KB)
📄
stdexcept
(7.66 KB)
📄
stdint.h
(2.27 KB)
📄
stdio.h
(3.44 KB)
📄
stdlib.h
(5.1 KB)
📄
streambuf
(14.18 KB)
📄
string
(163.38 KB)
📄
string.h
(4.58 KB)
📄
string_view
(33.74 KB)
📄
strstream
(10.88 KB)
📄
system_error
(13.88 KB)
📄
tgmath.h
(732 B)
📄
thread
(11.13 KB)
📄
tuple
(55.25 KB)
📄
type_traits
(147.84 KB)
📄
typeindex
(2.76 KB)
📄
typeinfo
(11.27 KB)
📄
unordered_map
(97.16 KB)
📄
unordered_set
(67.79 KB)
📄
utility
(48.28 KB)
📄
valarray
(131.97 KB)
📄
variant
(60.89 KB)
📄
vector
(109.43 KB)
📄
version
(14.98 KB)
📄
wchar.h
(8.24 KB)
📄
wctype.h
(1.52 KB)
Editing: typeinfo
// -*- C++ -*- //===-------------------------- typeinfo ----------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef __LIBCPP_TYPEINFO #define __LIBCPP_TYPEINFO /* typeinfo synopsis namespace std { class type_info { public: virtual ~type_info(); bool operator==(const type_info& rhs) const noexcept; bool operator!=(const type_info& rhs) const noexcept; bool before(const type_info& rhs) const noexcept; size_t hash_code() const noexcept; const char* name() const noexcept; type_info(const type_info& rhs) = delete; type_info& operator=(const type_info& rhs) = delete; }; class bad_cast : public exception { public: bad_cast() noexcept; bad_cast(const bad_cast&) noexcept; bad_cast& operator=(const bad_cast&) noexcept; virtual const char* what() const noexcept; }; class bad_typeid : public exception { public: bad_typeid() noexcept; bad_typeid(const bad_typeid&) noexcept; bad_typeid& operator=(const bad_typeid&) noexcept; virtual const char* what() const noexcept; }; } // std */ #include <__config> #include <exception> #include <cstddef> #include <cstdint> #include <type_traits> #ifdef _LIBCPP_NO_EXCEPTIONS #include <cstdlib> #endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif #if defined(_LIBCPP_ABI_VCRUNTIME) #include <vcruntime_typeinfo.h> #else namespace std // purposefully not using versioning namespace { #if defined(_LIBCPP_ABI_MICROSOFT) class _LIBCPP_EXCEPTION_ABI type_info { type_info& operator=(const type_info&); type_info(const type_info&); mutable struct { const char *__undecorated_name; const char __decorated_name[1]; } __data; int __compare(const type_info &__rhs) const _NOEXCEPT; public: _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE virtual ~type_info(); const char *name() const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY bool before(const type_info& __arg) const _NOEXCEPT { return __compare(__arg) < 0; } size_t hash_code() const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY bool operator==(const type_info& __arg) const _NOEXCEPT { return __compare(__arg) == 0; } _LIBCPP_INLINE_VISIBILITY bool operator!=(const type_info& __arg) const _NOEXCEPT { return !operator==(__arg); } }; #else // !defined(_LIBCPP_ABI_MICROSOFT) // ========================================================================== // // Implementations // ========================================================================== // // ------------------------------------------------------------------------- // // Unique // (_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION = 1) // ------------------------------------------------------------------------- // // This implementation of type_info assumes a unique copy of the RTTI for a // given type inside a program. This is a valid assumption when abiding to // Itanium ABI (http://itanium-cxx-abi.github.io/cxx-abi/abi.html#vtable-components). // Under this assumption, we can always compare the addresses of the type names // to implement equality-comparison of type_infos instead of having to perform // a deep string comparison. // -------------------------------------------------------------------------- // // NonUnique // (_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION = 2) // -------------------------------------------------------------------------- // // This implementation of type_info does not assume there is always a unique // copy of the RTTI for a given type inside a program. For various reasons // the linker may have failed to merge every copy of a types RTTI // (For example: -Bsymbolic or llvm.org/PR37398). Under this assumption, two // type_infos are equal if their addresses are equal or if a deep string // comparison is equal. // -------------------------------------------------------------------------- // // NonUniqueARMRTTIBit // (selected on ARM64 regardless of _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION) // -------------------------------------------------------------------------- // // This implementation of type_info does not assume always a unique copy of // the RTTI for a given type inside a program. It packs the pointer to the // type name into a uintptr_t and reserves the high bit of that pointer (which // is assumed to be free for use under the ABI in use) to represent whether // that specific copy of the RTTI can be assumed unique inside the program. // To implement equality-comparison of type_infos, we check whether BOTH // type_infos are guaranteed unique, and if so, we simply compare the addresses // of their type names instead of doing a deep string comparison, which is // faster. If at least one of the type_infos can't guarantee uniqueness, we // have no choice but to fall back to a deep string comparison. // // This implementation is specific to ARM64 on Apple platforms. // // Note that the compiler is the one setting (or unsetting) the high bit of // the pointer when it constructs the type_info, depending on whether it can // guarantee uniqueness for that specific type_info. struct __type_info_implementations { struct __string_impl_base { typedef const char* __type_name_t; _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR static const char* __type_name_to_string(__type_name_t __v) _NOEXCEPT { return __v; } _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR static __type_name_t __string_to_type_name(const char* __v) _NOEXCEPT { return __v; } }; struct __unique_impl : __string_impl_base { _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE static size_t __hash(__type_name_t __v) _NOEXCEPT { return reinterpret_cast<size_t>(__v); } _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT { return __lhs == __rhs; } _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT { return __lhs < __rhs; } }; struct __non_unique_impl : __string_impl_base { _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE static size_t __hash(__type_name_t __ptr) _NOEXCEPT { size_t __hash = 5381; while (unsigned char __c = static_cast<unsigned char>(*__ptr++)) __hash = (__hash * 33) ^ __c; return __hash; } _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT { return __lhs == __rhs || __builtin_strcmp(__lhs, __rhs) == 0; } _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT { return __builtin_strcmp(__lhs, __rhs) < 0; } }; struct __non_unique_arm_rtti_bit_impl { typedef uintptr_t __type_name_t; _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE static const char* __type_name_to_string(__type_name_t __v) _NOEXCEPT { return reinterpret_cast<const char*>(__v & ~__non_unique_rtti_bit::value); } _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE static __type_name_t __string_to_type_name(const char* __v) _NOEXCEPT { return reinterpret_cast<__type_name_t>(__v); } _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE static size_t __hash(__type_name_t __v) _NOEXCEPT { if (__is_type_name_unique(__v)) return reinterpret_cast<size_t>(__v); return __non_unique_impl::__hash(__type_name_to_string(__v)); } _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT { if (__lhs == __rhs) return true; if (__is_type_name_unique(__lhs, __rhs)) return false; return __builtin_strcmp(__type_name_to_string(__lhs), __type_name_to_string(__rhs)) == 0; } _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT { if (__is_type_name_unique(__lhs, __rhs)) return __lhs < __rhs; return __builtin_strcmp(__type_name_to_string(__lhs), __type_name_to_string(__rhs)) < 0; } private: // The unique bit is the top bit. It is expected that __type_name_t is 64 bits when // this implementation is actually used. typedef std::integral_constant<__type_name_t, (1ULL << ((__CHAR_BIT__ * sizeof(__type_name_t)) - 1))> __non_unique_rtti_bit; _LIBCPP_INLINE_VISIBILITY static bool __is_type_name_unique(__type_name_t __lhs) _NOEXCEPT { return !(__lhs & __non_unique_rtti_bit::value); } _LIBCPP_INLINE_VISIBILITY static bool __is_type_name_unique(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT { return !((__lhs & __rhs) & __non_unique_rtti_bit::value); } }; typedef #if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__) __non_unique_arm_rtti_bit_impl #elif _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 1 __unique_impl #elif _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 2 __non_unique_impl #else # error invalid configuration for _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION #endif __impl; }; class _LIBCPP_EXCEPTION_ABI type_info { type_info& operator=(const type_info&); type_info(const type_info&); protected: typedef __type_info_implementations::__impl __impl; __impl::__type_name_t __type_name; _LIBCPP_INLINE_VISIBILITY explicit type_info(const char* __n) : __type_name(__impl::__string_to_type_name(__n)) {} public: _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE virtual ~type_info(); _LIBCPP_INLINE_VISIBILITY const char* name() const _NOEXCEPT { return __impl::__type_name_to_string(__type_name); } _LIBCPP_INLINE_VISIBILITY bool before(const type_info& __arg) const _NOEXCEPT { return __impl::__lt(__type_name, __arg.__type_name); } _LIBCPP_INLINE_VISIBILITY size_t hash_code() const _NOEXCEPT { return __impl::__hash(__type_name); } _LIBCPP_INLINE_VISIBILITY bool operator==(const type_info& __arg) const _NOEXCEPT { return __impl::__eq(__type_name, __arg.__type_name); } _LIBCPP_INLINE_VISIBILITY bool operator!=(const type_info& __arg) const _NOEXCEPT { return !operator==(__arg); } }; #endif // defined(_LIBCPP_ABI_MICROSOFT) class _LIBCPP_EXCEPTION_ABI bad_cast : public exception { public: bad_cast() _NOEXCEPT; bad_cast(const bad_cast&) _NOEXCEPT = default; virtual ~bad_cast() _NOEXCEPT; virtual const char* what() const _NOEXCEPT; }; class _LIBCPP_EXCEPTION_ABI bad_typeid : public exception { public: bad_typeid() _NOEXCEPT; virtual ~bad_typeid() _NOEXCEPT; virtual const char* what() const _NOEXCEPT; }; } // std #endif // defined(_LIBCPP_ABI_VCRUNTIME) _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void __throw_bad_cast() { #ifndef _LIBCPP_NO_EXCEPTIONS throw bad_cast(); #else _VSTD::abort(); #endif } _LIBCPP_END_NAMESPACE_STD #endif // __LIBCPP_TYPEINFO
Upload File
Create Folder