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