summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2009-05-14 23:26:46 +0000
committerDavid Greene <greened@obbligato.org>2009-05-14 23:26:46 +0000
commit9bea7c85d71bbb192f686a56e9b5bf32ae3389e6 (patch)
treedbd9719b6373f1e119b294f122b6c4dac0ab5d0d /test
parent11adeed8b3032fddacb9f678dd122c142a8d08f1 (diff)
downloadllvm-9bea7c85d71bbb192f686a56e9b5bf32ae3389e6.tar.gz
llvm-9bea7c85d71bbb192f686a56e9b5bf32ae3389e6.tar.bz2
llvm-9bea7c85d71bbb192f686a56e9b5bf32ae3389e6.tar.xz
Implement !if, analogous to $(if) in GNU make.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71815 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/TableGen/if.td20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/TableGen/if.td b/test/TableGen/if.td
new file mode 100644
index 0000000000..3c45d95eb2
--- /dev/null
+++ b/test/TableGen/if.td
@@ -0,0 +1,20 @@
+// RUN: tblgen %s | grep {1, 2, 3} | count 4
+// RUN: tblgen %s | grep {4, 5, 6} | count 2
+
+class A<list<list<int>> vals> {
+ list<int> first = vals[0];
+ list<int> rest = !if(!null(!cdr(vals)), vals[0], vals[1]);
+}
+
+def One : A<[[1,2,3]]>;
+def Two : A<[[1,2,3],[4,5,6]]>;
+
+class B<list<int> v> {
+ list<int> vals = v;
+}
+
+class BB<list<list<int>> vals> : B<!if(!null(!cdr(vals)), vals[0], vals[1])>;
+class BBB<list<list<int>> vals> : BB<vals>;
+
+def OneB : BBB<[[1,2,3]]>;
+def TwoB : BBB<[[1,2,3],[4,5,6]]>;