merge two tests.
[oota-llvm.git] / test / LLVMC / OptionPreprocessor.td
1 // Test for the OptionPreprocessor and any*.
2 // RUN: ignore tblgen -I %p/../../include --gen-llvmc %s -o %t
3 // RUN: grep W1 %t
4 // RUN: grep W2 %t
5 // RUN: grep W3 %t
6
7 include "llvm/CompilerDriver/Common.td"
8
9 def OptList : OptionList<[
10 (switch_option "foo", (help "dummy")),
11 (switch_option "bar", (help "dummy")),
12 (switch_option "baz", (help "dummy")),
13 (parameter_option "foo_p", (help "dummy")),
14 (parameter_option "bar_p", (help "dummy")),
15 (parameter_option "baz_p", (help "dummy"))
16 ]>;
17
18 def Preprocess : OptionPreprocessor<
19 (case (and (switch_on "foo"), (any_switch_on ["bar", "baz"])),
20            (warning "W1"),
21       (and (switch_on ["foo", "bar"]), (any_empty ["foo_p", "bar_p"])),
22            (warning "W2"),
23       (and (empty ["foo_p", "bar_p"]), (any_not_empty ["baz_p"])),
24            (warning "W3"))
25 >;
26
27 // Shut up warnings...
28 def dummy : Tool<
29 [(in_language "dummy"),
30  (out_language "dummy"),
31  (output_suffix "d"),
32  (cmd_line "dummy $INFILE -o $OUTFILE"),
33  (actions (case (switch_on "foo"), (error),
34                 (switch_on "bar"), (error),
35                 (switch_on "baz"), (error),
36                 (not_empty "foo_p"), (error),
37                 (not_empty "bar_p"), (error),
38                 (not_empty "baz_p"), (error)))
39 ]>;
40
41 def Graph : CompilationGraph<[Edge<"root", "dummy">]>;
42