Home | History | Annotate | Download | only in Sema

Lines Matching defs:Template

1 //===------- SemaTemplateInstantiate.cpp - C++ Template Instantiation ------===/
9 // This file implements C++ template instantiation.
25 #include "clang/Sema/Template.h"
32 // Template Instantiation Support
35 /// \brief Retrieve the template argument list(s) that should be used to
38 /// \param D the declaration for which we are computing template instantiation
41 /// \param Innermost if non-NULL, the innermost template argument list.
43 /// \param RelativeToPrimary true if we should get the template
44 /// arguments relative to the primary template, even when we're
46 /// template specializations.
50 /// used to determine the proper set of template instantiation arguments for
51 /// friend function template specializations.
57 // Accumulate the set of template argument lists in this structure.
67 // Add template arguments from a variable template instantiation.
77 // If this variable template specialization was instantiated from a
78 // specialized member that is a variable template, we're done.
79 assert(Spec->getSpecializedTemplate() && "No variable template?");
94 // If we have a template template parameter with translation unit context,
95 // then we're performing substitution into a default template argument of
96 // this template template parameter before we've constructed the template
97 // that will own this template template parameter. In this case, we
98 // use empty template parameter lists for all of the outer templates
111 // Add template arguments from a class template instantiation.
121 // If this class template specialization was instantiated from a
122 // specialized member that is a class template, we're done.
123 assert(Spec->getSpecializedTemplate() && "No class template?");
127 // Add template arguments from a function template specialization.
137 // Add the template arguments for this specialization.
141 // a function template, we're done.
142 assert(Function->getPrimaryTemplate() && "No function template?");
152 // Add the "injected" template arguments.
207 Decl *Entity, NamedDecl *Template, ArrayRef<TemplateArgument> TemplateArgs,
223 Inst.Template = Template;
250 Sema &SemaRef, SourceLocation PointOfInstantiation, TemplateDecl *Template,
255 PointOfInstantiation, InstantiationRange, Template, nullptr,
300 Sema &SemaRef, SourceLocation PointOfInstantiation, NamedDecl *Template,
306 PointOfInstantiation, InstantiationRange, Param, Template,
310 Sema &SemaRef, SourceLocation PointOfInstantiation, NamedDecl *Template,
316 PointOfInstantiation, InstantiationRange, Param, Template,
320 Sema &SemaRef, SourceLocation PointOfInstantiation, TemplateDecl *Template,
325 PointOfInstantiation, InstantiationRange, Param, Template,
337 // Name lookup no longer looks in this template's defining module.
340 "forgot to remove a lookup module for a template instantiation");
375 // Determine which template instantiations to skip, if any.
383 // FIXME: In all of these cases, we need to show the template arguments
446 TemplateDecl *Template = cast<TemplateDecl>(Active->Entity);
449 Template->printName(OS);
518 if (TemplateDecl *Template = dyn_cast<TemplateDecl>(Active->Template))
519 TemplateParams = Template->getTemplateParameters();
522 cast<ClassTemplatePartialSpecializationDecl>(Active->Template)
537 if (TemplateDecl *Template = dyn_cast<TemplateDecl>(Active->Template))
538 TemplateParams = Template->getTemplateParameters();
541 cast<ClassTemplatePartialSpecializationDecl>(Active->Template)
575 // An instantiation of an alias template may or may not be a SFINAE
582 // This is a template instantiation, so there is no SFINAE.
588 // A default template argument instantiation and substitution into
589 // template parameters with arguments for prior parameters may or may
595 // We're either substitution explicitly-specified template arguments
596 // or deduced template arguments, so SFINAE applies.
619 // Template Instantiation for Types
640 /// For the purposes of template instantiation, a type has already been
715 // operator template of a generic lambda, update the "instantiation of"
799 template<typename Fn>
811 /// \brief Transforms a template type parameter type by performing
812 /// substitution of the corresponding template type argument.
816 /// \brief Transforms an already-substituted template type parameter pack
870 // If the corresponding template argument is NULL or non-existent, it's
872 // template arguments in a function template, but there were some
886 TemplateName Template = Arg.getAsTemplate();
887 assert(!Template.isNull() && Template.getAsTemplateDecl() &&
888 "Wrong kind of template template argument");
889 return Template.getAsTemplateDecl();
892 // Fall through to find the instantiated declaration for this template
893 // template parameter.
911 // If the first part of the nested-name-specifier was a template type
1010 // If the corresponding template argument is NULL or non-existent, it's
1012 // template arguments in a function template, but there were some
1025 // We have the template argument pack to substitute, but we're not
1034 TemplateName Template = Arg.getAsTemplate();
1035 assert(!Template.isNull() && "Null template template argument");
1037 // We don't ever want to substitute for a qualified template name, since
1039 // template name to its underlying declaration.
1040 if (QualifiedTemplateName *QTN = Template.getAsQualifiedTemplateName())
1041 Template = TemplateName(QTN->getTemplateDecl());
1043 Template = getSema().Context.getSubstTemplateTemplateParm(TTP, Template);
1044 return Template;
1073 // If the corresponding template argument is NULL or non-existent, it's
1075 // template arguments in a function template, but there were some
1120 // non-type template parameter.
1133 // The template argument itself might be an expression, in which
1146 // Find the instantiation of the template argument. This is
1153 // Propagate NULL template argument.
1278 // Handle references to non-type template parameters and non-type template
1284 // We have a non-type template parameter that isn't fully substituted;
1306 template<typename Fn>
1332 // Replace the template type parameter with its corresponding
1333 // template argument.
1335 // If the corresponding template argument is NULL or doesn't exist, it's
1337 // template arguments in a function template class, but there were some
1353 // We have the template argument pack, but we're not expanding the
1354 // enclosing pack expansion yet. Just save the template argument
1368 "Template argument kind mismatch");
1381 // The template type parameter comes from an inner template (e.g.,
1382 // the template parameter list of a member template inside the
1383 // template we are instantiating). Create a new template type
1384 // parameter with the template "level" reduced by one.
1426 /// \brief Perform substitution on the type T with a given set of template
1429 /// This routine substitutes the given template arguments into the
1432 /// \param T the type into which the template arguments will be
1436 /// \param Args the template arguments that will be
1437 /// substituted for the top-level template parameters within T.
1631 // the substitution goes through an alias template that "loses" the
1710 /// \brief Substitute the given template arguments into the given set of
1731 /// given class template specialization.
1734 /// attaches the instantiated base classes to the class template
1847 /// Determine whether we would be unable to instantiate this template (because
1879 // Not much point in noting the template declaration here, since
1909 /// instantiated. This will be either a class template specialization
1910 /// or a member class of a class template specialization.
1913 /// occurs. This will be either the declaration of a class template or
1914 /// the declaration of a member class of a class template.
1916 /// \param TemplateArgs The template arguments to be substituted into
2002 // template <int i> class A {
2006 // 'class B' has the template as lexical context but semantically it is
2021 // C++11 [temp.inst]p1: The implicit instantiation of a class template
2100 // Instantiate any out-of-line class template partial
2113 // Instantiate any out-of-line variable template partial
2134 // of a polymorphic class template specialization.
2152 /// \param TemplateArgs The template arguments to be substituted into
2216 /// \param TemplateArgs The template arguments to be substituted into
2282 /// \brief A partial specialization whose template arguments have matched
2283 /// a given template-id.
2300 ClassTemplateDecl *Template = ClassTemplateSpec->getSpecializedTemplate();
2304 // When a class template is used in a context that requires an
2307 // template or one of the partial specializations. This is done by
2308 // matching the template arguments of the class template
2309 // specialization with the template argument lists of the partial
2314 Template->getPartialSpecializations(PartialSpecs);
2326 DeclAccessPair::make(Template, AS_public), Partial,
2336 // If we're dealing with a member template where the template parameters
2337 // have been instantiated, this provides the original template parameters
2338 // from which the member template's parameters were instantiated.
2352 // specializations, then the use of the class template is
2397 // Instantiate using the best class template partial specialization.
2400 // If we've found an explicit specialization of this class template,
2412 // from the primary template.
2413 ClassTemplateDecl *OrigTemplate = Template;
2415 // If we've found an explicit specialization of this class template,
2436 /// of the given class, which is an instantiation of a class template
2437 /// or a member class of a template.
2450 "Unexpected template specialization kind!");
2472 // An explicit instantiation definition that names a class template
2473 // specialization explicitly instantiates the class template
2514 // An explicit instantiation definition that names a class template
2515 // specialization explicitly instantiates the class template
2561 assert(Pattern && "Missing instantiated-from-template information");
2566 // An explicit instantiation definition that names a class template
2567 // specialization explicitly instantiates the class template
2614 assert(Pattern && "Missing instantiated-from-template information");
2642 /// given class template specialization, which was named as part of an
2650 // An explicit instantiation that names a class template
2717 /// \brief Do template substitution on declaration name info.
2790 // If we're performing a partial substitution during template argument
2791 // deduction, we may not have values for template parameters yet.