ubsan_handlers_cxx.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //===-- ubsan_handlers_cxx.h ------------------------------------*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // Entry points to the runtime library for Clang's undefined behavior sanitizer,
  10. // for C++-specific checks. This code is not linked into C binaries.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef UBSAN_HANDLERS_CXX_H
  14. #define UBSAN_HANDLERS_CXX_H
  15. #include "ubsan_value.h"
  16. namespace __ubsan {
  17. struct DynamicTypeCacheMissData {
  18. SourceLocation Loc;
  19. const TypeDescriptor &Type;
  20. void *TypeInfo;
  21. unsigned char TypeCheckKind;
  22. };
  23. /// \brief Handle a runtime type check failure, caused by an incorrect vptr.
  24. /// When this handler is called, all we know is that the type was not in the
  25. /// cache; this does not necessarily imply the existence of a bug.
  26. extern "C" SANITIZER_INTERFACE_ATTRIBUTE
  27. void __ubsan_handle_dynamic_type_cache_miss(
  28. DynamicTypeCacheMissData *Data, ValueHandle Pointer, ValueHandle Hash);
  29. extern "C" SANITIZER_INTERFACE_ATTRIBUTE
  30. void __ubsan_handle_dynamic_type_cache_miss_abort(
  31. DynamicTypeCacheMissData *Data, ValueHandle Pointer, ValueHandle Hash);
  32. }
  33. #endif // UBSAN_HANDLERS_CXX_H