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
52 lines
1.0 KiB
TableGen
52 lines
1.0 KiB
TableGen
// RUN: llvm-tblgen %s | FileCheck %s
|
|
// XFAIL: vg_leak
|
|
|
|
// CHECK: Classes
|
|
// CHECK: Sr
|
|
// CHECK: Jr
|
|
// 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;
|
|
|
|
class A<list<string> names> {
|
|
list<string> Names = names;
|
|
}
|
|
|
|
class B<list<string> names> : A<!foreach(Decls.name, names, !strconcat(Decls.name, ", Sr."))>;
|
|
|
|
class C<list<string> names> : A<!foreach(Decls.name, names, !strconcat(Decls.name, ", Jr."))>;
|
|
|
|
class D<list<string> names> : A<!foreach(Decls.name, names, !subst("NAME", "John Smith", Decls.name))>;
|
|
|
|
class Names {
|
|
list<string> values = ["Ken Griffey", "Seymour Cray"];
|
|
}
|
|
|
|
def People : Names;
|
|
|
|
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]>;
|