1eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith//===-- ubsan_handlers_cxx.h ------------------------------------*- C++ -*-===//
2eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith//
3eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith//                     The LLVM Compiler Infrastructure
4eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith//
5eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith// This file is distributed under the University of Illinois Open Source
6eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith// License. See LICENSE.TXT for details.
7eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith//
8eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith//===----------------------------------------------------------------------===//
9eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith//
10eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith// Entry points to the runtime library for Clang's undefined behavior sanitizer,
11eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith// for C++-specific checks. This code is not linked into C binaries.
12eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith//
13eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith//===----------------------------------------------------------------------===//
14eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith#ifndef UBSAN_HANDLERS_CXX_H
15eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith#define UBSAN_HANDLERS_CXX_H
16eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith
17eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith#include "ubsan_value.h"
18eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith
19eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smithnamespace __ubsan {
20eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith
21eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smithstruct DynamicTypeCacheMissData {
22eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith  SourceLocation Loc;
23eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith  const TypeDescriptor &Type;
24eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith  void *TypeInfo;
25eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith  unsigned char TypeCheckKind;
26eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith};
27eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith
28eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith/// \brief Handle a runtime type check failure, caused by an incorrect vptr.
29eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith/// When this handler is called, all we know is that the type was not in the
30eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith/// cache; this does not necessarily imply the existence of a bug.
31a44110995241d30a886d711cbc33f65269b170eaWill Dietzextern "C" SANITIZER_INTERFACE_ATTRIBUTE
32a44110995241d30a886d711cbc33f65269b170eaWill Dietzvoid __ubsan_handle_dynamic_type_cache_miss(
33eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith  DynamicTypeCacheMissData *Data, ValueHandle Pointer, ValueHandle Hash);
34a44110995241d30a886d711cbc33f65269b170eaWill Dietzextern "C" SANITIZER_INTERFACE_ATTRIBUTE
35a44110995241d30a886d711cbc33f65269b170eaWill Dietzvoid __ubsan_handle_dynamic_type_cache_miss_abort(
36a82a5d360b19080f2b1beae374c12d4f26146450Will Dietz  DynamicTypeCacheMissData *Data, ValueHandle Pointer, ValueHandle Hash);
37eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith
38eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith}
39eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith
40eda8bd0fc07df35c9ad7de5b698bb717b063e7afRichard Smith#endif // UBSAN_HANDLERS_H
41