xref: /netbsd-src/external/gpl3/gcc.old/dist/libsanitizer/ubsan/ubsan_handlers_cxx.h (revision a2dc1f3faca890bc62c61c70cbcb4657d1fe6044)
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.
10 //
11 //===----------------------------------------------------------------------===//
12 #ifndef UBSAN_HANDLERS_CXX_H
13 #define UBSAN_HANDLERS_CXX_H
14 
15 #include "ubsan_value.h"
16 
17 namespace __ubsan {
18 
19 struct DynamicTypeCacheMissData {
20   SourceLocation Loc;
21   const TypeDescriptor &Type;
22   void *TypeInfo;
23   unsigned char TypeCheckKind;
24 };
25 
26 /// \brief Handle a runtime type check failure, caused by an incorrect vptr.
27 /// When this handler is called, all we know is that the type was not in the
28 /// cache; this does not necessarily imply the existence of a bug.
29 extern "C" SANITIZER_INTERFACE_ATTRIBUTE
30 void __ubsan_handle_dynamic_type_cache_miss(
31   DynamicTypeCacheMissData *Data, ValueHandle Pointer, ValueHandle Hash);
32 extern "C" SANITIZER_INTERFACE_ATTRIBUTE
33 void __ubsan_handle_dynamic_type_cache_miss_abort(
34   DynamicTypeCacheMissData *Data, ValueHandle Pointer, ValueHandle Hash);
35 }
36 
37 #endif // UBSAN_HANDLERS_H
38