1353944Sdim//===-- ubsan_type_hash.cpp -----------------------------------------------===//
2353944Sdim//
3353944Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4353944Sdim// See https://llvm.org/LICENSE.txt for license information.
5353944Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6353944Sdim//
7353944Sdim//===----------------------------------------------------------------------===//
8353944Sdim//
9353944Sdim// Implementation of a hash table for fast checking of inheritance
10353944Sdim// relationships. This file is only linked into C++ compilations, and is
11353944Sdim// permitted to use language features which require a C++ ABI library.
12353944Sdim//
13353944Sdim// Most of the implementation lives in an ABI-specific source file
14353944Sdim// (ubsan_type_hash_{itanium,win}.cpp).
15353944Sdim//
16353944Sdim//===----------------------------------------------------------------------===//
17353944Sdim
18353944Sdim#include "ubsan_platform.h"
19353944Sdim#if CAN_SANITIZE_UB
20353944Sdim#include "ubsan_type_hash.h"
21353944Sdim
22353944Sdim#include "sanitizer_common/sanitizer_common.h"
23353944Sdim
24353944Sdim/// A cache of recently-checked hashes. Mini hash table with "random" evictions.
25353944Sdim__ubsan::HashValue
26353944Sdim__ubsan::__ubsan_vptr_type_cache[__ubsan::VptrTypeCacheSize];
27353944Sdim
28353944Sdim__ubsan::DynamicTypeInfo __ubsan::getDynamicTypeInfoFromObject(void *Object) {
29353944Sdim  void *VtablePtr = *reinterpret_cast<void **>(Object);
30353944Sdim  return getDynamicTypeInfoFromVtable(VtablePtr);
31353944Sdim}
32353944Sdim
33353944Sdim#endif  // CAN_SANITIZE_UB
34