Home | History | Annotate | Download | only in TableGen
      1 // RUN: llvm-tblgen %s | FileCheck %s
      2 
      3 // CHECK: class X<list<int> X:a = ?, list<int> X:b = ?, list<int> X:c = ?> {
      4 // CHECK:   list<int> x = !listconcat(!listconcat(X:a, X:b), !listconcat(X:b, X:c));
      5 // CHECK: }
      6 
      7 // CHECK: class Y<list<string> Y:S = ?> {
      8 // CHECK:   list<string> T1 = !listconcat(Y:S, ["foo"]);
      9 // CHECK:   list<string> T2 = !listconcat(Y:S, !listconcat(["foo"], !listconcat(Y:S, ["bar", "baz"])));
     10 // CHECK: }
     11 
     12 // CHECK: def A0 {
     13 // CHECK:   list<int> lst = [4];
     14 // CHECK: }
     15 
     16 // CHECK: def A1 {
     17 // CHECK:   list<int> lst = [];
     18 // CHECK: }
     19 
     20 // CHECK: def DX {
     21 // CHECK:   list<int> x = [0, 1, 1, 2]
     22 // CHECK: }
     23 
     24 // CHECK: def Z {
     25 // CHECK:   list<string> T1 = ["fu", "foo"];
     26 // CHECK:   list<string> T2 = ["fu", "foo", "fu", "bar", "baz"];
     27 // CHECK: }
     28 
     29 class A<bit x> {
     30   // The empty lists type-check without issues.
     31   list<int> lst = !listconcat([], !if(x, [], [4]));
     32 }
     33 
     34 def A0 : A<0>;
     35 def A1 : A<1>;
     36 
     37 class X<list<int> a, list<int> b, list<int> c> {
     38     list<int> x = !listconcat(!listconcat(a, b), !listconcat(b, c));
     39 }
     40 
     41 class Y<list<string> S> {
     42   list<string> T1 = !listconcat(S, ["foo"]);
     43   list<string> T2 = !listconcat(S, ["foo"], S, ["bar", "baz"]);
     44 }
     45 
     46 def DX : X<[0], [1], [2]>;
     47 
     48 def Z : Y<["fu"]>;
     49