clang-c.h 975 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef PERF_UTIL_CLANG_C_H
  3. #define PERF_UTIL_CLANG_C_H
  4. #include <stddef.h> /* for size_t */
  5. #include <util-cxx.h> /* for __maybe_unused */
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. #ifdef HAVE_LIBCLANGLLVM_SUPPORT
  10. extern void perf_clang__init(void);
  11. extern void perf_clang__cleanup(void);
  12. extern int test__clang_to_IR(void);
  13. extern int test__clang_to_obj(void);
  14. extern int perf_clang__compile_bpf(const char *filename,
  15. void **p_obj_buf,
  16. size_t *p_obj_buf_sz);
  17. #else
  18. #include <errno.h>
  19. static inline void perf_clang__init(void) { }
  20. static inline void perf_clang__cleanup(void) { }
  21. static inline int test__clang_to_IR(void) { return -1; }
  22. static inline int test__clang_to_obj(void) { return -1;}
  23. static inline int
  24. perf_clang__compile_bpf(const char *filename __maybe_unused,
  25. void **p_obj_buf __maybe_unused,
  26. size_t *p_obj_buf_sz __maybe_unused)
  27. {
  28. return -ENOTSUP;
  29. }
  30. #endif
  31. #ifdef __cplusplus
  32. }
  33. #endif
  34. #endif