1 // RUN: llvm-tblgen %s | FileCheck %s
9 multiclass M0<string s> {
10 def _m0 : B<!cast<A>(s)>;
12 // Uncomment to test that !cast will eventually fail if the record it refers
13 // to does not exist by the time we instantiate this record from the top
15 //def _m1 : B<!cast<A>(s#"X")>;
18 multiclass M1<string s> {
20 // It would be nice if we could refer to _r1's name without having to pass it
21 // explicitly via 's'.
22 defm _m1: M0<s # "_r1">;
30 def _y : B<!cast<A>(NAME # "_x")>;
32 // This used to throw an error during multiclass parsing as NAME was not
33 // recognized when parsing the template arguments.
37 // CHECK-LABEL: def d0_m1_m0
38 // CHECK: A ba = d0_r1;
40 // CHECK-LABEL: def d0_x {
41 // CHECK: string n = "d0";
43 // CHECK-LABEL: def d0_y {
44 // CHECK: A ba = d0_x;
46 // This always works, because d1_r1 is instantiated before d1_m1 which would
47 // attempt to !cast to it.
49 // CHECK-LABEL: def d1_m1_m0
50 // CHECK: A ba = d1_r1;