@@ -1608,13 +1608,69 @@ createTypePackElementParameterList(const ASTContext &C, DeclContext *DC) {
1608
1608
nullptr );
1609
1609
}
1610
1610
1611
+ static TemplateParameterList *createBuiltinCommonTypeList (const ASTContext &C,
1612
+ DeclContext *DC) {
1613
+ // class... Args
1614
+ auto *Args =
1615
+ TemplateTypeParmDecl::Create (C, DC, SourceLocation (), SourceLocation (),
1616
+ /* Depth=*/ 1 , /* Position=*/ 0 , /* Id=*/ nullptr ,
1617
+ /* Typename=*/ false , /* ParameterPack=*/ true );
1618
+
1619
+ // <class... Args>
1620
+ auto *BaseTemplateList = TemplateParameterList::Create (
1621
+ C, SourceLocation (), SourceLocation (), Args, SourceLocation (), nullptr );
1622
+
1623
+ // template <class... Args> class BaseTemplate
1624
+ auto *BaseTemplate = TemplateTemplateParmDecl::Create (
1625
+ C, DC, SourceLocation (), /* Depth=*/ 0 , /* Position=*/ 0 ,
1626
+ /* ParameterPack=*/ false , /* Id=*/ nullptr ,
1627
+ /* Typename=*/ false , BaseTemplateList);
1628
+
1629
+ // class TypeMember
1630
+ auto *TypeMember =
1631
+ TemplateTypeParmDecl::Create (C, DC, SourceLocation (), SourceLocation (),
1632
+ /* Depth=*/ 1 , /* Position=*/ 0 , /* Id=*/ nullptr ,
1633
+ /* Typename=*/ false , /* ParameterPack=*/ false );
1634
+
1635
+ // <class TypeMember>
1636
+ auto *HasTypeMemberList =
1637
+ TemplateParameterList::Create (C, SourceLocation (), SourceLocation (),
1638
+ TypeMember, SourceLocation (), nullptr );
1639
+
1640
+ // template <class TypeMember> class HasTypeMember
1641
+ auto *HasTypeMember = TemplateTemplateParmDecl::Create (
1642
+ C, DC, SourceLocation (), /* Depth=*/ 0 , /* Position=*/ 1 ,
1643
+ /* ParameterPack=*/ false , /* Id=*/ nullptr ,
1644
+ /* Typename=*/ false , HasTypeMemberList);
1645
+
1646
+ // class HasNoTypeMember
1647
+ auto *HasNoTypeMember = TemplateTypeParmDecl::Create (
1648
+ C, DC, {}, {}, /* Depth=*/ 0 , /* Position=*/ 2 , /* Id=*/ nullptr ,
1649
+ /* Typename=*/ false , /* ParameterPack=*/ false );
1650
+
1651
+ // class... Ts
1652
+ auto *Ts = TemplateTypeParmDecl::Create (
1653
+ C, DC, SourceLocation (), SourceLocation (), /* Depth=*/ 0 , /* Position=*/ 3 ,
1654
+ /* Id=*/ nullptr , /* Typename=*/ false , /* ParameterPack=*/ true );
1655
+
1656
+ // template <template <class... Args> class BaseTemplate,
1657
+ // template <class TypeMember> class HasTypeMember, class HasNoTypeMember,
1658
+ // class... Ts>
1659
+ return TemplateParameterList::Create (
1660
+ C, SourceLocation (), SourceLocation (),
1661
+ {BaseTemplate, HasTypeMember, HasNoTypeMember, Ts}, SourceLocation (),
1662
+ nullptr );
1663
+ }
1664
+
1611
1665
static TemplateParameterList *createBuiltinTemplateParameterList (
1612
1666
const ASTContext &C, DeclContext *DC, BuiltinTemplateKind BTK) {
1613
1667
switch (BTK) {
1614
1668
case BTK__make_integer_seq:
1615
1669
return createMakeIntegerSeqParameterList (C, DC);
1616
1670
case BTK__type_pack_element:
1617
1671
return createTypePackElementParameterList (C, DC);
1672
+ case BTK__builtin_common_type:
1673
+ return createBuiltinCommonTypeList (C, DC);
1618
1674
}
1619
1675
1620
1676
llvm_unreachable (" unhandled BuiltinTemplateKind!" );
0 commit comments