annotate libsanitizer/ubsan/ubsan_type_hash.cc @ 138:fc828634a951

merge
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 08 Nov 2018 14:17:14 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 //===-- ubsan_type_hash.cc ------------------------------------------------===//
kono
parents:
diff changeset
2 //
kono
parents:
diff changeset
3 // This file is distributed under the University of Illinois Open Source
kono
parents:
diff changeset
4 // License. See LICENSE.TXT for details.
kono
parents:
diff changeset
5 //
kono
parents:
diff changeset
6 //===----------------------------------------------------------------------===//
kono
parents:
diff changeset
7 //
kono
parents:
diff changeset
8 // Implementation of a hash table for fast checking of inheritance
kono
parents:
diff changeset
9 // relationships. This file is only linked into C++ compilations, and is
kono
parents:
diff changeset
10 // permitted to use language features which require a C++ ABI library.
kono
parents:
diff changeset
11 //
kono
parents:
diff changeset
12 // Most of the implementation lives in an ABI-specific source file
kono
parents:
diff changeset
13 // (ubsan_type_hash_{itanium,win}.cc).
kono
parents:
diff changeset
14 //
kono
parents:
diff changeset
15 //===----------------------------------------------------------------------===//
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 #include "ubsan_platform.h"
kono
parents:
diff changeset
18 #if CAN_SANITIZE_UB
kono
parents:
diff changeset
19 #include "ubsan_type_hash.h"
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 #include "sanitizer_common/sanitizer_common.h"
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 /// A cache of recently-checked hashes. Mini hash table with "random" evictions.
kono
parents:
diff changeset
24 __ubsan::HashValue
kono
parents:
diff changeset
25 __ubsan::__ubsan_vptr_type_cache[__ubsan::VptrTypeCacheSize];
kono
parents:
diff changeset
26
kono
parents:
diff changeset
27 __ubsan::DynamicTypeInfo __ubsan::getDynamicTypeInfoFromObject(void *Object) {
kono
parents:
diff changeset
28 void *VtablePtr = *reinterpret_cast<void **>(Object);
kono
parents:
diff changeset
29 return getDynamicTypeInfoFromVtable(VtablePtr);
kono
parents:
diff changeset
30 }
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 #endif // CAN_SANITIZE_UB