clang 22.0.0git
SemaTemplate.cpp File Reference
#include "TreeTransform.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclFriend.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/DynamicRecursiveASTVisitor.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/TemplateName.h"
#include "clang/AST/Type.h"
#include "clang/AST/TypeOrdering.h"
#include "clang/AST/TypeVisitor.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/DiagnosticSema.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Sema/DeclSpec.h"
#include "clang/Sema/EnterExpressionEvaluationContext.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/Overload.h"
#include "clang/Sema/ParsedTemplate.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/SemaCUDA.h"
#include "clang/Sema/SemaInternal.h"
#include "clang/Sema/Template.h"
#include "clang/Sema/TemplateDeduction.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/SaveAndRestore.h"
#include <optional>
#include "clang/AST/TypeNodes.inc"

Go to the source code of this file.

Macros

#define TYPE(Class, Parent)
#define ABSTRACT_TYPE(Class, Parent)
#define NON_CANONICAL_TYPE(Class, Parent)

Enumerations

enum  NullPointerValueKind { NPV_NotNullPointer , NPV_NullPointer , NPV_Error }

Functions

static TemplateArgumentLoc translateTemplateArgument (Sema &SemaRef, const ParsedTemplateArgument &Arg)
static void maybeDiagnoseTemplateParameterShadow (Sema &SemaRef, Scope *S, SourceLocation Loc, const IdentifierInfo *Name)
static TemplateArgumentListInfo makeTemplateArgumentListInfo (Sema &S, TemplateIdAnnotation &TemplateId)
 Convert the parser's template argument list representation into our form.
template<typename ArgumentLocAppender>
static ExprResult formImmediatelyDeclaredConstraint (Sema &S, NestedNameSpecifierLoc NS, DeclarationNameInfo NameInfo, NamedDecl *NamedConcept, NamedDecl *FoundDecl, SourceLocation LAngleLoc, SourceLocation RAngleLoc, QualType ConstrainedType, SourceLocation ParamNameLoc, ArgumentLocAppender Appender, SourceLocation EllipsisLoc)
static void SetNestedNameSpecifier (Sema &S, TagDecl *T, const CXXScopeSpec &SS)
static bool DiagnoseDefaultTemplateArgument (Sema &S, Sema::TemplateParamListContext TPC, SourceLocation ParamLoc, SourceRange DefArgRange)
 Diagnose the presence of a default template argument on a template parameter, which is ill-formed in certain contexts.
static bool DiagnoseUnexpandedParameterPacks (Sema &S, TemplateTemplateParmDecl *TTP)
 Check for unexpanded parameter packs within the template parameters of a template template parameter, recursively.
static bool DependsOnTemplateParameters (QualType T, TemplateParameterList *Params)
 Determines whether a given type depends on the given parameter list.
static SourceRange getRangeOfTypeInNestedNameSpecifier (ASTContext &Context, QualType T, const CXXScopeSpec &SS)
static QualType builtinCommonTypeImpl (Sema &S, ElaboratedTypeKeyword Keyword, TemplateName BaseTemplate, SourceLocation TemplateLoc, ArrayRef< TemplateArgument > Ts)
static bool isInVkNamespace (const RecordType *RT)
static SpirvOperand checkHLSLSpirvTypeOperand (Sema &SemaRef, QualType OperandArg, SourceLocation Loc)
static QualType checkBuiltinTemplateIdType (Sema &SemaRef, ElaboratedTypeKeyword Keyword, BuiltinTemplateDecl *BTD, ArrayRef< TemplateArgument > Converted, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs)
static bool isEnableIfAliasTemplate (TypeAliasTemplateDecl *AliasTemplate)
 Determine whether this alias template is "enable_if_t".
static void collectConjunctionTerms (Expr *Clause, SmallVectorImpl< Expr * > &Terms)
 Collect all of the separable terms in the given condition, which might be a conjunction.
