Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
00b86691 WN |
2 | #ifndef PERF_UTIL_CLANG_C_H |
3 | #define PERF_UTIL_CLANG_C_H | |
4 | ||
edd695b0 WN |
5 | #include <stddef.h> /* for size_t */ |
6 | #include <util-cxx.h> /* for __maybe_unused */ | |
7 | ||
00b86691 WN |
8 | #ifdef __cplusplus |
9 | extern "C" { | |
10 | #endif | |
11 | ||
edd695b0 | 12 | #ifdef HAVE_LIBCLANGLLVM_SUPPORT |
00b86691 WN |
13 | extern void perf_clang__init(void); |
14 | extern void perf_clang__cleanup(void); | |
15 | ||
16 | extern int test__clang_to_IR(void); | |
5e08a765 | 17 | extern int test__clang_to_obj(void); |
00b86691 | 18 | |
edd695b0 WN |
19 | extern int perf_clang__compile_bpf(const char *filename, |
20 | void **p_obj_buf, | |
21 | size_t *p_obj_buf_sz); | |
22 | #else | |
23 | ||
a43783ae | 24 | #include <errno.h> |
edd695b0 WN |
25 | |
26 | static inline void perf_clang__init(void) { } | |
27 | static inline void perf_clang__cleanup(void) { } | |
28 | ||
29 | static inline int test__clang_to_IR(void) { return -1; } | |
30 | static inline int test__clang_to_obj(void) { return -1;} | |
31 | ||
32 | static inline int | |
33 | perf_clang__compile_bpf(const char *filename __maybe_unused, | |
34 | void **p_obj_buf __maybe_unused, | |
35 | size_t *p_obj_buf_sz __maybe_unused) | |
36 | { | |
37 | return -ENOTSUP; | |
38 | } | |
39 | ||
40 | #endif | |
41 | ||
00b86691 WN |
42 | #ifdef __cplusplus |
43 | } | |
44 | #endif | |
45 | #endif |