clang API Documentation
#include "clang/Sema/TemplateDeduction.h"
#include "TreeTransform.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTLambda.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/Sema/DeclSpec.h"
#include "clang/Sema/Sema.h"
#include "clang/Sema/Template.h"
#include "llvm/ADT/SmallBitVector.h"
#include <algorithm>
#include "clang/AST/TypeNodes.def"
Go to the source code of this file.
Classes | |
struct | RefParamPartialOrderingComparison |
Stores the result of comparing two reference parameters while performing template argument deduction for partial ordering of function templates. More... | |
struct | clang::DeducedPack |
A pack that we're currently deducing. More... | |
class | PackDeductionScope |
A scope in which we're performing pack deduction. More... | |
Namespaces | |
namespace | clang |
Defines | |
#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_InOverloadResolution = 0x20 } |
Various flags that control template argument deduction. More... | |
enum | DeductionQualifierComparison { NeitherMoreQualified = 0, ParamMoreQualified, ArgMoreQualified } |
Whether template argument deduction for two reference parameters resulted in the argument type, parameter type, or neither type being more qualified than the other. More... | |
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. | |
static Sema::TemplateDeductionResult | DeduceTemplateArguments (Sema &S, TemplateParameterList *TemplateParams, const TemplateArgument &Param, TemplateArgument Arg, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced) |
static Sema::TemplateDeductionResult | DeduceTemplateArgumentsByTypeMatch (Sema &S, TemplateParameterList *TemplateParams, QualType ParamIn, QualType ArgIn, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced, unsigned TDF, bool PartialOrdering, SmallVectorImpl< RefParamPartialOrderingComparison > *RefParamComparisons) |
Deduce the template arguments by comparing the parameter type and the argument type (C++ [temp.deduct.type]). | |
static Sema::TemplateDeductionResult | DeduceTemplateArguments (Sema &S, TemplateParameterList *TemplateParams, const TemplateArgument *Params, unsigned NumParams, const TemplateArgument *Args, unsigned NumArgs, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced) |
static NonTypeTemplateParmDecl * | getDeducedParameterFromExpr (Expr *E) |
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 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) |
Verify that the given, deduced template arguments are compatible. | |
static Sema::TemplateDeductionResult | DeduceNonTypeTemplateArgument (Sema &S, NonTypeTemplateParmDecl *NTTP, 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 constant. | |
static Sema::TemplateDeductionResult | DeduceNonTypeTemplateArgument (Sema &S, 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. | |
static Sema::TemplateDeductionResult | DeduceNonTypeTemplateArgument (Sema &S, NonTypeTemplateParmDecl *NTTP, ValueDecl *D, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced) |
Deduce the value of the given non-type template parameter from the given declaration. | |
static Sema::TemplateDeductionResult | DeduceTemplateArguments (Sema &S, TemplateParameterList *TemplateParams, TemplateName Param, TemplateName Arg, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced) |
static Sema::TemplateDeductionResult | DeduceTemplateArguments (Sema &S, TemplateParameterList *TemplateParams, const TemplateSpecializationType *Param, QualType Arg, 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. | |
static bool | IsPossiblyOpaquelyQualifiedType (QualType T) |
Determines whether the given type is an opaque type that might be more qualified when instantiated. | |
static std::pair< unsigned, unsigned > | getDepthAndIndex (NamedDecl *ND) |
Retrieve the depth and index of a template parameter. | |
static std::pair< unsigned, unsigned > | getDepthAndIndex (UnexpandedParameterPack UPP) |
Retrieve the depth and index of an unexpanded parameter pack. | |
static TemplateParameter | makeTemplateParameter (Decl *D) |
Helper function to build a TemplateParameter when we don't know its type statically. | |
static Sema::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, SmallVectorImpl< RefParamPartialOrderingComparison > *RefParamComparisons=nullptr) |
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 are either inconsistent with or a superset of the argument's qualifiers. | |
static bool | hasTemplateArgumentForDeduction (const TemplateArgument *&Args, unsigned &ArgIdx, unsigned &NumArgs) |
Determine whether there is a template argument to be used for deduction. | |
static bool | hasPackExpansionBeforeEnd (const TemplateArgument *Args, unsigned NumArgs) |
Determine whether the given set of template arguments has a pack expansion that is not the last template argument. | |
static Sema::TemplateDeductionResult | DeduceTemplateArguments (Sema &S, TemplateParameterList *TemplateParams, const TemplateArgumentList &ParamList, const TemplateArgumentList &ArgList, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced) |
static bool | isSameTemplateArg (ASTContext &Context, const TemplateArgument &X, const TemplateArgument &Y) |
Determine whether two template arguments are the same. | |
static TemplateArgumentLoc | getTrivialTemplateArgumentLoc (Sema &S, const TemplateArgument &Arg, QualType NTTPType, SourceLocation Loc) |
Allocate a TemplateArgumentLoc where all locations have been initialized to the given location. | |
static bool | ConvertDeducedTemplateArgument (Sema &S, NamedDecl *Param, DeducedTemplateArgument Arg, NamedDecl *Template, QualType NTTPType, unsigned ArgumentPackIndex, TemplateDeductionInfo &Info, bool InFunctionTemplate, SmallVectorImpl< TemplateArgument > &Output) |
Convert the given deduced template argument and add it to the set of fully-converted template arguments. | |
static Sema::TemplateDeductionResult | FinishTemplateArgumentDeduction (Sema &S, ClassTemplatePartialSpecializationDecl *Partial, const TemplateArgumentList &TemplateArgs, SmallVectorImpl< DeducedTemplateArgument > &Deduced, TemplateDeductionInfo &Info) |
static Sema::TemplateDeductionResult | FinishTemplateArgumentDeduction (Sema &S, VarTemplatePartialSpecializationDecl *Partial, const TemplateArgumentList &TemplateArgs, SmallVectorImpl< DeducedTemplateArgument > &Deduced, TemplateDeductionInfo &Info) |
static bool | isSimpleTemplateIdType (QualType T) |
Determine whether the given type T is a simple-template-id type. | |
static bool | CheckOriginalCallArgDeduction (Sema &S, 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 QualType | GetTypeOfFunction (Sema &S, const OverloadExpr::FindResult &R, FunctionDecl *Fn) |
static QualType | ResolveOverloadForDeduction (Sema &S, TemplateParameterList *TemplateParams, Expr *Arg, QualType ParamType, bool ParamWasReference) |
static bool | AdjustFunctionParmAndArgTypesForDeduction (Sema &S, TemplateParameterList *TemplateParams, QualType &ParamType, QualType &ArgType, Expr *Arg, unsigned &TDF) |
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 Sema::TemplateDeductionResult | DeduceTemplateArgumentByListElement (Sema &S, TemplateParameterList *TemplateParams, QualType ParamType, Expr *Arg, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced, unsigned TDF) |
Perform template argument deduction by matching a parameter type against a single expression, where the expression is an element of an initializer list that was originally matched against a parameter of type initializer_list<ParamType> . | |
static void | SubstAutoWithinFunctionReturnType (FunctionDecl *F, QualType TypeToReplaceAutoWith, Sema &S) |
Given a function declaration (e.g. a generic lambda conversion function) that contains an 'auto' in its result type, substitute it with TypeToReplaceAutoWith. Be careful to pass in the type you want to replace 'auto' with and not the actual result type you want to set the function to. | |
static Sema::TemplateDeductionResult | SpecializeCorrespondingLambdaCallOperatorAndInvoker (CXXConversionDecl *ConversionSpecialized, SmallVectorImpl< DeducedTemplateArgument > &DeducedArguments, QualType ReturnTypeOfDestFunctionPtr, TemplateDeductionInfo &TDInfo, Sema &S) |
Given a specialized conversion operator of a generic lambda create the corresponding specializations of the call operator and the static-invoker. If the return type of the call operator is auto, deduce its return type and check if that matches the return type of the destination function ptr. | |
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 void | AddImplicitObjectParameterType (ASTContext &Context, CXXMethodDecl *Method, SmallVectorImpl< QualType > &ArgTypes) |
If this is a non-static member function,. | |
static bool | isAtLeastAsSpecializedAs (Sema &S, SourceLocation Loc, FunctionTemplateDecl *FT1, FunctionTemplateDecl *FT2, TemplatePartialOrderingContext TPOC, unsigned NumCallArguments1, SmallVectorImpl< RefParamPartialOrderingComparison > *RefParamComparisons) |
Determine whether the function template FT1 is at least as specialized as FT2 . | |
static bool | isVariadicFunctionTemplate (FunctionTemplateDecl *FunTmpl) |
Determine whether this a function template whose parameter-type-list ends with a function parameter pack. | |
static bool | isSameTemplate (TemplateDecl *T1, TemplateDecl *T2) |
Determine if the two templates are equivalent. | |
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, 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 | |||
) | case Type::Class: llvm_unreachable("deducing non-canonical type: " #Class); |
#define NON_CANONICAL_TYPE | ( | Class, | |
Base | |||
) | case Type::Class: |
Whether template argument deduction for two reference parameters resulted in the argument type, parameter type, or neither type being more qualified than the other.
Definition at line 97 of file SemaTemplateDeduction.cpp.
static void AddImplicitObjectParameterType | ( | ASTContext & | Context, |
CXXMethodDecl * | Method, | ||
SmallVectorImpl< QualType > & | ArgTypes | ||
) | [static] |
If this is a non-static member function,.
Definition at line 4126 of file SemaTemplateDeduction.cpp.
References clang::Qualifiers::fromCVRMask(), clang::ASTContext::getLValueReferenceType(), clang::CXXMethodDecl::getParent(), clang::ASTContext::getQualifiedType(), clang::CXXMethodDecl::getRefQualifier(), clang::ASTContext::getRValueReferenceType(), clang::ASTContext::getTypeDeclType(), clang::CXXMethodDecl::getTypeQualifiers(), and clang::RQ_RValue.
Referenced by isAtLeastAsSpecializedAs().
static bool AdjustFunctionParmAndArgTypesForDeduction | ( | Sema & | S, |
TemplateParameterList * | TemplateParams, | ||
QualType & | ParamType, | ||
QualType & | ArgType, | ||
Expr * | Arg, | ||
unsigned & | TDF | ||
) | [static] |
Perform the adjustments to the parameter and argument types described in C++ [temp.deduct.call].
Definition at line 3125 of file SemaTemplateDeduction.cpp.
References clang::ASTContext::BoundMemberTy, clang::Expr::Classify(), clang::Sema::Context, clang::ASTContext::getArrayDecayedType(), clang::Type::getAs(), clang::ASTContext::getLValueReferenceType(), clang::PointerType::getPointeeType(), clang::ReferenceType::getPointeeType(), clang::ASTContext::getPointerType(), clang::QualType::getQualifiers(), clang::Expr::getType(), clang::QualType::getUnqualifiedType(), clang::QualType::hasQualifiers(), clang::Type::isArrayType(), clang::Type::isFunctionType(), clang::Type::isIncompleteArrayType(), clang::Expr::isLValue(), clang::Expr::Classification::isLValue(), clang::Type::isMemberPointerType(), clang::QualType::isNull(), clang::Type::isObjCObjectPointerType(), clang::Type::isPointerType(), clang::Type::isRValueReferenceType(), isSimpleTemplateIdType(), clang::ASTContext::OverloadTy, clang::Sema::RequireCompleteExprType(), ResolveOverloadForDeduction(), clang::TDF_DerivedClass, clang::TDF_IgnoreQualifiers, clang::TDF_ParamWithReferenceType, and clang::TDF_SkipNonDependent.
Referenced by clang::Sema::DeduceAutoType(), DeduceTemplateArgumentByListElement(), and clang::Sema::DeduceTemplateArguments().
static DeducedTemplateArgument checkDeducedTemplateArguments | ( | ASTContext & | Context, |
const DeducedTemplateArgument & | X, | ||
const DeducedTemplateArgument & | Y | ||
) | [static] |
Verify that the given, deduced template arguments are compatible.
Definition at line 177 of file SemaTemplateDeduction.cpp.
References 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::getNullPtrType(), hasSameExtendedValue(), clang::ASTContext::hasSameTemplateName(), clang::ASTContext::hasSameType(), clang::TemplateArgument::Integral, 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::Template, clang::TemplateArgument::TemplateExpansion, clang::TemplateArgument::Type, clang::DeducedTemplateArgument::wasDeducedFromArrayBound(), and X.
Referenced by DeduceNonTypeTemplateArgument(), DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), and PackDeductionScope::finish().
static bool CheckOriginalCallArgDeduction | ( | Sema & | S, |
Sema::OriginalCallArg | OriginalArg, | ||
QualType | DeducedA | ||
) | [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 2673 of file SemaTemplateDeduction.cpp.
References clang::Qualifiers::compatiblyIncludes(), clang::Sema::Context, Context, clang::Type::getAs(), clang::Sema::getLangOpts(), clang::Qualifiers::getObjCLifetime(), clang::Type::getPointeeType(), clang::ASTContext::getQualifiedType(), clang::QualType::getQualifiers(), clang::QualType::getUnqualifiedType(), clang::Qualifiers::hasConst(), clang::ASTContext::hasSameUnqualifiedType(), clang::Type::isAnyPointerType(), clang::Sema::IsDerivedFrom(), clang::Type::isMemberPointerType(), clang::Sema::IsNoReturnConversion(), 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, and clang::Qualifiers::setObjCLifetime().
Referenced by clang::Sema::DeduceAutoType(), and clang::Sema::FinishTemplateArgumentDeduction().
static bool ConvertDeducedTemplateArgument | ( | Sema & | S, |
NamedDecl * | Param, | ||
DeducedTemplateArgument | Arg, | ||
NamedDecl * | Template, | ||
QualType | NTTPType, | ||
unsigned | ArgumentPackIndex, | ||
TemplateDeductionInfo & | Info, | ||
bool | InFunctionTemplate, | ||
SmallVectorImpl< TemplateArgument > & | Output | ||
) | [static] |
Convert the given deduced template argument and add it to the set of fully-converted template arguments.
Definition at line 2086 of file SemaTemplateDeduction.cpp.
References clang::Sema::CheckTemplateArgument(), clang::Sema::Context, clang::TemplateArgument::CreatePackCopy(), clang::Sema::CTAK_Deduced, clang::Sema::CTAK_DeducedFromArrayBound, clang::Sema::CTAK_Specified, clang::SourceRange::getEnd(), clang::TemplateArgument::getKind(), clang::sema::TemplateDeductionInfo::getLocation(), clang::Decl::getLocation(), clang::Decl::getSourceRange(), getTrivialTemplateArgumentLoc(), P, clang::TemplateArgument::Pack, clang::TemplateArgument::pack_elements(), clang::DeducedTemplateArgument::setDeducedFromArrayBound(), and clang::DeducedTemplateArgument::wasDeducedFromArrayBound().
Referenced by FinishTemplateArgumentDeduction(), and clang::Sema::FinishTemplateArgumentDeduction().
static Sema::TemplateDeductionResult DeduceNonTypeTemplateArgument | ( | Sema & | S, |
NonTypeTemplateParmDecl * | NTTP, | ||
llvm::APSInt | Value, | ||
QualType | ValueType, | ||
bool | DeducedFromArrayBound, | ||
TemplateDeductionInfo & | Info, | ||
SmallVectorImpl< DeducedTemplateArgument > & | Deduced | ||
) | [static] |
Deduce the value of the given non-type template parameter from the given constant.
Definition at line 316 of file SemaTemplateDeduction.cpp.
References checkDeducedTemplateArguments(), clang::Sema::Context, clang::sema::TemplateDeductionInfo::FirstArg, clang::TemplateParmPosition::getDepth(), clang::TemplateParmPosition::getIndex(), clang::TemplateArgument::isNull(), clang::sema::TemplateDeductionInfo::Param, clang::sema::TemplateDeductionInfo::SecondArg, clang::Sema::TDK_Inconsistent, and clang::Sema::TDK_Success.
Referenced by DeduceTemplateArguments(), and DeduceTemplateArgumentsByTypeMatch().
static Sema::TemplateDeductionResult DeduceNonTypeTemplateArgument | ( | Sema & | S, |
NonTypeTemplateParmDecl * | NTTP, | ||
Expr * | Value, | ||
TemplateDeductionInfo & | Info, | ||
SmallVectorImpl< DeducedTemplateArgument > & | Deduced | ||
) | [static] |
Deduce the value of the given non-type template parameter from the given type- or value-dependent expression.
Definition at line 346 of file SemaTemplateDeduction.cpp.
References checkDeducedTemplateArguments(), clang::Sema::Context, clang::sema::TemplateDeductionInfo::FirstArg, clang::TemplateParmPosition::getDepth(), clang::TemplateParmPosition::getIndex(), clang::TemplateArgument::isNull(), clang::Expr::isTypeDependent(), clang::Expr::isValueDependent(), clang::sema::TemplateDeductionInfo::Param, clang::sema::TemplateDeductionInfo::SecondArg, clang::Sema::TDK_Inconsistent, and clang::Sema::TDK_Success.
static Sema::TemplateDeductionResult DeduceNonTypeTemplateArgument | ( | Sema & | S, |
NonTypeTemplateParmDecl * | NTTP, | ||
ValueDecl * | D, | ||
TemplateDeductionInfo & | Info, | ||
SmallVectorImpl< DeducedTemplateArgument > & | Deduced | ||
) | [static] |
Deduce the value of the given non-type template parameter from the given declaration.
Definition at line 377 of file SemaTemplateDeduction.cpp.
References checkDeducedTemplateArguments(), clang::Sema::Context, clang::sema::TemplateDeductionInfo::FirstArg, clang::TemplateParmPosition::getDepth(), clang::TemplateParmPosition::getIndex(), clang::ValueDecl::getType(), clang::TemplateArgument::isNull(), clang::sema::TemplateDeductionInfo::Param, clang::sema::TemplateDeductionInfo::SecondArg, clang::Sema::TDK_Inconsistent, and clang::Sema::TDK_Success.
static Sema::TemplateDeductionResult DeduceTemplateArgumentByListElement | ( | Sema & | S, |
TemplateParameterList * | TemplateParams, | ||
QualType | ParamType, | ||
Expr * | Arg, | ||
TemplateDeductionInfo & | Info, | ||
SmallVectorImpl< DeducedTemplateArgument > & | Deduced, | ||
unsigned | TDF | ||
) | [static] |
Perform template argument deduction by matching a parameter type against a single expression, where the expression is an element of an initializer list that was originally matched against a parameter of type initializer_list<ParamType>
.
Definition at line 3241 of file SemaTemplateDeduction.cpp.
References AdjustFunctionParmAndArgTypesForDeduction(), DeduceTemplateArgumentsByTypeMatch(), clang::sema::TemplateDeductionInfo::Expression, clang::QualType::getNonReferenceType(), clang::Expr::getType(), clang::Sema::isStdInitializerList(), clang::Sema::TDK_FailedOverloadResolution, clang::Sema::TDK_Success, and X.
Referenced by clang::Sema::DeduceAutoType(), and clang::Sema::DeduceTemplateArguments().
static Sema::TemplateDeductionResult DeduceTemplateArguments | ( | Sema & | S, |
TemplateParameterList * | TemplateParams, | ||
const TemplateArgument & | Param, | ||
TemplateArgument | Arg, | ||
TemplateDeductionInfo & | Info, | ||
SmallVectorImpl< DeducedTemplateArgument > & | Deduced | ||
) | [static] |
Definition at line 1690 of file SemaTemplateDeduction.cpp.
References clang::Sema::Context, clang::TemplateArgument::Declaration, DeduceNonTypeTemplateArgument(), DeduceTemplateArgumentsByTypeMatch(), clang::TemplateArgument::Expression, clang::sema::TemplateDeductionInfo::FirstArg, clang::TemplateArgument::getAsDecl(), clang::TemplateArgument::getAsExpr(), clang::TemplateArgument::getAsIntegral(), clang::TemplateArgument::getAsTemplate(), clang::TemplateArgument::getAsType(), getDeducedParameterFromExpr(), clang::TemplateArgument::getIntegralType(), clang::TemplateArgument::getKind(), clang::TemplateArgument::getNullPtrType(), clang::TemplateArgument::getPackExpansionPattern(), hasSameExtendedValue(), clang::ASTContext::hasSameType(), clang::TemplateArgument::Integral, clang::TemplateArgument::isPackExpansion(), isSameDeclaration(), clang::TemplateArgument::Null, clang::TemplateArgument::NullPtr, clang::TemplateArgument::Pack, clang::sema::TemplateDeductionInfo::SecondArg, clang::Sema::TDK_NonDeducedMismatch, clang::Sema::TDK_Success, clang::TemplateArgument::Template, clang::TemplateArgument::TemplateExpansion, and clang::TemplateArgument::Type.
Referenced by clang::Sema::ActOnExplicitInstantiation(), clang::Sema::CheckFunctionTemplateSpecialization(), clang::Sema::CheckVarTemplateId(), DeduceTemplateArguments(), clang::Sema::DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), and isAtLeastAsSpecializedAs().
static Sema::TemplateDeductionResult DeduceTemplateArguments | ( | Sema & | S, |
TemplateParameterList * | TemplateParams, | ||
const TemplateArgument * | Params, | ||
unsigned | NumParams, | ||
const TemplateArgument * | Args, | ||
unsigned | NumArgs, | ||
TemplateDeductionInfo & | Info, | ||
SmallVectorImpl< DeducedTemplateArgument > & | Deduced | ||
) | [static] |
Definition at line 1850 of file SemaTemplateDeduction.cpp.
References DeduceTemplateArguments(), PackDeductionScope::finish(), clang::TemplateArgument::getPackExpansionPattern(), hasPackExpansionBeforeEnd(), hasTemplateArgumentForDeduction(), PackDeductionScope::nextPackElement(), clang::Sema::TDK_MiscellaneousDeductionFailure, and clang::Sema::TDK_Success.
static Sema::TemplateDeductionResult DeduceTemplateArguments | ( | Sema & | S, |
TemplateParameterList * | TemplateParams, | ||
TemplateName | Param, | ||
TemplateName | Arg, | ||
TemplateDeductionInfo & | Info, | ||
SmallVectorImpl< DeducedTemplateArgument > & | Deduced | ||
) | [static] |
Definition at line 403 of file SemaTemplateDeduction.cpp.
References checkDeducedTemplateArguments(), clang::Sema::Context, clang::sema::TemplateDeductionInfo::FirstArg, clang::TemplateName::getAsTemplateDecl(), clang::ASTContext::getCanonicalTemplateName(), clang::ASTContext::hasSameTemplateName(), clang::sema::TemplateDeductionInfo::Param, clang::sema::TemplateDeductionInfo::SecondArg, clang::Sema::TDK_Inconsistent, clang::Sema::TDK_NonDeducedMismatch, and clang::Sema::TDK_Success.
static Sema::TemplateDeductionResult DeduceTemplateArguments | ( | Sema & | S, |
TemplateParameterList * | TemplateParams, | ||
const TemplateSpecializationType * | Param, | ||
QualType | Arg, | ||
TemplateDeductionInfo & | Info, | ||
SmallVectorImpl< DeducedTemplateArgument > & | Deduced | ||
) | [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 |
Param | the parameter type |
Arg | the argument type |
Info | information about the template argument deduction itself |
Deduced | the deduced template arguments |
Definition at line 462 of file SemaTemplateDeduction.cpp.
References clang::TemplateArgumentList::data(), DeduceTemplateArguments(), clang::sema::TemplateDeductionInfo::FirstArg, clang::TemplateSpecializationType::getArgs(), clang::RecordType::getDecl(), clang::TemplateSpecializationType::getNumArgs(), clang::ClassTemplateSpecializationDecl::getSpecializedTemplate(), clang::ClassTemplateSpecializationDecl::getTemplateArgs(), clang::TemplateSpecializationType::getTemplateName(), clang::QualType::isCanonical(), clang::sema::TemplateDeductionInfo::SecondArg, clang::TemplateArgumentList::size(), and clang::Sema::TDK_NonDeducedMismatch.
static Sema::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 , |
||
SmallVectorImpl< RefParamPartialOrderingComparison > * | RefParamComparisons = nullptr |
||
) | [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]). |
RefParamComparisons | If we're performing template argument deduction in the context of partial ordering, the set of qualifier comparisons. |
Definition at line 794 of file SemaTemplateDeduction.cpp.
References DeduceTemplateArgumentsByTypeMatch(), PackDeductionScope::finish(), clang::PackExpansionType::getPattern(), PackDeductionScope::nextPackElement(), clang::Sema::TDK_MiscellaneousDeductionFailure, and clang::Sema::TDK_Success.
static Sema::TemplateDeductionResult DeduceTemplateArguments | ( | Sema & | S, |
TemplateParameterList * | TemplateParams, | ||
const TemplateArgumentList & | ParamList, | ||
const TemplateArgumentList & | ArgList, | ||
TemplateDeductionInfo & | Info, | ||
SmallVectorImpl< DeducedTemplateArgument > & | Deduced | ||
) | [static] |
Definition at line 1937 of file SemaTemplateDeduction.cpp.
References clang::TemplateArgumentList::data(), DeduceTemplateArguments(), and clang::TemplateArgumentList::size().
static Sema::TemplateDeductionResult DeduceTemplateArgumentsByTypeMatch | ( | Sema & | S, |
TemplateParameterList * | TemplateParams, | ||
QualType | ParamIn, | ||
QualType | ArgIn, | ||
TemplateDeductionInfo & | Info, | ||
SmallVectorImpl< DeducedTemplateArgument > & | Deduced, | ||
unsigned | TDF, | ||
bool | PartialOrdering, | ||
SmallVectorImpl< RefParamPartialOrderingComparison > * | RefParamComparisons | ||
) | [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 |
ParamIn | the parameter type |
ArgIn | 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]). |
RefParamComparisons | If we're performing template argument deduction in the context of partial ordering, the set of qualifier comparisons. |
Definition at line 977 of file SemaTemplateDeduction.cpp.
References RefParamPartialOrderingComparison::ArgIsRvalueRef, ArgMoreQualified, clang::CXXRecordDecl::bases(), checkDeducedTemplateArguments(), clang::Sema::Context, DeduceNonTypeTemplateArgument(), DeduceTemplateArguments(), clang::sema::TemplateDeductionInfo::FirstArg, clang::Type::getAs(), clang::ASTContext::getAsArrayType(), clang::ASTContext::getAsConstantArrayType(), clang::ASTContext::getAsDependentSizedArrayType(), clang::ASTContext::getAsIncompleteArrayType(), clang::ASTContext::getCanonicalType(), clang::MemberPointerType::getClass(), clang::Qualifiers::getCVRQualifiers(), clang::QualType::getCVRQualifiers(), clang::RecordType::getDecl(), getDeducedParameterFromExpr(), clang::TemplateParmPosition::getDepth(), clang::ArrayType::getElementType(), clang::DependentSizedExtVectorType::getElementType(), clang::VectorType::getElementType(), getElementType(), clang::Sema::getLangOpts(), clang::sema::TemplateDeductionInfo::getLocation(), clang::VectorType::getNumElements(), clang::FunctionProtoType::getNumParams(), clang::Qualifiers::getObjCLifetime(), clang::TemplateParameterList::getParam(), clang::Type::getPointeeType(), clang::BlockPointerType::getPointeeType(), clang::ReferenceType::getPointeeType(), clang::MemberPointerType::getPointeeType(), clang::ASTContext::getQualifiedType(), clang::QualType::getQualifiers(), clang::FunctionProtoType::getRefQualifier(), clang::FunctionType::getReturnType(), clang::ConstantArrayType::getSize(), clang::DependentSizedArrayType::getSizeExpr(), clang::DependentSizedExtVectorType::getSizeExpr(), clang::ASTContext::getSizeType(), clang::Type::getTypeClass(), clang::FunctionProtoType::getTypeQuals(), clang::ASTContext::getTypeSize(), clang::ASTContext::getUnqualifiedArrayType(), clang::CanQual< T >::getUnqualifiedType(), clang::QualType::getUnqualifiedType(), clang::Qualifiers::hasAddressSpace(), hasInconsistentOrSupersetQualifiersOf(), clang::Qualifiers::hasObjCGCAttr(), clang::Qualifiers::hasObjCLifetime(), clang::ASTContext::IntTy, clang::Type::isDependentType(), clang::Type::isFunctionType(), clang::Type::isLValueReferenceType(), clang::TemplateArgument::isNull(), clang::Type::isObjCLifetimeType(), clang::Type::isPlaceholderType(), IsPossiblyOpaquelyQualifiedType(), clang::Sema::isSameOrCompatibleFunctionType(), clang::Qualifiers::isStrictSupersetOf(), clang::FunctionProtoType::isVariadic(), NeitherMoreQualified, clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_Strong, clang::ASTContext::OverloadTy, clang::sema::TemplateDeductionInfo::Param, clang::FunctionProtoType::param_type_begin(), RefParamPartialOrderingComparison::ParamIsRvalueRef, ParamMoreQualified, RefParamPartialOrderingComparison::Qualifiers, Record, clang::Qualifiers::removeAddressSpace(), clang::Qualifiers::removeCVRQualifiers(), clang::Qualifiers::removeObjCGCAttr(), clang::Qualifiers::removeObjCLifetime(), clang::Sema::RequireCompleteType(), clang::sema::TemplateDeductionInfo::SecondArg, clang::Qualifiers::setCVRQualifiers(), clang::Qualifiers::setObjCLifetime(), clang::format::Success, clang::TDF_DerivedClass, clang::TDF_IgnoreQualifiers, clang::TDF_InOverloadResolution, clang::TDF_ParamWithReferenceType, clang::TDF_SkipNonDependent, clang::TDF_TopLevelParameterTypeList, clang::Sema::TDK_Inconsistent, clang::Sema::TDK_NonDeducedMismatch, clang::Sema::TDK_Success, clang::Sema::TDK_Underqualified, and clang::Qualifiers::withoutObjCLifetime().
Referenced by clang::Sema::DeduceAutoType(), DeduceTemplateArgumentByListElement(), DeduceTemplateArguments(), clang::Sema::DeduceTemplateArguments(), clang::Sema::getMoreSpecializedPartialSpecialization(), isAtLeastAsSpecializedAs(), and ResolveOverloadForDeduction().
static Sema::TemplateDeductionResult FinishTemplateArgumentDeduction | ( | Sema & | S, |
ClassTemplatePartialSpecializationDecl * | Partial, | ||
const TemplateArgumentList & | TemplateArgs, | ||
SmallVectorImpl< DeducedTemplateArgument > & | Deduced, | ||
TemplateDeductionInfo & | Info | ||
) | [static] |
Complete template argument deduction for a class template partial specialization.
Definition at line 2143 of file SemaTemplateDeduction.cpp.
References Builder, clang::Sema::CheckTemplateArgumentList(), clang::Sema::Context, ConvertDeducedTemplateArgument(), clang::TemplateArgumentList::CreateCopy(), clang::sema::TemplateDeductionInfo::FirstArg, clang::TemplateArgumentLoc::getArgument(), clang::Decl::getLocation(), clang::TemplateParameterList::getParam(), clang::ClassTemplateSpecializationDecl::getSpecializedTemplate(), clang::ASTTemplateArgumentListInfo::getTemplateArgs(), clang::ClassTemplatePartialSpecializationDecl::getTemplateArgsAsWritten(), clang::TemplateDecl::getTemplateParameters(), clang::ClassTemplatePartialSpecializationDecl::getTemplateParameters(), clang::Sema::SFINAETrap::hasErrorOccurred(), clang::Type::isDependentType(), isSameTemplateArg(), clang::ASTTemplateArgumentListInfo::LAngleLoc, makeTemplateParameter(), clang::ASTTemplateArgumentListInfo::NumTemplateArgs, clang::TemplateArgumentList::OnStack, clang::sema::TemplateDeductionInfo::Param, clang::ASTTemplateArgumentListInfo::RAngleLoc, clang::sema::TemplateDeductionInfo::reset(), clang::sema::TemplateDeductionInfo::SecondArg, clang::TemplateParameterList::size(), clang::TemplateArgumentListInfo::size(), clang::Sema::Subst(), clang::Sema::SubstType(), clang::Sema::TDK_Incomplete, clang::Sema::TDK_NonDeducedMismatch, clang::Sema::TDK_SubstitutionFailure, clang::Sema::TDK_Success, and clang::Sema::Unevaluated.
Referenced by clang::Sema::DeduceTemplateArguments(), and clang::Sema::getMoreSpecializedPartialSpecialization().
static Sema::TemplateDeductionResult FinishTemplateArgumentDeduction | ( | Sema & | S, |
VarTemplatePartialSpecializationDecl * | Partial, | ||
const TemplateArgumentList & | TemplateArgs, | ||
SmallVectorImpl< DeducedTemplateArgument > & | Deduced, | ||
TemplateDeductionInfo & | Info | ||
) | [static] |
Complete template argument deduction for a variable template partial specialization. TODO: Unify with ClassTemplatePartialSpecializationDecl version? May require unifying ClassTemplate(Partial)SpecializationDecl and VarTemplate(Partial)SpecializationDecl with a new data structure Template(Partial)SpecializationDecl, and using Template(Partial)SpecializationDecl as input type.
Definition at line 2313 of file SemaTemplateDeduction.cpp.
References Builder, clang::Sema::CheckTemplateArgumentList(), clang::Sema::Context, ConvertDeducedTemplateArgument(), clang::TemplateArgumentList::CreateCopy(), clang::sema::TemplateDeductionInfo::FirstArg, clang::TemplateArgumentLoc::getArgument(), clang::Decl::getLocation(), clang::TemplateParameterList::getParam(), clang::VarTemplateSpecializationDecl::getSpecializedTemplate(), clang::ASTTemplateArgumentListInfo::getTemplateArgs(), clang::VarTemplatePartialSpecializationDecl::getTemplateArgsAsWritten(), clang::TemplateDecl::getTemplateParameters(), clang::VarTemplatePartialSpecializationDecl::getTemplateParameters(), clang::Sema::SFINAETrap::hasErrorOccurred(), clang::Type::isDependentType(), isSameTemplateArg(), clang::ASTTemplateArgumentListInfo::LAngleLoc, makeTemplateParameter(), clang::ASTTemplateArgumentListInfo::NumTemplateArgs, clang::TemplateArgumentList::OnStack, clang::sema::TemplateDeductionInfo::Param, clang::ASTTemplateArgumentListInfo::RAngleLoc, clang::sema::TemplateDeductionInfo::reset(), clang::sema::TemplateDeductionInfo::SecondArg, clang::TemplateParameterList::size(), clang::TemplateArgumentListInfo::size(), clang::Sema::Subst(), clang::Sema::SubstType(), clang::Sema::TDK_Incomplete, clang::Sema::TDK_NonDeducedMismatch, clang::Sema::TDK_SubstitutionFailure, clang::Sema::TDK_Success, and clang::Sema::Unevaluated.
static NonTypeTemplateParmDecl* getDeducedParameterFromExpr | ( | Expr * | E | ) | [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 142 of file SemaTemplateDeduction.cpp.
Referenced by DeduceTemplateArguments(), and DeduceTemplateArgumentsByTypeMatch().
static std::pair<unsigned, unsigned> getDepthAndIndex | ( | NamedDecl * | ND | ) | [static] |
Retrieve the depth and index of a template parameter.
Definition at line 552 of file SemaTemplateDeduction.cpp.
References clang::TemplateParmPosition::getDepth(), and clang::TemplateParmPosition::getIndex().
Referenced by getDepthAndIndex(), and PackDeductionScope::PackDeductionScope().
static std::pair<unsigned, unsigned> getDepthAndIndex | ( | UnexpandedParameterPack | UPP | ) | [static] |
Retrieve the depth and index of an unexpanded parameter pack.
Definition at line 565 of file SemaTemplateDeduction.cpp.
References getDepthAndIndex().
static TemplateArgumentLoc getTrivialTemplateArgumentLoc | ( | Sema & | S, |
const TemplateArgument & | Arg, | ||
QualType | NTTPType, | ||
SourceLocation | Loc | ||
) | [static] |
Allocate a TemplateArgumentLoc where all locations have been initialized to the given location.
S | The semantic analysis object. |
Arg | The template argument we are producing template argument location information for. |
NTTPType | For a declaration template argument, the type of the non-type template parameter that corresponds to this template argument. |
Loc | The source location to use for the resulting template argument. |
Definition at line 2019 of file SemaTemplateDeduction.cpp.
References Builder, clang::Sema::BuildExpressionFromDeclTemplateArgument(), clang::Sema::BuildExpressionFromIntegralTemplateArgument(), clang::Sema::Context, clang::TemplateArgument::Declaration, clang::TemplateArgument::Expression, clang::ActionResult< PtrTy, CompressInvalid >::getAs(), clang::TemplateName::getAsDependentTemplateName(), clang::TemplateArgument::getAsExpr(), clang::TemplateName::getAsQualifiedTemplateName(), clang::TemplateArgument::getAsTemplate(), clang::TemplateArgument::getAsType(), clang::TemplateArgument::getKind(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::NestedNameSpecifierLocBuilder::getWithLocInContext(), clang::TemplateArgument::Integral, clang::NestedNameSpecifierLocBuilder::MakeTrivial(), clang::TemplateArgument::Null, clang::TemplateArgument::NullPtr, clang::TemplateArgument::Pack, clang::TemplateArgument::Template, clang::TemplateArgument::TemplateExpansion, and clang::TemplateArgument::Type.
Referenced by ConvertDeducedTemplateArgument().
static QualType GetTypeOfFunction | ( | Sema & | S, |
const OverloadExpr::FindResult & | R, | ||
FunctionDecl * | Fn | ||
) | [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 3000 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::FunctionDecl::getReturnType(), clang::ValueDecl::getType(), clang::ASTContext::getTypeDeclType(), clang::OverloadExpr::FindResult::HasFormOfMemberPointer, clang::OverloadExpr::FindResult::IsAddressOfOperand, and clang::Type::isUndeducedType().
Referenced by ResolveOverloadForDeduction().
bool hasDeducibleTemplateParameters | ( | Sema & | S, |
FunctionTemplateDecl * | FunctionTemplate, | ||
QualType | T | ||
) | [static] |
Definition at line 5087 of file SemaTemplateDeduction.cpp.
References clang::Sema::Context, clang::TemplateParameterList::getDepth(), clang::TemplateDecl::getTemplateParameters(), clang::Type::isDependentType(), MarkUsedTemplateParameters(), and clang::TemplateParameterList::size().
Referenced by clang::Sema::DeduceTemplateArguments().
static bool hasInconsistentOrSupersetQualifiersOf | ( | QualType | ParamType, |
QualType | ArgType | ||
) | [static] |
Determine whether the parameter has qualifiers that are either inconsistent with or a superset of the argument's qualifiers.
Definition at line 894 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 bool hasPackExpansionBeforeEnd | ( | const TemplateArgument * | Args, |
unsigned | NumArgs | ||
) | [static] |
Determine whether the given set of template arguments has a pack expansion that is not the last template argument.
Definition at line 1824 of file SemaTemplateDeduction.cpp.
References getKind(), clang::TemplateArgument::isPackExpansion(), clang::TemplateArgument::Pack, clang::TemplateArgument::pack_begin(), and clang::TemplateArgument::pack_size().
Referenced by DeduceTemplateArguments(), MarkUsedTemplateParameters(), and clang::Sema::MarkUsedTemplateParameters().
static bool hasSameExtendedValue | ( | llvm::APSInt | X, |
llvm::APSInt | Y | ||
) | [static] |
Compare two APSInts, extending and switching the sign as necessary to compare their values regardless of underlying type.
Definition at line 67 of file SemaTemplateDeduction.cpp.
Referenced by checkDeducedTemplateArguments(), and DeduceTemplateArguments().
static bool hasTemplateArgumentForDeduction | ( | const TemplateArgument *& | Args, |
unsigned & | ArgIdx, | ||
unsigned & | NumArgs | ||
) | [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 1805 of file SemaTemplateDeduction.cpp.
References clang::TemplateArgument::getKind(), clang::TemplateArgument::Pack, clang::TemplateArgument::pack_begin(), and clang::TemplateArgument::pack_size().
Referenced by DeduceTemplateArguments().
static bool isAtLeastAsSpecializedAs | ( | Sema & | S, |
SourceLocation | Loc, | ||
FunctionTemplateDecl * | FT1, | ||
FunctionTemplateDecl * | FT2, | ||
TemplatePartialOrderingContext | TPOC, | ||
unsigned | NumCallArguments1, | ||
SmallVectorImpl< RefParamPartialOrderingComparison > * | RefParamComparisons | ||
) | [static] |
Determine whether the function template FT1
is at least as specialized as FT2
.
Definition at line 4148 of file SemaTemplateDeduction.cpp.
References AddImplicitObjectParameterType(), clang::Sema::Context, DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), clang::Type::getAs(), clang::TemplateParameterList::getDepth(), clang::FunctionType::getReturnType(), clang::FunctionTemplateDecl::getTemplatedDecl(), clang::TemplateDecl::getTemplateParameters(), clang::ValueDecl::getType(), clang::CXXMethodDecl::isStatic(), MarkUsedTemplateParameters(), clang::FunctionProtoType::param_type_begin(), clang::FunctionProtoType::param_type_end(), clang::TemplateParameterList::size(), clang::TDF_None, clang::TPOC_Call, clang::TPOC_Conversion, and clang::TPOC_Other.
Referenced by clang::Sema::getMoreSpecializedTemplate().
static bool IsPossiblyOpaquelyQualifiedType | ( | QualType | T | ) | [static] |
Determines whether the given type is an opaque type that might be more qualified when instantiated.
Definition at line 528 of file SemaTemplateDeduction.cpp.
References getElementType(), and clang::Type::getTypeClass().
Referenced by DeduceTemplateArgumentsByTypeMatch().
static bool isSameDeclaration | ( | Decl * | X, |
Decl * | Y | ||
) | [static] |
Determine whether two declaration pointers refer to the same declaration.
Definition at line 163 of file SemaTemplateDeduction.cpp.
References clang::Decl::getCanonicalDecl().
Referenced by checkDeducedTemplateArguments(), DeduceTemplateArguments(), and isSameTemplateArg().
static bool isSameTemplate | ( | TemplateDecl * | T1, |
TemplateDecl * | T2 | ||
) | [static] |
Determine if the two templates are equivalent.
Definition at line 4431 of file SemaTemplateDeduction.cpp.
References clang::Decl::getCanonicalDecl().
Referenced by clang::Sema::getMostSpecialized().
static bool isSameTemplateArg | ( | ASTContext & | Context, |
const TemplateArgument & | X, | ||
const TemplateArgument & | Y | ||
) | [static] |
Determine whether two template arguments are the same.
Definition at line 1950 of file SemaTemplateDeduction.cpp.
References clang::TemplateArgument::Declaration, clang::TemplateArgument::Expression, clang::TemplateArgument::getAsDecl(), clang::TemplateArgument::getAsExpr(), clang::TemplateArgument::getAsIntegral(), clang::TemplateArgument::getAsTemplateOrTemplatePattern(), clang::TemplateArgument::getAsType(), clang::ASTContext::getCanonicalTemplateName(), clang::ASTContext::getCanonicalType(), clang::TemplateArgument::getKind(), clang::TemplateArgument::getNullPtrType(), clang::ASTContext::hasSameType(), clang::TemplateArgument::Integral, 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::Template, clang::TemplateArgument::TemplateExpansion, and clang::TemplateArgument::Type.
Referenced by FinishTemplateArgumentDeduction().
static bool isSimpleTemplateIdType | ( | QualType | T | ) | [static] |
Determine whether the given type T is a simple-template-id type.
Definition at line 2471 of file SemaTemplateDeduction.cpp.
References clang::Type::getAs().
Referenced by AdjustFunctionParmAndArgTypesForDeduction(), and CheckOriginalCallArgDeduction().
static bool isVariadicFunctionTemplate | ( | FunctionTemplateDecl * | FunTmpl | ) | [static] |
Determine whether this a function template whose parameter-type-list ends with a function parameter pack.
Definition at line 4298 of file SemaTemplateDeduction.cpp.
References clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getParamDecl(), clang::FunctionTemplateDecl::getTemplatedDecl(), clang::ParmVarDecl::isParameterPack(), and clang::LangAS::Last.
Referenced by clang::Sema::getMoreSpecializedTemplate().
static TemplateParameter makeTemplateParameter | ( | Decl * | D | ) | [static] |
Helper function to build a TemplateParameter when we don't know its type statically.
Definition at line 575 of file SemaTemplateDeduction.cpp.
Referenced by PackDeductionScope::finish(), FinishTemplateArgumentDeduction(), clang::Sema::FinishTemplateArgumentDeduction(), and clang::Sema::SubstituteExplicitTemplateArguments().
static void MarkUsedTemplateParameters | ( | ASTContext & | Ctx, |
QualType | T, | ||
bool | OnlyDeduced, | ||
unsigned | Level, | ||
llvm::SmallBitVector & | Deduced | ||
) | [static] |
Mark the template parameters that are used by the given type.
Definition at line 4773 of file SemaTemplateDeduction.cpp.
References Depth, clang::TemplateSpecializationType::getArg(), clang::DependentTemplateSpecializationType::getArg(), clang::TemplateSpecializationType::getArgs(), clang::DependentTemplateSpecializationType::getArgs(), clang::SubstTemplateTypeParmPackType::getArgumentPack(), clang::ASTContext::getCanonicalType(), clang::MemberPointerType::getClass(), clang::TemplateTypeParmType::getDepth(), clang::DependentSizedExtVectorType::getElementType(), getElementType(), clang::TemplateTypeParmType::getIndex(), clang::TemplateSpecializationType::getNumArgs(), clang::DependentTemplateSpecializationType::getNumArgs(), clang::FunctionProtoType::getNumParams(), clang::FunctionProtoType::getParamType(), clang::MemberPointerType::getPointeeType(), clang::DependentTemplateSpecializationType::getQualifier(), clang::SubstTemplateTypeParmPackType::getReplacedParameter(), clang::FunctionType::getReturnType(), clang::DependentSizedExtVectorType::getSizeExpr(), clang::TemplateSpecializationType::getTemplateName(), clang::Type::getTypeClass(), clang::QualType::getTypePtr(), getUnderlyingType(), hasPackExpansionBeforeEnd(), clang::Type::isDependentType(), clang::QualType::isNull(), Record, and Used.
Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnVarTemplateSpecialization(), hasDeducibleTemplateParameters(), isAtLeastAsSpecializedAs(), clang::Sema::MarkDeducedTemplateParameters(), MarkUsedTemplateParameters(), and clang::Sema::MarkUsedTemplateParameters().
static void MarkUsedTemplateParameters | ( | ASTContext & | Ctx, |
const TemplateArgument & | TemplateArg, | ||
bool | OnlyDeduced, | ||
unsigned | Depth, | ||
llvm::SmallBitVector & | Used | ||
) | [static] |
Mark the template parameters that are used by this template argument.
Definition at line 5005 of file SemaTemplateDeduction.cpp.
References clang::TemplateArgument::Declaration, Depth, clang::TemplateArgument::Expression, clang::TemplateArgument::getAsExpr(), clang::TemplateArgument::getAsTemplateOrTemplatePattern(), clang::TemplateArgument::getAsType(), clang::TemplateArgument::getKind(), clang::TemplateArgument::getNullPtrType(), clang::TemplateArgument::Integral, MarkUsedTemplateParameters(), clang::TemplateArgument::Null, clang::TemplateArgument::NullPtr, P, clang::TemplateArgument::Pack, clang::TemplateArgument::pack_elements(), clang::TemplateArgument::Template, clang::TemplateArgument::TemplateExpansion, clang::TemplateArgument::Type, and Used.
static void MarkUsedTemplateParameters | ( | ASTContext & | Ctx, |
const Expr * | E, | ||
bool | OnlyDeduced, | ||
unsigned | Depth, | ||
llvm::SmallBitVector & | Used | ||
) | [static] |
Mark the template parameters that are used by the given expression.
Definition at line 4692 of file SemaTemplateDeduction.cpp.
References Depth, clang::DeclRefExpr::getDecl(), clang::TemplateParmPosition::getDepth(), and clang::TemplateParmPosition::getIndex().
static void MarkUsedTemplateParameters | ( | ASTContext & | Ctx, |
NestedNameSpecifier * | NNS, | ||
bool | OnlyDeduced, | ||
unsigned | Depth, | ||
llvm::SmallBitVector & | Used | ||
) | [static] |
Mark the template parameters that are used by the given nested name specifier.
Definition at line 4731 of file SemaTemplateDeduction.cpp.
References Depth, clang::NestedNameSpecifier::getAsType(), clang::NestedNameSpecifier::getPrefix(), MarkUsedTemplateParameters(), and Used.
static void MarkUsedTemplateParameters | ( | ASTContext & | Ctx, |
TemplateName | Name, | ||
bool | OnlyDeduced, | ||
unsigned | Depth, | ||
llvm::SmallBitVector & | Used | ||
) | [static] |
Mark the template parameters that are used by the given template name.
Definition at line 4748 of file SemaTemplateDeduction.cpp.
References Depth, clang::TemplateName::getAsDependentTemplateName(), clang::TemplateName::getAsQualifiedTemplateName(), clang::TemplateName::getAsTemplateDecl(), MarkUsedTemplateParameters(), and Used.
static QualType ResolveOverloadForDeduction | ( | Sema & | S, |
TemplateParameterList * | TemplateParams, | ||
Expr * | Arg, | ||
QualType | ParamType, | ||
bool | ParamWasReference | ||
) | [static] |
Apply the deduction rules for overload sets.
Definition at line 3026 of file SemaTemplateDeduction.cpp.
References clang::Sema::Context, clang::ASTTemplateArgumentListInfo::copyInto(), clang::OverloadExpr::decls_begin(), clang::OverloadExpr::decls_end(), clang::Sema::DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), clang::OverloadExpr::FindResult::Expression, clang::OverloadExpr::find(), clang::OverloadExpr::getExplicitTemplateArgs(), 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::QualType::isNull(), clang::Type::isPointerType(), clang::Sema::ResolveSingleFunctionTemplateSpecialization(), clang::TemplateParameterList::size(), clang::TDF_IgnoreQualifiers, and clang::TDF_ParamWithReferenceType.
Referenced by AdjustFunctionParmAndArgTypesForDeduction().
static Sema::TemplateDeductionResult SpecializeCorrespondingLambdaCallOperatorAndInvoker | ( | CXXConversionDecl * | ConversionSpecialized, |
SmallVectorImpl< DeducedTemplateArgument > & | DeducedArguments, | ||
QualType | ReturnTypeOfDestFunctionPtr, | ||
TemplateDeductionInfo & | TDInfo, | ||
Sema & | S | ||
) | [inline, static] |
Given a specialized conversion operator of a generic lambda create the corresponding specializations of the call operator and the static-invoker. If the return type of the call operator is auto, deduce its return type and check if that matches the return type of the destination function ptr.
Definition at line 3651 of file SemaTemplateDeduction.cpp.
References clang::Sema::Context, clang::Sema::DeduceReturnType(), clang::Sema::FinishTemplateArgumentDeduction(), clang::Type::getContainedAutoType(), clang::AutoType::getDeducedType(), clang::FunctionProtoType::getExtProtoInfo(), clang::ASTContext::getFunctionType(), clang::CXXRecordDecl::getLambdaCallOperator(), clang::FunctionProtoType::getParamTypes(), clang::CXXMethodDecl::getParent(), clang::FunctionDecl::getPointOfInstantiation(), clang::FunctionDecl::getReturnType(), clang::FunctionType::getReturnType(), clang::ASTContext::hasSameType(), clang::CXXRecordDecl::isGenericLambda(), clang::Type::isUndeducedType(), clang::ValueDecl::setType(), SubstAutoWithinFunctionReturnType(), clang::Sema::TDK_NonDeducedMismatch, clang::Sema::TDK_Success, and clang::FunctionProtoType::ExtProtoInfo::TypeQuals.
Referenced by clang::Sema::DeduceTemplateArguments().
static void SubstAutoWithinFunctionReturnType | ( | FunctionDecl * | F, |
QualType | TypeToReplaceAutoWith, | ||
Sema & | S | ||
) | [inline, static] |
Given a function declaration (e.g. a generic lambda conversion function) that contains an 'auto' in its result type, substitute it with TypeToReplaceAutoWith. Be careful to pass in the type you want to replace 'auto' with and not the actual result type you want to set the function to.
Definition at line 3634 of file SemaTemplateDeduction.cpp.
References clang::ASTContext::adjustDeducedFunctionResultType(), clang::Sema::Context, clang::Type::getContainedAutoType(), clang::FunctionDecl::getReturnType(), and clang::Sema::SubstAutoType().
Referenced by SpecializeCorrespondingLambdaCallOperatorAndInvoker().