1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 #if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_ABI_VCRUNTIME)
15 int std::type_info::__compare(const type_info
&__rhs
) const noexcept
{
16 if (&__data
== &__rhs
.__data
)
18 return strcmp(&__data
.__decorated_name
[1], &__rhs
.__data
.__decorated_name
[1]);
21 const char *std::type_info::name() const noexcept
{
22 // TODO(compnerd) cache demangled &__data.__decorated_name[1]
23 return &__data
.__decorated_name
[1];
26 size_t std::type_info::hash_code() const noexcept
{
28 constexpr size_t fnv_offset_basis
= 14695981039346656037ull;
29 constexpr size_t fnv_prime
= 10995116282110ull;
31 constexpr size_t fnv_offset_basis
= 2166136261ull;
32 constexpr size_t fnv_prime
= 16777619ull;
35 size_t value
= fnv_offset_basis
;
36 for (const char* c
= &__data
.__decorated_name
[1]; *c
; ++c
) {
37 value
^= static_cast<size_t>(static_cast<unsigned char>(*c
));
47 #endif // _LIBCPP_ABI_MICROSOFT
49 // FIXME: Remove the _LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY configuration.
50 #if (!defined(LIBCXX_BUILDING_LIBCXXABI) && \
51 !defined(LIBCXXRT) && \
52 !defined(__GLIBCXX__) && \
53 !defined(_LIBCPP_ABI_VCRUNTIME)) || \
54 defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY)
55 std::type_info::~type_info()