Bump version to 19.1.0-rc3
[llvm-project.git] / llvm / test / TableGen / subst.td
blob657ecda3dd9c49e5ac8cd91b0f00922fb655b866
1 // RUN: llvm-tblgen %s | FileCheck %s
2 // XFAIL: vg_leak
4 class Honorific<string t> {
5   string honorific = 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> {
14   string name = n;
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);
31 // CHECK-NEXT: }
32 // CHECK-NEXT: class Honorific<string Honorific:t = ?> {
33 // CHECK-NEXT:   string honorific = Honorific:t;
34 // CHECK-NEXT: }
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;
38 // CHECK-NEXT: }
39 // CHECK-NEXT: ------------- Defs -----------------
40 // CHECK-NEXT: def JaneSmith {
41 // CHECK-NEXT:   string name = "Jane Smith";
42 // CHECK-NEXT:   Honorific honorific = Ms;
43 // CHECK-NEXT: }
44 // CHECK-NEXT: def JimmyJohnson {
45 // CHECK-NEXT:   string name = "Jimmy Johnson";
46 // CHECK-NEXT:   Honorific honorific = Mr;
47 // CHECK-NEXT: }
48 // CHECK-NEXT: def JohnSmith {
49 // CHECK-NEXT:   string name = "John Smith";
50 // CHECK-NEXT:   Honorific honorific = Mr;
51 // CHECK-NEXT: }
52 // CHECK-NEXT: def JohnSmithJones {
53 // CHECK-NEXT:   string name = "John Smith-Jones";
54 // CHECK-NEXT:   Honorific honorific = Mr;
55 // CHECK-NEXT: }
56 // CHECK-NEXT: def Mr 
57 // CHECK-NEXT:   string honorific = "Mr.";
58 // CHECK-NEXT: }
59 // CHECK-NEXT: def Mrs {
60 // CHECK-NEXT:   string honorific = "Mrs.";
61 // CHECK-NEXT: }
62 // CHECK-NEXT: def Ms {
63 // CHECK-NEXT:   string honorific = "Ms.";
64 // CHECK-NEXT: }
65 // CHECK-NEXT: def TVAR {
66 // CHECK-NEXT:   string honorific = "Bogus";
67 // CHECK-NEXT: }