]>
Commit | Line | Data |
---|---|---|
b667dd70 | 1 | //===-- ubsan_type_hash.cpp -----------------------------------------------===// |
de5a5fa1 | 2 | // |
b667dd70 ML |
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 | |
de5a5fa1 MP |
6 | // |
7 | //===----------------------------------------------------------------------===// | |
8 | // | |
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. | |
12 | // | |
696d846a | 13 | // Most of the implementation lives in an ABI-specific source file |
b667dd70 | 14 | // (ubsan_type_hash_{itanium,win}.cpp). |
696d846a | 15 | // |
de5a5fa1 MP |
16 | //===----------------------------------------------------------------------===// |
17 | ||
696d846a MO |
18 | #include "ubsan_platform.h" |
19 | #if CAN_SANITIZE_UB | |
de5a5fa1 MP |
20 | #include "ubsan_type_hash.h" |
21 | ||
22 | #include "sanitizer_common/sanitizer_common.h" | |
23 | ||
de5a5fa1 MP |
24 | /// A cache of recently-checked hashes. Mini hash table with "random" evictions. |
25 | __ubsan::HashValue | |
df77f0e4 | 26 | __ubsan::__ubsan_vptr_type_cache[__ubsan::VptrTypeCacheSize]; |
de5a5fa1 | 27 | |
696d846a MO |
28 | __ubsan::DynamicTypeInfo __ubsan::getDynamicTypeInfoFromObject(void *Object) { |
29 | void *VtablePtr = *reinterpret_cast<void **>(Object); | |
30 | return getDynamicTypeInfoFromVtable(VtablePtr); | |
de5a5fa1 MP |
31 | } |
32 | ||
696d846a | 33 | #endif // CAN_SANITIZE_UB |