xref: /freebsd/contrib/llvm-project/compiler-rt/lib/ubsan/ubsan_handlers_cxx.h (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
10b57cec5SDimitry Andric //===-- ubsan_handlers_cxx.h ------------------------------------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric // Entry points to the runtime library for Clang's undefined behavior sanitizer,
100b57cec5SDimitry Andric // for C++-specific checks. This code is not linked into C binaries.
110b57cec5SDimitry Andric //
120b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
130b57cec5SDimitry Andric #ifndef UBSAN_HANDLERS_CXX_H
140b57cec5SDimitry Andric #define UBSAN_HANDLERS_CXX_H
150b57cec5SDimitry Andric 
160b57cec5SDimitry Andric #include "ubsan_value.h"
170b57cec5SDimitry Andric 
180b57cec5SDimitry Andric namespace __ubsan {
190b57cec5SDimitry Andric 
200b57cec5SDimitry Andric struct DynamicTypeCacheMissData {
210b57cec5SDimitry Andric   SourceLocation Loc;
220b57cec5SDimitry Andric   const TypeDescriptor &Type;
230b57cec5SDimitry Andric   void *TypeInfo;
240b57cec5SDimitry Andric   unsigned char TypeCheckKind;
250b57cec5SDimitry Andric };
260b57cec5SDimitry Andric 
270b57cec5SDimitry Andric /// \brief Handle a runtime type check failure, caused by an incorrect vptr.
280b57cec5SDimitry Andric /// When this handler is called, all we know is that the type was not in the
290b57cec5SDimitry Andric /// cache; this does not necessarily imply the existence of a bug.
300b57cec5SDimitry Andric extern "C" SANITIZER_INTERFACE_ATTRIBUTE
310b57cec5SDimitry Andric void __ubsan_handle_dynamic_type_cache_miss(
320b57cec5SDimitry Andric   DynamicTypeCacheMissData *Data, ValueHandle Pointer, ValueHandle Hash);
330b57cec5SDimitry Andric extern "C" SANITIZER_INTERFACE_ATTRIBUTE
340b57cec5SDimitry Andric void __ubsan_handle_dynamic_type_cache_miss_abort(
350b57cec5SDimitry Andric   DynamicTypeCacheMissData *Data, ValueHandle Pointer, ValueHandle Hash);
360b57cec5SDimitry Andric }
370b57cec5SDimitry Andric 
38*04eeddc0SDimitry Andric #endif // UBSAN_HANDLERS_CXX_H
39