• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: tblgen %s | grep {Smith} | count 7
2// RUN: tblgen %s | grep {Johnson} | count 2
3// RUN: tblgen %s | grep {FIRST} | count 1
4// RUN: tblgen %s | grep {LAST} | count 1
5// RUN: tblgen %s | grep {TVAR} | count 2
6// RUN: tblgen %s | grep {Bogus} | count 1
7// XFAIL: vg_leak
8
9class Honorific<string t> {
10  string honorific = t;
11}
12
13def Mr : Honorific<"Mr.">;
14def Ms : Honorific<"Ms.">;
15def Mrs : Honorific<"Mrs.">;
16def TVAR : Honorific<"Bogus">;
17
18class Name<string n, Honorific t> {
19  string name = n;
20  Honorific honorific = t;
21}
22
23class AName<string name, Honorific honorific> :
24  Name<!subst("FIRST", "John", !subst("LAST", "Smith", name)),
25       !subst(TVAR, Mr, honorific)>;
26
27def JohnSmith : AName<"FIRST LAST", TVAR>;
28def JaneSmith : AName<"Jane LAST", Ms>;
29def JohnSmithJones : AName<"FIRST LAST-Jones", Mr>;
30def JimmyJohnson : AName<"Jimmy Johnson", Mr>;
31