|
clang 23.0.0git
|
#include "TreeTransform.h"#include "clang/AST/ASTConcept.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 Expr * | lookThroughRangesV3Condition (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 Expr * | BuildExpressionFromIntegralTemplateArgumentValue (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 Expr * | BuildExpressionFromNonTypeTemplateArgumentValue (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 void | addExplicitInstantiationDecl (ASTContext &Context, DeclContext *CurContext, NamedDecl *Spec, SourceLocation ExternLoc, SourceLocation TemplateLoc, NestedNameSpecifierLoc QualifierLoc, const ASTTemplateArgumentListInfo *ArgsAsWritten, SourceLocation NameLoc, TypeSourceInfo *TypeAsWritten, TemplateSpecializationKind TSK) |
Create an ExplicitInstantiationDecl to record source-location info for an explicit template instantiation statement, and add it to CurContext. | |
| 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. | |
| #define ABSTRACT_TYPE | ( | Class, | |
| Parent ) |
Definition at line 6261 of file SemaTemplate.cpp.
| #define NON_CANONICAL_TYPE | ( | Class, | |
| Parent ) |
Definition at line 6263 of file SemaTemplate.cpp.
| #define TYPE | ( | Class, | |
| Parent ) |
Definition at line 6259 of file SemaTemplate.cpp.
| enum NullPointerValueKind |
| Enumerator | |
|---|---|
| NPV_NotNullPointer | |
| NPV_NullPointer | |
| NPV_Error | |
Definition at line 6574 of file SemaTemplate.cpp.
|
static |
Create an ExplicitInstantiationDecl to record source-location info for an explicit template instantiation statement, and add it to CurContext.
For class templates / nested classes, the caller should build a TypeSourceInfo that encodes the tag keyword, qualifier, name, and template arguments, and pass empty QualifierLoc / null ArgsAsWritten.
For function / variable templates, the caller should pass TypeAsWritten for the declared type, and separate QualifierLoc / ArgsAsWritten.
Definition at line 9346 of file SemaTemplate.cpp.
References clang::DeclContext::addDecl(), and clang::ExplicitInstantiationDecl::Create().
Referenced by clang::Sema::ActOnExplicitInstantiation(), clang::Sema::ActOnExplicitInstantiation(), and clang::Sema::ActOnExplicitInstantiation().
|
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 8063 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::UTF16, clang::UTF32, clang::UTF8, clang::VK_PRValue, and clang::Wide.
Referenced by clang::Sema::BuildExpressionFromNonTypeTemplateArgument(), and BuildExpressionFromNonTypeTemplateArgumentValue().
|
static |
Definition at line 8109 of file SemaTemplate.cpp.
References clang::APValue::AddrLabelDiff, clang::APValue::Array, BuildExpressionFromIntegralTemplateArgumentValue(), BuildExpressionFromNonTypeTemplateArgumentValue(), clang::Type::castAs(), clang::APValue::ComplexFloat, clang::APValue::ComplexInt, clang::Sema::Context, clang::ConstantExpr::Create(), clang::FloatingLiteral::Create(), clang::FixedPointLiteral::CreateFromRawInt(), clang::APValue::FixedPoint, clang::APValue::Float, clang::APValue::getComplexFloatImag(), clang::APValue::getComplexFloatReal(), clang::APValue::getComplexIntImag(), clang::APValue::getComplexIntReal(), clang::APValue::getFixedPoint(), clang::APValue::getFloat(), clang::APValue::getInt(), clang::APValue::getKind(), clang::APValue::getVectorElt(), clang::APValue::getVectorLength(), clang::APValue::Indeterminate, clang::APValue::Int, clang::APValue::LValue, clang::APValue::Matrix, clang::APValue::MemberPointer, clang::APValue::None, clang::Expr::setType(), clang::APValue::Struct, clang::APValue::Union, clang::APValue::Vector, clang::VK_LValue, and clang::VK_PRValue.
Referenced by clang::Sema::BuildExpressionFromNonTypeTemplateArgument(), and BuildExpressionFromNonTypeTemplateArgumentValue().
|
static |
Definition at line 3231 of file SemaTemplate.cpp.
References clang::TemplateArgumentListInfo::addArgument(), clang::QualType::addConst(), clang::ASTContext::BoolTy, builtinCommonTypeImpl(), clang::Sema::BuiltinDecay(), clang::Sema::CheckConditionalOperands(), clang::Sema::CheckTemplateIdType(), clang::Cond, clang::Sema::Context, clang::TemplateArgument::getAsType(), clang::ASTContext::getLangOpts(), clang::ASTContext::getTranslationUnitDecl(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::Sema::SFINAETrap::hasErrorOccurred(), clang::ASTContext::hasSameType(), clang::Type::isBuiltinType(), clang::Keyword, clang::OK_Ordinary, clang::Sema::Unevaluated, clang::VK_LValue, and clang::VK_PRValue.
Referenced by builtinCommonTypeImpl(), and checkBuiltinTemplateIdType().
|
static |
Definition at line 3421 of file SemaTemplate.cpp.
References clang::TemplateArgumentListInfo::addArgument(), builtinCommonTypeImpl(), clang::C, checkHLSLSpirvTypeOperand(), clang::Sema::CheckTemplateIdType(), clang::Sema::Context, clang::TemplateArgument::CreatePackCopy(), clang::SemaBase::Diag(), clang::TemplateArgument::getAsIntegral(), clang::Sema::getASTContext(), clang::BuiltinTemplateDecl::getBuiltinTemplateKind(), clang::TemplateArgument::getKind(), clang::TemplateArgument::getPackAsArray(), clang::TemplateDecl::getTemplateParameters(), clang::Sema::getTrivialTemplateArgumentLoc(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::TemplateArgument::isDependent(), clang::Type::isDependentType(), clang::Type::isIntegralType(), clang::QualType::isNull(), clang::Keyword, clang::TemplateArgument::Pack, clang::TemplateParameterList::size(), and clang::TemplateArgument::Type.
Referenced by clang::Sema::CheckTemplateIdType().
|
static |
Common checks for whether an explicit instantiation of D is valid.
Definition at line 10171 of file SemaTemplate.cpp.
References CheckExplicitInstantiationScope(), clang::SemaBase::Diag(), clang::NamedDecl::getFormalLinkage(), clang::Internal, and clang::TSK_ExplicitInstantiationDeclaration.
Referenced by clang::Sema::ActOnExplicitInstantiation(), clang::Sema::ActOnExplicitInstantiation(), and clang::Sema::ActOnExplicitInstantiation().
|
static |
Check the scope of an explicit instantiation.
Definition at line 10119 of file SemaTemplate.cpp.
References clang::Sema::CurContext, clang::SemaBase::Diag(), clang::DeclContext::Encloses(), clang::Decl::getDeclContext(), clang::DeclContext::getEnclosingNamespaceContext(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::DeclContext::getRedeclContext(), clang::DeclContext::InEnclosingNamespaceSetOf(), and clang::DeclContext::isRecord().
Referenced by CheckExplicitInstantiation().
|
static |
Definition at line 3380 of file SemaTemplate.cpp.
References clang::SemaBase::Diag(), clang::Type::getAsCanonical(), isInVkNamespace(), and clang::Sema::RequireCompleteType().
Referenced by checkBuiltinTemplateIdType().
|
static |
Definition at line 4247 of file SemaTemplate.cpp.
References clang::SemaBase::Diag(), Diag(), clang::Sema::getDiagnostics(), clang::sema::TemplateDeductionInfo::hasSFINAEDiagnostic(), clang::isa(), clang::Sema::isMoreSpecializedThanPrimary(), clang::Sema::MaybeEmitAmbiguousAtomicConstraintsDiagnostic(), clang::Sema::NoteTemplateLocation(), clang::sema::TemplateDeductionInfo::takeSFINAEDiagnostic(), and clang::Template.
Referenced by checkTemplatePartialSpecialization().
|
static |
Subroutine of Sema::CheckTemplatePartialSpecializationArgs that checks non-type template partial specialization arguments.
Definition at line 8650 of file SemaTemplate.cpp.
References CheckNonTypeTemplatePartialSpecializationArgs(), clang::Expr::containsErrors(), clang::SemaBase::Diag(), clang::TemplateArgument::Expression, findTemplateParameter(), findTemplateParameterInType(), clang::TemplateArgument::getAsExpr(), clang::SourceRange::getBegin(), clang::Stmt::getBeginLoc(), getKind(), clang::isa(), clang::OverloadExpr::isConceptReference(), clang::SourceRange::isValid(), clang::OverloadExpr::isVarDeclReference(), clang::Sema::NoteTemplateParameterLocation(), and clang::TemplateArgument::Pack.
Referenced by CheckNonTypeTemplatePartialSpecializationArgs(), and clang::Sema::CheckTemplatePartialSpecializationArgs().
|
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 6746 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().
|
static |
Checks whether the given template argument is compatible with its template parameter.
Definition at line 6689 of file SemaTemplate.cpp.
References clang::Type::castAs(), clang::Sema::Context, clang::SemaBase::Diag(), clang::Type::getAs(), clang::Stmt::getBeginLoc(), clang::QualType::getNonReferenceType(), clang::PointerType::getPointeeType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::ASTContext::hasSameUnqualifiedType(), clang::Type::isFunctionType(), clang::Type::isPointerType(), clang::Sema::IsQualificationConversion(), clang::Type::isReferenceType(), and clang::Sema::NoteTemplateParameterLocation().
Referenced by CheckTemplateArgumentAddressOfObjectOrFunction().
|
static |
Checks whether the given template argument is a pointer to member constant according to C++ [temp.arg.nontype]p1.
Definition at line 7009 of file SemaTemplate.cpp.
References clang::cast(), clang::Sema::Context, clang::SemaBase::Diag(), clang::SemaBase::DiagCompat(), clang::ActionResult< PtrTy, Compress >::get(), clang::Stmt::getBeginLoc(), clang::Decl::getCanonicalDecl(), clang::ASTContext::getCanonicalTemplateArgument(), clang::ASTContext::getCanonicalType(), clang::DeclRefExpr::getDecl(), clang::Expr::getExprLoc(), clang::Decl::getLocation(), clang::QualType::getNonReferenceType(), clang::DeclRefExpr::getQualifier(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::Expr::getValueKind(), clang::ASTContext::hasSameUnqualifiedType(), clang::Expr::IgnoreImpCasts(), clang::Sema::ImpCastExprToType(), clang::Invalid, clang::isa(), clang::Type::isMemberPointerType(), isNullPointerValueTemplateArgument(), clang::Sema::IsQualificationConversion(), clang::Expr::isTypeDependent(), clang::Expr::isValueDependent(), clang::Sema::NoteTemplateParameterLocation(), NPV_Error, NPV_NotNullPointer, NPV_NullPointer, and clang::Parens.
Referenced by clang::Sema::CheckTemplateArgument().
|
static |
Definition at line 4299 of file SemaTemplate.cpp.
References checkMoreSpecializedThanPrimary(), clang::SemaBase::Diag(), clang::isa(), clang::Sema::MarkUsedTemplateParameters(), and noteNonDeducibleParameters().
Referenced by clang::Sema::CheckTemplatePartialSpecialization(), and clang::Sema::CheckTemplatePartialSpecialization().
|
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).
| S | the semantic analysis object for which this check is being performed. |
| Specialized | the 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). |
| PrevDecl | the previous declaration of this entity, if any. |
| Loc | the location of the explicit specialization or instantiation of this entity. |
| IsPartialSpecialization | whether this is a partial specialization of a class template. |
Definition at line 8556 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().
|
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 3597 of file SemaTemplate.cpp.
References collectConjunctionTerms().
Referenced by collectConjunctionTerms(), and clang::Sema::findFailedBooleanCondition().
|
static |
Complete the explicit specialization of a member of a class template by updating the instantiated member to be marked as an explicit specialization.
| OrigD | The member declaration instantiated from the template. |
| Loc | The location of the explicit specialization of the member. |
Definition at line 10085 of file SemaTemplate.cpp.
References clang::TSK_ExplicitSpecialization, and clang::TSK_ImplicitInstantiation.
Referenced by clang::Sema::CompleteMemberSpecialization().
|
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 5522 of file SemaTemplate.cpp.
References clang::TypeLoc::getAs(), and clang::TemplateName::isNull().
Referenced by clang::Sema::CheckTemplateArgument().
|
static |
Determines whether a given type depends on the given parameter list.
Definition at line 2815 of file SemaTemplate.cpp.
References clang::TemplateParameterList::size().
Referenced by clang::Sema::MatchTemplateParametersToScopeSpecifier().
|
static |
Compute the diagnostic location for an explicit instantiation.
Definition at line 9362 of file SemaTemplate.cpp.
References clang::Decl::getASTContext(), clang::ASTContext::getExplicitInstantiationDecls(), clang::SourceLocation::isValid(), and clang::TSK_ExplicitInstantiationDefinition.
Referenced by clang::Sema::CheckSpecializationInstantiationRedecl().
|
static |
Diagnose the presence of a default template argument on a template parameter, which is ill-formed in certain contexts.
Definition at line 2335 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().
|
static |
Diagnose a missing template argument.
Definition at line 5820 of file SemaTemplate.cpp.
References clang::cast(), clang::Sema::DefaultArgument, clang::SemaBase::Diag(), clang::Sema::diagnoseMissingImport(), clang::NamedDecl::getMostRecentDecl(), clang::TemplateParameterList::getSourceRange(), clang::Sema::getTemplateNameKindForDiagnostics(), clang::TemplateDecl::getTemplateParameters(), clang::Sema::hasReachableDefaultArgument(), int, and clang::Sema::NoteTemplateLocation().
Referenced by clang::Sema::CheckTemplateArgumentList().
|
static |
Diagnose a known arity mismatch when comparing template argument lists.
Definition at line 8370 of file SemaTemplate.cpp.
References clang::SemaBase::Diag(), clang::TemplateParameterList::getRAngleLoc(), clang::TemplateParameterList::getTemplateLoc(), clang::SourceLocation::isValid(), New, clang::TemplateParameterList::size(), and clang::Sema::TPL_TemplateMatch.
Referenced by clang::Sema::TemplateParameterListsAreEqual().
|
static |
Check for unexpanded parameter packs within the template parameters of a template template parameter, recursively.
Definition at line 2386 of file SemaTemplate.cpp.
References clang::Sema::DiagnoseUnexpandedParameterPack(), DiagnoseUnexpandedParameterPacks(), clang::TemplateParameterList::getParam(), clang::TemplateDecl::getTemplateParameters(), clang::TemplateTemplateParmDecl::isParameterPack(), clang::TemplateParameterList::size(), clang::Sema::UPPC_NonTypeTemplateParameterType, and clang::Sema::UPPC_TypeConstraint.
Referenced by clang::Sema::checkExceptionSpecification(), and DiagnoseUnexpandedParameterPacks().
|
static |
Make a dllexport or dllimport attr on a class template specialization take effect.
Definition at line 10215 of file SemaTemplate.cpp.
References clang::CXXRecordDecl::bases(), clang::Sema::checkClassLevelDLLAttribute(), clang::Sema::DelayedDllExportClasses, clang::TypeDecl::getBeginLoc(), clang::getDLLAttr(), clang::Sema::propagateDLLAttrToBaseClassTemplate(), and clang::Sema::referenceDLLExportedClassMethods().
Referenced by clang::Sema::ActOnExplicitInstantiation().
|
static |
Definition at line 8638 of file SemaTemplate.cpp.
References clang::TypeLoc::getSourceRange(), clang::TypeLoc::getType(), clang::Type::isDependentType(), and clang::SourceLocation::isInvalid().
Referenced by CheckNonTypeTemplatePartialSpecializationArgs().
|
static |
Definition at line 8628 of file SemaTemplate.cpp.
References clang::Stmt::getSourceRange(), clang::SourceLocation::isInvalid(), and clang::Expr::isTypeDependent().
Referenced by CheckNonTypeTemplatePartialSpecializationArgs().
|
static |
Definition at line 1198 of file SemaTemplate.cpp.
References clang::TemplateArgumentListInfo::addArgument(), clang::CXXScopeSpec::Adopt(), clang::Sema::BuildCXXFoldExpr(), clang::Sema::CheckConceptTemplateId(), clang::Sema::CheckVarOrConceptTemplateTemplateId(), clang::ActionResult< PtrTy, Compress >::get(), clang::Sema::getTrivialTemplateArgumentLoc(), clang::Sema::inParameterMappingSubstitution(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::SourceLocation::isValid(), clang::TemplateArgumentListInfo::setLAngleLoc(), and clang::TemplateArgumentListInfo::setRAngleLoc().
Referenced by clang::Sema::AttachTypeConstraint(), and clang::Sema::AttachTypeConstraint().
|
static |
Definition at line 2826 of file SemaTemplate.cpp.
References clang::NestedNameSpecifierLoc::castAsTypeLoc(), clang::NestedNameSpecifierLoc::getAsNamespaceAndPrefix(), clang::NestedNameSpecifier::getAsType(), clang::NestedNameSpecifier::getKind(), clang::NestedNameSpecifierLoc::getNestedNameSpecifier(), clang::CXXScopeSpec::getScopeRep(), clang::TypeLoc::getSourceRange(), clang::CXXScopeSpec::location_data(), clang::NamespaceAndPrefixLoc::Prefix, and clang::NestedNameSpecifier::Type.
Referenced by clang::Sema::MatchTemplateParametersToScopeSpecifier().
|
static |
Determine what kind of template specialization the given declaration is.
Definition at line 8518 of file SemaTemplate.cpp.
References clang::VarDecl::getTemplateSpecializationKind(), and clang::TSK_Undeclared.
Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnVarTemplateSpecialization(), clang::Sema::CheckMemberSpecialization(), and clang::Sema::CheckSpecializationInstantiationRedecl().
|
static |
Determine whether this failed name lookup should be treated as being disabled by a usage of std::enable_if.
Definition at line 11292 of file SemaTemplate.cpp.
References clang::NestedNameSpecifierLoc::castAsTypeLoc(), clang::Cond, clang::TemplateArgument::Expression, clang::TypeLoc::getAs(), clang::DeclarationName::getAsIdentifierInfo(), clang::NamedDecl::getDeclName(), clang::NestedNameSpecifier::getKind(), clang::NestedNameSpecifierLoc::getNestedNameSpecifier(), clang::ConcreteTypeLoc< Base, Derived, TypeClass, LocalData >::getTypePtr(), clang::isa(), clang::IdentifierInfo::isStr(), and clang::NestedNameSpecifier::Type.
Referenced by clang::Sema::CheckTypenameType().
|
static |
Determine whether this alias template is "enable_if_t".
libc++ >=14 uses "__enable_if_t" in C++11 mode.
Definition at line 3586 of file SemaTemplate.cpp.
References clang::AliasTemplate.
Referenced by clang::Sema::CheckTemplateIdType().
|
static |
Definition at line 3368 of file SemaTemplate.cpp.
References clang::NamedDecl::getQualifiedNameAsString().
Referenced by checkHLSLSpirvTypeOperand().
|
static |
Determine whether the given template argument is a null pointer value of the appropriate type.
Definition at line 6583 of file SemaTemplate.cpp.
References clang::Sema::Context, clang::FixItHint::CreateInsertion(), clang::Sema::DefaultFunctionArrayConversion(), clang::Expr::EvalStatus::Diag, clang::SemaBase::Diag(), clang::Expr::EvaluateAsRValue(), clang::ActionResult< PtrTy, Compress >::get(), clang::APValue::getAsString(), clang::QualType::getAsString(), clang::Stmt::getBeginLoc(), clang::Stmt::getEndLoc(), clang::Expr::getExprLoc(), clang::Sema::getLangOpts(), clang::Sema::getLocForEndOfToken(), clang::APValue::getLValueBase(), clang::APValue::getMemberPointerDecl(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::ASTContext::hasSameUnqualifiedType(), clang::Expr::EvalStatus::HasSideEffects, clang::Sema::isCompleteType(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::APValue::isLValue(), clang::APValue::isMemberPointer(), clang::APValue::isNullPointer(), clang::Expr::isNullPointerConstant(), clang::Type::isNullPtrType(), clang::Sema::IsQualificationConversion(), clang::Expr::isTypeDependent(), clang::Expr::isValueDependent(), clang::Sema::NoteTemplateParameterLocation(), clang::Expr::NPC_NeverValueDependent, NPV_Error, NPV_NotNullPointer, NPV_NullPointer, and clang::Expr::EvalResult::Val.
Referenced by clang::Sema::CheckTemplateArgument(), CheckTemplateArgumentAddressOfObjectOrFunction(), and CheckTemplateArgumentPointerToMember().
|
static |
Definition at line 4208 of file SemaTemplate.cpp.
References clang::TemplateParameterList::getDepth(), clang::TemplateArgument::getKind(), clang::TemplateArgument::getPackExpansionPattern(), clang::TemplateParameterList::getParam(), clang::TemplateArgument::isPackExpansion(), clang::Decl::isParameterPack(), isTemplateArgumentTemplateParameter(), clang::TemplateArgument::Pack, clang::TemplateArgument::pack_begin(), clang::TemplateArgument::pack_size(), and clang::TemplateParameterList::size().
Referenced by clang::Sema::ActOnVarTemplateSpecialization().
|
static |
Definition at line 4169 of file SemaTemplate.cpp.
References clang::TemplateArgument::Declaration, clang::TemplateArgument::Expression, clang::Type::getAsCanonical(), clang::TemplateArgument::getAsExpr(), clang::TemplateName::getAsTemplateDecl(), clang::TemplateArgument::getAsTemplateOrTemplatePattern(), clang::TemplateArgument::getAsType(), clang::DeclRefExpr::getDecl(), clang::NonTypeTemplateParmDecl::getDepth(), clang::TemplateTemplateParmDecl::getDepth(), clang::NonTypeTemplateParmDecl::getIndex(), clang::TemplateTemplateParmDecl::getIndex(), clang::TemplateArgument::getKind(), clang::TemplateArgument::Integral, clang::TemplateArgument::Null, clang::TemplateArgument::NullPtr, clang::TemplateArgument::Pack, clang::TemplateArgument::StructuralValue, clang::TemplateArgument::Template, clang::TemplateArgument::TemplateExpansion, and clang::TemplateArgument::Type.
Referenced by isSameAsPrimaryTemplate().
|
static |
Definition at line 3613 of file SemaTemplate.cpp.
References clang::Cond, clang::Preprocessor::getImmediateMacroName(), clang::Expr::IgnoreParenImpCasts(), clang::isa(), and clang::SourceLocation::isMacroID().
Referenced by clang::Sema::findFailedBooleanCondition().
|
static |
Convert the parser's template argument list representation into our form.
Definition at line 1103 of file SemaTemplate.cpp.
References clang::TemplateIdAnnotation::getTemplateArgs(), clang::TemplateIdAnnotation::LAngleLoc, clang::TemplateIdAnnotation::NumArgs, clang::TemplateIdAnnotation::RAngleLoc, and clang::Sema::translateTemplateArguments().
Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnExplicitInstantiation(), clang::Sema::ActOnVarTemplateSpecialization(), and clang::Sema::BuildTypeConstraint().
|
static |
Match two template parameters within template parameter lists.
Definition at line 8221 of file SemaTemplate.cpp.
References clang::Sema::AreConstraintExpressionsEqual(), clang::cast(), clang::Sema::Context, clang::SemaBase::Diag(), clang::Decl::getBeginLoc(), clang::Stmt::getBeginLoc(), clang::Decl::getKind(), clang::Decl::getLocation(), clang::TemplateDecl::getTemplateParameters(), clang::ValueDecl::getType(), clang::ASTContext::getUnconstrainedType(), clang::ASTContext::hasSameType(), clang::isa(), clang::Type::isDependentType(), clang::Decl::isParameterPack(), clang::Decl::isTemplateParameterPack(), clang::SourceLocation::isValid(), New, clang::TemplateTemplateParmDecl::templateParameterKind(), clang::Sema::TemplateParameterListsAreEqual(), clang::Sema::TPL_TemplateMatch, clang::Sema::TPL_TemplateParamsEquivalent, and clang::Sema::TPL_TemplateTemplateParmMatch.
Referenced by clang::Sema::TemplateParameterListsAreEqual().
|
static |
Definition at line 987 of file SemaTemplate.cpp.
References clang::Sema::DiagnoseTemplateParameterShadow(), ForVisibleRedeclaration, clang::Decl::isTemplateParameter(), clang::Sema::LookupOrdinaryName, and clang::Sema::LookupSingleName().
Referenced by clang::Sema::ActOnNonTypeTemplateParameter(), clang::Sema::ActOnTemplateTemplateParameter(), and clang::Sema::ActOnTypeParameter().
|
static |
Definition at line 7910 of file SemaTemplate.cpp.
References clang::SemaBase::Diag(), clang::Decl::getLocation(), clang::Sema::getPrintingPolicy(), clang::SourceLocation::isValid(), clang::Decl::print(), and clang::PrintingPolicy::TerseOutput.
Referenced by clang::Sema::NoteTemplateLocation(), and clang::Sema::NoteTemplateParameterLocation().
|
static |
Definition at line 4282 of file SemaTemplate.cpp.
References clang::SemaBase::Diag(), and clang::TemplateParameterList::getParam().
Referenced by clang::Sema::CheckDeductionGuideTemplate(), and checkTemplatePartialSpecialization().
|
static |
Definition at line 9227 of file SemaTemplate.cpp.
References clang::C, clang::LookupResult::Filter::done(), clang::LookupResult::Filter::erase(), clang::Found, clang::LookupResult::Filter::hasNext(), and clang::LookupResult::Filter::next().
Referenced by clang::Sema::ActOnFinishConceptDefinition().
|
static |
Definition at line 3723 of file SemaTemplate.cpp.
References clang::Sema::Context, clang::Sema::CorrectTypo(), clang::Sema::diagnoseTypo(), clang::ErrorRecovery, clang::getAsTypeTemplateDecl(), clang::TypoCorrection::getCorrectionDecl(), clang::TypoCorrection::getCorrectionDeclAs(), clang::AssumedTemplateStorage::getDeclName(), clang::TypoCorrection::getFoundDecl(), clang::ASTContext::getQualifiedTemplateName(), clang::Sema::LookupOrdinaryName, clang::SemaBase::PDiag(), and clang::TemplateName.
Referenced by clang::Sema::ActOnUndeclaredTypeTemplateName(), and clang::Sema::CheckTemplateIdType().
|
static |
Determine whether the given scope specifier has a template-id in it.
Definition at line 10194 of file SemaTemplate.cpp.
References clang::NestedNameSpecifier::getAsType(), clang::NestedNameSpecifier::getKind(), clang::CXXScopeSpec::getScopeRep(), clang::isa(), and clang::NestedNameSpecifier::Type.
Referenced by clang::Sema::ActOnExplicitInstantiation(), and clang::Sema::ActOnExplicitInstantiation().
|
static |
Definition at line 1893 of file SemaTemplate.cpp.
References clang::Sema::Context, clang::CXXScopeSpec::getWithLocInContext(), and clang::CXXScopeSpec::isSet().
Strips various properties off an implicit instantiation that has just been explicitly specialized.
Definition at line 9328 of file SemaTemplate.cpp.
References clang::cast(), clang::Decl::dropAttrs(), and clang::isa().
Referenced by clang::Sema::CheckSpecializationInstantiationRedecl().
|
static |
Substitute template arguments into the default template argument for the given template template parameter.
| SemaRef | the semantic analysis object for which we are performing the substitution. |
| Template | the template that we are synthesizing template arguments for. |
| TemplateLoc | the location of the template name that started the template-id we are checking. |
| RAngleLoc | the location of the right angle bracket ('>') that terminates the template-id. |
| Param | the template template parameter whose default we are substituting into. |
| Converted | the list of template arguments provided for template parameters that precede Param in the template parameter list. |
| QualifierLoc | Will be set to the nested-name-specifier (with source-location information) that precedes the template name. |
Definition at line 5438 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.
|
static |
Substitute template arguments into the default template argument for the given non-type template parameter.
| SemaRef | the semantic analysis object for which we are performing the substitution. |
| Template | the template that we are synthesizing template arguments for. |
| TemplateLoc | the location of the template name that started the template-id we are checking. |
| RAngleLoc | the location of the right angle bracket ('>') that terminates the template-id. |
| Param | the non-type template parameter whose default we are substituting into. |
| Converted | the list of template arguments provided for template parameters that precede Param in the template parameter list. |
Definition at line 5388 of file SemaTemplate.cpp.
References clang::MultiLevelTemplateArgumentList::addOuterTemplateArguments(), clang::Sema::ConstantEvaluated, clang::Sema::InstantiatingTemplate::isInvalid(), clang::Sema::SubstTemplateArgument(), and clang::Template.
|
static |
Substitute template arguments into the default template argument for the given template type parameter.
| SemaRef | the semantic analysis object for which we are performing the substitution. |
| Template | the template that we are synthesizing template arguments for. |
| TemplateLoc | the location of the template name that started the template-id we are checking. |
| RAngleLoc | the location of the right angle bracket ('>') that terminates the template-id. |
| Param | the template template parameter whose default we are substituting into. |
| Converted | the list of template arguments provided for template parameters that precede Param in the template parameter list. |
| Output | the resulting substituted template argument. |
Definition at line 5328 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().
|
static |
Definition at line 946 of file SemaTemplate.cpp.
References clang::Sema::Context, clang::OpaquePtr< PtrTy >::get(), clang::ParsedTemplateArgument::getAsExpr(), clang::ParsedTemplateArgument::getAsTemplate(), clang::ParsedTemplateArgument::getAsType(), clang::ParsedTemplateArgument::getEllipsisLoc(), clang::ParsedTemplateArgument::getKind(), clang::ParsedTemplateArgument::getNameLoc(), clang::ParsedTemplateArgument::getScopeSpec(), clang::ParsedTemplateArgument::getTemplateKwLoc(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::Sema::GetTypeFromParser(), clang::CXXScopeSpec::getWithLocInContext(), clang::SourceLocation::isValid(), clang::ParsedTemplateArgument::NonType, clang::ParsedTemplateArgument::Template, clang::Template, and clang::ParsedTemplateArgument::Type.
Referenced by clang::Sema::ActOnTemplateTemplateParameter(), and clang::Sema::translateTemplateArguments().