1// RUN: llvm-tblgen %s | FileCheck %s 2// XFAIL: vg_leak 3 4// Test !size of lists. 5 6// CHECK: --- Defs --- 7 8// CHECK: def A1 { 9// CHECK: int Val = 0; 10// CHECK: } 11 12// CHECK: def A2 { 13// CHECK: int Val = 3; 14// CHECK: } 15 16// CHECK: def B1 { 17// CHECK: int Val = 0; 18// CHECK: } 19 20// CHECK: def B2 { 21// CHECK: int Val = 2; 22// CHECK: } 23 24class A<list<int> L> { 25 int Val = !size(L); 26} 27 28class B<list<string> L> { 29 int Val = !size(L); 30} 31 32def A1 : A<[]>; 33def A2 : A<[1, 1, 2]>; 34 35def B1 : B<[]>; 36def B2 : B<["a", "b"]>; 37 38// Test !size of DAGs. 39 40// CHECK: def D0 { 41// CHECK: int Val = 0; 42// CHECK: } 43 44// CHECK: def D1 { 45// CHECK: int Val = 1; 46// CHECK: } 47 48// CHECK: def D2 { 49// CHECK: int Val = 2; 50// CHECK: } 51 52// CHECK: def D3 { 53// CHECK: int Val = 3; 54// CHECK: } 55 56// CHECK: def D4 { 57// CHECK: int Val = 4; 58// CHECK: } 59 60class D<dag D> { 61 int Val = !size(D); 62} 63 64def op; 65 66def D0 : D<(op)>; 67def D1 : D<(op "string")>; 68def D2 : D<(op "string", 42)>; 69def D3 : D<(op "string", 42, (op "sub-dag"))>; 70def D4 : D<(op "string", 42, (op "sub-dag"), D0.Val)>; 71 72// Test !size of strings. 73 74// CHECK: def S0 { 75// CHECK: int Val = 0; 76// CHECK: } 77 78// CHECK: def S1 { 79// CHECK: int Val = 1; 80// CHECK: } 81 82// CHECK: def S2 { 83// CHECK: int Val = 2; 84// CHECK: } 85 86// CHECK: def S3 { 87// CHECK: int Val = 3; 88// CHECK: } 89 90// CHECK: def S4 { 91// CHECK: int Val = 29; 92// CHECK: } 93 94class S<string S> { 95 int Val = !size(S); 96} 97 98def S0 : S<"">; 99def S1 : S<"a">; 100def S2 : S<"ab">; 101def S3 : S<"abc">; 102def S4 : S<"This is the end of the world!">; 103 104