summaryrefslogtreecommitdiffstats
path: root/llvm/test/LLVMC/OptionPreprocessor.td
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2009-10-25 01:43:50 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2009-10-25 01:43:50 +0000
commit9b291a08623318f0fc973384e4b961230d730073 (patch)
tree94816e8a5b96fd9cc6ab055f8bb34bc8a3797c5e /llvm/test/LLVMC/OptionPreprocessor.td
parent768251875cfce53411460ea7c40fa567a4a474f1 (diff)
downloadbcm5719-llvm-9b291a08623318f0fc973384e4b961230d730073.tar.gz
bcm5719-llvm-9b291a08623318f0fc973384e4b961230d730073.zip
Add a test for OptionPreprocessor.
llvm-svn: 85029
Diffstat (limited to 'llvm/test/LLVMC/OptionPreprocessor.td')
-rw-r--r--llvm/test/LLVMC/OptionPreprocessor.td42
1 files changed, 42 insertions, 0 deletions
diff --git a/llvm/test/LLVMC/OptionPreprocessor.td b/llvm/test/LLVMC/OptionPreprocessor.td
new file mode 100644
index 00000000000..5b9f4357fea
--- /dev/null
+++ b/llvm/test/LLVMC/OptionPreprocessor.td
@@ -0,0 +1,42 @@
+// 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
+
+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">]>;
+
OpenPOWER on IntegriCloud