ubsan_type_hash.cc revision 1.3
1//===-- ubsan_type_hash.cc ------------------------------------------------===// 2// 3// This file is distributed under the University of Illinois Open Source 4// License. See LICENSE.TXT for details. 5// 6//===----------------------------------------------------------------------===// 7// 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. 11// 12// Most of the implementation lives in an ABI-specific source file 13// (ubsan_type_hash_{itanium,win}.cc). 14// 15//===----------------------------------------------------------------------===// 16 17#include "ubsan_platform.h" 18#if CAN_SANITIZE_UB 19#include "ubsan_type_hash.h" 20 21#include "sanitizer_common/sanitizer_common.h" 22 23/// A cache of recently-checked hashes. Mini hash table with "random" evictions. 24__ubsan::HashValue 25__ubsan::__ubsan_vptr_type_cache[__ubsan::VptrTypeCacheSize]; 26 27__ubsan::DynamicTypeInfo __ubsan::getDynamicTypeInfoFromObject(void *Object) { 28 void *VtablePtr = *reinterpret_cast<void **>(Object); 29 return getDynamicTypeInfoFromVtable(VtablePtr); 30} 31 32#endif // CAN_SANITIZE_UB 33