Home | History | Annotate | Download | only in TableGen
      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 // XFAIL: vg_leak
      8 
      9 class Honorific<string t> {
     10   string honorific = t;
     11 }
     12 
     13 def Mr : Honorific<"Mr.">;
     14 def Ms : Honorific<"Ms.">;
     15 def Mrs : Honorific<"Mrs.">;
     16 def TVAR : Honorific<"Bogus">;
     17 
     18 class Name<string n, Honorific t> {
     19   string name = n;
     20   Honorific honorific = t;
     21 }
     22 
     23 class AName<string name, Honorific honorific> : 
     24   Name<!subst("FIRST", "John", !subst("LAST", "Smith", name)),
     25        !subst(TVAR, Mr, honorific)>;
     26 
     27 def JohnSmith : AName<"FIRST LAST", TVAR>;
     28 def JaneSmith : AName<"Jane LAST", Ms>;
     29 def JohnSmithJones : AName<"FIRST LAST-Jones", Mr>;
     30 def JimmyJohnson : AName<"Jimmy Johnson", Mr>;
     31