1 //===-- ubsan_handlers_cxx.h ------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
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.
12 //===----------------------------------------------------------------------===//
13 #ifndef UBSAN_HANDLERS_CXX_H
14 #define UBSAN_HANDLERS_CXX_H
16 #include "ubsan_value.h"
20 struct DynamicTypeCacheMissData
{
22 const TypeDescriptor
&Type
;
24 unsigned char TypeCheckKind
;
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
);
37 struct FunctionTypeMismatchData
{
39 const TypeDescriptor
&Type
;
42 extern "C" SANITIZER_INTERFACE_ATTRIBUTE
void
43 __ubsan_handle_function_type_mismatch_v1(FunctionTypeMismatchData
*Data
,
45 ValueHandle calleeRTTI
,
47 extern "C" SANITIZER_INTERFACE_ATTRIBUTE
void
48 __ubsan_handle_function_type_mismatch_v1_abort(FunctionTypeMismatchData
*Data
,
50 ValueHandle calleeRTTI
,
54 #endif // UBSAN_HANDLERS_CXX_H