Staging
v0.8.1
swh:1:snp:a902887e4be9191b7c6c4406aa06b31c1ce2c7cc
Raw File
Tip revision: ef954844c7ace62f773f4f23e28d2d915adc419f authored by Linus Torvalds on 13 August 2017, 23:01:32 UTC
Linux 4.13-rc5
Tip revision: ef95484
clang.c
#include "tests.h"
#include "debug.h"
#include "util.h"
#include "c++/clang-c.h"
#include <linux/kernel.h>

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",
	},
	{
		.func = test__clang_to_obj,
		.desc = "builtin clang compile C source to ELF object",
	},
#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
int test__clang(int i)
{
	if (i < 0 || i >= (int)ARRAY_SIZE(clang_testcase_table))
		return TEST_FAIL;
	return clang_testcase_table[i].func();
}
#endif
back to top