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