]> git.proxmox.com Git - rustc.git/blame - src/compiler-rt/lib/ubsan/ubsan_type_hash.cc
Imported Upstream version 1.6.0+dfsg1
[rustc.git] / src / compiler-rt / lib / ubsan / ubsan_type_hash.cc
CommitLineData
1a4d82fc
JJ
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//
92a42be0
SL
14// Most of the implementation lives in an ABI-specific source file
15// (ubsan_type_hash_{itanium,win}.cc).
16//
1a4d82fc
JJ
17//===----------------------------------------------------------------------===//
18
92a42be0
SL
19#include "ubsan_platform.h"
20#if CAN_SANITIZE_UB
1a4d82fc
JJ
21#include "ubsan_type_hash.h"
22
23#include "sanitizer_common/sanitizer_common.h"
24
1a4d82fc
JJ
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
92a42be0
SL
29__ubsan::DynamicTypeInfo __ubsan::getDynamicTypeInfoFromObject(void *Object) {
30 void *VtablePtr = *reinterpret_cast<void **>(Object);
31 return getDynamicTypeInfoFromVtable(VtablePtr);
1a4d82fc
JJ
32}
33
92a42be0 34#endif // CAN_SANITIZE_UB