0001
0002 #ifndef PERF_UTIL_CLANG_C_H
0003 #define PERF_UTIL_CLANG_C_H
0004
0005 #include <stddef.h> /* for size_t */
0006
0007 #ifdef __cplusplus
0008 extern "C" {
0009 #endif
0010
0011 #ifdef HAVE_LIBCLANGLLVM_SUPPORT
0012 extern void perf_clang__init(void);
0013 extern void perf_clang__cleanup(void);
0014
0015 struct test_suite;
0016 extern int test__clang_to_IR(struct test_suite *test, int subtest);
0017 extern int test__clang_to_obj(struct test_suite *test, int subtest);
0018
0019 extern int perf_clang__compile_bpf(const char *filename,
0020 void **p_obj_buf,
0021 size_t *p_obj_buf_sz);
0022 #else
0023
0024 #include <errno.h>
0025 #include <linux/compiler.h> /* for __maybe_unused */
0026
0027 static inline void perf_clang__init(void) { }
0028 static inline void perf_clang__cleanup(void) { }
0029
0030 static inline int
0031 perf_clang__compile_bpf(const char *filename __maybe_unused,
0032 void **p_obj_buf __maybe_unused,
0033 size_t *p_obj_buf_sz __maybe_unused)
0034 {
0035 return -ENOTSUP;
0036 }
0037
0038 #endif
0039
0040 #ifdef __cplusplus
0041 }
0042 #endif
0043 #endif