lisp.td 945 B

123456789101112131415161718192021222324252627282930313233343536
  1. // RUN: llvm-tblgen %s
  2. // CHECK: def One {
  3. // CHECK-NEXT: list<string> names = ["Jeffrey Sinclair"];
  4. // CHECK-NEXT: string element = "Jeffrey Sinclair";
  5. // CHECK-NEXT: list<string> rest = [];
  6. // CHECK-NEXT: int null = 1;
  7. // CHECK-NEXT: string NAME = ?;
  8. // CHECK-NEXT: }
  9. // CHECK-NEXT: def Three {
  10. // CHECK-NEXT: list<string> names = ["Tom", "Dick", "Harry"];
  11. // CHECK-NEXT: string element = "Tom";
  12. // CHECK-NEXT: list<string> rest = ["Dick", "Harry"];
  13. // CHECK-NEXT: int null = 0;
  14. // CHECK-NEXT: string NAME = ?;
  15. // CHECK-NEXT: }
  16. class List<list<string> n> {
  17. list<string> names = n;
  18. }
  19. class CAR<string e> {
  20. string element = e;
  21. }
  22. class CDR<list<string> r, int n> {
  23. list<string> rest = r;
  24. int null = n;
  25. }
  26. class NameList<list<string> Names> :
  27. List<Names>, CAR<!head(Names)>, CDR<!tail(Names), !empty(!tail(Names))>;
  28. def Three : NameList<["Tom", "Dick", "Harry"]>;
  29. def One : NameList<["Jeffrey Sinclair"]>;