Home | History | Annotate | Download | only in TableGen
      1 // RUN: llvm-tblgen %s | FileCheck %s
      2 
      3 class Base<list<int> v> {
      4   list<int> values = v;
      5 }
      6 
      7 class Derived<list<int> v> : Base<!if(!empty(v),[0],v)>;
      8 
      9 multiclass Multi<list<list<list<int>>> v> {
     10   def ONE : Derived<!if(!empty(v),[]<int>,!if(!empty(!head(v)),[]<int>,v[0][0]))>;
     11   def TWO : Derived<!if(!empty(v),[]<int>,!if(!empty(!tail(v)),!if(!empty(!head(v)),[]<int>,v[0][0]),v[1][0]))>;
     12 }
     13 
     14 defm Def : Multi<[[[]],[[1, 2, 3]]]>;
     15 
     16 // CHECK: values = [0]
     17 // CHECK: values = [1, 2, 3]
     18