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