1 // RUN: llvm-tblgen %s | FileCheck %s
4 class Honorific<string t> {
8 def Mr : Honorific<"Mr.">;
9 def Ms : Honorific<"Ms.">;
10 def Mrs : Honorific<"Mrs.">;
11 def TVAR : Honorific<"Bogus">;
13 class Name<string n, Honorific t> {
15 Honorific honorific = t;
18 class AName<string name, Honorific honorific> :
19 Name<!subst("FIRST", "John", !subst("LAST", "Smith", name)),
20 !subst(TVAR, Mr, honorific)>;
22 def JohnSmith : AName<"FIRST LAST", TVAR>;
23 def JaneSmith : AName<"Jane LAST", Ms>;
24 def JohnSmithJones : AName<"FIRST LAST-Jones", Mr>;
25 def JimmyJohnson : AName<"Jimmy Johnson", Mr>;
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);
32 // CHECK-NEXT: class Honorific<string Honorific:t = ?> {
33 // CHECK-NEXT: string honorific = Honorific:t;
35 // CHECK-NEXT: class Name<string Name:n = ?, Honorific Name:t = ?> {
36 // CHECK-NEXT: string name = Name:n;
37 // CHECK-NEXT: Honorific honorific = Name:t;
39 // CHECK-NEXT: ------------- Defs -----------------
40 // CHECK-NEXT: def JaneSmith {
41 // CHECK-NEXT: string name = "Jane Smith";
42 // CHECK-NEXT: Honorific honorific = Ms;
44 // CHECK-NEXT: def JimmyJohnson {
45 // CHECK-NEXT: string name = "Jimmy Johnson";
46 // CHECK-NEXT: Honorific honorific = Mr;
48 // CHECK-NEXT: def JohnSmith {
49 // CHECK-NEXT: string name = "John Smith";
50 // CHECK-NEXT: Honorific honorific = Mr;
52 // CHECK-NEXT: def JohnSmithJones {
53 // CHECK-NEXT: string name = "John Smith-Jones";
54 // CHECK-NEXT: Honorific honorific = Mr;
57 // CHECK-NEXT: string honorific = "Mr.";
59 // CHECK-NEXT: def Mrs {
60 // CHECK-NEXT: string honorific = "Mrs.";
62 // CHECK-NEXT: def Ms {
63 // CHECK-NEXT: string honorific = "Ms.";
65 // CHECK-NEXT: def TVAR {
66 // CHECK-NEXT: string honorific = "Bogus";