2012-10-25 10:07:02 +08:00
|
|
|
//===-- ubsan_handlers_cxx.h ------------------------------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2012-10-25 10:07:02 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Entry points to the runtime library for Clang's undefined behavior sanitizer,
|
|
|
|
// for C++-specific checks. This code is not linked into C binaries.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef UBSAN_HANDLERS_CXX_H
|
|
|
|
#define UBSAN_HANDLERS_CXX_H
|
|
|
|
|
|
|
|
#include "ubsan_value.h"
|
|
|
|
|
|
|
|
namespace __ubsan {
|
|
|
|
|
|
|
|
struct DynamicTypeCacheMissData {
|
|
|
|
SourceLocation Loc;
|
|
|
|
const TypeDescriptor &Type;
|
|
|
|
void *TypeInfo;
|
|
|
|
unsigned char TypeCheckKind;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// \brief Handle a runtime type check failure, caused by an incorrect vptr.
|
|
|
|
/// When this handler is called, all we know is that the type was not in the
|
|
|
|
/// cache; this does not necessarily imply the existence of a bug.
|
2013-01-11 01:01:13 +08:00
|
|
|
extern "C" SANITIZER_INTERFACE_ATTRIBUTE
|
|
|
|
void __ubsan_handle_dynamic_type_cache_miss(
|
2012-10-25 10:07:02 +08:00
|
|
|
DynamicTypeCacheMissData *Data, ValueHandle Pointer, ValueHandle Hash);
|
2013-01-11 01:01:13 +08:00
|
|
|
extern "C" SANITIZER_INTERFACE_ATTRIBUTE
|
|
|
|
void __ubsan_handle_dynamic_type_cache_miss_abort(
|
2012-12-03 03:47:29 +08:00
|
|
|
DynamicTypeCacheMissData *Data, ValueHandle Pointer, ValueHandle Hash);
|
2019-05-02 14:40:33 +08:00
|
|
|
|
|
|
|
struct FunctionTypeMismatchData {
|
|
|
|
SourceLocation Loc;
|
|
|
|
const TypeDescriptor &Type;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern "C" SANITIZER_INTERFACE_ATTRIBUTE void
|
2019-07-16 14:23:27 +08:00
|
|
|
__ubsan_handle_function_type_mismatch_v1(FunctionTypeMismatchData *Data,
|
|
|
|
ValueHandle Val,
|
|
|
|
ValueHandle calleeRTTI,
|
|
|
|
ValueHandle fnRTTI);
|
2019-05-02 14:40:33 +08:00
|
|
|
extern "C" SANITIZER_INTERFACE_ATTRIBUTE void
|
2019-07-16 14:23:27 +08:00
|
|
|
__ubsan_handle_function_type_mismatch_v1_abort(FunctionTypeMismatchData *Data,
|
|
|
|
ValueHandle Val,
|
|
|
|
ValueHandle calleeRTTI,
|
|
|
|
ValueHandle fnRTTI);
|
2012-10-25 10:07:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // UBSAN_HANDLERS_H
|