static ExprlookThroughRangesV3Condition (Preprocessor &PP, Expr *Cond)
static TemplateName resolveAssumedTemplateNameAsType (Sema &S, Scope *Scope, const AssumedTemplateStorage *ATN, SourceLocation NameLoc)
static bool CheckTemplateSpecializationScope (Sema &S, NamedDecl *Specialized, NamedDecl *PrevDecl, SourceLocation Loc, bool IsPartialSpecialization)
 Check whether a specialization is well-formed in the current context.
static TemplateSpecializationKind getTemplateSpecializationKind (Decl *D)
 Determine what kind of template specialization the given declaration is.
static bool isTemplateArgumentTemplateParameter (const TemplateArgument &Arg, unsigned Depth, unsigned Index)
static bool isSameAsPrimaryTemplate (TemplateParameterList *Params, TemplateParameterList *SpecParams, ArrayRef< TemplateArgument > Args)
template<typename PartialSpecDecl>
static void checkMoreSpecializedThanPrimary (Sema &S, PartialSpecDecl *Partial)
static void noteNonDeducibleParameters (Sema &S, TemplateParameterList *TemplateParams, const llvm::SmallBitVector &DeducibleParams)
template<typename PartialSpecDecl>
static void checkTemplatePartialSpecialization (Sema &S, PartialSpecDecl *Partial)
static bool SubstDefaultTemplateArgument (Sema &SemaRef, TemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, TemplateTypeParmDecl *Param, ArrayRef< TemplateArgument > SugaredConverted, ArrayRef< TemplateArgument > CanonicalConverted, TemplateArgumentLoc &Output)
 Substitute template arguments into the default template argument for the given template type parameter.
static bool SubstDefaultTemplateArgument (Sema &SemaRef, TemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, NonTypeTemplateParmDecl *Param, ArrayRef< TemplateArgument > SugaredConverted, ArrayRef< TemplateArgument > CanonicalConverted, TemplateArgumentLoc &Output)
 Substitute template arguments into the default template argument for the given non-type template parameter.
static TemplateName SubstDefaultTemplateArgument (Sema &SemaRef, TemplateDecl *Template, SourceLocation TemplateKWLoc, SourceLocation TemplateLoc, SourceLocation RAngleLoc, TemplateTemplateParmDecl *Param, ArrayRef< TemplateArgument > SugaredConverted, ArrayRef< TemplateArgument > CanonicalConverted, NestedNameSpecifierLoc &QualifierLoc)
 Substitute template arguments into the default template argument for the given template template parameter.
static TemplateArgumentLoc convertTypeTemplateArgumentToTemplate (ASTContext &Context, TypeLoc TLoc)
 Convert a template-argument that we parsed as a type into a template, if possible.
template<typename TemplateParmDecl>
static bool diagnoseMissingArgument (Sema &S, SourceLocation Loc, TemplateDecl *TD, const TemplateParmDecl *D, TemplateArgumentListInfo &Args)
 Diagnose a missing template argument.
static NullPointerValueKind isNullPointerValueTemplateArgument (Sema &S, NamedDecl *Param, QualType ParamType, Expr *Arg, Decl *Entity=nullptr)
 Determine whether the given template argument is a null pointer value of the appropriate type.
static bool CheckTemplateArgumentIsCompatibleWithParameter (Sema &S, NamedDecl *Param, QualType ParamType, Expr *ArgIn, Expr *Arg, QualType ArgType)
 Checks whether the given template argument is compatible with its template parameter.
static bool CheckTemplateArgumentAddressOfObjectOrFunction (Sema &S, NamedDecl *Param, QualType ParamType, Expr *ArgIn, TemplateArgument &SugaredConverted, TemplateArgument &CanonicalConverted)
 Checks whether the given template argument is the address of an object or function according to C++ [temp.arg.nontype]p1.
static bool CheckTemplateArgumentPointerToMember (Sema &S, NamedDecl *Param, QualType ParamType, Expr *&ResultArg, TemplateArgument &SugaredConverted, TemplateArgument &CanonicalConverted)
 Checks whether the given template argument is a pointer to member constant according to C++ [temp.arg.nontype]p1.
static void DiagnoseTemplateParameterListArityMismatch (Sema &S, TemplateParameterList *New, TemplateParameterList *Old, Sema::TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc)
 Diagnose a known arity mismatch when comparing template argument lists.
