]>
Commit | Line | Data |
---|---|---|
de5a5fa1 MP |
1 | //===-- ubsan_handlers_cxx.h ------------------------------------*- C++ -*-===// |
2 | // | |
b667dd70 ML |
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 | |
de5a5fa1 MP |
6 | // |
7 | //===----------------------------------------------------------------------===// | |
8 | // | |
9 | // Entry points to the runtime library for Clang's undefined behavior sanitizer, | |
10 | // for C++-specific checks. This code is not linked into C binaries. | |
11 | // | |
12 | //===----------------------------------------------------------------------===// | |
13 | #ifndef UBSAN_HANDLERS_CXX_H | |
14 | #define UBSAN_HANDLERS_CXX_H | |
15 | ||
16 | #include "ubsan_value.h" | |
17 | ||
18 | namespace __ubsan { | |
19 | ||
20 | struct DynamicTypeCacheMissData { | |
21 | SourceLocation Loc; | |
22 | const TypeDescriptor &Type; | |
23 | void *TypeInfo; | |
24 | unsigned char TypeCheckKind; | |
25 | }; | |
26 | ||
27 | /// \brief Handle a runtime type check failure, caused by an incorrect vptr. | |
28 | /// When this handler is called, all we know is that the type was not in the | |
29 | /// cache; this does not necessarily imply the existence of a bug. | |
30 | extern "C" SANITIZER_INTERFACE_ATTRIBUTE | |
31 | void __ubsan_handle_dynamic_type_cache_miss( | |
32 | DynamicTypeCacheMissData *Data, ValueHandle Pointer, ValueHandle Hash); | |
33 | extern "C" SANITIZER_INTERFACE_ATTRIBUTE | |
34 | void __ubsan_handle_dynamic_type_cache_miss_abort( | |
35 | DynamicTypeCacheMissData *Data, ValueHandle Pointer, ValueHandle Hash); | |
b667dd70 ML |
36 | |
37 | struct FunctionTypeMismatchData { | |
38 | SourceLocation Loc; | |
39 | const TypeDescriptor &Type; | |
40 | }; | |
41 | ||
42 | extern "C" SANITIZER_INTERFACE_ATTRIBUTE void | |
43 | __ubsan_handle_function_type_mismatch_v1(FunctionTypeMismatchData *Data, | |
44 | ValueHandle Val, | |
45 | ValueHandle calleeRTTI, | |
46 | ValueHandle fnRTTI); | |
47 | extern "C" SANITIZER_INTERFACE_ATTRIBUTE void | |
48 | __ubsan_handle_function_type_mismatch_v1_abort(FunctionTypeMismatchData *Data, | |
49 | ValueHandle Val, | |
50 | ValueHandle calleeRTTI, | |
51 | ValueHandle fnRTTI); | |
de5a5fa1 MP |
52 | } |
53 | ||
54 | #endif // UBSAN_HANDLERS_H |