1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-01 00:12:50 +01:00
llvm-mirror/test/LLVMC/OptionPreprocessor.td
Mikhail Glushenkov 93c8d86be9 Validate the generated C++ code in llvmc tests.
Checks that the code generated by 'tblgen --emit-llvmc' can be actually
compiled. Also fixes two bugs found in this way:

- forward_transformed_value didn't work with non-list arguments
- cl::ZeroOrOne is now called cl::Optional

llvm-svn: 91404
2009-12-15 03:04:52 +00:00

44 lines
1.3 KiB
TableGen

// Test for the OptionPreprocessor and any*.
// RUN: ignore tblgen -I %p/../../include --gen-llvmc %s -o %t
// RUN: grep W1 %t
// RUN: grep W2 %t
// RUN: grep W3 %t
// RUN: %compile_cxx -fexceptions -x c++ %t
include "llvm/CompilerDriver/Common.td"
def OptList : OptionList<[
(switch_option "foo", (help "dummy")),
(switch_option "bar", (help "dummy")),
(switch_option "baz", (help "dummy")),
(parameter_option "foo_p", (help "dummy")),
(parameter_option "bar_p", (help "dummy")),
(parameter_option "baz_p", (help "dummy"))
]>;
def Preprocess : OptionPreprocessor<
(case (and (switch_on "foo"), (any_switch_on ["bar", "baz"])),
(warning "W1"),
(and (switch_on ["foo", "bar"]), (any_empty ["foo_p", "bar_p"])),
(warning "W2"),
(and (empty ["foo_p", "bar_p"]), (any_not_empty ["baz_p"])),
(warning "W3"))
>;
// Shut up warnings...
def dummy : Tool<
[(in_language "dummy"),
(out_language "dummy"),
(output_suffix "d"),
(cmd_line "dummy $INFILE -o $OUTFILE"),
(actions (case (switch_on "foo"), (error),
(switch_on "bar"), (error),
(switch_on "baz"), (error),
(not_empty "foo_p"), (error),
(not_empty "bar_p"), (error),
(not_empty "baz_p"), (error)))
]>;
def Graph : CompilationGraph<[Edge<"root", "dummy">]>;