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