Does llvm-lit support type substitution (macro)?

Hello all,

I am writing test cases which are dedicated to be executed by llvm-lit. Most of my test cases have the same logic but different types. For example:

// RUN: %clang_cc1 -fsyntax-only
func (int a) {
a = 3;
}

// RUN: %clang_cc1 -fsyntax-only
func (char a) {
a = 3;
}

// RUN: %clang_cc1 -fsyntax-only
func (unsigned a) {
a = 3;
}

Now I put them in three different test cases but it is hard to maintain. I am wondering whether llvm-lit support writing test cases with macro parameter and a parameter config file:

// RUN: %clang_cc1 -fsyntax-only
func (TYPE a) {
a = 3;
}

// TYPE config
TYPE = {int, char, unsigned}

Many thanks

Nope, lit doesn’t have anything like that.

Best to keep the tests simple, sometimes to the point of being repetitious.

Do you actually have different codepaths to test for each type?

Can’t you just use C macros?

You can use the C preprocessor:

// RUN: %clang_cc1 -DTYPE=char %s -fsyntax-only