1 //===-- ubsan_type_hash.cpp -----------------------------------------------===//
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 //===----------------------------------------------------------------------===//
9 // Implementation of a hash table for fast checking of inheritance
10 // relationships. This file is only linked into C++ compilations, and is
11 // permitted to use language features which require a C++ ABI library.
13 // Most of the implementation lives in an ABI-specific source file
14 // (ubsan_type_hash_{itanium,win}.cpp).
16 //===----------------------------------------------------------------------===//
18 #include "ubsan_platform.h"
20 #include "ubsan_type_hash.h"
22 #include "sanitizer_common/sanitizer_common.h"
24 /// A cache of recently-checked hashes. Mini hash table with "random" evictions.
26 __ubsan::__ubsan_vptr_type_cache
[__ubsan::VptrTypeCacheSize
];
28 __ubsan::DynamicTypeInfo
__ubsan::getDynamicTypeInfoFromObject(void *Object
) {
29 void *VtablePtr
= *reinterpret_cast<void **>(Object
);
30 return getDynamicTypeInfoFromVtable(VtablePtr
);
33 #endif // CAN_SANITIZE_UB