clang 18.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 | |
namespace | clang |
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... | |
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 | 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]). | |
static Sema::TemplateDeductionResult | DeduceTemplateArguments (Sema &S, TemplateParameterList *TemplateParams, ArrayRef< TemplateArgument > Ps, ArrayRef< TemplateArgument > As, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced, bool NumberOfArgumentsMustMatch) |
static void | MarkUsedTemplateParameters (ASTContext &Ctx, const TemplateArgument &TemplateArg, bool OnlyDeduced, unsigned Depth, llvm::SmallBitVector &Used) |
Mark the template parameters that are used by this template argument. | |
static void | MarkUsedTemplateParameters (ASTContext &Ctx, QualType T, bool OnlyDeduced, unsigned Depth, llvm::SmallBitVector &Used) |
Mark the template parameters that are used by the given type. | |
static const 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. | |
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. | |
static DeducedTemplateArgument | checkDeducedTemplateArguments (ASTContext &Context, const DeducedTemplateArgument &X, const DeducedTemplateArgument &Y, bool AggregateCandidateDeduction=false) |
Verify that the given, deduced template arguments are compatible. | |
static Sema::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. | |
static Sema::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. | |
static Sema::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. | |
static Sema::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. | |
static Sema::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. | |
static Sema::TemplateDeductionResult | DeduceTemplateArguments (Sema &S, TemplateParameterList *TemplateParams, TemplateName Param, TemplateName Arg, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced) |
static Sema::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. | |
static bool | IsPossiblyOpaquelyQualifiedTypeInternal (const Type *T) |
static bool | IsPossiblyOpaquelyQualifiedType (QualType T) |
Determines whether the given type is an opaque type that might be more qualified when instantiated. | |
static TemplateParameter | makeTemplateParameter (Decl *D) |
Helper function to build a TemplateParameter when we don't know its type statically. | |
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) |
Deduce the template arguments by comparing the list of parameter types to the list of argument types, as in the parameter-type-lists of function types (C++ [temp.deduct.type]p10). | |
static bool | hasInconsistentOrSupersetQualifiersOf (QualType ParamType, QualType ArgType) |
Determine whether the parameter has qualifiers that the argument lacks. | |
static unsigned | getFirstInnerIndex (FunctionTemplateDecl *FTD) |
Get the index of the first template parameter that was originally from the innermost template-parameter-list. | |
static bool | isForwardingReference (QualType Param, unsigned FirstInnerIndex) |
Determine whether a type denotes a forwarding reference. | |
static CXXRecordDecl * | getCanonicalRD (QualType T) |
static Sema::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. | |
static Sema::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. | |
static bool | hasPackExpansionBeforeEnd (ArrayRef< TemplateArgument > Args) |
Determine whether the given set of template arguments has a pack expansion that is not the last template argument. | |
static Sema::TemplateDeductionResult | DeduceTemplateArguments (Sema &S, TemplateParameterList *TemplateParams, const TemplateArgumentList &ParamList, const TemplateArgumentList &ArgList, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced) |
static bool | isSameTemplateArg (ASTContext &Context, TemplateArgument X, const TemplateArgument &Y, bool PartialOrdering, bool PackExpansionMatchesPack=false) |
Determine whether two template arguments are the same. | |
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. | |
template<typename TemplateDeclT > | |
static Sema::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 Sema::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, Sema::TemplateDeductionResult > | FinishTemplateArgumentDeduction (Sema &S, T *Partial, bool IsPartialOrdering, const TemplateArgumentList &TemplateArgs, SmallVectorImpl< DeducedTemplateArgument > &Deduced, TemplateDeductionInfo &Info) |
Complete template argument deduction for a partial specialization. | |
static Sema::TemplateDeductionResult | FinishTemplateArgumentDeduction (Sema &S, TemplateDecl *Template, bool PartialOrdering, const TemplateArgumentList &TemplateArgs, SmallVectorImpl< DeducedTemplateArgument > &Deduced, TemplateDeductionInfo &Info) |
Complete template argument deduction for a class or variable template, when partial ordering against a partial specialization. | |
static bool | isSimpleTemplateIdType (QualType T) |
Determine whether the given type T is a simple-template-id type. | |
static Sema::TemplateDeductionResult | CheckOriginalCallArgDeduction (Sema &S, TemplateDeductionInfo &Info, Sema::OriginalCallArg OriginalArg, QualType DeducedA) |
Check whether the deduced argument type for a call to a function template matches the actual argument type per C++ [temp.deduct.call]p4. | |
static 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. | |
static QualType | GetTypeOfFunction (Sema &S, const OverloadExpr::FindResult &R, FunctionDecl *Fn) |
Gets the type of a function for template-argument-deducton purposes when it's considered as part of an overload set. | |
static QualType | ResolveOverloadForDeduction (Sema &S, TemplateParameterList *TemplateParams, Expr *Arg, QualType ParamType, bool ParamWasReference, TemplateSpecCandidateSet *FailedTSC=nullptr) |
Apply the deduction rules for overload sets. | |
static bool | AdjustFunctionParmAndArgTypesForDeduction (Sema &S, TemplateParameterList *TemplateParams, unsigned FirstInnerIndex, QualType &ParamType, QualType &ArgType, Expr *Arg, unsigned &TDF, TemplateSpecCandidateSet *FailedTSC=nullptr) |
Perform the adjustments to the parameter and argument types described in C++ [temp.deduct.call]. | |
static bool | hasDeducibleTemplateParameters (Sema &S, FunctionTemplateDecl *FunctionTemplate, QualType T) |
static Sema::TemplateDeductionResult | DeduceTemplateArgumentsFromCallArgument (Sema &S, TemplateParameterList *TemplateParams, unsigned FirstInnerIndex, QualType ParamType, Expr *Arg, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced, SmallVectorImpl< Sema::OriginalCallArg > &OriginalCallArgs, bool DecomposedParam, unsigned ArgIdx, unsigned TDF, TemplateSpecCandidateSet *FailedTSC) |
Perform template argument deduction per [temp.deduct.call] for a single parameter / argument pair. | |
static Sema::TemplateDeductionResult | DeduceFromInitializerList (Sema &S, TemplateParameterList *TemplateParams, QualType AdjustedParamType, InitListExpr *ILE, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced, SmallVectorImpl< Sema::OriginalCallArg > &OriginalCallArgs, unsigned ArgIdx, unsigned TDF) |
Attempt template argument deduction from an initializer list deemed to be an argument in a function call. | |
static bool | CheckDeducedPlaceholderConstraints (Sema &S, const AutoType &Type, AutoTypeLoc TypeLoc, QualType Deduced) |
static 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, bool Reversed) |
Determine whether the function template FT1 is at least as specialized as FT2 . | |
static bool | isSameTemplate (TemplateDecl *T1, TemplateDecl *T2) |
Determine if the two templates are equivalent. | |
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. | |
template<typename TemplateLikeDecl , typename PrimaryDel > | |
static TemplateLikeDecl * | getMoreSpecialized (Sema &S, QualType T1, QualType T2, TemplateLikeDecl *P1, PrimaryDel *P2, TemplateDeductionInfo &Info) |
Returns the more specialized template specialization between T1/P1 and T2/P2. | |
static void | MarkUsedTemplateParameters (ASTContext &Ctx, const Expr *E, bool OnlyDeduced, unsigned Depth, llvm::SmallBitVector &Used) |
Mark the template parameters that are used by the given expression. | |
static void | MarkUsedTemplateParameters (ASTContext &Ctx, NestedNameSpecifier *NNS, bool OnlyDeduced, unsigned Depth, llvm::SmallBitVector &Used) |
Mark the template parameters that are used by the given nested name specifier. | |
static void | MarkUsedTemplateParameters (ASTContext &Ctx, TemplateName Name, bool OnlyDeduced, unsigned Depth, llvm::SmallBitVector &Used) |
Mark the template parameters that are used by the given template name. | |
#define ABSTRACT_TYPE | ( | Class, | |
Base | |||
) |
#define DEPENDENT_TYPE | ( | Class, | |
Base | |||
) |
#define NON_CANONICAL_TYPE | ( | Class, | |
Base | |||
) | 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 | |||
) |
|
static |
If this is a non-static member function,.
Definition at line 5073 of file SemaTemplateDeduction.cpp.
References clang::ASTContext::getLValueReferenceType(), clang::CXXMethodDecl::getMethodQualifiers(), clang::CXXMethodDecl::getParent(), clang::ASTContext::getQualifiedType(), clang::CXXMethodDecl::getRefQualifier(), clang::ASTContext::getRValueReferenceType(), clang::ASTContext::getTypeDeclType(), and clang::RQ_RValue.
Referenced by isAtLeastAsSpecializedAs().
|
static |
Perform the adjustments to the parameter and argument types described in C++ [temp.deduct.call].
Definition at line 3875 of file SemaTemplateDeduction.cpp.
References clang::Type::canDecayToPointerType(), clang::Type::castAs(), clang::Sema::Context, clang::ASTContext::getAddrSpaceQualType(), clang::Type::getAs(), clang::Sema::getCompletedType(), clang::ASTContext::getDecayedType(), clang::ASTContext::getDefaultOpenCLPointeeAddrSpace(), clang::Sema::getLangOpts(), clang::ASTContext::getLValueReferenceType(), clang::PointerType::getPointeeType(), clang::ReferenceType::getPointeeType(), clang::QualType::getUnqualifiedType(), clang::QualType::hasAddressSpace(), clang::QualType::hasQualifiers(), isForwardingReference(), clang::Type::isIncompleteArrayType(), clang::Expr::isLValue(), clang::Type::isMemberPointerType(), clang::QualType::isNull(), clang::Type::isObjCObjectPointerType(), clang::Type::isPointerType(), isSimpleTemplateIdType(), clang::ASTContext::OverloadTy, ResolveOverloadForDeduction(), clang::TDF_DerivedClass, clang::TDF_IgnoreQualifiers, clang::TDF_ParamWithReferenceType, and clang::TDF_SkipNonDependent.
Referenced by DeduceTemplateArgumentsFromCallArgument().
|
static |
Definition at line 2880 of file SemaTemplateDeduction.cpp.
References clang::sema::TemplateDeductionInfo::AssociatedConstraintsSatisfaction, clang::Sema::CheckConstraintSatisfaction(), clang::Sema::Context, clang::TemplateArgumentList::CreateCopy(), DeducedArgsNeedReplacement(), clang::sema::TemplateDeductionInfo::getLocation(), clang::Sema::getTemplateInstantiationArgs(), clang::ConstraintSatisfaction::IsSatisfied, clang::TemplateArgumentList::OnStack, clang::MultiLevelTemplateArgumentList::replaceInnermostTemplateArguments(), clang::sema::TemplateDeductionInfo::reset(), clang::Sema::TDK_ConstraintsNotSatisfied, and clang::Sema::TDK_Success.
Referenced by FinishTemplateArgumentDeduction().
|
static |
Definition at line 4695 of file SemaTemplateDeduction.cpp.
References clang::TemplateArgumentListInfo::addArgument(), clang::C, clang::Sema::CheckConstraintSatisfaction(), clang::Sema::CheckTemplateArgumentList(), clang::Sema::Context, clang::Sema::Diag(), clang::Sema::DiagnoseUnsatisfiedConstraint(), clang::TypeLoc::getLocalSourceRange(), clang::Sema::getPrintingPolicy(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::ConstraintSatisfaction::IsSatisfied, and clang::printTemplateArgumentList().
Referenced by clang::Sema::DeduceAutoType().
|
static |
Verify that the given, deduced template arguments are compatible.
Definition at line 213 of file SemaTemplateDeduction.cpp.
References checkDeducedTemplateArguments(), clang::TemplateArgument::CreatePackCopy(), clang::TemplateArgument::Declaration, clang::TemplateArgument::Expression, clang::TemplateArgument::getAsDecl(), clang::TemplateArgument::getAsExpr(), clang::TemplateArgument::getAsIntegral(), clang::TemplateArgument::getAsTemplate(), clang::TemplateArgument::getAsTemplateOrTemplatePattern(), clang::TemplateArgument::getAsType(), clang::ASTContext::getCommonSugaredType(), clang::TemplateArgument::getKind(), clang::TemplateArgument::getNonTypeTemplateArgumentType(), clang::TemplateArgument::getNullPtrType(), clang::Expr::getType(), hasSameExtendedValue(), clang::ASTContext::hasSameTemplateName(), clang::ASTContext::hasSameType(), clang::TemplateArgument::Integral, clang::TemplateArgument::isNull(), clang::QualType::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 checkDeducedTemplateArguments(), DeduceNonTypeTemplateArgument(), DeduceTemplateArguments(), and DeduceTemplateArgumentsByTypeMatch().
|
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 3406 of file SemaTemplateDeduction.cpp.
References clang::Sema::OriginalCallArg::ArgIdx, clang::sema::TemplateDeductionInfo::CallArgIndex, clang::Qualifiers::compatiblyIncludes(), clang::Sema::Context, clang::Sema::OriginalCallArg::DecomposedParam, clang::sema::TemplateDeductionInfo::FirstArg, clang::Type::getAs(), clang::Sema::getLangOpts(), clang::sema::TemplateDeductionInfo::getLocation(), 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::Sema::IsFunctionConversion(), clang::Type::isFunctionType(), clang::Type::isMemberPointerType(), clang::Sema::IsQualificationConversion(), clang::Type::isRecordType(), isSimpleTemplateIdType(), clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_None, clang::Qualifiers::OCL_Strong, clang::Sema::OriginalCallArg::OriginalArgType, clang::Sema::OriginalCallArg::OriginalParamType, clang::sema::TemplateDeductionInfo::SecondArg, clang::Qualifiers::setObjCLifetime(), clang::Sema::TDK_DeducedMismatch, clang::Sema::TDK_DeducedMismatchNested, and clang::Sema::TDK_Success.
Referenced by clang::Sema::DeduceAutoType(), and clang::Sema::FinishTemplateArgumentDeduction().
|
static |
Convert the given deduced template argument and add it to the set of fully-converted template arguments.
Definition at line 2631 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::Sema::CurContext, clang::Sema::Diag(), clang::SourceRange::getEnd(), clang::TemplateArgument::getKind(), clang::Decl::getLocation(), clang::sema::TemplateDeductionInfo::getLocation(), clang::Decl::getSourceRange(), clang::Sema::getTrivialTemplateArgumentLoc(), clang::Sema::InstantiatingTemplate::isInvalid(), P, clang::TemplateArgument::Pack, clang::TemplateArgument::pack_elements(), clang::DeducedTemplateArgument::setDeducedFromArrayBound(), clang::Sema::SubstDecl(), clang::Sema::SubstType(), and clang::DeducedTemplateArgument::wasDeducedFromArrayBound().
Referenced by ConvertDeducedTemplateArguments().
|
static |
Definition at line 2726 of file SemaTemplateDeduction.cpp.
References clang::Sema::CheckTemplateArgument(), clang::Sema::Context, ConvertDeducedTemplateArgument(), clang::TemplateArgumentList::CreateCopy(), clang::Sema::CTAK_Specified, clang::TemplateArgumentLoc::getArgument(), clang::ASTContext::getCanonicalTemplateArgument(), clang::Decl::getDeclContext(), clang::SourceRange::getEnd(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::TemplateParameterList::getParam(), clang::DeclContext::getParent(), clang::TemplateDecl::getSourceRange(), clang::TemplateArgument::isNull(), clang::Decl::isParameterPack(), clang::Decl::isTemplateParameterPack(), makeTemplateParameter(), clang::sema::TemplateDeductionInfo::Param, clang::sema::TemplateDeductionInfo::reset(), clang::Result, clang::TemplateParameterList::size(), clang::Sema::SubstDefaultTemplateArgumentIfAvailable(), clang::Sema::TDK_Incomplete, clang::Sema::TDK_SubstitutionFailure, and clang::Sema::TDK_Success.
Referenced by clang::Sema::FinishTemplateArgumentDeduction(), and FinishTemplateArgumentDeduction().
|
static |
Definition at line 2864 of file SemaTemplateDeduction.cpp.
Referenced by CheckDeducedArgumentConstraints().
bool DeducedArgsNeedReplacement< ClassTemplatePartialSpecializationDecl > | ( | ClassTemplatePartialSpecializationDecl * | Spec | ) |
Definition at line 2873 of file SemaTemplateDeduction.cpp.
References clang::ClassTemplateSpecializationDecl::isClassScopeExplicitSpecialization().
bool DeducedArgsNeedReplacement< VarTemplatePartialSpecializationDecl > | ( | VarTemplatePartialSpecializationDecl * | Spec | ) |
Definition at line 2868 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 3979 of file SemaTemplateDeduction.cpp.
References clang::Sema::Context, DeduceNonTypeTemplateArgument(), DeduceTemplateArgumentsFromCallArgument(), clang::ASTContext::getAsArrayType(), getDeducedParameterFromExpr(), clang::ASTContext::getIntWidth(), clang::InitListExpr::getNumInits(), clang::ASTContext::getSizeType(), clang::InitListExpr::inits(), clang::Type::isDependentType(), clang::Sema::isStdInitializerList(), clang::Result, and clang::Sema::TDK_Success.
Referenced by DeduceTemplateArgumentsFromCallArgument().
|
static |
Deduce the value of the given non-type template parameter as the given deduced template argument.
All non-type template parameter deduction is funneled through here.
Definition at line 386 of file SemaTemplateDeduction.cpp.
References checkDeducedTemplateArguments(), clang::Sema::Context, DeduceTemplateArgumentsByTypeMatch(), clang::sema::TemplateDeductionInfo::FirstArg, clang::ASTContext::getAdjustedParameterType(), clang::sema::TemplateDeductionInfo::getDeducedDepth(), clang::NonTypeTemplateParmDecl::getDepth(), clang::NonTypeTemplateParmDecl::getIndex(), clang::Sema::getLangOpts(), clang::QualType::getNonReferenceType(), clang::ValueDecl::getType(), clang::QualType::getUnqualifiedType(), clang::NonTypeTemplateParmDecl::isExpandedParameterPack(), clang::Type::isReferenceType(), clang::sema::TemplateDeductionInfo::Param, clang::sema::TemplateDeductionInfo::SecondArg, clang::TDF_SkipNonDependent, clang::Sema::TDK_Inconsistent, clang::Sema::TDK_Success, and clang::DeducedTemplateArgument::wasDeducedFromArrayBound().
Referenced by DeduceFromInitializerList(), DeduceNonTypeTemplateArgument(), DeduceNullPtrTemplateArgument(), DeduceTemplateArguments(), and DeduceTemplateArgumentsByTypeMatch().
|
static |
Deduce the value of the given non-type template parameter from the given integral constant.
Definition at line 439 of file SemaTemplateDeduction.cpp.
References clang::Sema::Context, and DeduceNonTypeTemplateArgument().
|
static |
Deduce the value of the given non-type template parameter from the given type- or value-dependent expression.
Definition at line 474 of file SemaTemplateDeduction.cpp.
References DeduceNonTypeTemplateArgument(), and clang::Value::getType().
|
static |
Deduce the value of the given non-type template parameter from the given declaration.
Definition at line 487 of file SemaTemplateDeduction.cpp.
References DeduceNonTypeTemplateArgument(), and clang::Decl::getCanonicalDecl().
|
static |
Deduce the value of the given non-type template parameter from the given null pointer template argument type.
Definition at line 453 of file SemaTemplateDeduction.cpp.
References clang::Sema::Context, DeduceNonTypeTemplateArgument(), clang::ActionResult< PtrTy, Compress >::get(), clang::Decl::getLocation(), clang::Value::getType(), clang::Sema::ImpCastExprToType(), clang::Type::isMemberPointerType(), and clang::ASTContext::NullPtrTy.
Referenced by DeduceTemplateArguments().
|
static |
Definition at line 2379 of file SemaTemplateDeduction.cpp.
References DeduceTemplateArguments(), hasPackExpansionBeforeEnd(), hasTemplateArgumentForDeduction(), P, clang::Result, clang::Sema::TDK_MiscellaneousDeductionFailure, and clang::Sema::TDK_Success.
Referenced by clang::Sema::AddMethodTemplateCandidate(), clang::Sema::AddTemplateConversionCandidate(), clang::Sema::AddTemplateOverloadCandidate(), DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), DeduceTemplateSpecArguments(), isAtLeastAsSpecializedAs(), and clang::Sema::ResolveSingleFunctionTemplateSpecialization().
|
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 1035 of file SemaTemplateDeduction.cpp.
References DeduceTemplateArgumentsByTypeMatch(), clang::PackExpansionType::getNumExpansions(), clang::PackExpansionType::getPattern(), clang::QualType::getUnqualifiedType(), clang::PartialOrdering, clang::Sema::TDK_MiscellaneousDeductionFailure, and clang::Sema::TDK_Success.
|
static |
Definition at line 2243 of file SemaTemplateDeduction.cpp.
References clang::Sema::Context, clang::TemplateArgument::Declaration, DeduceNonTypeTemplateArgument(), DeduceNullPtrTemplateArgument(), DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), clang::TemplateArgument::Expression, clang::sema::TemplateDeductionInfo::FirstArg, clang::TemplateArgument::getAsDecl(), clang::TemplateArgument::getAsExpr(), clang::TemplateArgument::getAsIntegral(), clang::TemplateArgument::getAsTemplate(), clang::TemplateArgument::getAsType(), getDeducedParameterFromExpr(), clang::TemplateArgument::getIntegralType(), clang::TemplateArgument::getKind(), clang::TemplateArgument::getNullPtrType(), clang::TemplateArgument::getPackExpansionPattern(), clang::TemplateArgument::getParamTypeForDecl(), hasSameExtendedValue(), clang::ASTContext::hasSameType(), clang::TemplateArgument::Integral, clang::TemplateArgument::isPackExpansion(), isSameDeclaration(), clang::TemplateArgument::Null, clang::TemplateArgument::NullPtr, P, 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.
|
static |
Definition at line 2460 of file SemaTemplateDeduction.cpp.
References clang::TemplateArgumentList::asArray(), and DeduceTemplateArguments().
|
static |
Definition at line 499 of file SemaTemplateDeduction.cpp.
References checkDeducedTemplateArguments(), clang::Sema::Context, clang::sema::TemplateDeductionInfo::FirstArg, clang::TemplateName::getAsTemplateDecl(), clang::ASTContext::getCanonicalTemplateName(), clang::sema::TemplateDeductionInfo::getDeducedDepth(), 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 |
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 1378 of file SemaTemplateDeduction.cpp.
References clang::Sema::adjustMemberFunctionCC(), clang::ASTContext::BoolTy, checkDeducedTemplateArguments(), clang::Qualifiers::compatiblyIncludes(), clang::Sema::Context, clang::CT_Can, clang::CT_Cannot, clang::CT_Dependent, DeduceNonTypeTemplateArgument(), DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), DeduceTemplateBases(), DeduceTemplateSpecArguments(), clang::sema::TemplateDeductionInfo::FirstArg, clang::QualType::getAddressSpace(), clang::Type::getAs(), clang::ASTContext::getAsArrayType(), clang::ASTContext::getAsConstantArrayType(), clang::ASTContext::getAsDependentSizedArrayType(), clang::ASTContext::getAsIncompleteArrayType(), getCanonicalRD(), clang::QualType::getCanonicalType(), clang::Type::getCanonicalTypeInternal(), clang::DependentSizedMatrixType::getColumnExpr(), clang::Qualifiers::getCVRQualifiers(), clang::QualType::getCVRQualifiers(), clang::sema::TemplateDeductionInfo::getDeducedDepth(), getDeducedParameterFromExpr(), clang::NonTypeTemplateParmDecl::getDepth(), clang::MatrixType::getElementType(), clang::Expr::getIntegerConstantExpr(), clang::Sema::getLangOpts(), clang::sema::TemplateDeductionInfo::getLocation(), clang::ConstantMatrixType::getNumColumns(), clang::ConstantMatrixType::getNumRows(), clang::TemplateParameterList::getParam(), clang::Type::getPointeeType(), clang::PointerType::getPointeeType(), clang::ReferenceType::getPointeeType(), clang::ASTContext::getQualifiedType(), clang::QualType::getQualifiers(), clang::DependentSizedMatrixType::getRowExpr(), clang::ASTContext::getSizeType(), clang::ASTContext::getTypeSize(), clang::ASTContext::getUnqualifiedArrayType(), clang::Qualifiers::hasAddressSpace(), hasInconsistentOrSupersetQualifiersOf(), clang::Qualifiers::hasNonTrivialObjCLifetime(), clang::Qualifiers::hasObjCGCAttr(), clang::Qualifiers::hasObjCLifetime(), clang::ASTContext::hasSameType(), clang::ASTContext::hasSameUnqualifiedType(), clang::ASTContext::IntTy, clang::Type::isArrayType(), clang::Sema::isCompleteType(), clang::Type::isDependentType(), isForwardingReference(), clang::Type::isFunctionType(), clang::Type::isLValueReferenceType(), clang::Type::isObjCLifetimeType(), clang::Type::isPlaceholderType(), IsPossiblyOpaquelyQualifiedType(), clang::Type::isRecordType(), clang::Sema::isSameOrCompatibleFunctionType(), clang::Qualifiers::isStrictSupersetOf(), clang::isTargetAddressSpace(), clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_Strong, clang::ASTContext::OverloadTy, P, clang::sema::TemplateDeductionInfo::Param, clang::PartialOrdering, clang::Qualifiers::removeAddressSpace(), clang::ASTContext::removeAddrSpaceQualType(), clang::Qualifiers::removeCVRQualifiers(), clang::Qualifiers::removeObjCGCAttr(), clang::Qualifiers::removeObjCLifetime(), clang::Result, clang::sema::TemplateDeductionInfo::SecondArg, clang::Qualifiers::setCVRQualifiers(), clang::Qualifiers::setObjCLifetime(), clang::TDF_AllowCompatibleFunctionType, clang::TDF_ArgWithReferenceType, clang::TDF_DerivedClass, clang::TDF_IgnoreQualifiers, clang::TDF_ParamWithReferenceType, clang::TDF_SkipNonDependent, clang::TDF_TopLevelParameterTypeList, clang::Sema::TDK_Inconsistent, clang::Sema::TDK_Invalid, clang::Sema::TDK_NonDeducedMismatch, clang::Sema::TDK_Success, clang::Sema::TDK_Underqualified, clang::toTargetAddressSpace(), clang::ASTContext::UnsignedIntTy, and clang::Qualifiers::withoutObjCLifetime().
Referenced by DeduceNonTypeTemplateArgument(), clang::Sema::DeduceTemplateArguments(), DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), DeduceTemplateArgumentsFromCallArgument(), isAtLeastAsSpecializedAs(), and ResolveOverloadForDeduction().
|
static |
Perform template argument deduction per [temp.deduct.call] for a single parameter / argument pair.
Definition at line 4046 of file SemaTemplateDeduction.cpp.
References AdjustFunctionParmAndArgTypesForDeduction(), DeduceFromInitializerList(), DeduceTemplateArgumentsByTypeMatch(), clang::Expr::getType(), and clang::Sema::TDK_Success.
Referenced by clang::Sema::DeduceAutoType(), DeduceFromInitializerList(), 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 1259 of file SemaTemplateDeduction.cpp.
References clang::CXXRecordDecl::bases(), DeduceTemplateSpecArguments(), clang::sema::TemplateDeductionInfo::ForBase, getCanonicalRD(), clang::Type::isRecordType(), P, clang::Sema::TDK_Invalid, clang::Sema::TDK_MiscellaneousDeductionFailure, clang::Sema::TDK_Success, and Visited.
Referenced by DeduceTemplateArgumentsByTypeMatch().
|
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 562 of file SemaTemplateDeduction.cpp.
References clang::Type::castAs(), DeduceTemplateArguments(), clang::sema::TemplateDeductionInfo::FirstArg, clang::Type::getAs(), clang::TemplateName::getAsTemplateDecl(), clang::QualType::getCanonicalType(), clang::TemplateDecl::isTypeAlias(), P, clang::sema::TemplateDeductionInfo::SecondArg, clang::Sema::TDK_NonDeducedMismatch, and clang::Sema::TDK_Success.
Referenced by DeduceTemplateArgumentsByTypeMatch(), and DeduceTemplateBases().
|
static |
Complete template argument deduction for a partial specialization.
Definition at line 2920 of file SemaTemplateDeduction.cpp.
References clang::ASTTemplateArgumentListInfo::arguments(), CheckDeducedArgumentConstraints(), clang::Sema::CheckTemplateArgumentList(), clang::Sema::Context, ConvertDeducedTemplateArguments(), clang::TemplateArgumentList::CreateCopy(), clang::sema::TemplateDeductionInfo::FirstArg, getAsDeclContextOrEnclosing(), clang::TemplateParameterList::getParam(), clang::Sema::SFINAETrap::hasErrorOccurred(), isSameTemplateArg(), clang::ASTTemplateArgumentListInfo::LAngleLoc, makeTemplateParameter(), clang::sema::TemplateDeductionInfo::Param, clang::ASTTemplateArgumentListInfo::RAngleLoc, clang::sema::TemplateDeductionInfo::reset(), clang::Result, clang::sema::TemplateDeductionInfo::SecondArg, clang::TemplateParameterList::size(), clang::TemplateArgumentListInfo::size(), clang::Sema::SubstTemplateArguments(), clang::Sema::TDK_ConstraintsNotSatisfied, clang::Sema::TDK_NonDeducedMismatch, clang::Sema::TDK_SubstitutionFailure, clang::Sema::TDK_Success, clang::Unevaluated, and clang::Sema::Unevaluated.
|
static |
Complete template argument deduction for a class or variable template, when partial ordering against a partial specialization.
Definition at line 3013 of file SemaTemplateDeduction.cpp.
References CheckDeducedArgumentConstraints(), clang::Sema::Context, ConvertDeducedTemplateArguments(), clang::sema::TemplateDeductionInfo::FirstArg, getAsDeclContextOrEnclosing(), clang::TemplateParameterList::getParam(), clang::TemplateDecl::getTemplateParameters(), clang::Sema::SFINAETrap::hasErrorOccurred(), isSameTemplateArg(), makeTemplateParameter(), clang::sema::TemplateDeductionInfo::Param, clang::PartialOrdering, clang::Result, clang::sema::TemplateDeductionInfo::SecondArg, clang::TemplateParameterList::size(), clang::Sema::TDK_NonDeducedMismatch, clang::Sema::TDK_SubstitutionFailure, clang::Sema::TDK_Success, clang::Unevaluated, and clang::Sema::Unevaluated.
|
static |
Definition at line 2846 of file SemaTemplateDeduction.cpp.
References clang::Decl::getDeclContext().
Referenced by FinishTemplateArgumentDeduction().
|
static |
Definition at line 1235 of file SemaTemplateDeduction.cpp.
References clang::Type::castAs(), clang::TagDecl::getCanonicalDecl(), and clang::RecordType::getDecl().
Referenced by DeduceTemplateArgumentsByTypeMatch(), and DeduceTemplateBases().
|
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 163 of file SemaTemplateDeduction.cpp.
Referenced by DeduceFromInitializerList(), DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), getDeducedParameterFromExpr(), and MarkUsedTemplateParameters().
|
static |
Definition at line 193 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 1213 of file SemaTemplateDeduction.cpp.
References clang::FunctionTemplateDecl::getTemplatedDecl().
Referenced by clang::Sema::DeduceTemplateArguments().
|
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 5660 of file SemaTemplateDeduction.cpp.
References clang::Sema::Context, clang::Sema::getASTContext(), clang::TemplateArgument::getKind(), clang::ASTContext::getLangOpts(), clang::Sema::IsAtLeastAsConstrained(), isAtLeastAsSpecializedAs(), clang::TemplateArgument::Pack, clang::TemplateArgument::pack_elements(), clang::TemplateArgument::pack_size(), clang::TemplateParameterList::size(), clang::Sema::TemplateParameterListsAreEqual(), and clang::Sema::TPL_TemplateParamsEquivalent.
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 3527 of file SemaTemplateDeduction.cpp.
References clang::Sema::getNumArgumentsInExpansion(), clang::FunctionTemplateDecl::getTemplatedDecl(), and clang::FunctionDecl::parameters().
Referenced by clang::Sema::FinishTemplateArgumentDeduction().
|
static |
Gets the type of a function for template-argument-deducton purposes when it's considered as part of an overload set.
Definition at line 3740 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::QualType::getTypePtr(), clang::OverloadExpr::FindResult::HasFormOfMemberPointer, clang::OverloadExpr::FindResult::IsAddressOfOperand, and clang::Type::isUndeducedType().
Referenced by ResolveOverloadForDeduction().
|
static |
Definition at line 6388 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().
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 1157 of file SemaTemplateDeduction.cpp.
References clang::Qualifiers::getAddressSpace(), clang::Qualifiers::getCVRQualifiers(), clang::Qualifiers::getObjCGCAttr(), clang::Qualifiers::getObjCLifetime(), clang::QualType::getQualifiers(), clang::Qualifiers::hasAddressSpace(), clang::Qualifiers::hasObjCGCAttr(), and clang::Qualifiers::hasObjCLifetime().
Referenced by DeduceTemplateArgumentsByTypeMatch().
|
static |
Determine whether the given set of template arguments has a pack expansion that is not the last template argument.
Definition at line 2360 of file SemaTemplateDeduction.cpp.
References hasPackExpansionBeforeEnd(), and clang::TemplateArgument::Pack.
Referenced by DeduceTemplateArguments(), hasPackExpansionBeforeEnd(), 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.
Referenced by checkDeducedTemplateArguments(), DeduceTemplateArguments(), and isSameTemplateArg().
|
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 2343 of file SemaTemplateDeduction.cpp.
References clang::TemplateArgument::getKind(), clang::TemplateArgument::Pack, and clang::TemplateArgument::pack_elements().
Referenced by DeduceTemplateArguments().
|
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 5518 of file SemaTemplateDeduction.cpp.
References DeduceTemplateArgumentsByTypeMatch(), clang::sema::TemplateDeductionInfo::getLocation(), clang::Sema::InstantiatingTemplate::isInvalid(), clang::Sema::runWithSufficientStackSpace(), and clang::TDF_None.
|
static |
Determine whether the function template FT1
is at least as specialized as FT2
.
Definition at line 5094 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::Reversed, clang::TemplateParameterList::size(), clang::TDF_None, clang::TPOC_Call, clang::TPOC_Conversion, and clang::TPOC_Other.
Referenced by getMoreSpecialized(), clang::Sema::getMoreSpecializedTemplate(), and clang::Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs().
Determine whether a type denotes a forwarding reference.
Definition at line 1221 of file SemaTemplateDeduction.cpp.
References clang::Type::getAs(), and clang::TemplateTypeParmType::getIndex().
Referenced by AdjustFunctionParmAndArgTypesForDeduction(), and DeduceTemplateArgumentsByTypeMatch().
Determines whether the given type is an opaque type that might be more qualified when instantiated.
Definition at line 657 of file SemaTemplateDeduction.cpp.
References clang::Type::getCanonicalTypeInternal(), clang::QualType::getTypePtr(), and IsPossiblyOpaquelyQualifiedTypeInternal().
Referenced by DeduceTemplateArgumentsByTypeMatch().
Definition at line 631 of file SemaTemplateDeduction.cpp.
References clang::Type::getTypeClass(), clang::Type::isCanonicalUnqualified(), and IsPossiblyOpaquelyQualifiedTypeInternal().
Referenced by IsPossiblyOpaquelyQualifiedType(), and IsPossiblyOpaquelyQualifiedTypeInternal().
Determine whether two declaration pointers refer to the same declaration.
Definition at line 199 of file SemaTemplateDeduction.cpp.
References clang::Decl::getCanonicalDecl(), and X.
Referenced by checkDeducedTemplateArguments(), DeduceTemplateArguments(), and isSameTemplateArg().
|
static |
Determine if the two templates are equivalent.
Definition at line 5400 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 2471 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::TemplateName::getAsVoidPointer(), clang::ASTContext::getCanonicalTemplateName(), clang::ASTContext::getCanonicalType(), clang::TemplateArgument::getKind(), clang::TemplateArgument::getNullPtrType(), hasSameExtendedValue(), clang::ASTContext::hasSameType(), clang::TemplateArgument::Integral, clang::TemplateArgument::isPackExpansion(), isSameDeclaration(), isSameTemplateArg(), clang::TemplateArgument::Null, clang::TemplateArgument::NullPtr, clang::TemplateArgument::Pack, clang::TemplateArgument::pack_elements(), clang::TemplateArgument::pack_size(), clang::PartialOrdering, clang::Stmt::Profile(), clang::TemplateArgument::Template, clang::TemplateArgument::TemplateExpansion, clang::TemplateArgument::Type, and X.
Referenced by FinishTemplateArgumentDeduction(), and isSameTemplateArg().
Determine whether the given type T is a simple-template-id type.
Definition at line 3162 of file SemaTemplateDeduction.cpp.
References clang::Type::getAs().
Referenced by AdjustFunctionParmAndArgTypesForDeduction(), and CheckOriginalCallArgDeduction().
|
static |
Helper function to build a TemplateParameter when we don't know its type statically.
Definition at line 664 of file SemaTemplateDeduction.cpp.
Referenced by ConvertDeducedTemplateArguments(), FinishTemplateArgumentDeduction(), and clang::Sema::SubstituteExplicitTemplateArguments().
|
static |
Mark the template parameters that are used by the given expression.
Definition at line 5923 of file SemaTemplateDeduction.cpp.
References 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 6292 of file SemaTemplateDeduction.cpp.
References clang::TemplateArgument::Declaration, clang::TemplateArgument::Expression, clang::TemplateArgument::Integral, MarkUsedTemplateParameters(), clang::TemplateArgument::Null, clang::TemplateArgument::NullPtr, P, clang::TemplateArgument::Pack, clang::TemplateArgument::Template, clang::TemplateArg, clang::TemplateArgument::TemplateExpansion, clang::TemplateArgument::Type, and Used.
Referenced by hasDeducibleTemplateParameters(), isAtLeastAsSpecializedAs(), and MarkUsedTemplateParameters().
|
static |
Mark the template parameters that are used by the given nested name specifier.
Definition at line 5954 of file SemaTemplateDeduction.cpp.
References clang::NestedNameSpecifier::getAsType(), clang::NestedNameSpecifier::getPrefix(), MarkUsedTemplateParameters(), and Used.
|
static |
Mark the template parameters that are used by the given type.
Definition at line 5996 of file SemaTemplateDeduction.cpp.
References 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(), clang::QualType::getTypePtr(), getUnderlyingType(), hasPackExpansionBeforeEnd(), clang::Type::isDependentType(), clang::QualType::isNull(), MarkUsedTemplateParameters(), 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 5971 of file SemaTemplateDeduction.cpp.
References MarkUsedTemplateParameters(), and Used.
|
static |
Apply the deduction rules for overload sets.
Definition at line 3767 of file SemaTemplateDeduction.cpp.
References clang::Sema::Context, clang::OverloadExpr::copyTemplateArgumentsInto(), clang::OverloadExpr::decls_begin(), clang::OverloadExpr::decls_end(), clang::Sema::DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), clang::OverloadExpr::FindResult::Expression, clang::OverloadExpr::find(), clang::OverloadExpr::getNameLoc(), clang::ASTContext::getPointerType(), GetTypeOfFunction(), clang::NamedDecl::getUnderlyingDecl(), clang::OverloadExpr::hasExplicitTemplateArgs(), clang::OverloadExpr::FindResult::IsAddressOfOperand, clang::Type::isFunctionPointerType(), clang::Type::isFunctionType(), clang::Type::isMemberFunctionPointerType(), clang::QualType::isNull(), clang::Type::isPointerType(), clang::Sema::resolveAddressOfSingleOverloadCandidate(), clang::Sema::ResolveSingleFunctionTemplateSpecialization(), clang::Result, clang::TemplateParameterList::size(), clang::Specialization, clang::TDF_IgnoreQualifiers, and clang::TDF_ParamWithReferenceType.
Referenced by AdjustFunctionParmAndArgTypesForDeduction().