18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef PERF_UTIL_CLANG_C_H
38c2ecf20Sopenharmony_ci#define PERF_UTIL_CLANG_C_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <stddef.h>	/* for size_t */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifdef __cplusplus
88c2ecf20Sopenharmony_ciextern "C" {
98c2ecf20Sopenharmony_ci#endif
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifdef HAVE_LIBCLANGLLVM_SUPPORT
128c2ecf20Sopenharmony_ciextern void perf_clang__init(void);
138c2ecf20Sopenharmony_ciextern void perf_clang__cleanup(void);
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciextern int test__clang_to_IR(void);
168c2ecf20Sopenharmony_ciextern int test__clang_to_obj(void);
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ciextern int perf_clang__compile_bpf(const char *filename,
198c2ecf20Sopenharmony_ci				   void **p_obj_buf,
208c2ecf20Sopenharmony_ci				   size_t *p_obj_buf_sz);
218c2ecf20Sopenharmony_ci#else
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#include <errno.h>
248c2ecf20Sopenharmony_ci#include <linux/compiler.h>	/* for __maybe_unused */
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_cistatic inline void perf_clang__init(void) { }
278c2ecf20Sopenharmony_cistatic inline void perf_clang__cleanup(void) { }
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cistatic inline int test__clang_to_IR(void) { return -1; }
308c2ecf20Sopenharmony_cistatic inline int test__clang_to_obj(void) { return -1;}
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_cistatic inline int
338c2ecf20Sopenharmony_ciperf_clang__compile_bpf(const char *filename __maybe_unused,
348c2ecf20Sopenharmony_ci			void **p_obj_buf __maybe_unused,
358c2ecf20Sopenharmony_ci			size_t *p_obj_buf_sz __maybe_unused)
368c2ecf20Sopenharmony_ci{
378c2ecf20Sopenharmony_ci	return -ENOTSUP;
388c2ecf20Sopenharmony_ci}
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#endif
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#ifdef __cplusplus
438c2ecf20Sopenharmony_ci}
448c2ecf20Sopenharmony_ci#endif
458c2ecf20Sopenharmony_ci#endif
46