For obj-c stage-final re-use the checksum from the previous stage
[official-gcc.git] / libsanitizer / ubsan / ubsan_type_hash.cpp
blob8f4b9aee50bbd276bdf5e43b86d933572efe2ff2
1 //===-- ubsan_type_hash.cpp -----------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Implementation of a hash table for fast checking of inheritance
10 // relationships. This file is only linked into C++ compilations, and is
11 // permitted to use language features which require a C++ ABI library.
13 // Most of the implementation lives in an ABI-specific source file
14 // (ubsan_type_hash_{itanium,win}.cpp).
16 //===----------------------------------------------------------------------===//
18 #include "ubsan_platform.h"
19 #if CAN_SANITIZE_UB
20 #include "ubsan_type_hash.h"
22 #include "sanitizer_common/sanitizer_common.h"
24 /// A cache of recently-checked hashes. Mini hash table with "random" evictions.
25 __ubsan::HashValue
26 __ubsan::__ubsan_vptr_type_cache[__ubsan::VptrTypeCacheSize];
28 __ubsan::DynamicTypeInfo __ubsan::getDynamicTypeInfoFromObject(void *Object) {
29 void *VtablePtr = *reinterpret_cast<void **>(Object);
30 return getDynamicTypeInfoFromVtable(VtablePtr);
33 #endif // CAN_SANITIZE_UB