1 //===-- ubsan_type_hash.cc ------------------------------------------------===//
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
6 //===----------------------------------------------------------------------===//
8 // Implementation of a hash table for fast checking of inheritance
9 // relationships. This file is only linked into C++ compilations, and is
10 // permitted to use language features which require a C++ ABI library.
12 // Most of the implementation lives in an ABI-specific source file
13 // (ubsan_type_hash_{itanium,win}.cc).
15 //===----------------------------------------------------------------------===//
17 #include "ubsan_platform.h"
19 #include "ubsan_type_hash.h"
21 #include "sanitizer_common/sanitizer_common.h"
23 /// A cache of recently-checked hashes. Mini hash table with "random" evictions.
25 __ubsan::__ubsan_vptr_type_cache
[__ubsan::VptrTypeCacheSize
];
27 __ubsan::DynamicTypeInfo
__ubsan::getDynamicTypeInfoFromObject(void *Object
) {
28 void *VtablePtr
= *reinterpret_cast<void **>(Object
);
29 return getDynamicTypeInfoFromVtable(VtablePtr
);
32 #endif // CAN_SANITIZE_UB