xref: /aosp_15_r20/external/compiler-rt/include/sanitizer/esan_interface.h (revision 7c3d14c8b49c529e04be81a3ce6f5cc23712e4c6)
1*7c3d14c8STreehugger Robot //===-- sanitizer/esan_interface.h ------------------------------*- C++ -*-===//
2*7c3d14c8STreehugger Robot //
3*7c3d14c8STreehugger Robot //                     The LLVM Compiler Infrastructure
4*7c3d14c8STreehugger Robot //
5*7c3d14c8STreehugger Robot // This file is distributed under the University of Illinois Open Source
6*7c3d14c8STreehugger Robot // License. See LICENSE.TXT for details.
7*7c3d14c8STreehugger Robot //
8*7c3d14c8STreehugger Robot //===----------------------------------------------------------------------===//
9*7c3d14c8STreehugger Robot //
10*7c3d14c8STreehugger Robot // This file is a part of EfficiencySanitizer, a family of performance tuners.
11*7c3d14c8STreehugger Robot //
12*7c3d14c8STreehugger Robot // Public interface header.
13*7c3d14c8STreehugger Robot //===----------------------------------------------------------------------===//
14*7c3d14c8STreehugger Robot #ifndef SANITIZER_ESAN_INTERFACE_H
15*7c3d14c8STreehugger Robot #define SANITIZER_ESAN_INTERFACE_H
16*7c3d14c8STreehugger Robot 
17*7c3d14c8STreehugger Robot #include <sanitizer/common_interface_defs.h>
18*7c3d14c8STreehugger Robot 
19*7c3d14c8STreehugger Robot // We declare our interface routines as weak to allow the user to avoid
20*7c3d14c8STreehugger Robot // ifdefs and instead use this pattern to allow building the same sources
21*7c3d14c8STreehugger Robot // with and without our runtime library:
22*7c3d14c8STreehugger Robot //     if (__esan_report)
23*7c3d14c8STreehugger Robot //       __esan_report();
24*7c3d14c8STreehugger Robot #ifdef _MSC_VER
25*7c3d14c8STreehugger Robot /* selectany is as close to weak as we'll get. */
26*7c3d14c8STreehugger Robot #define COMPILER_RT_WEAK __declspec(selectany)
27*7c3d14c8STreehugger Robot #elif __GNUC__
28*7c3d14c8STreehugger Robot #define COMPILER_RT_WEAK __attribute__((weak))
29*7c3d14c8STreehugger Robot #else
30*7c3d14c8STreehugger Robot #define COMPILER_RT_WEAK
31*7c3d14c8STreehugger Robot #endif
32*7c3d14c8STreehugger Robot 
33*7c3d14c8STreehugger Robot #ifdef __cplusplus
34*7c3d14c8STreehugger Robot extern "C" {
35*7c3d14c8STreehugger Robot #endif
36*7c3d14c8STreehugger Robot 
37*7c3d14c8STreehugger Robot // This function can be called mid-run (or at the end of a run for
38*7c3d14c8STreehugger Robot // a server process that doesn't shut down normally) to request that
39*7c3d14c8STreehugger Robot // data for that point in the run be reported from the tool.
40*7c3d14c8STreehugger Robot void COMPILER_RT_WEAK __esan_report();
41*7c3d14c8STreehugger Robot 
42*7c3d14c8STreehugger Robot #ifdef __cplusplus
43*7c3d14c8STreehugger Robot } // extern "C"
44*7c3d14c8STreehugger Robot #endif
45*7c3d14c8STreehugger Robot 
46*7c3d14c8STreehugger Robot #endif // SANITIZER_ESAN_INTERFACE_H
47