summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorNicolai Haehnle <nhaehnle@gmail.com>2018-02-22 15:26:35 +0000
committerNicolai Haehnle <nhaehnle@gmail.com>2018-02-22 15:26:35 +0000
commit6d64915c87ae326f352f1a95011856a2d4acb0d7 (patch)
tree6b6f7c473f59aa8f54a78b04ed15e95803d3c6e1 /llvm/test
parente4a2cf5761fef90c228a2d90c6f1fefa986561c8 (diff)
downloadbcm5719-llvm-6d64915c87ae326f352f1a95011856a2d4acb0d7.tar.gz
bcm5719-llvm-6d64915c87ae326f352f1a95011856a2d4acb0d7.zip
TableGen: Fix type deduction for !foreach
Summary: In the case of !foreach(id, input-list, transform) where the type of input-list is list<A> and the type of transform is B, we now correctly deduce list<B> as the type of the !foreach. Change-Id: Ia19dd65eecc5991dd648280ba6a15f6a20fd61de Reviewers: arsenm, craig.topper, tra, MartinO Subscribers: wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D43555 llvm-svn: 325797
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/TableGen/foreach.td12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/test/TableGen/foreach.td b/llvm/test/TableGen/foreach.td
index 541da49ccde..33b6eb5bfa8 100644
--- a/llvm/test/TableGen/foreach.td
+++ b/llvm/test/TableGen/foreach.td
@@ -7,12 +7,18 @@
// CHECK: "NAME"
// CHECK: Defs
+
+// CHECK: def DX {
+// CHECK: list<string> x = ["0", "1", "2"];
+// CHECK: }
+
// CHECK: Jr
// CHECK: Sr
// Variables for foreach
class decls {
string name;
+ int num;
}
def Decls : decls;
@@ -37,3 +43,9 @@ def Seniors : B<People.values>;
def Juniors : C<People.values>;
def Smiths : D<["NAME", "Jane Smith"]>;
def Unprocessed : D<People.values>;
+
+class X<list<int> a> {
+ list<string> x = !foreach(Decls.num, a, !cast<string>(Decls.num));
+}
+
+def DX : X<[0, 1, 2]>;
OpenPOWER on IntegriCloud