clang 22.0.0git
|
#include "TreeTransform.h"
#include "TypeLocBuilder.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTLambda.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclAccessPair.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/DynamicRecursiveASTVisitor.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/AST/TemplateBase.h"
#include "clang/AST/TemplateName.h"
#include "clang/AST/Type.h"
#include "clang/AST/TypeLoc.h"
#include "clang/AST/TypeOrdering.h"
#include "clang/AST/UnresolvedSet.h"
#include "clang/Basic/AddressSpaces.h"
#include "clang/Basic/ExceptionSpecificationType.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/Specifiers.h"
#include "clang/Basic/TemplateKinds.h"
#include "clang/Sema/EnterExpressionEvaluationContext.h"
#include "clang/Sema/Ownership.h"
#include "clang/Sema/Sema.h"
#include "clang/Sema/Template.h"
#include "clang/Sema/TemplateDeduction.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/SaveAndRestore.h"
#include <algorithm>
#include <cassert>
#include <optional>
#include <tuple>
#include <type_traits>
#include <utility>
#include "clang/AST/TypeNodes.inc"
Go to the source code of this file.
Classes | |
class | NonTypeOrVarTemplateParmDecl |
struct | clang::DeducedPack |
A pack that we're currently deducing. More... | |
struct | IsPartialSpecialization< T > |
struct | IsPartialSpecialization< ClassTemplatePartialSpecializationDecl > |
struct | IsPartialSpecialization< VarTemplatePartialSpecializationDecl > |
Namespaces | |
namespace | clang |
The JSON file list parser is used to communicate input to InstallAPI. |
Macros | |
#define | NON_CANONICAL_TYPE(Class, Base) |
#define | TYPE(Class, Base) |
#define | TYPE(Class, Base) |
#define | ABSTRACT_TYPE(Class, Base) |
#define | DEPENDENT_TYPE(Class, Base) |
#define | NON_CANONICAL_TYPE(Class, Base) |
Enumerations | |
enum | clang::TemplateDeductionFlags { clang::TDF_None = 0 , clang::TDF_ParamWithReferenceType = 0x1 , clang::TDF_IgnoreQualifiers = 0x02 , clang::TDF_DerivedClass = 0x04 , clang::TDF_SkipNonDependent = 0x08 , clang::TDF_TopLevelParameterTypeList = 0x10 , clang::TDF_AllowCompatibleFunctionType = 0x20 , clang::TDF_ArgWithReferenceType = 0x40 } |
Various flags that control template argument deduction. More... | |
enum class | PartialOrderingKind { None , NonCall , Call } |
The kind of PartialOrdering we're performing template argument deduction for (C++11 [temp.deduct.partial]). More... | |
enum class | PackFold { ParameterToArgument , ArgumentToParameter , Both } |
What directions packs are allowed to match non-packs. More... | |
enum class | MoreSpecializedTrailingPackTieBreakerResult { Equal , Less , More } |
Functions | |
static TemplateDeductionResult | DeduceTemplateArgumentsByTypeMatch (Sema &S, TemplateParameterList *TemplateParams, QualType P, QualType A, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced, unsigned TDF, PartialOrderingKind POK, bool DeducedFromArrayBound, bool *HasDeducedAnyParam) |
Deduce the template arguments by comparing the parameter type and the argument type (C++ [temp.deduct.type]). | |
static TemplateDeductionResult | DeduceTemplateArguments (Sema &S, TemplateParameterList *TemplateParams, ArrayRef< TemplateArgument > Ps, ArrayRef< TemplateArgument > As, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced, bool NumberOfArgumentsMustMatch, bool PartialOrdering, PackFold PackFold, bool *HasDeducedAnyParam) |
static void | MarkUsedTemplateParameters (ASTContext &Ctx, const TemplateArgument &TemplateArg, bool OnlyDeduced, unsigned Depth, llvm::SmallBitVector &Used) |
Mark the template parameters that are used by this template argument. | |
static void | MarkUsedTemplateParameters (ASTContext &Ctx, QualType T, bool OnlyDeduced, unsigned Depth, llvm::SmallBitVector &Used) |
Mark the template parameters that are used by the given type. | |
static const Expr * | unwrapExpressionForDeduction (const Expr *E) |
static NonTypeOrVarTemplateParmDecl | getDeducedNTTParameterFromExpr (const Expr *E, unsigned Depth) |
If the given expression is of a form that permits the deduction of a non-type template parameter, return the declaration of that non-type template parameter. | |
static const NonTypeOrVarTemplateParmDecl | getDeducedNTTParameterFromExpr (TemplateDeductionInfo &Info, Expr *E) |
static bool | isSameDeclaration (Decl *X, Decl *Y) |
Determine whether two declaration pointers refer to the same declaration. | |
static DeducedTemplateArgument | checkDeducedTemplateArguments (ASTContext &Context, const DeducedTemplateArgument &X, const DeducedTemplateArgument &Y, bool AggregateCandidateDeduction=false) |
Verify that the given, deduced template arguments are compatible. | |
static TemplateDeductionResult | DeduceNonTypeTemplateArgument (Sema &S, TemplateParameterList *TemplateParams, const NonTypeOrVarTemplateParmDecl NTTP, const DeducedTemplateArgument &NewDeduced, QualType ValueType, TemplateDeductionInfo &Info, bool PartialOrdering, SmallVectorImpl< DeducedTemplateArgument > &Deduced, bool *HasDeducedAnyParam) |
Deduce the value of the given non-type template parameter as the given deduced template argument. | |
static TemplateDeductionResult | DeduceNonTypeTemplateArgument (Sema &S, TemplateParameterList *TemplateParams, NonTypeOrVarTemplateParmDecl NTTP, const llvm::APSInt &Value, QualType ValueType, bool DeducedFromArrayBound, TemplateDeductionInfo &Info, bool PartialOrdering, SmallVectorImpl< DeducedTemplateArgument > &Deduced, bool *HasDeducedAnyParam) |
Deduce the value of the given non-type template parameter from the given integral constant. | |
static TemplateDeductionResult | DeduceNullPtrTemplateArgument (Sema &S, TemplateParameterList *TemplateParams, NonTypeOrVarTemplateParmDecl NTTP, QualType NullPtrType, TemplateDeductionInfo &Info, bool PartialOrdering, SmallVectorImpl< DeducedTemplateArgument > &Deduced, bool *HasDeducedAnyParam) |
Deduce the value of the given non-type template parameter from the given null pointer template argument type. | |
static TemplateDeductionResult | DeduceNonTypeTemplateArgument (Sema &S, TemplateParameterList *TemplateParams, NonTypeOrVarTemplateParmDecl NTTP, Expr *Value, TemplateDeductionInfo &Info, bool PartialOrdering, SmallVectorImpl< DeducedTemplateArgument > &Deduced, bool *HasDeducedAnyParam) |
Deduce the value of the given non-type template parameter from the given type- or value-dependent expression. | |
static TemplateDeductionResult | DeduceNonTypeTemplateArgument (Sema &S, TemplateParameterList *TemplateParams, NonTypeOrVarTemplateParmDecl NTTP, ValueDecl *D, QualType T, TemplateDeductionInfo &Info, bool PartialOrdering, SmallVectorImpl< DeducedTemplateArgument > &Deduced, bool *HasDeducedAnyParam) |
Deduce the value of the given non-type template parameter from the given declaration. | |
static TemplateDeductionResult | DeduceTemplateArguments (Sema &S, TemplateParameterList *TemplateParams, TemplateName Param, TemplateName Arg, TemplateDeductionInfo &Info, ArrayRef< TemplateArgument > DefaultArguments, bool PartialOrdering, SmallVectorImpl< DeducedTemplateArgument > &Deduced, bool *HasDeducedAnyParam) |
static const TemplateSpecializationType * | getLastTemplateSpecType (QualType QT) |
Deduce the template arguments by comparing the template parameter type (which is a template-id) with the template argument type. | |
static TemplateDeductionResult | DeduceTemplateSpecArguments (Sema &S, TemplateParameterList *TemplateParams, const QualType P, QualType A, TemplateDeductionInfo &Info, bool PartialOrdering, SmallVectorImpl< DeducedTemplateArgument > &Deduced, bool *HasDeducedAnyParam) |
static bool | IsPossiblyOpaquelyQualifiedTypeInternal (const Type *T) |
static bool | IsPossiblyOpaquelyQualifiedType (QualType T) |
Determines whether the given type is an opaque type that might be more qualified when instantiated. | |
static TemplateParameter | makeTemplateParameter (Decl *D) |
Helper function to build a TemplateParameter when we don't know its type statically. | |
template<class T> | |
static TemplateDeductionResult | DeduceForEachType (Sema &S, TemplateParameterList *TemplateParams, ArrayRef< QualType > Params, ArrayRef< QualType > Args, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced, PartialOrderingKind POK, bool FinishingDeduction, T &&DeductFunc) |
static TemplateDeductionResult | DeduceTemplateArguments (Sema &S, TemplateParameterList *TemplateParams, ArrayRef< QualType > Params, ArrayRef< QualType > Args, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced, unsigned TDF, PartialOrderingKind POK, bool *HasDeducedAnyParam, llvm::SmallBitVector *HasDeducedParam) |
Deduce the template arguments by comparing the list of parameter types to the list of argument types, as in the parameter-type-lists of function types (C++ [temp.deduct.type]p10). | |
static bool | hasInconsistentOrSupersetQualifiersOf (QualType ParamType, QualType ArgType) |
Determine whether the parameter has qualifiers that the argument lacks. | |
static unsigned | getFirstInnerIndex (FunctionTemplateDecl *FTD) |
Get the index of the first template parameter that was originally from the innermost template-parameter-list. | |
static bool | isForwardingReference (QualType Param, unsigned FirstInnerIndex) |
Determine whether a type denotes a forwarding reference. | |
static TemplateDeductionResult | DeduceTemplateBases (Sema &S, const CXXRecordDecl *RD, TemplateParameterList *TemplateParams, QualType P, TemplateDeductionInfo &Info, bool PartialOrdering, SmallVectorImpl< DeducedTemplateArgument > &Deduced, bool *HasDeducedAnyParam) |
Attempt to deduce the template arguments by checking the base types according to (C++20 [temp.deduct.call] p4b3. | |
static PartialOrderingKind | degradeCallPartialOrderingKind (PartialOrderingKind POK) |
When propagating a partial ordering kind into a NonCall context, this is used to downgrade a 'Call' into a 'NonCall', so that the kind still reflects whether we are in a partial ordering context. | |
static TemplateDeductionResult | DeduceTemplateArguments (Sema &S, TemplateParameterList *TemplateParams, const TemplateArgument &P, TemplateArgument A, TemplateDeductionInfo &Info, bool PartialOrdering, SmallVectorImpl< DeducedTemplateArgument > &Deduced, bool *HasDeducedAnyParam) |
static bool | hasTemplateArgumentForDeduction (ArrayRef< TemplateArgument > &Args, unsigned &ArgIdx) |
Determine whether there is a template argument to be used for deduction. | |
static bool | hasPackExpansionBeforeEnd (ArrayRef< TemplateArgument > Args) |
Determine whether the given set of template arguments has a pack expansion that is not the last template argument. | |
static bool | ConvertDeducedTemplateArgument (Sema &S, NamedDecl *Param, DeducedTemplateArgument Arg, NamedDecl *Template, TemplateDeductionInfo &Info, bool IsDeduced, Sema::CheckTemplateArgumentInfo &CTAI) |
Convert the given deduced template argument and add it to the set of fully-converted template arguments. | |
static TemplateDeductionResult | ConvertDeducedTemplateArguments (Sema &S, NamedDecl *Template, TemplateParameterList *TemplateParams, bool IsDeduced, SmallVectorImpl< DeducedTemplateArgument > &Deduced, TemplateDeductionInfo &Info, Sema::CheckTemplateArgumentInfo &CTAI, LocalInstantiationScope *CurrentInstantiationScope, unsigned NumAlreadyConverted, bool *IsIncomplete) |
static DeclContext * | getAsDeclContextOrEnclosing (Decl *D) |
static TemplateDeductionResult | CheckDeducedArgumentConstraints (Sema &S, NamedDecl *Template, ArrayRef< TemplateArgument > SugaredDeducedArgs, ArrayRef< TemplateArgument > CanonicalDeducedArgs, TemplateDeductionInfo &Info) |
static TemplateDeductionResult | FinishTemplateArgumentDeduction (Sema &S, NamedDecl *Entity, TemplateParameterList *EntityTPL, TemplateDecl *Template, bool PartialOrdering, ArrayRef< TemplateArgumentLoc > Ps, ArrayRef< TemplateArgument > As, SmallVectorImpl< DeducedTemplateArgument > &Deduced, TemplateDeductionInfo &Info, bool CopyDeducedArgs) |
Complete template argument deduction. | |
static TemplateDeductionResult | FinishTemplateArgumentDeduction (Sema &S, NamedDecl *Entity, TemplateParameterList *EntityTPL, TemplateDecl *Template, bool PartialOrdering, ArrayRef< TemplateArgument > Ps, ArrayRef< TemplateArgument > As, SmallVectorImpl< DeducedTemplateArgument > &Deduced, TemplateDeductionInfo &Info, bool CopyDeducedArgs) |
static TemplateDeductionResult | FinishTemplateArgumentDeduction (Sema &S, TemplateDecl *TD, SmallVectorImpl< DeducedTemplateArgument > &Deduced, TemplateDeductionInfo &Info) |
Complete template argument deduction for DeduceTemplateArgumentsFromType. | |
template<typename T> | |
static std::enable_if_t< IsPartialSpecialization< T >::value, TemplateDeductionResult > | DeduceTemplateArguments (Sema &S, T *Partial, ArrayRef< TemplateArgument > TemplateArgs, TemplateDeductionInfo &Info) |
Perform template argument deduction to determine whether the given template arguments match the given class or variable template partial specialization per C++ [temp.class.spec.match]. | |
static bool | isSimpleTemplateIdType (QualType T) |
Determine whether the given type T is a simple-template-id type. | |
static TemplateDeductionResult | CheckOriginalCallArgDeduction (Sema &S, TemplateDeductionInfo &Info, Sema::OriginalCallArg OriginalArg, QualType DeducedA) |
Check whether the deduced argument type for a call to a function template matches the actual argument type per C++ [temp.deduct.call]p4. | |
static UnsignedOrNone | getPackIndexForParam (Sema &S, FunctionTemplateDecl *FunctionTemplate, const MultiLevelTemplateArgumentList &Args, unsigned ParamIdx) |
Find the pack index for a particular parameter index in an instantiation of a function template with specific arguments. | |
static TemplateDeductionResult | instantiateExplicitSpecifierDeferred (Sema &S, FunctionDecl *Specialization, const MultiLevelTemplateArgumentList &SubstArgs, TemplateDeductionInfo &Info, FunctionTemplateDecl *FunctionTemplate, ArrayRef< TemplateArgument > DeducedArgs) |
static QualType | GetTypeOfFunction (Sema &S, const OverloadExpr::FindResult &R, FunctionDecl *Fn) |
Gets the type of a function for template-argument-deducton purposes when it's considered as part of an overload set. | |
static QualType | ResolveOverloadForDeduction (Sema &S, TemplateParameterList *TemplateParams, Expr *Arg, QualType ParamType, bool ParamWasReference, TemplateSpecCandidateSet *FailedTSC=nullptr) |
Apply the deduction rules for overload sets. | |
static bool | AdjustFunctionParmAndArgTypesForDeduction (Sema &S, TemplateParameterList *TemplateParams, unsigned FirstInnerIndex, QualType &ParamType, QualType &ArgType, Expr::Classification ArgClassification, Expr *Arg, unsigned &TDF, TemplateSpecCandidateSet *FailedTSC=nullptr) |
Perform the adjustments to the parameter and argument types described in C++ [temp.deduct.call]. | |
static bool | hasDeducibleTemplateParameters (Sema &S, FunctionTemplateDecl *FunctionTemplate, QualType T) |
static TemplateDeductionResult | DeduceTemplateArgumentsFromCallArgument (Sema &S, TemplateParameterList *TemplateParams, unsigned FirstInnerIndex, QualType ParamType, QualType ArgType, Expr::Classification ArgClassification, Expr *Arg, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced, SmallVectorImpl< Sema::OriginalCallArg > &OriginalCallArgs, bool DecomposedParam, unsigned ArgIdx, unsigned TDF, TemplateSpecCandidateSet *FailedTSC) |
Perform template argument deduction per [temp.deduct.call] for a single parameter / argument pair. | |
static TemplateDeductionResult | DeduceFromInitializerList (Sema &S, TemplateParameterList *TemplateParams, QualType AdjustedParamType, InitListExpr *ILE, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced, SmallVectorImpl< Sema::OriginalCallArg > &OriginalCallArgs, unsigned ArgIdx, unsigned TDF) |
Attempt template argument deduction from an initializer list deemed to be an argument in a function call. | |
static bool | CheckDeducedPlaceholderConstraints (Sema &S, const AutoType &Type, AutoTypeLoc TypeLoc, QualType Deduced) |
static QualType | GetImplicitObjectParameterType (ASTContext &Context, const CXXMethodDecl *Method, QualType RawType, bool IsOtherRvr) |
static TemplateDeductionResult | CheckDeductionConsistency (Sema &S, FunctionTemplateDecl *FTD, UnsignedOrNone ArgIdx, QualType P, QualType A, ArrayRef< TemplateArgument > DeducedArgs, bool CheckConsistency) |
template<class T> | |
static TemplateDeductionResult | FinishTemplateArgumentDeduction (Sema &S, FunctionTemplateDecl *FTD, SmallVectorImpl< DeducedTemplateArgument > &Deduced, TemplateDeductionInfo &Info, T &&CheckDeductionConsistency) |
static bool | isAtLeastAsSpecializedAs (Sema &S, SourceLocation Loc, FunctionTemplateDecl *FT1, FunctionTemplateDecl *FT2, TemplatePartialOrderingContext TPOC, ArrayRef< QualType > Args1, ArrayRef< QualType > Args2, bool Args1Offset) |
Determine whether the function template FT1 is at least as specialized as FT2 . | |
static MoreSpecializedTrailingPackTieBreakerResult | getMoreSpecializedTrailingPackTieBreaker (const TemplateSpecializationType *TST1, const TemplateSpecializationType *TST2) |
template<typename TemplateLikeDecl> | |
static bool | isAtLeastAsSpecializedAs (Sema &S, QualType T1, QualType T2, TemplateLikeDecl *P2, TemplateDecl *Template, TemplateDeductionInfo &Info) |
Determine whether one template specialization, P1, is at least as specialized than another, P2. | |
template<typename TemplateLikeDecl, typename PrimaryDel> | |
static TemplateLikeDecl * | getMoreSpecialized (Sema &S, QualType T1, QualType T2, TemplateLikeDecl *P1, PrimaryDel *P2, TemplateDeductionInfo &Info) |
Returns the more specialized template specialization between T1/P1 and T2/P2. | |
static void | MarkUsedTemplateParameters (ASTContext &Ctx, const Expr *E, bool OnlyDeduced, unsigned Depth, llvm::SmallBitVector &Used) |
Mark the template parameters that are used by the given expression. | |
static void | MarkUsedTemplateParameters (ASTContext &Ctx, NestedNameSpecifier NNS, bool OnlyDeduced, unsigned Depth, llvm::SmallBitVector &Used) |
Mark the template parameters that are used by the given nested name specifier. | |
static void | MarkUsedTemplateParameters (ASTContext &Ctx, TemplateName Name, bool OnlyDeduced, unsigned Depth, llvm::SmallBitVector &Used) |
Mark the template parameters that are used by the given template name. |
#define ABSTRACT_TYPE | ( | Class, | |
Base ) |
#define DEPENDENT_TYPE | ( | Class, | |
Base ) |
#define NON_CANONICAL_TYPE | ( | Class, | |
Base ) |
#define NON_CANONICAL_TYPE | ( | Class, | |
Base ) |
#define TYPE | ( | Class, | |
Base ) |
#define TYPE | ( | Class, | |
Base ) |
|
strong |
Enumerator | |
---|---|
Equal | |
Less | |
More |
Definition at line 5863 of file SemaTemplateDeduction.cpp.
|
strong |
What directions packs are allowed to match non-packs.
Enumerator | |
---|---|
ParameterToArgument | |
ArgumentToParameter | |
Both |
Definition at line 130 of file SemaTemplateDeduction.cpp.
|
strong |
The kind of PartialOrdering we're performing template argument deduction for (C++11 [temp.deduct.partial]).
Enumerator | |
---|---|
None | |
NonCall | |
Call |
Definition at line 120 of file SemaTemplateDeduction.cpp.
|
static |
Perform the adjustments to the parameter and argument types described in C++ [temp.deduct.call].
Definition at line 4305 of file SemaTemplateDeduction.cpp.
References clang::Type::castAs(), clang::Sema::Context, clang::ASTContext::getAddrSpaceQualType(), clang::Type::getAs(), clang::Sema::getCompletedType(), clang::ASTContext::getDecayedType(), clang::ASTContext::getDefaultOpenCLPointeeAddrSpace(), clang::Sema::getLangOpts(), clang::ASTContext::getLValueReferenceType(), clang::PointerType::getPointeeType(), clang::ReferenceType::getPointeeType(), clang::QualType::getUnqualifiedType(), clang::QualType::hasQualifiers(), isForwardingReference(), clang::Expr::Classification::isLValue(), isSimpleTemplateIdType(), clang::ASTContext::OverloadTy, ResolveOverloadForDeduction(), clang::TDF_DerivedClass, clang::TDF_IgnoreQualifiers, clang::TDF_ParamWithReferenceType, and clang::TDF_SkipNonDependent.
Referenced by DeduceTemplateArgumentsFromCallArgument().
|
static |
Definition at line 3204 of file SemaTemplateDeduction.cpp.
References clang::sema::TemplateDeductionInfo::AssociatedConstraintsSatisfaction, clang::cast(), clang::Sema::CheckConstraintSatisfaction(), clang::ConstraintsNotSatisfied, clang::Sema::Context, clang::TemplateArgumentList::CreateCopy(), clang::sema::TemplateDeductionInfo::getLocation(), clang::Sema::getTemplateInstantiationArgs(), clang::ConstraintSatisfaction::IsSatisfied, clang::MultiLevelTemplateArgumentList::replaceInnermostTemplateArguments(), clang::sema::TemplateDeductionInfo::reset(), clang::Success, and clang::Template.
Referenced by FinishTemplateArgumentDeduction().
|
static |
Definition at line 5168 of file SemaTemplateDeduction.cpp.
References clang::TemplateArgumentListInfo::addArgument(), clang::C, clang::Sema::CheckTemplateArgumentInfo::CanonicalConverted, clang::cast(), clang::Sema::CheckConstraintSatisfaction(), clang::Sema::CheckTemplateArgumentList(), clang::Concept, clang::Sema::Context, clang::ImplicitConceptSpecializationDecl::Create(), clang::SemaBase::Diag(), clang::Sema::DiagnoseUnsatisfiedConstraint(), clang::Sema::getASTContext(), clang::TypeLoc::getLocalSourceRange(), clang::Sema::getPrintingPolicy(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::ConstraintSatisfaction::IsSatisfied, and clang::Sema::Unevaluated.
Referenced by clang::Sema::DeduceAutoType().
|
static |
Verify that the given, deduced template arguments are compatible.
Definition at line 282 of file SemaTemplateDeduction.cpp.
References checkDeducedTemplateArguments(), clang::TemplateArgument::CreatePackCopy(), clang::TemplateArgument::Declaration, clang::TemplateArgument::Expression, clang::TemplateArgument::getAsDecl(), clang::TemplateArgument::getAsExpr(), clang::TemplateArgument::getAsIntegral(), clang::TemplateArgument::getAsTemplate(), clang::TemplateArgument::getAsTemplateOrTemplatePattern(), clang::TemplateArgument::getAsType(), clang::TemplateArgument::getKind(), clang::TemplateArgument::getNonTypeTemplateArgumentType(), clang::TemplateArgument::getNullPtrType(), clang::Expr::getType(), clang::TemplateArgument::Integral, clang::QualType::isNull(), clang::TemplateArgument::isNull(), isSameDeclaration(), clang::TemplateArgument::Null, clang::TemplateArgument::NullPtr, clang::TemplateArgument::Pack, clang::TemplateArgument::pack_begin(), clang::TemplateArgument::pack_end(), clang::TemplateArgument::pack_size(), clang::Stmt::Profile(), clang::TemplateArgument::StructuralValue, clang::TemplateArgument::Template, clang::TemplateArgument::TemplateExpansion, clang::TemplateArgument::Type, clang::DeducedTemplateArgument::wasDeducedFromArrayBound(), and X.
Referenced by checkDeducedTemplateArguments(), DeduceNonTypeTemplateArgument(), DeduceTemplateArguments(), and DeduceTemplateArgumentsByTypeMatch().
|
static |
Definition at line 5585 of file SemaTemplateDeduction.cpp.
References clang::Sema::Context, clang::Type::getAsCanonical(), clang::QualType::getCanonicalType(), clang::NamedDecl::getDeclName(), clang::Decl::getLocation(), clang::QualType::getNonReferenceType(), getPackIndexForParam(), clang::FunctionTemplateDecl::getTemplatedDecl(), clang::ASTContext::getUnqualifiedArrayType(), clang::ASTContext::hasSameType(), clang::Incomplete, clang::isa(), clang::QualType::isNull(), clang::NonDeducedMismatch, clang::SubstitutionFailure, clang::Sema::SubstType(), and clang::Success.
Referenced by FinishTemplateArgumentDeduction().
|
static |
Check whether the deduced argument type for a call to a function template matches the actual argument type per C++ [temp.deduct.call]p4.
Definition at line 3763 of file SemaTemplateDeduction.cpp.
References clang::Sema::OriginalCallArg::ArgIdx, clang::sema::TemplateDeductionInfo::CallArgIndex, clang::Qualifiers::compatiblyIncludes(), clang::Sema::Context, clang::Sema::OriginalCallArg::DecomposedParam, clang::DeducedMismatch, clang::DeducedMismatchNested, clang::sema::TemplateDeductionInfo::FirstArg, clang::Type::getAs(), clang::Sema::getASTContext(), clang::Sema::getLangOpts(), clang::sema::TemplateDeductionInfo::getLocation(), clang::Qualifiers::getObjCLifetime(), clang::Type::getPointeeType(), clang::QualType::getQualifiers(), clang::QualType::getUnqualifiedType(), clang::Qualifiers::hasConst(), clang::Type::isAnyPointerType(), clang::Sema::IsDerivedFrom(), clang::Sema::IsFunctionConversion(), clang::Type::isFunctionType(), clang::Type::isMemberPointerType(), clang::Sema::IsQualificationConversion(), clang::Type::isRecordType(), isSimpleTemplateIdType(), clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_None, clang::Qualifiers::OCL_Strong, clang::Sema::OriginalCallArg::OriginalArgType, clang::Sema::OriginalCallArg::OriginalParamType, clang::sema::TemplateDeductionInfo::SecondArg, clang::Qualifiers::setObjCLifetime(), and clang::Success.
Referenced by clang::Sema::DeduceAutoType(), and clang::Sema::FinishTemplateArgumentDeduction().
|
static |
Convert the given deduced template argument and add it to the set of fully-converted template arguments.
Definition at line 2953 of file SemaTemplateDeduction.cpp.
References _2, clang::Sema::CheckTemplateArgumentInfo::CanonicalConverted, clang::Sema::CheckTemplateArgument(), clang::Sema::Context, clang::TemplateArgument::CreatePackCopy(), clang::Sema::CTAK_Deduced, clang::Sema::CTAK_DeducedFromArrayBound, clang::Sema::CTAK_Specified, clang::Sema::CurContext, clang::SemaBase::Diag(), clang::TemplateArgument::getKind(), clang::sema::TemplateDeductionInfo::getLocation(), clang::Sema::getTrivialTemplateArgumentLoc(), clang::Sema::InstantiatingTemplate::isInvalid(), clang::Sema::CheckTemplateArgumentInfo::MatchingTTP, clang::TemplateArgument::Pack, clang::TemplateArgument::pack_elements(), clang::DeducedTemplateArgument::setDeducedFromArrayBound(), clang::sema::TemplateDeductionInfo::setStrictPackMatch(), clang::Sema::CheckTemplateArgumentInfo::StrictPackMatch, clang::Sema::SubstDecl(), clang::Sema::SubstType(), clang::Sema::CheckTemplateArgumentInfo::SugaredConverted, clang::Template, and clang::DeducedTemplateArgument::wasDeducedFromArrayBound().
Referenced by ConvertDeducedTemplateArguments().
|
static |
IsIncomplete | When used, we only consider template parameters that were deduced, disregarding any default arguments. After the function finishes, the object pointed at will contain a value indicating if the conversion was actually incomplete. |
Definition at line 3053 of file SemaTemplateDeduction.cpp.
References _2, clang::Sema::CheckTemplateArgumentInfo::CanonicalConverted, clang::Sema::CheckTemplateArgument(), clang::Sema::Context, ConvertDeducedTemplateArgument(), clang::TemplateArgumentList::CreateCopy(), clang::Sema::CTAK_Specified, clang::TemplateArgumentLoc::getArgument(), clang::ASTContext::getCanonicalTemplateArgument(), clang::Decl::getDeclContext(), clang::SourceRange::getEnd(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::TemplateParameterList::getParam(), clang::DeclContext::getParent(), clang::LocalInstantiationScope::getPartiallySubstitutedPack(), clang::TemplateDecl::getSourceRange(), clang::Incomplete, clang::isa(), clang::TemplateArgument::isNull(), makeTemplateParameter(), clang::Sema::CheckTemplateArgumentInfo::MatchingTTP, clang::sema::TemplateDeductionInfo::Param, clang::Sema::CheckTemplateArgumentInfo::PartialOrdering, clang::sema::TemplateDeductionInfo::reset(), clang::LocalInstantiationScope::ResetPartiallySubstitutedPack(), clang::TemplateParameterList::size(), clang::Sema::CheckTemplateArgumentInfo::StrictPackMatch, clang::Sema::SubstDefaultTemplateArgumentIfAvailable(), clang::SubstitutionFailure, clang::Success, clang::Sema::CheckTemplateArgumentInfo::SugaredConverted, and clang::Template.
Referenced by clang::Sema::FinishTemplateArgumentDeduction(), FinishTemplateArgumentDeduction(), FinishTemplateArgumentDeduction(), and FinishTemplateArgumentDeduction().
|
static |
Definition at line 1204 of file SemaTemplateDeduction.cpp.
References Call, clang::QualType::getUnqualifiedType(), clang::isa(), clang::MiscellaneousDeductionFailure, clang::Success, and clang::T.
|
static |
Attempt template argument deduction from an initializer list deemed to be an argument in a function call.
Definition at line 4415 of file SemaTemplateDeduction.cpp.
References clang::Sema::Context, DeduceNonTypeTemplateArgument(), DeduceTemplateArgumentsFromCallArgument(), clang::ASTContext::getAsArrayType(), clang::Sema::getASTContext(), getDeducedNTTParameterFromExpr(), clang::ASTContext::getIntWidth(), clang::InitListExpr::getNumInits(), clang::InitListExpr::getNumInitsWithEmbedExpanded(), clang::ASTContext::getSizeType(), clang::InitListExpr::inits(), clang::isa(), clang::Type::isDependentType(), clang::Sema::isStdInitializerList(), clang::Success, and clang::T.
Referenced by DeduceTemplateArgumentsFromCallArgument().
|
static |
Deduce the value of the given non-type template parameter as the given deduced template argument.
All non-type template parameter deduction is funneled through here.
Definition at line 467 of file SemaTemplateDeduction.cpp.
References NonTypeOrVarTemplateParmDecl::asTemplateParam(), checkDeducedTemplateArguments(), clang::Sema::Context, DeduceTemplateArgumentsByTypeMatch(), clang::sema::TemplateDeductionInfo::FirstArg, clang::ASTContext::getAdjustedParameterType(), clang::sema::TemplateDeductionInfo::getDeducedDepth(), NonTypeOrVarTemplateParmDecl::getDepth(), NonTypeOrVarTemplateParmDecl::getIndex(), clang::Sema::getLangOpts(), clang::ASTContext::getLValueReferenceType(), clang::ASTContext::getRValueReferenceType(), NonTypeOrVarTemplateParmDecl::getType(), clang::Inconsistent, NonTypeOrVarTemplateParmDecl::isExpandedParameterPack(), clang::Type::isReferenceType(), clang::Type::isRValueReferenceType(), NonCall, None, clang::sema::TemplateDeductionInfo::Param, clang::PartialOrdering, clang::sema::TemplateDeductionInfo::SecondArg, clang::Success, clang::TDF_IgnoreQualifiers, clang::TDF_SkipNonDependent, and clang::DeducedTemplateArgument::wasDeducedFromArrayBound().
Referenced by DeduceFromInitializerList(), DeduceNonTypeTemplateArgument(), DeduceNonTypeTemplateArgument(), DeduceNonTypeTemplateArgument(), DeduceNullPtrTemplateArgument(), DeduceTemplateArguments(), and DeduceTemplateArgumentsByTypeMatch().
|
static |
Deduce the value of the given non-type template parameter from the given integral constant.
Definition at line 523 of file SemaTemplateDeduction.cpp.
References clang::Sema::Context, DeduceNonTypeTemplateArgument(), and clang::PartialOrdering.
|
static |
Deduce the value of the given non-type template parameter from the given type- or value-dependent expression.
Definition at line 562 of file SemaTemplateDeduction.cpp.
References DeduceNonTypeTemplateArgument(), clang::Value::getType(), and clang::PartialOrdering.
|
static |
Deduce the value of the given non-type template parameter from the given declaration.
Definition at line 577 of file SemaTemplateDeduction.cpp.
References DeduceNonTypeTemplateArgument(), New, clang::PartialOrdering, and clang::T.
|
static |
Deduce the value of the given non-type template parameter from the given null pointer template argument type.
Definition at line 539 of file SemaTemplateDeduction.cpp.
References clang::Sema::Context, DeduceNonTypeTemplateArgument(), clang::ActionResult< PtrTy, Compress >::get(), NonTypeOrVarTemplateParmDecl::getLocation(), clang::Value::getType(), clang::Sema::ImpCastExprToType(), clang::Type::isMemberPointerType(), clang::ASTContext::NullPtrTy, and clang::PartialOrdering.
Referenced by DeduceTemplateArguments().
|
static |
Perform template argument deduction to determine whether the given template arguments match the given class or variable template partial specialization per C++ [temp.class.spec.match].
Definition at line 3428 of file SemaTemplateDeduction.cpp.
References DeduceTemplateArguments(), clang::sema::TemplateDeductionInfo::getLocation(), clang::Sema::SFINAETrap::hasErrorOccurred(), clang::InstantiationDepth, clang::Invalid, clang::Sema::InstantiatingTemplate::isInvalid(), ParameterToArgument, clang::Sema::runWithSufficientStackSpace(), clang::SubstitutionFailure, clang::Success, clang::T, clang::Sema::Unevaluated, and clang::Unevaluated.
|
static |
Deduce the template arguments by comparing the list of parameter types to the list of argument types, as in the parameter-type-lists of function types (C++ [temp.deduct.type]p10).
S | The semantic analysis object within which we are deducing |
TemplateParams | The template parameters that we are deducing |
Params | The list of parameter types |
Args | The list of argument types |
Info | information about the template argument deduction itself |
Deduced | the deduced template arguments |
TDF | bitwise OR of the TemplateDeductionFlags bits that describe how template argument deduction is performed. |
PartialOrdering | If true, we are performing template argument deduction for during partial ordering for a call (C++0x [temp.deduct.partial]). |
HasDeducedAnyParam | If set, the object pointed at will indicate whether any template parameter was deduced. |
HasDeducedParam | If set, the bit vector will be used to represent which template parameters were deduced, in order. |
Definition at line 1352 of file SemaTemplateDeduction.cpp.
References DeduceTemplateArgumentsByTypeMatch().
|
static |
Definition at line 2759 of file SemaTemplateDeduction.cpp.
References ArgumentToParameter, Both, DeduceTemplateArguments(), hasPackExpansionBeforeEnd(), hasTemplateArgumentForDeduction(), clang::MiscellaneousDeductionFailure, ParameterToArgument, clang::PartialOrdering, clang::sema::TemplateDeductionInfo::setStrictPackMatch(), and clang::Success.
Referenced by clang::Sema::BuildTypeAwareUsualDelete(), DeduceTemplateArguments(), DeduceTemplateArguments(), DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), DeduceTemplateSpecArguments(), isAtLeastAsSpecializedAs(), clang::Sema::ResolveSingleFunctionTemplateSpecialization(), and clang::Sema::usesPartialOrExplicitSpecialization().
|
static |
Definition at line 2572 of file SemaTemplateDeduction.cpp.
References clang::TemplateArgument::Declaration, DeduceNonTypeTemplateArgument(), DeduceNullPtrTemplateArgument(), DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), clang::TemplateArgument::Expression, clang::sema::TemplateDeductionInfo::FirstArg, clang::TemplateArgument::getAsDecl(), clang::TemplateArgument::getAsExpr(), clang::TemplateArgument::getAsIntegral(), clang::TemplateArgument::getAsTemplate(), clang::TemplateArgument::getAsType(), getDeducedNTTParameterFromExpr(), clang::TemplateArgument::getKind(), clang::TemplateArgument::getNonTypeTemplateArgumentType(), clang::TemplateArgument::getNullPtrType(), clang::TemplateArgument::getPackExpansionPattern(), clang::TemplateArgument::getParamTypeForDecl(), clang::Expr::getType(), clang::TemplateArgument::Integral, clang::TemplateArgument::isPackExpansion(), isSameDeclaration(), NonCall, clang::NonDeducedMismatch, None, clang::TemplateArgument::Null, clang::TemplateArgument::NullPtr, clang::TemplateArgument::Pack, clang::PartialOrdering, clang::sema::TemplateDeductionInfo::SecondArg, clang::TemplateArgument::structurallyEquals(), clang::TemplateArgument::StructuralValue, clang::Success, clang::TDF_SkipNonDependent, clang::TemplateArgument::Template, clang::TemplateArgument::TemplateExpansion, and clang::TemplateArgument::Type.
|
static |
Definition at line 589 of file SemaTemplateDeduction.cpp.
References clang::TemplateParameterList::asArray(), checkDeducedTemplateArguments(), clang::Sema::Context, clang::sema::TemplateDeductionInfo::FirstArg, clang::sema::TemplateDeductionInfo::getDeducedDepth(), clang::ASTContext::getDeducedTemplateName(), clang::TemplateDecl::getTemplateParameters(), clang::ASTContext::hasSameTemplateName(), clang::Inconsistent, isParameterPack(), clang::NonDeducedMismatch, clang::sema::TemplateDeductionInfo::Param, clang::PartialOrdering, clang::sema::TemplateDeductionInfo::SecondArg, and clang::Success.
|
static |
Deduce the template arguments by comparing the parameter type and the argument type (C++ [temp.deduct.type]).
S | the semantic analysis object within which we are deducing |
TemplateParams | the template parameters that we are deducing |
P | the parameter type |
A | the argument type |
Info | information about the template argument deduction itself |
Deduced | the deduced template arguments |
TDF | bitwise OR of the TemplateDeductionFlags bits that describe how template argument deduction is performed. |
PartialOrdering | Whether we're performing template argument deduction in the context of partial ordering (C++0x [temp.deduct.partial]). |
Definition at line 1605 of file SemaTemplateDeduction.cpp.
References clang::Sema::adjustMemberFunctionCC(), clang::ASTContext::BoolTy, Call, clang::cast(), clang::Type::castAs(), checkDeducedTemplateArguments(), clang::Qualifiers::compatiblyIncludes(), clang::Sema::Context, clang::CT_Can, clang::CT_Cannot, clang::CT_Dependent, DeduceNonTypeTemplateArgument(), DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), DeduceTemplateBases(), DeduceTemplateSpecArguments(), degradeCallPartialOrderingKind(), clang::sema::TemplateDeductionInfo::FirstArg, clang::QualType::getAddressSpace(), clang::Type::getAs(), clang::ASTContext::getAsArrayType(), clang::Type::getAsCanonical(), clang::ASTContext::getAsConstantArrayType(), clang::Type::getAsCXXRecordDecl(), clang::ASTContext::getAsDependentSizedArrayType(), clang::ASTContext::getAsIncompleteArrayType(), clang::Sema::getASTContext(), clang::ASTContext::getCanonicalTagType(), clang::QualType::getCanonicalType(), clang::Type::getCanonicalTypeInternal(), clang::DependentSizedMatrixType::getColumnExpr(), clang::Qualifiers::getCVRQualifiers(), clang::QualType::getCVRQualifiers(), clang::sema::TemplateDeductionInfo::getDeducedDepth(), getDeducedNTTParameterFromExpr(), NonTypeOrVarTemplateParmDecl::getDepth(), clang::MatrixType::getElementType(), clang::Expr::getIntegerConstantExpr(), clang::Decl::getKind(), clang::Sema::getLangOpts(), clang::sema::TemplateDeductionInfo::getLocation(), clang::ConstantMatrixType::getNumColumns(), clang::ConstantMatrixType::getNumRows(), clang::TemplateParameterList::getParam(), clang::PointerType::getPointeeType(), clang::ReferenceType::getPointeeType(), clang::Type::getPointeeType(), clang::ASTContext::getQualifiedType(), clang::QualType::getQualifiers(), clang::DependentSizedMatrixType::getRowExpr(), clang::ASTContext::getSizeType(), clang::Type::getTypeClass(), clang::ASTContext::getTypeSize(), clang::ASTContext::getUnqualifiedArrayType(), clang::QualType::getUnqualifiedType(), clang::Qualifiers::hasAddressSpace(), hasInconsistentOrSupersetQualifiersOf(), clang::Qualifiers::hasNonTrivialObjCLifetime(), clang::Qualifiers::hasObjCGCAttr(), clang::Qualifiers::hasObjCLifetime(), clang::QualType::hasQualifiers(), clang::ASTContext::hasSameType(), clang::ASTContext::hasSameUnqualifiedType(), clang::IncompletePack, clang::Inconsistent, clang::ASTContext::IntTy, clang::Invalid, clang::isa(), clang::Type::isArrayType(), clang::Sema::isCompleteType(), clang::Type::isDependentType(), isForwardingReference(), clang::Type::isFunctionType(), clang::Decl::isInvalidDecl(), clang::Type::isLValueReferenceType(), clang::QualType::isNull(), clang::Type::isObjCLifetimeType(), clang::Type::isPlaceholderType(), IsPossiblyOpaquelyQualifiedType(), clang::Type::isRecordType(), clang::Sema::isSameOrCompatibleFunctionType(), clang::Qualifiers::isStrictSupersetOf(), clang::isTargetAddressSpace(), clang::Noexcept, clang::NonDeducedMismatch, None, clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_Strong, clang::ASTContext::OverloadTy, clang::sema::TemplateDeductionInfo::Param, clang::Qualifiers::removeAddressSpace(), clang::ASTContext::removeAddrSpaceQualType(), clang::Qualifiers::removeCVRQualifiers(), clang::Qualifiers::removeObjCGCAttr(), clang::Qualifiers::removeObjCLifetime(), clang::sema::TemplateDeductionInfo::SecondArg, clang::Qualifiers::setCVRQualifiers(), clang::Qualifiers::setObjCLifetime(), clang::Success, clang::TDF_AllowCompatibleFunctionType, clang::TDF_ArgWithReferenceType, clang::TDF_DerivedClass, clang::TDF_IgnoreQualifiers, clang::TDF_ParamWithReferenceType, clang::TDF_SkipNonDependent, clang::TDF_TopLevelParameterTypeList, clang::toTargetAddressSpace(), clang::Underqualified, clang::ASTContext::UnsignedIntTy, and clang::Qualifiers::withoutObjCLifetime().
Referenced by DeduceNonTypeTemplateArgument(), clang::Sema::DeduceTemplateArguments(), clang::Sema::DeduceTemplateArguments(), DeduceTemplateArguments(), DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), DeduceTemplateArgumentsFromCallArgument(), isAtLeastAsSpecializedAs(), isAtLeastAsSpecializedAs(), and ResolveOverloadForDeduction().
|
static |
Perform template argument deduction per [temp.deduct.call] for a single parameter / argument pair.
Definition at line 4487 of file SemaTemplateDeduction.cpp.
References AdjustFunctionParmAndArgTypesForDeduction(), DeduceFromInitializerList(), DeduceTemplateArgumentsByTypeMatch(), None, and clang::Success.
Referenced by clang::Sema::DeduceAutoType(), DeduceFromInitializerList(), clang::Sema::DeduceTemplateArguments(), and clang::Sema::DeduceTemplateArguments().
|
static |
Attempt to deduce the template arguments by checking the base types according to (C++20 [temp.deduct.call] p4b3.
S | the semantic analysis object within which we are deducing. |
RD | the top level record object we are deducing against. |
TemplateParams | the template parameters that we are deducing. |
P | the template specialization parameter type. |
Info | information about the template argument deduction itself. |
Deduced | the deduced template arguments. |
Definition at line 1470 of file SemaTemplateDeduction.cpp.
References clang::CXXRecordDecl::bases(), DeduceTemplateSpecArguments(), clang::sema::TemplateDeductionInfo::ForBase, clang::Type::getAsCXXRecordDecl(), clang::Invalid, clang::Match, clang::MiscellaneousDeductionFailure, clang::PartialOrdering, clang::Success, and clang::T.
Referenced by DeduceTemplateArgumentsByTypeMatch().
|
static |
Definition at line 689 of file SemaTemplateDeduction.cpp.
References clang::Type::castAs(), clang::Sema::Context, DeduceTemplateArguments(), clang::sema::TemplateDeductionInfo::FirstArg, clang::Type::getAs(), clang::TemplateName::getAsDependentTemplateName(), clang::Type::getAsNonAliasTemplateSpecializationType(), clang::TemplateName::getAsTemplateDecl(), clang::QualType::getCanonicalType(), getLastTemplateSpecType(), clang::isa(), clang::isPackProducingBuiltinTemplateName(), clang::TemplateDecl::isTypeAlias(), clang::NonDeducedMismatch, ParameterToArgument, clang::PartialOrdering, clang::sema::TemplateDeductionInfo::SecondArg, and clang::Success.
Referenced by DeduceTemplateArgumentsByTypeMatch(), and DeduceTemplateBases().
|
static |
When propagating a partial ordering kind into a NonCall context, this is used to downgrade a 'Call' into a 'NonCall', so that the kind still reflects whether we are in a partial ordering context.
Definition at line 1577 of file SemaTemplateDeduction.cpp.
References NonCall.
Referenced by DeduceTemplateArgumentsByTypeMatch().
|
static |
Definition at line 5637 of file SemaTemplateDeduction.cpp.
References clang::Sema::CheckTemplateArgumentInfo::CanonicalConverted, CheckDeductionConsistency(), clang::Sema::Context, ConvertDeducedTemplateArguments(), clang::TemplateArgumentList::CreateCopy(), getAsDeclContextOrEnclosing(), clang::TemplateDecl::getTemplateParameters(), clang::Sema::SFINAETrap::hasErrorOccurred(), clang::sema::TemplateDeductionInfo::reset(), clang::SubstitutionFailure, clang::Success, clang::Sema::CheckTemplateArgumentInfo::SugaredConverted, clang::T, clang::Sema::Unevaluated, and clang::Unevaluated.
|
static |
Definition at line 3377 of file SemaTemplateDeduction.cpp.
References FinishTemplateArgumentDeduction(), clang::Decl::getLocation(), clang::TemplateParameterList::getParam(), clang::Sema::getTrivialTemplateArgumentLoc(), clang::PartialOrdering, and clang::Template.
|
static |
Complete template argument deduction.
Definition at line 3253 of file SemaTemplateDeduction.cpp.
References clang::MultiLevelTemplateArgumentList::addOuterRetainedLevels(), clang::Sema::CheckTemplateArgumentInfo::CanonicalConverted, CheckDeducedArgumentConstraints(), clang::Sema::CheckTemplateArgumentList(), clang::ConstraintsNotSatisfied, clang::Sema::Context, ConvertDeducedTemplateArguments(), clang::TemplateArgumentList::CreateCopy(), clang::sema::TemplateDeductionInfo::FirstArg, getAsDeclContextOrEnclosing(), clang::TemplateParameterList::getDepth(), clang::TemplateParameterList::getLAngleLoc(), clang::TemplateParameterList::getParam(), clang::TemplateParameterList::getRAngleLoc(), clang::TemplateArgument::isPackExpansion(), clang::ASTContext::isSameTemplateArgument(), makeTemplateParameter(), clang::NonDeducedMismatch, None, clang::TemplateArgument::Pack, clang::sema::TemplateDeductionInfo::Param, clang::PartialOrdering, clang::sema::TemplateDeductionInfo::reset(), clang::sema::TemplateDeductionInfo::SecondArg, clang::TemplateArgumentListInfo::size(), clang::TemplateParameterList::size(), clang::SubstitutionFailure, clang::Sema::SubstTemplateArguments(), clang::Success, clang::Sema::CheckTemplateArgumentInfo::SugaredConverted, clang::Template, clang::Sema::Unevaluated, clang::Unevaluated, and X.
Referenced by FinishTemplateArgumentDeduction().
|
static |
Complete template argument deduction for DeduceTemplateArgumentsFromType.
FIXME: this is mostly duplicated with the above two versions. Deduplicate the three implementations.
Definition at line 3396 of file SemaTemplateDeduction.cpp.
References clang::Sema::CheckTemplateArgumentInfo::CanonicalConverted, ConvertDeducedTemplateArguments(), getAsDeclContextOrEnclosing(), clang::TemplateDecl::getTemplateParameters(), clang::Success, clang::Sema::CheckTemplateArgumentInfo::SugaredConverted, clang::Sema::Unevaluated, and clang::Unevaluated.
|
static |
Definition at line 3185 of file SemaTemplateDeduction.cpp.
References clang::Decl::getDeclContext().
Referenced by FinishTemplateArgumentDeduction(), FinishTemplateArgumentDeduction(), and FinishTemplateArgumentDeduction().
|
static |
If the given expression is of a form that permits the deduction of a non-type template parameter, return the declaration of that non-type template parameter.
Definition at line 241 of file SemaTemplateDeduction.cpp.
References unwrapExpressionForDeduction().
Referenced by DeduceFromInitializerList(), DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), getDeducedNTTParameterFromExpr(), and MarkUsedTemplateParameters().
|
static |
Definition at line 262 of file SemaTemplateDeduction.cpp.
References clang::sema::TemplateDeductionInfo::getDeducedDepth(), and getDeducedNTTParameterFromExpr().
|
static |
Get the index of the first template parameter that was originally from the innermost template-parameter-list.
This is 0 except when we concatenate the template parameter lists of a class template and a constructor template when forming an implicit deduction guide.
Definition at line 1428 of file SemaTemplateDeduction.cpp.
References clang::FunctionTemplateDecl::getTemplatedDecl().
Referenced by clang::Sema::DeduceTemplateArguments(), and clang::Sema::DeduceTemplateArguments().
|
static |
Definition at line 5562 of file SemaTemplateDeduction.cpp.
References clang::RQ_None, and clang::RQ_RValue.
Referenced by clang::Sema::getMoreSpecializedTemplate().
|
static |
Deduce the template arguments by comparing the template parameter type (which is a template-id) with the template argument type.
S | the Sema |
TemplateParams | the template parameters that we are deducing |
P | the parameter type |
A | the argument type |
Info | information about the template argument deduction itself |
Deduced | the deduced template arguments |
Definition at line 674 of file SemaTemplateDeduction.cpp.
References clang::QualType::getTypePtr(), and clang::T.
Referenced by DeduceTemplateSpecArguments().
|
static |
Returns the more specialized template specialization between T1/P1 and T2/P2.
T1 | the type of the first template partial specialization |
T2 | if IsMoreSpecialThanPrimaryCheck is true, the type of the second template partial specialization; otherwise, the type of the primary template. |
P1 | the first template partial specialization |
P2 | if IsMoreSpecialThanPrimaryCheck is true, the second template partial specialization; otherwise, the primary template. |
Definition at line 6385 of file SemaTemplateDeduction.cpp.
References clang::cast(), clang::Sema::Context, Equal, clang::Sema::getASTContext(), clang::ASTContext::getLangOpts(), getMoreSpecializedTrailingPackTieBreaker(), clang::Sema::IsAtLeastAsConstrained(), isAtLeastAsSpecializedAs(), Less, More, clang::TemplateParameterList::size(), clang::Sema::TemplateParameterListsAreEqual(), and clang::Sema::TPL_TemplateParamsEquivalent.
Referenced by clang::Sema::getMoreSpecializedPartialSpecialization(), clang::Sema::getMoreSpecializedPartialSpecialization(), clang::Sema::isMoreSpecializedThanPrimary(), and clang::Sema::isMoreSpecializedThanPrimary().
|
static |
Definition at line 5868 of file SemaTemplateDeduction.cpp.
References Equal, clang::TemplateArgument::getKind(), Less, More, clang::TemplateArgument::Pack, clang::TemplateArgument::pack_elements(), and clang::TemplateArgument::pack_size().
Referenced by getMoreSpecialized(), and clang::Sema::getMoreSpecializedTemplate().
|
static |
Find the pack index for a particular parameter index in an instantiation of a function template with specific arguments.
Definition at line 3884 of file SemaTemplateDeduction.cpp.
References clang::FunctionTemplate, and clang::Sema::getNumArgumentsInExpansion().
Referenced by CheckDeductionConsistency(), and clang::Sema::FinishTemplateArgumentDeduction().
|
static |
Gets the type of a function for template-argument-deducton purposes when it's considered as part of an overload set.
Definition at line 4162 of file SemaTemplateDeduction.cpp.
References clang::Sema::Context, clang::Sema::DeduceReturnType(), clang::OverloadExpr::FindResult::Expression, clang::Expr::getExprLoc(), clang::Sema::getLangOpts(), clang::ASTContext::getMemberPointerType(), clang::ASTContext::getPointerType(), clang::OverloadExpr::FindResult::HasFormOfMemberPointer, and clang::OverloadExpr::FindResult::IsAddressOfOperand.
Referenced by ResolveOverloadForDeduction().
|
static |
Definition at line 7213 of file SemaTemplateDeduction.cpp.
References clang::Sema::Context, clang::FunctionTemplate, clang::TemplateParameterList::getDepth(), MarkUsedTemplateParameters(), clang::TemplateParameterList::size(), and clang::T.
Referenced by clang::Sema::DeduceTemplateArguments().
Determine whether the parameter has qualifiers that the argument lacks.
Put another way, determine whether there is no way to add a deduced set of qualifiers to the ParamType that would result in its qualifiers matching those of the ArgType.
Definition at line 1381 of file SemaTemplateDeduction.cpp.
References clang::Qualifiers::getAddressSpace(), clang::Qualifiers::getCVRQualifiers(), clang::Qualifiers::getObjCGCAttr(), clang::Qualifiers::getObjCLifetime(), clang::QualType::getQualifiers(), clang::Qualifiers::hasAddressSpace(), clang::Qualifiers::hasObjCGCAttr(), and clang::Qualifiers::hasObjCLifetime().
Referenced by DeduceTemplateArgumentsByTypeMatch().
|
static |
Determine whether the given set of template arguments has a pack expansion that is not the last template argument.
Definition at line 2740 of file SemaTemplateDeduction.cpp.
References hasPackExpansionBeforeEnd(), and clang::TemplateArgument::Pack.
Referenced by DeduceTemplateArguments(), hasPackExpansionBeforeEnd(), clang::Sema::MarkUsedTemplateParameters(), and MarkUsedTemplateParameters().
|
static |
Determine whether there is a template argument to be used for deduction.
This routine "expands" argument packs in-place, overriding its input parameters so that Args
[ArgIdx] will be the available template argument.
Args
[ArgIdx]), false otherwise. Definition at line 2723 of file SemaTemplateDeduction.cpp.
References clang::TemplateArgument::getKind(), clang::TemplateArgument::Pack, and clang::TemplateArgument::pack_elements().
Referenced by DeduceTemplateArguments().
|
static |
Definition at line 3909 of file SemaTemplateDeduction.cpp.
References clang::cast(), clang::Sema::CodeSynthesisContext::DeducedTemplateArgumentSubstitution, clang::FunctionTemplate, clang::ExplicitSpecifier::getExpr(), clang::sema::TemplateDeductionInfo::getLocation(), clang::Sema::SFINAETrap::hasErrorOccurred(), clang::Sema::instantiateExplicitSpecifier(), clang::InstantiationDepth, clang::isa(), clang::ExplicitSpecifier::isInvalid(), clang::Sema::InstantiatingTemplate::isInvalid(), clang::Expr::isValueDependent(), clang::Specialization, clang::SubstitutionFailure, and clang::Success.
Referenced by clang::Sema::FinishTemplateArgumentDeduction().
|
static |
Determine whether one template specialization, P1, is at least as specialized than another, P2.
TemplateLikeDecl | The kind of P2, which must be a TemplateDecl or {Class,Var}TemplatePartialSpecializationDecl. |
T1 | The injected-class-name of P1 (faked for a variable template). |
T2 | The injected-class-name of P2 (faked for a variable template). |
Template | The primary template of P2, in case it is a partial specialization, the same as P2 otherwise. |
Definition at line 6230 of file SemaTemplateDeduction.cpp.
References Call, clang::cast(), DeduceTemplateArgumentsByTypeMatch(), clang::sema::TemplateDeductionInfo::getLocation(), clang::Sema::SFINAETrap::hasErrorOccurred(), clang::Sema::InstantiatingTemplate::isInvalid(), clang::Sema::runWithSufficientStackSpace(), clang::Success, clang::TDF_None, and clang::Template.
|
static |
Determine whether the function template FT1
is at least as specialized as FT2
.
Definition at line 5683 of file SemaTemplateDeduction.cpp.
References Call, clang::Sema::CodeSynthesisContext::DeducedTemplateArgumentSubstitution, DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), clang::Type::getAs(), clang::sema::TemplateDeductionInfo::getLocation(), clang::FunctionProtoType::getMethodQuals(), clang::FunctionProtoType::getParamTypes(), clang::FunctionProtoType::getRefQualifier(), clang::FunctionType::getReturnType(), clang::FunctionTemplateDecl::getTemplatedDecl(), clang::TemplateDecl::getTemplateParameters(), clang::ValueDecl::getType(), clang::Sema::InstantiatingTemplate::isInvalid(), clang::FunctionProtoType::isVariadic(), clang::Sema::runWithSufficientStackSpace(), clang::TemplateParameterList::size(), clang::Success, clang::TDF_None, clang::TPOC_Call, clang::TPOC_Conversion, and clang::TPOC_Other.
Referenced by getMoreSpecialized(), and clang::Sema::getMoreSpecializedTemplate().
Determine whether a type denotes a forwarding reference.
Definition at line 1436 of file SemaTemplateDeduction.cpp.
Referenced by AdjustFunctionParmAndArgTypesForDeduction(), and DeduceTemplateArgumentsByTypeMatch().
Determines whether the given type is an opaque type that might be more qualified when instantiated.
Definition at line 817 of file SemaTemplateDeduction.cpp.
References IsPossiblyOpaquelyQualifiedTypeInternal(), and clang::T.
Referenced by DeduceTemplateArgumentsByTypeMatch().
Definition at line 789 of file SemaTemplateDeduction.cpp.
References clang::cast(), IsPossiblyOpaquelyQualifiedTypeInternal(), and clang::T.
Referenced by IsPossiblyOpaquelyQualifiedType(), and IsPossiblyOpaquelyQualifiedTypeInternal().
Determine whether two declaration pointers refer to the same declaration.
Definition at line 268 of file SemaTemplateDeduction.cpp.
References clang::Decl::getCanonicalDecl(), and X.
Referenced by checkDeducedTemplateArguments(), DeduceTemplateArguments(), and clang::Sema::FinishTemplateArgumentDeduction().
Determine whether the given type T is a simple-template-id type.
Definition at line 3553 of file SemaTemplateDeduction.cpp.
References clang::isa(), and clang::T.
Referenced by AdjustFunctionParmAndArgTypesForDeduction(), and CheckOriginalCallArgDeduction().
|
static |
Helper function to build a TemplateParameter when we don't know its type statically.
Definition at line 824 of file SemaTemplateDeduction.cpp.
References clang::cast().
Referenced by ConvertDeducedTemplateArguments(), FinishTemplateArgumentDeduction(), and clang::Sema::SubstituteExplicitTemplateArguments().
|
static |
Mark the template parameters that are used by the given expression.
Definition at line 6748 of file SemaTemplateDeduction.cpp.
References getDeducedNTTParameterFromExpr(), NonTypeOrVarTemplateParmDecl::getDepth(), NonTypeOrVarTemplateParmDecl::getIndex(), clang::ASTContext::getLangOpts(), clang::OverloadExpr::getTemplateTemplateDecl(), NonTypeOrVarTemplateParmDecl::getType(), clang::OverloadExpr::isConceptReference(), clang::OverloadExpr::isVarDeclReference(), MarkUsedTemplateParameters(), clang::OverloadExpr::template_arguments(), unwrapExpressionForDeduction(), and Used.
|
static |
Mark the template parameters that are used by this template argument.
Definition at line 7130 of file SemaTemplateDeduction.cpp.
References clang::TemplateArgument::Declaration, clang::TemplateArgument::Expression, clang::TemplateArgument::Integral, MarkUsedTemplateParameters(), clang::TemplateArgument::Null, clang::TemplateArgument::NullPtr, clang::TemplateArgument::Pack, clang::TemplateArgument::StructuralValue, clang::TemplateArgument::Template, clang::TemplateArg, clang::TemplateArgument::TemplateExpansion, clang::TemplateArgument::Type, and Used.
Referenced by hasDeducibleTemplateParameters(), MarkUsedTemplateParameters(), MarkUsedTemplateParameters(), MarkUsedTemplateParameters(), MarkUsedTemplateParameters(), and MarkUsedTemplateParameters().
|
static |
Mark the template parameters that are used by the given nested name specifier.
Definition at line 6789 of file SemaTemplateDeduction.cpp.
References clang::NestedNameSpecifier::getAsType(), clang::NestedNameSpecifier::getKind(), MarkUsedTemplateParameters(), clang::NestedNameSpecifier::Type, and Used.
|
static |
Mark the template parameters that are used by the given type.
Definition at line 6826 of file SemaTemplateDeduction.cpp.
References clang::cast(), clang::DependentAddressSpaceType::getAddrSpaceExpr(), clang::Type::getAs(), clang::TemplateName::getAsDependentTemplateName(), clang::NestedNameSpecifier::getAsType(), clang::ASTContext::getCanonicalType(), clang::DependentSizedMatrixType::getColumnExpr(), clang::DependentSizedExtVectorType::getElementType(), clang::MatrixType::getElementType(), clang::FunctionProtoType::getNoexceptExpr(), clang::FunctionProtoType::getNumParams(), clang::FunctionProtoType::getParamType(), clang::DependentAddressSpaceType::getPointeeType(), clang::MemberPointerType::getPointeeType(), getPointeeType(), clang::MemberPointerType::getQualifier(), clang::FunctionType::getReturnType(), clang::DependentSizedMatrixType::getRowExpr(), clang::DependentSizedExtVectorType::getSizeExpr(), getUnderlyingType(), hasPackExpansionBeforeEnd(), MarkUsedTemplateParameters(), clang::T, and Used.
|
static |
Mark the template parameters that are used by the given template name.
Definition at line 6801 of file SemaTemplateDeduction.cpp.
References clang::TemplateName::getAsDependentTemplateName(), clang::TemplateName::getAsQualifiedTemplateName(), clang::TemplateName::getAsTemplateDecl(), MarkUsedTemplateParameters(), clang::Template, and Used.
|
static |
Apply the deduction rules for overload sets.
Definition at line 4189 of file SemaTemplateDeduction.cpp.
References clang::cast(), clang::Sema::Context, clang::OverloadExpr::copyTemplateArgumentsInto(), clang::OverloadExpr::decls_begin(), clang::OverloadExpr::decls_end(), clang::Sema::DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), clang::OverloadExpr::FindResult::Expression, clang::OverloadExpr::find(), clang::OverloadExpr::getNameLoc(), clang::ASTContext::getPointerType(), GetTypeOfFunction(), clang::NamedDecl::getUnderlyingDecl(), clang::OverloadExpr::hasExplicitTemplateArgs(), clang::OverloadExpr::FindResult::IsAddressOfOperand, clang::Type::isFunctionPointerType(), clang::Type::isFunctionType(), clang::Type::isMemberFunctionPointerType(), clang::Type::isPointerType(), clang::Sema::isSameOrCompatibleFunctionType(), clang::Match, None, clang::Sema::resolveAddressOfSingleOverloadCandidate(), clang::Sema::ResolveSingleFunctionTemplateSpecialization(), clang::TemplateParameterList::size(), clang::Specialization, clang::Success, clang::TDF_IgnoreQualifiers, and clang::TDF_ParamWithReferenceType.
Referenced by AdjustFunctionParmAndArgTypesForDeduction().
Definition at line 150 of file SemaTemplateDeduction.cpp.
Referenced by getDeducedNTTParameterFromExpr(), and MarkUsedTemplateParameters().