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