PR rtl-optimization/79386
[official-gcc.git] / libsanitizer / ubsan / ubsan_handlers_cxx.h
blob6ace2b3472b209974e454806a59f6a7f3481c9c4
1 //===-- ubsan_handlers_cxx.h ------------------------------------*- C++ -*-===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // Entry points to the runtime library for Clang's undefined behavior sanitizer,
9 // for C++-specific checks. This code is not linked into C binaries.
11 //===----------------------------------------------------------------------===//
12 #ifndef UBSAN_HANDLERS_CXX_H
13 #define UBSAN_HANDLERS_CXX_H
15 #include "ubsan_value.h"
17 namespace __ubsan {
19 struct DynamicTypeCacheMissData {
20 SourceLocation Loc;
21 const TypeDescriptor &Type;
22 void *TypeInfo;
23 unsigned char TypeCheckKind;
26 struct CFIBadTypeData {
27 SourceLocation Loc;
28 const TypeDescriptor &Type;
29 unsigned char TypeCheckKind;
32 /// \brief Handle a runtime type check failure, caused by an incorrect vptr.
33 /// When this handler is called, all we know is that the type was not in the
34 /// cache; this does not necessarily imply the existence of a bug.
35 extern "C" SANITIZER_INTERFACE_ATTRIBUTE
36 void __ubsan_handle_dynamic_type_cache_miss(
37 DynamicTypeCacheMissData *Data, ValueHandle Pointer, ValueHandle Hash);
38 extern "C" SANITIZER_INTERFACE_ATTRIBUTE
39 void __ubsan_handle_dynamic_type_cache_miss_abort(
40 DynamicTypeCacheMissData *Data, ValueHandle Pointer, ValueHandle Hash);
42 /// \brief Handle a control flow integrity check failure by printing a
43 /// diagnostic.
44 extern "C" SANITIZER_INTERFACE_ATTRIBUTE void
45 __ubsan_handle_cfi_bad_type(CFIBadTypeData *Data, ValueHandle Vtable);
46 extern "C" SANITIZER_INTERFACE_ATTRIBUTE void
47 __ubsan_handle_cfi_bad_type_abort(CFIBadTypeData *Data, ValueHandle Vtable);
50 #endif // UBSAN_HANDLERS_H