mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
46f55527d8
as the operator of the dag. Specifically, this allows parsing things like (F.x 4) in addition to just (a 4). Unfortunately, this runs afoul of an idiom being used by llvmc. It is using dags like (foo [1,2,3]) to represent a list of stuff being passed into foo. With this change, this is parsed as a [1,2,3] subscript on foo instead of being the first argument to the dag. Cope with this in the short term by requiring a "-llvmc-temp-hack" argument to tblgen to get the old parsing behavior. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115742 91177308-0d34-0410-b5e6-96231b3b80d8
68 lines
2.3 KiB
TableGen
68 lines
2.3 KiB
TableGen
// Test for the OptionPreprocessor and related functionality.
|
|
// RUN: tblgen -I %p/../../include -llvmc-temp-hack --gen-llvmc %s -o %t
|
|
// RUN: FileCheck -input-file %t %s
|
|
// RUN: %compile_cxx %t
|
|
// XFAIL: vg_leak
|
|
|
|
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")),
|
|
(parameter_list_option "foo_l", (help "dummy"))
|
|
]>;
|
|
|
|
def Preprocess : OptionPreprocessor<
|
|
(case
|
|
// CHECK: W1
|
|
// CHECK: foo = false;
|
|
// CHECK: foo_p = "";
|
|
// CHECK: foo_l.clear();
|
|
(and (switch_on "foo"), (any_switch_on ["bar", "baz"])),
|
|
[(warning "W1"), (unset_option "foo"),
|
|
(unset_option "foo_p"), (unset_option "foo_l")],
|
|
// CHECK: W2
|
|
// CHECK: foo = true;
|
|
// CHECK: bar = true;
|
|
// CHECK: baz = false;
|
|
// CHECK: foo_p = "asdf";
|
|
// CHECK: foo_l.clear();
|
|
// CHECK: foo_l.push_back("qwert");
|
|
// CHECK: foo_l.push_back("yuiop");
|
|
// CHECK: foo_l.push_back("asdf");
|
|
(and (switch_on ["foo", "bar"]), (any_empty ["foo_p", "bar_p"])),
|
|
[(warning "W2"), (set_option "foo"),
|
|
(set_option "bar", true),
|
|
(set_option "baz", false),
|
|
(set_option "foo_p", "asdf"),
|
|
(set_option "foo_l", ["qwert", "yuiop", "asdf"])],
|
|
// CHECK: W3
|
|
// CHECK: foo = true;
|
|
// CHECK: bar = true;
|
|
// CHECK: baz = true;
|
|
(and (empty ["foo_p", "bar_p"]), (any_not_empty ["baz_p"])),
|
|
[(warning "W3"), (set_option ["foo", "bar", "baz"])])
|
|
>;
|
|
|
|
// Shut up warnings...
|
|
def dummy : Tool<
|
|
[(in_language "dummy"),
|
|
(out_language "dummy"),
|
|
(output_suffix "d"),
|
|
(command "dummy"),
|
|
(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),
|
|
(not_empty "foo_l"), (error)))
|
|
]>;
|
|
|
|
def Graph : CompilationGraph<[(edge "root", "dummy")]>;
|
|
|