Home | History | Annotate | Download | only in sanitizer
      1 //===-- sanitizer/esan_interface.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 // This file is a part of EfficiencySanitizer, a family of performance tuners.
     11 //
     12 // Public interface header.
     13 //===----------------------------------------------------------------------===//
     14 #ifndef SANITIZER_ESAN_INTERFACE_H
     15 #define SANITIZER_ESAN_INTERFACE_H
     16 
     17 #include <sanitizer/common_interface_defs.h>
     18 
     19 // We declare our interface routines as weak to allow the user to avoid
     20 // ifdefs and instead use this pattern to allow building the same sources
     21 // with and without our runtime library:
     22 //     if (__esan_report)
     23 //       __esan_report();
     24 #ifdef _MSC_VER
     25 /* selectany is as close to weak as we'll get. */
     26 #define COMPILER_RT_WEAK __declspec(selectany)
     27 #elif __GNUC__
     28 #define COMPILER_RT_WEAK __attribute__((weak))
     29 #else
     30 #define COMPILER_RT_WEAK
     31 #endif
     32 
     33 #ifdef __cplusplus
     34 extern "C" {
     35 #endif
     36 
     37 // This function can be called mid-run (or at the end of a run for
     38 // a server process that doesn't shut down normally) to request that
     39 // data for that point in the run be reported from the tool.
     40 void COMPILER_RT_WEAK __esan_report();
     41 
     42 // This function returns the number of samples that the esan tool has collected
     43 // to this point.  This is useful for testing.
     44 unsigned int COMPILER_RT_WEAK __esan_get_sample_count();
     45 
     46 #ifdef __cplusplus
     47 } // extern "C"
     48 #endif
     49 
     50 #endif // SANITIZER_ESAN_INTERFACE_H
     51