esan_interface.h 1.6 KB

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