• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
7class A {}
8class B<A a> {
9  A ba = a;
10}
11
12multiclass M0<string s> {
13  // This should work fine.
14  def _m00 : B<!cast<A>(s)>;
15  // CHECK: error: Undefined reference to record: 'd1_r1_no_such_record'
16  def _m01: B<!cast<A>(s#"_no_such_record")>;
17}
18
19multiclass 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
27// CHECK: def _m01: B
28// CHECK: note: instantiated from multiclass
29// CHECK: defm _m1: M0
30// CHECK: note: instantiated from multiclass
31// CHECK: defm d1: M1
32defm d1: M1<"d1">;
33