1 // Test for the OptionPreprocessor and any*.
2 // RUN: tblgen -I %p/../../include --gen-llvmc %s -o %t
3 // RUN: FileCheck -input-file %t %s
4 // RUN: %compile_cxx -fexceptions -x c++ %t
6 include "llvm/CompilerDriver/Common.td"
8 def OptList : OptionList<[
9 (switch_option "foo", (help "dummy")),
10 (switch_option "bar", (help "dummy")),
11 (switch_option "baz", (help "dummy")),
12 (parameter_option "foo_p", (help "dummy")),
13 (parameter_option "bar_p", (help "dummy")),
14 (parameter_option "baz_p", (help "dummy")),
15 (parameter_list_option "foo_l", (help "dummy"))
18 def Preprocess : OptionPreprocessor<
21 // CHECK: foo = false;
23 // CHECK: foo_l.clear();
24 (and (switch_on "foo"), (any_switch_on ["bar", "baz"])),
25 [(warning "W1"), (unset_option "foo"),
26 (unset_option "foo_p"), (unset_option "foo_l")],
29 // CHECK: foo_p = "asdf";
30 (and (switch_on ["foo", "bar"]), (any_empty ["foo_p", "bar_p"])),
31 [(warning "W2"), (set_option "foo"), (set_option "foo_p", "asdf")],
36 (and (empty ["foo_p", "bar_p"]), (any_not_empty ["baz_p"])),
37 [(warning "W3"), (set_option ["foo", "bar", "baz"])])
40 // Shut up warnings...
42 [(in_language "dummy"),
43 (out_language "dummy"),
45 (cmd_line "dummy $INFILE -o $OUTFILE"),
46 (actions (case (switch_on "foo"), (error),
47 (switch_on "bar"), (error),
48 (switch_on "baz"), (error),
49 (not_empty "foo_p"), (error),
50 (not_empty "bar_p"), (error),
51 (not_empty "baz_p"), (error),
52 (not_empty "foo_l"), (error)))
55 def Graph : CompilationGraph<[Edge<"root", "dummy">]>;