static Sema::SemaDiagnosticBuilder noteLocation (Sema &S, const NamedDecl &Decl, unsigned HereDiagID, unsigned ExternalDiagID)
static ExprBuildExpressionFromIntegralTemplateArgumentValue (Sema &S, QualType OrigT, const llvm::APSInt &Int, SourceLocation Loc)
 Construct a new expression that refers to the given integral template argument with the given source-location information.
static ExprBuildExpressionFromNonTypeTemplateArgumentValue (Sema &S, QualType T, const APValue &Val, SourceLocation Loc)
static bool MatchTemplateParameterKind (Sema &S, NamedDecl *New, const Sema::TemplateCompareNewDeclInfo &NewInstFrom, NamedDecl *Old, const NamedDecl *OldInstFrom, bool Complain, Sema::TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc)
 Match two template parameters within template parameter lists.
static SourceRange findTemplateParameterInType (unsigned Depth, Expr *E)
static SourceRange findTemplateParameter (unsigned Depth, TypeLoc TL)
static bool CheckNonTypeTemplatePartialSpecializationArgs (Sema &S, SourceLocation TemplateNameLoc, NonTypeTemplateParmDecl *Param, const TemplateArgument *Args, unsigned NumArgs, bool IsDefaultArgument)
 Subroutine of Sema::CheckTemplatePartialSpecializationArgs that checks non-type template partial specialization arguments.
static bool RemoveLookupResult (LookupResult &R, NamedDecl *C)
static void StripImplicitInstantiation (NamedDecl *D, bool MinGW)
 Strips various properties off an implicit instantiation that has just been explicitly specialized.
static SourceLocation DiagLocForExplicitInstantiation (NamedDecl *D, SourceLocation PointOfInstantiation)
 Compute the diagnostic location for an explicit instantiation.
template<typename DeclT>
static void completeMemberSpecializationImpl (Sema &S, DeclT *OrigD, SourceLocation Loc)
 Complete the explicit specialization of a member of a class template by updating the instantiated member to be marked as an explicit specialization.
static bool CheckExplicitInstantiationScope (Sema &S, NamedDecl *D, SourceLocation InstLoc, bool WasQualifiedName)
 Check the scope of an explicit instantiation.
static bool CheckExplicitInstantiation (Sema &S, NamedDecl *D, SourceLocation InstLoc, bool WasQualifiedName, TemplateSpecializationKind TSK)
 Common checks for whether an explicit instantiation of D is valid.
static bool ScopeSpecifierHasTemplateId (const CXXScopeSpec &SS)
 Determine whether the given scope specifier has a template-id in it.
static void dllExportImportClassTemplateSpecialization (Sema &S, ClassTemplateSpecializationDecl *Def)
 Make a dllexport or dllimport attr on a class template specialization take effect.
static bool isEnableIf (NestedNameSpecifierLoc NNS, const IdentifierInfo &II, SourceRange &CondRange, Expr *&Cond)
 Determine whether this failed name lookup should be treated as being disabled by a usage of std::enable_if.

Macro Definition Documentation

◆ ABSTRACT_TYPE

#define ABSTRACT_TYPE ( Class,
Parent )
Value:
bool Visit##Class##Type(const Class##Type *) { return false; }
The base class of the type hierarchy.
Definition TypeBase.h:1833
@ Type
The name was classified as a type.
Definition Sema.h:562

Definition at line 6166 of file SemaTemplate.cpp.

◆ NON_CANONICAL_TYPE

#define NON_CANONICAL_TYPE ( Class,
Parent )
Value:
bool Visit##Class##Type(const Class##Type *) { return false; }

Definition at line 6168 of file SemaTemplate.cpp.

◆ TYPE

#define TYPE ( Class,
Parent )
Value:
bool Visit##Class##Type(const Class##Type *);

Definition at line 6164 of file SemaTemplate.cpp.

Enumeration Type Documentation

◆ NullPointerValueKind

Enumerator
NPV_NotNullPointer 
NPV_NullPointer 
NPV_Error 

