clang
19.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/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/TemplateBase.h"
#include "clang/AST/TemplateName.h"
#include "clang/AST/Type.h"
#include "clang/AST/TypeLoc.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/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 <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 | |
struct | clang::DeducedPack |
A pack that we're currently deducing. More... | |
struct | IsPartialSpecialization< T > |
struct | IsPartialSpecialization< ClassTemplatePartialSpecializationDecl > |
struct | IsPartialSpecialization< VarTemplatePartialSpecializationDecl > |
Namespaces | |
clang | |
The JSON file list parser is used to communicate input to InstallAPI. | |
Macros | |
#define | NON_CANONICAL_TYPE(Class, Base) case Type::Class: llvm_unreachable("deducing non-canonical type: " #Class); |
#define | TYPE(Class, Base) |
#define | TYPE(Class, Base) |
#define | ABSTRACT_TYPE(Class, Base) |
#define | DEPENDENT_TYPE(Class, Base) |
#define | NON_CANONICAL_TYPE(Class, Base) case Type::Class: |
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 | PackFold { ParameterToArgument , ArgumentToParameter } |
Functions | |
static bool | hasSameExtendedValue (llvm::APSInt X, llvm::APSInt Y) |
Compare two APSInts, extending and switching the sign as necessary to compare their values regardless of underlying type. More... | |
static TemplateDeductionResult | DeduceTemplateArgumentsByTypeMatch (Sema &S, TemplateParameterList *TemplateParams, QualType P, QualType A, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced, unsigned TDF, bool PartialOrdering, bool DeducedFromArrayBound) |
Deduce the template arguments by comparing the parameter type and the argument type (C++ [temp.deduct.type]). More... | |
static TemplateDeductionResult | DeduceTemplateArguments (Sema &S, TemplateParameterList *TemplateParams, ArrayRef< TemplateArgument > Ps, ArrayRef< TemplateArgument > As, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced, bool NumberOfArgumentsMustMatch, PackFold PackFold=PackFold::ParameterToArgument) |
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. More... | |
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. More... | |
static const NonTypeTemplateParmDecl * | getDeducedParameterFromExpr (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. More... | |
static const NonTypeTemplateParmDecl * | getDeducedParameterFromExpr (TemplateDeductionInfo &Info, Expr *E) |
static bool | isSameDeclaration (Decl *X, Decl *Y) |
Determine whether two declaration pointers refer to the same declaration. More... | |
static DeducedTemplateArgument | checkDeducedTemplateArguments (ASTContext &Context, const DeducedTemplateArgument &X, const DeducedTemplateArgument &Y, bool AggregateCandidateDeduction=false) |
Verify that the given, deduced template arguments are compatible. More... | |
static TemplateDeductionResult | DeduceNonTypeTemplateArgument (Sema &S, TemplateParameterList *TemplateParams, const NonTypeTemplateParmDecl *NTTP, const DeducedTemplateArgument &NewDeduced, QualType ValueType, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced) |
Deduce the value of the given non-type template parameter as the given deduced template argument. More... | |
static TemplateDeductionResult | DeduceNonTypeTemplateArgument (Sema &S, TemplateParameterList *TemplateParams, const NonTypeTemplateParmDecl *NTTP, const llvm::APSInt &Value, QualType ValueType, bool DeducedFromArrayBound, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced) |
Deduce the value of the given non-type template parameter from the given integral constant. More... | |
static TemplateDeductionResult | DeduceNullPtrTemplateArgument (Sema &S, TemplateParameterList *TemplateParams, const NonTypeTemplateParmDecl *NTTP, QualType NullPtrType, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced) |
Deduce the value of the given non-type template parameter from the given null pointer template argument type. More... | |
static TemplateDeductionResult | DeduceNonTypeTemplateArgument (Sema &S, TemplateParameterList *TemplateParams, const NonTypeTemplateParmDecl *NTTP, Expr *Value, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced) |
Deduce the value of the given non-type template parameter from the given type- or value-dependent expression. More... | |
static TemplateDeductionResult | DeduceNonTypeTemplateArgument (Sema &S, TemplateParameterList *TemplateParams, const NonTypeTemplateParmDecl *NTTP, ValueDecl *D, QualType T, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced) |
Deduce the value of the given non-type template parameter from the given declaration. More... | |
static NamedDecl * | getTemplateParameterWithDefault (Sema &S, NamedDecl *A, TemplateArgument Default) |
Create a shallow copy of a given template parameter declaration, with empty source locations and using the given TemplateArgument as it's default argument. More... | |
static TemplateDeductionResult | DeduceTemplateArguments (Sema &S, TemplateParameterList *TemplateParams, TemplateName Param, TemplateName Arg, TemplateDeductionInfo &Info, ArrayRef< TemplateArgument > DefaultArguments, SmallVectorImpl< DeducedTemplateArgument > &Deduced) |
static TemplateDeductionResult | DeduceTemplateSpecArguments (Sema &S, TemplateParameterList *TemplateParams, const QualType P, QualType A, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced) |
Deduce the template arguments by comparing the template parameter type (which is a template-id) with the template argument type. More... | |
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. More... | |
static TemplateParameter | makeTemplateParameter (Decl *D) |
Helper function to build a TemplateParameter when we don't know its type statically. More... | |
static TemplateDeductionResult | DeduceTemplateArguments (Sema &S, TemplateParameterList *TemplateParams, const QualType *Params, unsigned NumParams, const QualType *Args, unsigned NumArgs, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced, unsigned TDF, bool PartialOrdering=false) |
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). More... | |
static bool | hasInconsistentOrSupersetQualifiersOf (QualType ParamType, QualType ArgType) |
Determine whether the parameter has qualifiers that the argument lacks. More... | |
static unsigned | getFirstInnerIndex (FunctionTemplateDecl *FTD) |
Get the index of the first template parameter that was originally from the innermost template-parameter-list. More... | |
static bool | isForwardingReference (QualType Param, unsigned FirstInnerIndex) |
Determine whether a type denotes a forwarding reference. More... | |
static CXXRecordDecl * | getCanonicalRD (QualType T) |
static TemplateDeductionResult | DeduceTemplateBases (Sema &S, const CXXRecordDecl *RD, TemplateParameterList *TemplateParams, QualType P, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced) |
Attempt to deduce the template arguments by checking the base types according to (C++20 [temp.deduct.call] p4b3. More... | |
static TemplateDeductionResult | DeduceTemplateArguments (Sema &S, TemplateParameterList *TemplateParams, const TemplateArgument &P, TemplateArgument A, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced) |
static bool | hasTemplateArgumentForDeduction (ArrayRef< TemplateArgument > &Args, unsigned &ArgIdx) |
Determine whether there is a template argument to be used for deduction. More... | |
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. More... | |
static bool | isSameTemplateArg (ASTContext &Context, TemplateArgument X, const TemplateArgument &Y, bool PartialOrdering, bool PackExpansionMatchesPack=false) |
Determine whether two template arguments are the same. More... | |
static bool | ConvertDeducedTemplateArgument (Sema &S, NamedDecl *Param, DeducedTemplateArgument Arg, NamedDecl *Template, TemplateDeductionInfo &Info, bool IsDeduced, SmallVectorImpl< TemplateArgument > &SugaredOutput, SmallVectorImpl< TemplateArgument > &CanonicalOutput) |
Convert the given deduced template argument and add it to the set of fully-converted template arguments. More... | |
template<typename TemplateDeclT > | |
static TemplateDeductionResult | ConvertDeducedTemplateArguments (Sema &S, TemplateDeclT *Template, bool IsDeduced, SmallVectorImpl< DeducedTemplateArgument > &Deduced, TemplateDeductionInfo &Info, SmallVectorImpl< TemplateArgument > &SugaredBuilder, SmallVectorImpl< TemplateArgument > &CanonicalBuilder, LocalInstantiationScope *CurrentInstantiationScope=nullptr, unsigned NumAlreadyConverted=0, bool PartialOverloading=false) |
static DeclContext * | getAsDeclContextOrEnclosing (Decl *D) |
template<typename TemplateDeclT > | |
static bool | DeducedArgsNeedReplacement (TemplateDeclT *Template) |
template<> | |
bool | DeducedArgsNeedReplacement< VarTemplatePartialSpecializationDecl > (VarTemplatePartialSpecializationDecl *Spec) |
template<> | |
bool | DeducedArgsNeedReplacement< ClassTemplatePartialSpecializationDecl > (ClassTemplatePartialSpecializationDecl *Spec) |
template<typename TemplateDeclT > | |
static TemplateDeductionResult | CheckDeducedArgumentConstraints (Sema &S, TemplateDeclT *Template, ArrayRef< TemplateArgument > SugaredDeducedArgs, ArrayRef< TemplateArgument > CanonicalDeducedArgs, TemplateDeductionInfo &Info) |
template<typename T > | |
static std::enable_if_t< IsPartialSpecialization< T >::value, TemplateDeductionResult > | FinishTemplateArgumentDeduction (Sema &S, T *Partial, bool IsPartialOrdering, ArrayRef< TemplateArgument > TemplateArgs, SmallVectorImpl< DeducedTemplateArgument > &Deduced, TemplateDeductionInfo &Info) |
Complete template argument deduction for a partial specialization. More... | |
static TemplateDeductionResult | FinishTemplateArgumentDeduction (Sema &S, TemplateDecl *Template, bool PartialOrdering, ArrayRef< TemplateArgument > TemplateArgs, SmallVectorImpl< DeducedTemplateArgument > &Deduced, TemplateDeductionInfo &Info) |
Complete template argument deduction for a class or variable template, when partial ordering against a partial specialization. More... | |
static TemplateDeductionResult | FinishTemplateArgumentDeduction (Sema &S, TemplateDecl *TD, SmallVectorImpl< DeducedTemplateArgument > &Deduced, TemplateDeductionInfo &Info) |
Complete template argument deduction for DeduceTemplateArgumentsFromType. More... | |
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]. More... | |
static bool | isSimpleTemplateIdType (QualType T) |
Determine whether the given type T is a simple-template-id type. More... | |
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. More... | |
static unsigned | 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. More... | |
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. More... | |
static QualType | ResolveOverloadForDeduction (Sema &S, TemplateParameterList *TemplateParams, Expr *Arg, QualType ParamType, bool ParamWasReference, TemplateSpecCandidateSet *FailedTSC=nullptr) |
Apply the deduction rules for overload sets. More... | |
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]. More... | |
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. More... | |
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. More... | |
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 bool | isAtLeastAsSpecializedAs (Sema &S, SourceLocation Loc, const FunctionTemplateDecl *FT1, const FunctionTemplateDecl *FT2, TemplatePartialOrderingContext TPOC, bool Reversed, const SmallVector< QualType > &Args1, const SmallVector< QualType > &Args2) |
Determine whether the function template FT1 is at least as specialized as FT2 . More... | |
static bool | isSameTemplate (TemplateDecl *T1, TemplateDecl *T2) |
Determine if the two templates are equivalent. More... | |
template<typename TemplateLikeDecl > | |
static bool | isAtLeastAsSpecializedAs (Sema &S, QualType T1, QualType T2, TemplateLikeDecl *P2, TemplateDeductionInfo &Info) |
Determine whether one partial specialization, P1, is at least as specialized than another, P2. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
#define ABSTRACT_TYPE | ( | Class, | |
Base | |||
) |
#define DEPENDENT_TYPE | ( | Class, | |
Base | |||
) |
#define NON_CANONICAL_TYPE | ( | Class, | |
Base | |||
) | case Type::Class: llvm_unreachable("deducing non-canonical type: " #Class); |
#define NON_CANONICAL_TYPE | ( | Class, | |
Base | |||
) | case Type::Class: |
#define TYPE | ( | Class, | |
Base | |||
) |
#define TYPE | ( | Class, | |
Base | |||
) |
|
strong |
Enumerator | |
---|---|
ParameterToArgument | |
ArgumentToParameter |
Definition at line 142 of file SemaTemplateDeduction.cpp.
|
static |
Perform the adjustments to the parameter and argument types described in C++ [temp.deduct.call].
Definition at line 4165 of file SemaTemplateDeduction.cpp.
|
static |
Definition at line 3062 of file SemaTemplateDeduction.cpp.
|
static |
Definition at line 5083 of file SemaTemplateDeduction.cpp.
Referenced by clang::Sema::DeduceAutoType().
|
static |
Verify that the given, deduced template arguments are compatible.
Definition at line 215 of file SemaTemplateDeduction.cpp.
|
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 3635 of file SemaTemplateDeduction.cpp.
Referenced by clang::Sema::DeduceAutoType().
|
static |
Convert the given deduced template argument and add it to the set of fully-converted template arguments.
Definition at line 2812 of file SemaTemplateDeduction.cpp.
|
static |
Definition at line 2907 of file SemaTemplateDeduction.cpp.
Referenced by clang::Sema::FinishTemplateArgumentDeduction().
|
static |
Definition at line 3046 of file SemaTemplateDeduction.cpp.
bool DeducedArgsNeedReplacement< ClassTemplatePartialSpecializationDecl > | ( | ClassTemplatePartialSpecializationDecl * | Spec | ) |
Definition at line 3055 of file SemaTemplateDeduction.cpp.
References clang::ClassTemplateSpecializationDecl::isClassScopeExplicitSpecialization().
bool DeducedArgsNeedReplacement< VarTemplatePartialSpecializationDecl > | ( | VarTemplatePartialSpecializationDecl * | Spec | ) |
Definition at line 3050 of file SemaTemplateDeduction.cpp.
References clang::VarTemplateSpecializationDecl::isClassScopeExplicitSpecialization().
|
static |
Attempt template argument deduction from an initializer list deemed to be an argument in a function call.
Definition at line 4275 of file SemaTemplateDeduction.cpp.
|
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 398 of file SemaTemplateDeduction.cpp.
|
static |
Deduce the value of the given non-type template parameter from the given integral constant.
Definition at line 452 of file SemaTemplateDeduction.cpp.
|
static |
Deduce the value of the given non-type template parameter from the given type- or value-dependent expression.
Definition at line 487 of file SemaTemplateDeduction.cpp.
|
static |
Deduce the value of the given non-type template parameter from the given declaration.
Definition at line 501 of file SemaTemplateDeduction.cpp.
|
static |
Deduce the value of the given non-type template parameter from the given null pointer template argument type.
Definition at line 466 of file SemaTemplateDeduction.cpp.
|
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 3287 of file SemaTemplateDeduction.cpp.
|
static |
Definition at line 2546 of file SemaTemplateDeduction.cpp.
Referenced by clang::Sema::CheckVarTemplateId(), and clang::Sema::DeduceTemplateArguments().
|
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 |
NumParams | The number of types in Params |
Args | The list of argument types |
NumArgs | The number of types in Args |
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]). |
Definition at line 1160 of file SemaTemplateDeduction.cpp.
|
static |
Definition at line 2391 of file SemaTemplateDeduction.cpp.
|
static |
Definition at line 568 of file SemaTemplateDeduction.cpp.
|
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 1500 of file SemaTemplateDeduction.cpp.
Referenced by clang::Sema::DeduceTemplateArguments().
|
static |
Perform template argument deduction per [temp.deduct.call] for a single parameter / argument pair.
Definition at line 4345 of file SemaTemplateDeduction.cpp.
Referenced by clang::Sema::DeduceAutoType(), 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 1381 of file SemaTemplateDeduction.cpp.
|
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 662 of file SemaTemplateDeduction.cpp.
|
static |
Complete template argument deduction for a partial specialization.
Definition at line 3103 of file SemaTemplateDeduction.cpp.
|
static |
Complete template argument deduction for DeduceTemplateArgumentsFromType.
FIXME: this is mostly duplicated with the above two versions. Deduplicate the three implementations.
Definition at line 3249 of file SemaTemplateDeduction.cpp.
|
static |
Complete template argument deduction for a class or variable template, when partial ordering against a partial specialization.
Definition at line 3199 of file SemaTemplateDeduction.cpp.
|
static |
Definition at line 3028 of file SemaTemplateDeduction.cpp.
References clang::Decl::getDeclContext().
|
static |
Definition at line 1357 of file SemaTemplateDeduction.cpp.
References clang::Type::castAs(), clang::TagDecl::getCanonicalDecl(), clang::RecordType::getDecl(), and clang::T.
|
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 165 of file SemaTemplateDeduction.cpp.
References Depth.
Referenced by getDeducedParameterFromExpr(), and MarkUsedTemplateParameters().
|
static |
Definition at line 195 of file SemaTemplateDeduction.cpp.
References clang::sema::TemplateDeductionInfo::getDeducedDepth(), and getDeducedParameterFromExpr().
|
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 1335 of file SemaTemplateDeduction.cpp.
References clang::FunctionTemplateDecl::getTemplatedDecl().
Referenced by clang::Sema::DeduceTemplateArguments().
|
static |
Definition at line 5480 of file SemaTemplateDeduction.cpp.
Referenced by clang::Sema::getMoreSpecializedTemplate().
|
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 6158 of file SemaTemplateDeduction.cpp.
Referenced by clang::Sema::getMoreSpecializedPartialSpecialization(), and clang::Sema::isMoreSpecializedThanPrimary().
|
static |
Find the pack index for a particular parameter index in an instantiation of a function template with specific arguments.
Definition at line 3757 of file SemaTemplateDeduction.cpp.
|
static |
Create a shallow copy of a given template parameter declaration, with empty source locations and using the given TemplateArgument as it's default argument.
Definition at line 517 of file SemaTemplateDeduction.cpp.
|
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 4029 of file SemaTemplateDeduction.cpp.
|
static |
Definition at line 6923 of file SemaTemplateDeduction.cpp.
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 1281 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().
|
static |
Determine whether the given set of template arguments has a pack expansion that is not the last template argument.
Definition at line 2527 of file SemaTemplateDeduction.cpp.
References clang::TemplateArgument::Pack.
Referenced by MarkUsedTemplateParameters(), and clang::Sema::MarkUsedTemplateParameters().
|
static |
Compare two APSInts, extending and switching the sign as necessary to compare their values regardless of underlying type.
Definition at line 117 of file SemaTemplateDeduction.cpp.
References X.
|
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 2510 of file SemaTemplateDeduction.cpp.
References clang::TemplateArgument::getKind(), clang::TemplateArgument::Pack, and clang::TemplateArgument::pack_elements().
|
static |
Definition at line 3782 of file SemaTemplateDeduction.cpp.
|
static |
Determine whether one partial 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). |
Definition at line 6017 of file SemaTemplateDeduction.cpp.
|
static |
Determine whether the function template FT1
is at least as specialized as FT2
.
Definition at line 5505 of file SemaTemplateDeduction.cpp.
Referenced by clang::Sema::getMoreSpecializedTemplate().
Determine whether a type denotes a forwarding reference.
Definition at line 1343 of file SemaTemplateDeduction.cpp.
References clang::Type::getAs(), and clang::TemplateTypeParmType::getIndex().
Determines whether the given type is an opaque type that might be more qualified when instantiated.
Definition at line 763 of file SemaTemplateDeduction.cpp.
References clang::Type::getCanonicalTypeInternal(), clang::QualType::getTypePtr(), IsPossiblyOpaquelyQualifiedTypeInternal(), and clang::T.
Definition at line 735 of file SemaTemplateDeduction.cpp.
References clang::Type::getTypeClass(), clang::Type::isCanonicalUnqualified(), and clang::T.
Referenced by IsPossiblyOpaquelyQualifiedType().
Determine whether two declaration pointers refer to the same declaration.
Definition at line 201 of file SemaTemplateDeduction.cpp.
References clang::Decl::getCanonicalDecl(), and X.
|
static |
Determine if the two templates are equivalent.
Definition at line 5867 of file SemaTemplateDeduction.cpp.
References clang::Decl::getCanonicalDecl().
Referenced by clang::Sema::getMostSpecialized().
|
static |
Determine whether two template arguments are the same.
Definition at line 2647 of file SemaTemplateDeduction.cpp.
Determine whether the given type T is a simple-template-id type.
Definition at line 3401 of file SemaTemplateDeduction.cpp.
References clang::Type::getAs(), and clang::T.
|
static |
Helper function to build a TemplateParameter when we don't know its type statically.
Definition at line 770 of file SemaTemplateDeduction.cpp.
|
static |
Mark the template parameters that are used by the given expression.
Definition at line 6452 of file SemaTemplateDeduction.cpp.
References Depth, getDeducedParameterFromExpr(), clang::NonTypeTemplateParmDecl::getDepth(), clang::NonTypeTemplateParmDecl::getIndex(), clang::ASTContext::getLangOpts(), clang::ValueDecl::getType(), MarkUsedTemplateParameters(), and Used.
|
static |
Mark the template parameters that are used by this template argument.
Definition at line 6830 of file SemaTemplateDeduction.cpp.
References clang::TemplateArgument::Declaration, Depth, clang::TemplateArgument::Expression, clang::TemplateArgument::Integral, clang::TemplateArgument::Null, clang::TemplateArgument::NullPtr, P, clang::TemplateArgument::Pack, clang::TemplateArgument::StructuralValue, clang::TemplateArgument::Template, clang::TemplateArg, clang::TemplateArgument::TemplateExpansion, clang::TemplateArgument::Type, and Used.
Referenced by MarkUsedTemplateParameters().
|
static |
Mark the template parameters that are used by the given nested name specifier.
Definition at line 6483 of file SemaTemplateDeduction.cpp.
References Depth, clang::NestedNameSpecifier::getAsType(), clang::NestedNameSpecifier::getPrefix(), MarkUsedTemplateParameters(), and Used.
|
static |
Mark the template parameters that are used by the given type.
Definition at line 6525 of file SemaTemplateDeduction.cpp.
References Depth, clang::DependentAddressSpaceType::getAddrSpaceExpr(), clang::SubstTemplateTypeParmPackType::getArgumentPack(), clang::Type::getAs(), clang::ASTContext::getCanonicalType(), clang::MemberPointerType::getClass(), clang::DependentSizedMatrixType::getColumnExpr(), clang::TemplateTypeParmDecl::getDepth(), clang::TemplateTypeParmType::getDepth(), clang::DependentSizedExtVectorType::getElementType(), clang::MatrixType::getElementType(), clang::TemplateTypeParmType::getIndex(), clang::SubstTemplateTypeParmPackType::getIndex(), clang::FunctionProtoType::getNoexceptExpr(), clang::FunctionProtoType::getNumParams(), clang::FunctionProtoType::getParamType(), clang::MemberPointerType::getPointeeType(), clang::DependentAddressSpaceType::getPointeeType(), clang::DependentTemplateSpecializationType::getQualifier(), clang::SubstTemplateTypeParmPackType::getReplacedParameter(), clang::FunctionType::getReturnType(), clang::DependentSizedMatrixType::getRowExpr(), clang::DependentSizedExtVectorType::getSizeExpr(), clang::TemplateSpecializationType::getTemplateName(), clang::Type::getTypeClass(), getUnderlyingType(), hasPackExpansionBeforeEnd(), clang::Type::isDependentType(), MarkUsedTemplateParameters(), clang::T, clang::TemplateSpecializationType::template_arguments(), clang::DependentTemplateSpecializationType::template_arguments(), and Used.
|
static |
Mark the template parameters that are used by the given template name.
Definition at line 6500 of file SemaTemplateDeduction.cpp.
|
static |
Apply the deduction rules for overload sets.
Definition at line 4056 of file SemaTemplateDeduction.cpp.