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