Merge tag 'powerpc-5.11-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[linux/fpc-iii.git] / tools / perf / tests / clang.c
blob2577d3ed153152fe1c53494847e7ac2a184cc2c5
1 // SPDX-License-Identifier: GPL-2.0
2 #include "tests.h"
3 #include "c++/clang-c.h"
4 #include <linux/kernel.h>
6 static struct {
7 int (*func)(void);
8 const char *desc;
9 } clang_testcase_table[] = {
10 #ifdef HAVE_LIBCLANGLLVM_SUPPORT
12 .func = test__clang_to_IR,
13 .desc = "builtin clang compile C source to IR",
16 .func = test__clang_to_obj,
17 .desc = "builtin clang compile C source to ELF object",
19 #endif
22 int test__clang_subtest_get_nr(void)
24 return (int)ARRAY_SIZE(clang_testcase_table);
27 const char *test__clang_subtest_get_desc(int i)
29 if (i < 0 || i >= (int)ARRAY_SIZE(clang_testcase_table))
30 return NULL;
31 return clang_testcase_table[i].desc;
34 #ifndef HAVE_LIBCLANGLLVM_SUPPORT
35 int test__clang(struct test *test __maybe_unused, int i __maybe_unused)
37 return TEST_SKIP;
39 #else
40 int test__clang(struct test *test __maybe_unused, int i)
42 if (i < 0 || i >= (int)ARRAY_SIZE(clang_testcase_table))
43 return TEST_FAIL;
44 return clang_testcase_table[i].func();
46 #endif