Nicolai Haehnle | f3b54ef | 2018-03-05 14:01:38 +0000 | [diff] [blame] | 1 | // RUN: not llvm-tblgen %s 2>&1 | FileCheck %s |
| 2 | // XFAIL: vg_leak |
| 3 | |
| 4 | // This test verifies that tablegen does fail if it can't resolve an unresolved |
| 5 | // !cast() during processing top-level defm. |
| 6 | |
| 7 | class A {} |
| 8 | class B<A a> { |
| 9 | A ba = a; |
| 10 | } |
| 11 | |
| 12 | multiclass M0<string s> { |
| 13 | // This should work fine. |
| 14 | def _m00 : B<!cast<A>(s)>; |
Nicolai Haehnle | ce04a4a | 2018-03-19 14:13:37 +0000 | [diff] [blame] | 15 | // CHECK: error: Undefined reference to record: 'd1_r1_no_such_record' |
Nicolai Haehnle | f3b54ef | 2018-03-05 14:01:38 +0000 | [diff] [blame] | 16 | def _m01: B<!cast<A>(s#"_no_such_record")>; |
| 17 | } |
| 18 | |
| 19 | multiclass M1<string s> { |
| 20 | def _r1 : A; |
| 21 | // It would be nice if we could refer to _r1's name without having to pass it |
| 22 | // explicitly via 's'. |
| 23 | // XCHECK-DAG: note: instantiated from multiclass |
| 24 | defm _m1: M0<s # "_r1">; |
| 25 | } |
| 26 | |
Nicolai Haehnle | 02dea26 | 2018-03-21 17:12:53 +0000 | [diff] [blame] | 27 | // CHECK: def _m01: B |
Nicolai Haehnle | f3b54ef | 2018-03-05 14:01:38 +0000 | [diff] [blame] | 28 | // CHECK: note: instantiated from multiclass |
| 29 | // CHECK: defm _m1: M0 |
| 30 | // CHECK: note: instantiated from multiclass |
Nicolai Haehnle | 02dea26 | 2018-03-21 17:12:53 +0000 | [diff] [blame] | 31 | // CHECK: defm d1: M1 |
Nicolai Haehnle | f3b54ef | 2018-03-05 14:01:38 +0000 | [diff] [blame] | 32 | defm d1: M1<"d1">; |