Definition at line 6474 of file SemaTemplate.cpp.

Function Documentation

◆ BuildExpressionFromIntegralTemplateArgumentValue()

Expr * BuildExpressionFromIntegralTemplateArgumentValue ( Sema & S,
QualType OrigT,
const llvm::APSInt & Int,
SourceLocation Loc )
static

Construct a new expression that refers to the given integral template argument with the given source-location information.

This routine takes care of the mapping from an integral template argument (which may have any integral type) to the appropriate literal value.

Definition at line 7971 of file SemaTemplate.cpp.

References clang::Ascii, clang::Sema::Context, clang::CStyleCastExpr::Create(), clang::CXXBoolLiteralExpr::Create(), clang::IntegerLiteral::Create(), clang::Sema::CurFPFeatureOverrides(), clang::Type::getAsEnumDecl(), clang::Sema::getLangOpts(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::Type::isEnumeralType(), clang::Type::isIntegralOrEnumerationType(), clang::T, clang::UTF16, clang::UTF32, clang::UTF8, clang::VK_PRValue, and clang::Wide.

Referenced by clang::Sema::BuildExpressionFromNonTypeTemplateArgument(), and BuildExpressionFromNonTypeTemplateArgumentValue().

◆ BuildExpressionFromNonTypeTemplateArgumentValue()

◆ builtinCommonTypeImpl()

◆ checkBuiltinTemplateIdType()

◆ CheckExplicitInstantiation()

◆ CheckExplicitInstantiationScope()

◆ checkHLSLSpirvTypeOperand()

SpirvOperand checkHLSLSpirvTypeOperand ( Sema & SemaRef,
QualType OperandArg,
SourceLocation Loc )
static

◆ checkMoreSpecializedThanPrimary()

◆ CheckNonTypeTemplatePartialSpecializationArgs()

◆ CheckTemplateArgumentAddressOfObjectOrFunction()

bool CheckTemplateArgumentAddressOfObjectOrFunction ( Sema & S,
NamedDecl * Param,
QualType ParamType,
Expr * ArgIn,
TemplateArgument & SugaredConverted,
TemplateArgument & CanonicalConverted )
static

Checks whether the given template argument is the address of an object or function according to C++ [temp.arg.nontype]p1.

Definition at line 6646 of file SemaTemplate.cpp.

References clang::cast(), CheckTemplateArgumentIsCompatibleWithParameter(), clang::Sema::Context, clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateRemoval(), clang::SemaBase::Diag(), clang::SemaBase::DiagCompat(), clang::Func, clang::ASTContext::getArrayDecayedType(), clang::Stmt::getBeginLoc(), clang::Decl::getCanonicalDecl(), clang::ASTContext::getCanonicalTemplateArgument(), clang::ASTContext::getCanonicalType(), clang::Expr::getExprLoc(), clang::NamedDecl::getFormalLinkage(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::QualType::getNonReferenceType(), clang::ASTContext::getPointerType(), clang::Stmt::getSourceRange(), clang::VarDecl::getTLSKind(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::NamedDecl::hasLinkage(), clang::ASTContext::hasSameUnqualifiedType(), clang::Expr::IgnoreImpCasts(), clang::Expr::IgnoreParenCasts(), clang::Internal, clang::Invalid, clang::isa(), clang::Type::isArrayType(), isNullPointerValueTemplateArgument(), clang::Type::isNullPtrType(), clang::Type::isPointerType(), clang::Type::isReferenceType(), clang::SourceLocation::isValid(), clang::Expr::isValueDependent(), clang::Sema::MarkAnyDeclReferenced(), clang::Sema::NoteTemplateParameterLocation(), NPV_Error, NPV_NotNullPointer, NPV_NullPointer, and clang::Parens.

Referenced by clang::Sema::CheckTemplateArgument().

◆ CheckTemplateArgumentIsCompatibleWithParameter()

◆ CheckTemplateArgumentPointerToMember()

◆ checkTemplatePartialSpecialization()

template<typename PartialSpecDecl>
void checkTemplatePartialSpecialization ( Sema & S,
PartialSpecDecl * Partial )
static

◆ CheckTemplateSpecializationScope()

bool CheckTemplateSpecializationScope ( Sema & S,
NamedDecl * Specialized,
NamedDecl * PrevDecl,
SourceLocation Loc,
bool IsPartialSpecialization )
static

Check whether a specialization is well-formed in the current context.

This routine determines whether a template specialization can be declared in the current context (C++ [temp.expl.spec]p2).

Parameters
Sthe semantic analysis object for which this check is being performed.
Specializedthe entity being specialized or instantiated, which may be a kind of template (class template, function template, etc.) or a member of a class template (member function, static data member, member class).
PrevDeclthe previous declaration of this entity, if any.
Locthe location of the explicit specialization or instantiation of this entity.
IsPartialSpecializationwhether this is a partial specialization of a class template.
Returns
true if there was an error that we cannot recover from, false otherwise.

Definition at line 8461 of file SemaTemplate.cpp.

References clang::cast(), clang::Sema::CurContext, clang::SemaBase::Diag(), Diag(), clang::DeclContext::Encloses(), clang::DeclContext::Equals(), clang::Decl::getDeclContext(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::DeclContext::getRedeclContext(), clang::isa(), clang::DeclContext::isFileContext(), clang::DeclContext::isFunctionOrMethod(), and clang::DeclContext::isRecord().

Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnVarTemplateSpecialization(), clang::Sema::CheckFunctionTemplateSpecialization(), and clang::Sema::CheckMemberSpecialization().

◆ collectConjunctionTerms()

void collectConjunctionTerms ( Expr * Clause,
SmallVectorImpl< Expr * > & Terms )
static

Collect all of the separable terms in the given condition, which might be a conjunction.

FIXME: The right answer is to convert the logical expression into disjunctive normal form, so we can find the first failed term within each possible clause.

Definition at line 3546 of file SemaTemplate.cpp.

References collectConjunctionTerms().

Referenced by collectConjunctionTerms(), and clang::Sema::findFailedBooleanCondition().

◆ completeMemberSpecializationImpl()

template<typename DeclT>
void completeMemberSpecializationImpl ( Sema & S,
DeclT * OrigD,
SourceLocation Loc )
static

Complete the explicit specialization of a member of a class template by updating the instantiated member to be marked as an explicit specialization.

Parameters
OrigDThe member declaration instantiated from the template.
LocThe location of the explicit specialization of the member.

Definition at line 9957 of file SemaTemplate.cpp.

References clang::TSK_ExplicitSpecialization, and clang::TSK_ImplicitInstantiation.

Referenced by clang::Sema::CompleteMemberSpecialization().

◆ convertTypeTemplateArgumentToTemplate()

TemplateArgumentLoc convertTypeTemplateArgumentToTemplate ( ASTContext & Context,
TypeLoc TLoc )
static

Convert a template-argument that we parsed as a type into a template, if possible.

C++ permits injected-class-names to perform dual service as template template arguments and as template type arguments.

Definition at line 5442 of file SemaTemplate.cpp.

References clang::TypeLoc::getAs(), and clang::TemplateName::isNull().

Referenced by clang::Sema::CheckTemplateArgument().

◆ DependsOnTemplateParameters()

bool DependsOnTemplateParameters ( QualType T,
TemplateParameterList * Params )
static

Determines whether a given type depends on the given parameter list.

Definition at line 2765 of file SemaTemplate.cpp.

References clang::TemplateParameterList::size(), and clang::T.

Referenced by clang::Sema::MatchTemplateParametersToScopeSpecifier().

◆ DiagLocForExplicitInstantiation()

SourceLocation DiagLocForExplicitInstantiation ( NamedDecl * D,
SourceLocation PointOfInstantiation )
static

Compute the diagnostic location for an explicit instantiation.

Definition at line 9239 of file SemaTemplate.cpp.

References clang::SourceLocation::isValid().

Referenced by clang::Sema::CheckSpecializationInstantiationRedecl().

◆ DiagnoseDefaultTemplateArgument()

bool DiagnoseDefaultTemplateArgument ( Sema & S,
Sema::TemplateParamListContext TPC,
SourceLocation ParamLoc,
SourceRange DefArgRange )
static

Diagnose the presence of a default template argument on a template parameter, which is ill-formed in certain contexts.

Returns
true if the default template argument should be dropped.

Definition at line 2285 of file SemaTemplate.cpp.

References clang::SemaBase::Diag(), clang::SemaBase::DiagCompat(), clang::Sema::TPC_ClassTemplateMember, clang::Sema::TPC_FriendClassTemplate, clang::Sema::TPC_FriendFunctionTemplate, clang::Sema::TPC_FriendFunctionTemplateDefinition, clang::Sema::TPC_FunctionTemplate, clang::Sema::TPC_Other, and clang::Sema::TPC_TemplateTemplateParameterPack.

Referenced by clang::Sema::CheckTemplateParameterList().

◆ diagnoseMissingArgument()

◆ DiagnoseTemplateParameterListArityMismatch()

void DiagnoseTemplateParameterListArityMismatch ( Sema & S,
TemplateParameterList * New,
TemplateParameterList * Old,
Sema::TemplateParameterListEqualKind Kind,
SourceLocation TemplateArgLoc )
static

◆ DiagnoseUnexpandedParameterPacks()

◆ dllExportImportClassTemplateSpecialization()

◆ findTemplateParameter()

◆ findTemplateParameterInType()

SourceRange findTemplateParameterInType ( unsigned Depth,
Expr * E )
static

◆ formImmediatelyDeclaredConstraint()

◆ getRangeOfTypeInNestedNameSpecifier()

◆ getTemplateSpecializationKind()

◆ isEnableIf()

◆ isEnableIfAliasTemplate()

bool isEnableIfAliasTemplate ( TypeAliasTemplateDecl * AliasTemplate)
static

Determine whether this alias template is "enable_if_t".

libc++ >=14 uses "__enable_if_t" in C++11 mode.

Definition at line 3535 of file SemaTemplate.cpp.

References clang::AliasTemplate.

Referenced by clang::Sema::CheckTemplateIdType().

◆ isInVkNamespace()

bool isInVkNamespace ( const RecordType * RT)
static

◆ isNullPointerValueTemplateArgument()

NullPointerValueKind isNullPointerValueTemplateArgument ( Sema & S,
NamedDecl * Param,
QualType ParamType,
Expr * Arg,
Decl * Entity = nullptr )
static

◆ isSameAsPrimaryTemplate()

◆ isTemplateArgumentTemplateParameter()

◆ lookThroughRangesV3Condition()

◆ makeTemplateArgumentListInfo()

◆ MatchTemplateParameterKind()

◆ maybeDiagnoseTemplateParameterShadow()

◆ noteLocation()

◆ noteNonDeducibleParameters()

void noteNonDeducibleParameters ( Sema & S,
TemplateParameterList * TemplateParams,
const llvm::SmallBitVector & DeducibleParams )
static

◆ RemoveLookupResult()

◆ resolveAssumedTemplateNameAsType()

◆ ScopeSpecifierHasTemplateId()

bool ScopeSpecifierHasTemplateId ( const CXXScopeSpec & SS)
static

◆ SetNestedNameSpecifier()

void SetNestedNameSpecifier ( Sema & S,
TagDecl * T,
const CXXScopeSpec & SS )
static

◆ StripImplicitInstantiation()

void StripImplicitInstantiation ( NamedDecl * D,
bool MinGW )
static

Strips various properties off an implicit instantiation that has just been explicitly specialized.

Definition at line 9228 of file SemaTemplate.cpp.

References clang::cast(), clang::Decl::dropAttrs(), and clang::isa().

Referenced by clang::Sema::CheckSpecializationInstantiationRedecl().

◆ SubstDefaultTemplateArgument() [1/3]

TemplateName SubstDefaultTemplateArgument ( Sema & SemaRef,
TemplateDecl * Template,
SourceLocation TemplateKWLoc,
SourceLocation TemplateLoc,
SourceLocation RAngleLoc,
TemplateTemplateParmDecl * Param,
ArrayRef< TemplateArgument > SugaredConverted,
ArrayRef< TemplateArgument > CanonicalConverted,
NestedNameSpecifierLoc & QualifierLoc )
static

Substitute template arguments into the default template argument for the given template template parameter.

Parameters
SemaRefthe semantic analysis object for which we are performing the substitution.
Templatethe template that we are synthesizing template arguments for.
TemplateLocthe location of the template name that started the template-id we are checking.
RAngleLocthe location of the right angle bracket ('>') that terminates the template-id.
Paramthe template template parameter whose default we are substituting into.
Convertedthe list of template arguments provided for template parameters that precede Param in the template parameter list.
QualifierLocWill be set to the nested-name-specifier (with source-location information) that precedes the template name.
Returns
the substituted template argument, or NULL if an error occurred.

Definition at line 5358 of file SemaTemplate.cpp.

References clang::MultiLevelTemplateArgumentList::addOuterTemplateArguments(), clang::TemplateArgumentLoc::getArgument(), clang::TemplateArgument::getAsTemplate(), clang::TemplateArgumentLoc::getTemplateNameLoc(), clang::TemplateArgumentLoc::getTemplateQualifierLoc(), clang::Sema::InstantiatingTemplate::isInvalid(), clang::Sema::SubstTemplateName(), clang::Template, and clang::TemplateName.

◆ SubstDefaultTemplateArgument() [2/3]

bool SubstDefaultTemplateArgument ( Sema & SemaRef,
TemplateDecl * Template,
SourceLocation TemplateLoc,
SourceLocation RAngleLoc,
NonTypeTemplateParmDecl * Param,
ArrayRef< TemplateArgument > SugaredConverted,
ArrayRef< TemplateArgument > CanonicalConverted,
TemplateArgumentLoc & Output )
static

Substitute template arguments into the default template argument for the given non-type template parameter.

Parameters
SemaRefthe semantic analysis object for which we are performing the substitution.
Templatethe template that we are synthesizing template arguments for.
TemplateLocthe location of the template name that started the template-id we are checking.
RAngleLocthe location of the right angle bracket ('>') that terminates the template-id.
Paramthe non-type template parameter whose default we are substituting into.
Convertedthe list of template arguments provided for template parameters that precede Param in the template parameter list.
Returns
the substituted template argument, or NULL if an error occurred.

Definition at line 5308 of file SemaTemplate.cpp.

References clang::MultiLevelTemplateArgumentList::addOuterTemplateArguments(), clang::Sema::ConstantEvaluated, clang::Sema::InstantiatingTemplate::isInvalid(), clang::Sema::SubstTemplateArgument(), and clang::Template.

◆ SubstDefaultTemplateArgument() [3/3]

bool SubstDefaultTemplateArgument ( Sema & SemaRef,
TemplateDecl * Template,
SourceLocation TemplateLoc,
SourceLocation RAngleLoc,
TemplateTypeParmDecl * Param,
ArrayRef< TemplateArgument > SugaredConverted,
ArrayRef< TemplateArgument > CanonicalConverted,
TemplateArgumentLoc & Output )
static

Substitute template arguments into the default template argument for the given template type parameter.

Parameters
SemaRefthe semantic analysis object for which we are performing the substitution.
Templatethe template that we are synthesizing template arguments for.
TemplateLocthe location of the template name that started the template-id we are checking.
RAngleLocthe location of the right angle bracket ('>') that terminates the template-id.
Paramthe template template parameter whose default we are substituting into.
Convertedthe list of template arguments provided for template parameters that precede Param in the template parameter list.
Outputthe resulting substituted template argument.
Returns
true if an error occurred.

Definition at line 5248 of file SemaTemplate.cpp.

References clang::MultiLevelTemplateArgumentList::addOuterTemplateArguments(), clang::TemplateArgumentLoc::getArgument(), clang::TemplateArgument::isInstantiationDependent(), clang::Sema::InstantiatingTemplate::isInvalid(), clang::Sema::SubstTemplateArgument(), and clang::Template.

Referenced by clang::Sema::SubstDefaultTemplateArgumentIfAvailable().

◆ translateTemplateArgument()