2016-11-26 14:03:34 +07:00
|
|
|
#include "tests.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "c++/clang-c.h"
|
2017-04-17 21:39:06 +07:00
|
|
|
#include <linux/kernel.h>
|
2016-11-26 14:03:34 +07:00
|
|
|
|
|
|
|
static struct {
|
|
|
|
int (*func)(void);
|
|
|
|
const char *desc;
|
|
|
|
} clang_testcase_table[] = {
|
|
|
|
#ifdef HAVE_LIBCLANGLLVM_SUPPORT
|
|
|
|
{
|
|
|
|
.func = test__clang_to_IR,
|
|
|
|
.desc = "builtin clang compile C source to IR",
|
|
|
|
},
|
2016-11-26 14:03:38 +07:00
|
|
|
{
|
|
|
|
.func = test__clang_to_obj,
|
|
|
|
.desc = "builtin clang compile C source to ELF object",
|
|
|
|
},
|
2016-11-26 14:03:34 +07:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
int test__clang_subtest_get_nr(void)
|
|
|
|
{
|
|
|
|
return (int)ARRAY_SIZE(clang_testcase_table);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *test__clang_subtest_get_desc(int i)
|
|
|
|
{
|
|
|
|
if (i < 0 || i >= (int)ARRAY_SIZE(clang_testcase_table))
|
|
|
|
return NULL;
|
|
|
|
return clang_testcase_table[i].desc;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef HAVE_LIBCLANGLLVM_SUPPORT
|
|
|
|
int test__clang(int i __maybe_unused)
|
|
|
|
{
|
|
|
|
return TEST_SKIP;
|
|
|
|
}
|
|
|
|
#else
|
2016-11-26 14:03:38 +07:00
|
|
|
int test__clang(int i)
|
2016-11-26 14:03:34 +07:00
|
|
|
{
|
|
|
|
if (i < 0 || i >= (int)ARRAY_SIZE(clang_testcase_table))
|
|
|
|
return TEST_FAIL;
|
|
|
|
return clang_testcase_table[i].func();
|
|
|
|
}
|
|
|
|
#endif
|