• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: llvm-tblgen %s | FileCheck %s
2// XFAIL: vg_leak
3
4class Honorific<string t> {
5  string honorific = t;
6}
7
8def Mr : Honorific<"Mr.">;
9def Ms : Honorific<"Ms.">;
10def Mrs : Honorific<"Mrs.">;
11def TVAR : Honorific<"Bogus">;
12
13class Name<string n, Honorific t> {
14  string name = n;
15  Honorific honorific = t;
16}
17
18class AName<string name, Honorific honorific> :
19  Name<!subst("FIRST", "John", !subst("LAST", "Smith", name)),
20       !subst(TVAR, Mr, honorific)>;
21
22def JohnSmith : AName<"FIRST LAST", TVAR>;
23def JaneSmith : AName<"Jane LAST", Ms>;
24def JohnSmithJones : AName<"FIRST LAST-Jones", Mr>;
25def JimmyJohnson : AName<"Jimmy Johnson", Mr>;
26
27// CHECK:      ------------- Classes -----------------
28// CHECK-NEXT: class AName<string AName:name = ?, Honorific AName:honorific = ?> {
29// CHECK-NEXT:   string name = !subst("FIRST", "John", !subst("LAST", "Smith", AName:name));
30// CHECK-NEXT:   Honorific honorific = !subst(TVAR, Mr, AName:honorific);
31// CHECK-NEXT:   string NAME = ?;
32// CHECK-NEXT: }
33// CHECK-NEXT: class Honorific<string Honorific:t = ?> {
34// CHECK-NEXT:   string honorific = Honorific:t;
35// CHECK-NEXT:   string NAME = ?;
36// CHECK-NEXT: }
37// CHECK-NEXT: class Name<string Name:n = ?, Honorific Name:t = ?> {
38// CHECK-NEXT:   string name = Name:n;
39// CHECK-NEXT:   Honorific honorific = Name:t;
40// CHECK-NEXT:   string NAME = ?;
41// CHECK-NEXT: }
42// CHECK-NEXT: ------------- Defs -----------------
43// CHECK-NEXT: def JaneSmith {
44// CHECK-NEXT:   string name = "Jane Smith";
45// CHECK-NEXT:   Honorific honorific = Ms;
46// CHECK-NEXT:   string NAME = ?;
47// CHECK-NEXT: }
48// CHECK-NEXT: def JimmyJohnson {
49// CHECK-NEXT:   string name = "Jimmy Johnson";
50// CHECK-NEXT:   Honorific honorific = Mr;
51// CHECK-NEXT:   string NAME = ?;
52// CHECK-NEXT: }
53// CHECK-NEXT: def JohnSmith {
54// CHECK-NEXT:   string name = "John Smith";
55// CHECK-NEXT:   Honorific honorific = Mr;
56// CHECK-NEXT:   string NAME = ?;
57// CHECK-NEXT: }
58// CHECK-NEXT: def JohnSmithJones {
59// CHECK-NEXT:   string name = "John Smith-Jones";
60// CHECK-NEXT:   Honorific honorific = Mr;
61// CHECK-NEXT:   string NAME = ?;
62// CHECK-NEXT: }
63// CHECK-NEXT: def Mr
64// CHECK-NEXT:   string honorific = "Mr.";
65// CHECK-NEXT:   string NAME = ?;
66// CHECK-NEXT: }
67// CHECK-NEXT: def Mrs {
68// CHECK-NEXT:   string honorific = "Mrs.";
69// CHECK-NEXT:   string NAME = ?;
70// CHECK-NEXT: }
71// CHECK-NEXT: def Ms {
72// CHECK-NEXT:   string honorific = "Ms.";
73// CHECK-NEXT:   string NAME = ?;
74// CHECK-NEXT: }
75// CHECK-NEXT: def TVAR {
76// CHECK-NEXT:   string honorific = "Bogus";
77// CHECK-NEXT:   string NAME = ?;
78// CHECK-NEXT: }
79