1// RUN: llvm-tblgen %s | FileCheck %s 2// XFAIL: vg_leak 3 4// CHECK: WorldHelloCC 5// CHECK-NOT: WorldHelloCC 6 7class C<string n> { 8 string name = n; 9} 10 11multiclass Names<string n, string m> { 12 def CC : C<n>; 13 def World#NAME#CC : C<m>; 14} 15 16defm Hello : Names<"hello", "world">; 17 18// Ensure that the same anonymous name is used as the prefix for all defs in an 19// anonymous multiclass. 20 21class Outer<C i> { 22 C Inner = i; 23} 24 25multiclass MC<string name> { 26 def hi : C<name>; 27 def there : Outer<!cast<C>(!strconcat(NAME, "hi"))>; 28} 29 30defm : MC<"foo">; 31 32multiclass MC2<string name> { 33 def there : Outer<C<name> >; 34} 35 36// Ensure that we've correctly captured the reference to name from the implicit 37// anonymous C def in the template parameter list of Outer. 38// CHECK-NOT: MC2::name 39 40defm : MC2<"bar">; 41 42multiclass MC3<string s> { 43 def ZFizz#s : C<s>; 44} 45 46defm "" : MC3<"Buzz">; 47 48// CHECK: def ZFizzBuzz 49// CHECK: string name = "Buzz"; 50// CHECK-NOT: MC3::s 51 52multiclass MC4<string s> { 53 def NAME#s : C<s>; 54} 55 56defm ZTagazok : MC4<"AToi">; 57 58// CHECK: def ZTagazokAToi 59// CHECK: string name = "AToi"; 60// CHECK-NOT: MC4::s 61 62multiclass MC5<C c> { 63 def NAME#c.name : C<c.name>; 64} 65 66def CTiger : C<"Tiger">; 67defm Zebra : MC5<CTiger>; 68 69// CHECK: def ZebraTiger 70// CHECK: string name = "Tiger"; 71// CHECK-NOT: MC5::c 72 73multiclass MC6<C c> { 74 def NAME#Tiger#c.name : C<c.name>; 75} 76 77def CAligator : C<"Aligator">; 78defm Zebra : MC6<CAligator>; 79 80// CHECK: def ZebraTigerAligator 81// CHECK: string name = "Aligator"; 82// CHECK-NOT: MC6::c 83 84