@@ -1571,140 +1571,11 @@ SourceRange VarTemplatePartialSpecializationDecl::getSourceRange() const {
15711571 return Range;
15721572}
15731573
1574- static TemplateParameterList *
1575- createMakeIntegerSeqParameterList (const ASTContext &C, DeclContext *DC) {
1576- // typename T
1577- auto *T = TemplateTypeParmDecl::Create (
1578- C, DC, SourceLocation (), SourceLocation (), /* Depth=*/ 1 , /* Position=*/ 0 ,
1579- /* Id=*/ nullptr , /* Typename=*/ true , /* ParameterPack=*/ false ,
1580- /* HasTypeConstraint=*/ false );
1581- T->setImplicit (true );
1582-
1583- // T ...Ints
1584- TypeSourceInfo *TI =
1585- C.getTrivialTypeSourceInfo (QualType (T->getTypeForDecl (), 0 ));
1586- auto *N = NonTypeTemplateParmDecl::Create (
1587- C, DC, SourceLocation (), SourceLocation (), /* Depth=*/ 0 , /* Position=*/ 1 ,
1588- /* Id=*/ nullptr , TI->getType (), /* ParameterPack=*/ true , TI);
1589- N->setImplicit (true );
1590-
1591- // <typename T, T ...Ints>
1592- NamedDecl *P[2 ] = {T, N};
1593- auto *TPL = TemplateParameterList::Create (
1594- C, SourceLocation (), SourceLocation (), P, SourceLocation (), nullptr );
1595-
1596- // template <typename T, ...Ints> class IntSeq
1597- auto *TemplateTemplateParm = TemplateTemplateParmDecl::Create (
1598- C, DC, SourceLocation (), /* Depth=*/ 0 , /* Position=*/ 0 ,
1599- /* ParameterPack=*/ false , /* Id=*/ nullptr , /* Typename=*/ false , TPL);
1600- TemplateTemplateParm->setImplicit (true );
1601-
1602- // typename T
1603- auto *TemplateTypeParm = TemplateTypeParmDecl::Create (
1604- C, DC, SourceLocation (), SourceLocation (), /* Depth=*/ 0 , /* Position=*/ 1 ,
1605- /* Id=*/ nullptr , /* Typename=*/ true , /* ParameterPack=*/ false ,
1606- /* HasTypeConstraint=*/ false );
1607- TemplateTypeParm->setImplicit (true );
1608-
1609- // T N
1610- TypeSourceInfo *TInfo = C.getTrivialTypeSourceInfo (
1611- QualType (TemplateTypeParm->getTypeForDecl (), 0 ));
1612- auto *NonTypeTemplateParm = NonTypeTemplateParmDecl::Create (
1613- C, DC, SourceLocation (), SourceLocation (), /* Depth=*/ 0 , /* Position=*/ 2 ,
1614- /* Id=*/ nullptr , TInfo->getType (), /* ParameterPack=*/ false , TInfo);
1615- NamedDecl *Params[] = {TemplateTemplateParm, TemplateTypeParm,
1616- NonTypeTemplateParm};
1617-
1618- // template <template <typename T, T ...Ints> class IntSeq, typename T, T N>
1619- return TemplateParameterList::Create (C, SourceLocation (), SourceLocation (),
1620- Params, SourceLocation (), nullptr );
1621- }
1622-
1623- static TemplateParameterList *
1624- createTypePackElementParameterList (const ASTContext &C, DeclContext *DC) {
1625- // std::size_t Index
1626- TypeSourceInfo *TInfo = C.getTrivialTypeSourceInfo (C.getSizeType ());
1627- auto *Index = NonTypeTemplateParmDecl::Create (
1628- C, DC, SourceLocation (), SourceLocation (), /* Depth=*/ 0 , /* Position=*/ 0 ,
1629- /* Id=*/ nullptr , TInfo->getType (), /* ParameterPack=*/ false , TInfo);
1630-
1631- // typename ...T
1632- auto *Ts = TemplateTypeParmDecl::Create (
1633- C, DC, SourceLocation (), SourceLocation (), /* Depth=*/ 0 , /* Position=*/ 1 ,
1634- /* Id=*/ nullptr , /* Typename=*/ true , /* ParameterPack=*/ true ,
1635- /* HasTypeConstraint=*/ false );
1636- Ts->setImplicit (true );
1637-
1638- // template <std::size_t Index, typename ...T>
1639- NamedDecl *Params[] = {Index, Ts};
1640- return TemplateParameterList::Create (C, SourceLocation (), SourceLocation (),
1641- llvm::ArrayRef (Params), SourceLocation (),
1642- nullptr );
1643- }
1644-
1645- static TemplateParameterList *createBuiltinCommonTypeList (const ASTContext &C,
1646- DeclContext *DC) {
1647- // class... Args
1648- auto *Args =
1649- TemplateTypeParmDecl::Create (C, DC, SourceLocation (), SourceLocation (),
1650- /* Depth=*/ 1 , /* Position=*/ 0 , /* Id=*/ nullptr ,
1651- /* Typename=*/ false , /* ParameterPack=*/ true );
1652-
1653- // <class... Args>
1654- auto *BaseTemplateList = TemplateParameterList::Create (
1655- C, SourceLocation (), SourceLocation (), Args, SourceLocation (), nullptr );
1656-
1657- // template <class... Args> class BaseTemplate
1658- auto *BaseTemplate = TemplateTemplateParmDecl::Create (
1659- C, DC, SourceLocation (), /* Depth=*/ 0 , /* Position=*/ 0 ,
1660- /* ParameterPack=*/ false , /* Id=*/ nullptr ,
1661- /* Typename=*/ false , BaseTemplateList);
1662-
1663- // class TypeMember
1664- auto *TypeMember =
1665- TemplateTypeParmDecl::Create (C, DC, SourceLocation (), SourceLocation (),
1666- /* Depth=*/ 1 , /* Position=*/ 0 , /* Id=*/ nullptr ,
1667- /* Typename=*/ false , /* ParameterPack=*/ false );
1668-
1669- // <class TypeMember>
1670- auto *HasTypeMemberList =
1671- TemplateParameterList::Create (C, SourceLocation (), SourceLocation (),
1672- TypeMember, SourceLocation (), nullptr );
1673-
1674- // template <class TypeMember> class HasTypeMember
1675- auto *HasTypeMember = TemplateTemplateParmDecl::Create (
1676- C, DC, SourceLocation (), /* Depth=*/ 0 , /* Position=*/ 1 ,
1677- /* ParameterPack=*/ false , /* Id=*/ nullptr ,
1678- /* Typename=*/ false , HasTypeMemberList);
1679-
1680- // class HasNoTypeMember
1681- auto *HasNoTypeMember = TemplateTypeParmDecl::Create (
1682- C, DC, {}, {}, /* Depth=*/ 0 , /* Position=*/ 2 , /* Id=*/ nullptr ,
1683- /* Typename=*/ false , /* ParameterPack=*/ false );
1684-
1685- // class... Ts
1686- auto *Ts = TemplateTypeParmDecl::Create (
1687- C, DC, SourceLocation (), SourceLocation (), /* Depth=*/ 0 , /* Position=*/ 3 ,
1688- /* Id=*/ nullptr , /* Typename=*/ false , /* ParameterPack=*/ true );
1689-
1690- // template <template <class... Args> class BaseTemplate,
1691- // template <class TypeMember> class HasTypeMember, class HasNoTypeMember,
1692- // class... Ts>
1693- return TemplateParameterList::Create (
1694- C, SourceLocation (), SourceLocation (),
1695- {BaseTemplate, HasTypeMember, HasNoTypeMember, Ts}, SourceLocation (),
1696- nullptr );
1697- }
1698-
16991574static TemplateParameterList *createBuiltinTemplateParameterList (
17001575 const ASTContext &C, DeclContext *DC, BuiltinTemplateKind BTK) {
17011576 switch (BTK) {
1702- case BTK__make_integer_seq:
1703- return createMakeIntegerSeqParameterList (C, DC);
1704- case BTK__type_pack_element:
1705- return createTypePackElementParameterList (C, DC);
1706- case BTK__builtin_common_type:
1707- return createBuiltinCommonTypeList (C, DC);
1577+ #define CREATE_BUILTIN_TEMPLATE_PARAMETER_LIST
1578+ #include " clang/Basic/BuiltinTemplates.inc"
17081579 }
17091580
17101581 llvm_unreachable (" unhandled BuiltinTemplateKind!" );
0 commit comments