xref: /freebsd/contrib/llvm-project/compiler-rt/lib/ubsan/ubsan_handlers_cxx.h (revision f126890ac5386406dadf7c4cfa9566cbb56537c5)
1 //===-- ubsan_handlers_cxx.h ------------------------------------*- C++ -*-===//
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 // 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);
36 }
37 
38 #endif // UBSAN_HANDLERS_CXX_H
39