clang  12.0.0git
Public Types | Public Member Functions | Public Attributes | List of all members
clang::sema::TemplateDeductionInfo Class Reference

Provides information about an attempted template argument deduction, whose success or failure was described by a TemplateDeductionResult value. More...

#include "clang/Sema/TemplateDeduction.h"

Collaboration diagram for clang::sema::TemplateDeductionInfo:
Collaboration graph
[legend]

Public Types

enum  ForBaseTag { ForBase }
 
using diag_iterator = SmallVectorImpl< PartialDiagnosticAt >::const_iterator
 Iterator over the set of suppressed diagnostics. More...
 

Public Member Functions

 TemplateDeductionInfo (SourceLocation Loc, unsigned DeducedDepth=0)
 
 TemplateDeductionInfo (const TemplateDeductionInfo &)=delete
 
TemplateDeductionInfooperator= (const TemplateDeductionInfo &)=delete
 
 TemplateDeductionInfo (ForBaseTag, const TemplateDeductionInfo &Info)
 Create temporary template deduction info for speculatively deducing against a base class of an argument's type. More...
 
SourceLocation getLocation () const
 Returns the location at which template argument is occurring. More...
 
unsigned getDeducedDepth () const
 The depth of template parameters for which deduction is being performed. More...
 
unsigned getNumExplicitArgs () const
 Get the number of explicitly-specified arguments. More...
 
TemplateArgumentListtake ()
 Take ownership of the deduced template argument list. More...
 
void takeSFINAEDiagnostic (PartialDiagnosticAt &PD)
 Take ownership of the SFINAE diagnostic. More...
 
void clearSFINAEDiagnostic ()
 Discard any SFINAE diagnostics. More...
 
const PartialDiagnosticAtpeekSFINAEDiagnostic () const
 Peek at the SFINAE diagnostic. More...
 
void setExplicitArgs (TemplateArgumentList *NewDeduced)
 Provide an initial template argument list that contains the explicitly-specified arguments. More...
 
void reset (TemplateArgumentList *NewDeduced)
 Provide a new template argument list that contains the results of template argument deduction. More...
 
bool hasSFINAEDiagnostic () const
 Is a SFINAE diagnostic available? More...
 
void addSFINAEDiagnostic (SourceLocation Loc, PartialDiagnostic PD)
 Set the diagnostic which caused the SFINAE failure. More...
 
void addSuppressedDiagnostic (SourceLocation Loc, PartialDiagnostic PD)
 Add a new diagnostic to the set of diagnostics. More...
 
diag_iterator diag_begin () const
 Returns an iterator at the beginning of the sequence of suppressed diagnostics. More...
 
diag_iterator diag_end () const
 Returns an iterator at the end of the sequence of suppressed diagnostics. More...
 

Public Attributes

TemplateParameter Param
 The template parameter to which a template argument deduction failure refers. More...
 
TemplateArgument FirstArg
 The first template argument to which the template argument deduction failure refers. More...
 
TemplateArgument SecondArg
 The second template argument to which the template argument deduction failure refers. More...
 
unsigned CallArgIndex = 0
 The index of the function argument that caused a deduction failure. More...
 
SmallVector< DeducedPack *, 8 > PendingDeducedPacks
 Information on packs that we're currently expanding. More...
 
ConstraintSatisfaction AssociatedConstraintsSatisfaction
 The constraint satisfaction details resulting from the associated constraints satisfaction tests. More...
 

Detailed Description

Provides information about an attempted template argument deduction, whose success or failure was described by a TemplateDeductionResult value.

Definition at line 42 of file TemplateDeduction.h.

Member Typedef Documentation

◆ diag_iterator

Iterator over the set of suppressed diagnostics.

Definition at line 158 of file TemplateDeduction.h.

Member Enumeration Documentation

◆ ForBaseTag

Enumerator
ForBase 

Definition at line 70 of file TemplateDeduction.h.

Constructor & Destructor Documentation

◆ TemplateDeductionInfo() [1/3]

clang::sema::TemplateDeductionInfo::TemplateDeductionInfo ( SourceLocation  Loc,
unsigned  DeducedDepth = 0 
)
inline

Definition at line 65 of file TemplateDeduction.h.

References operator=().

◆ TemplateDeductionInfo() [2/3]

clang::sema::TemplateDeductionInfo::TemplateDeductionInfo ( const TemplateDeductionInfo )
delete

◆ TemplateDeductionInfo() [3/3]

clang::sema::TemplateDeductionInfo::TemplateDeductionInfo ( ForBaseTag  ,
const TemplateDeductionInfo Info 
)
inline

Create temporary template deduction info for speculatively deducing against a base class of an argument's type.

Definition at line 73 of file TemplateDeduction.h.

Member Function Documentation

◆ addSFINAEDiagnostic()

void clang::sema::TemplateDeductionInfo::addSFINAEDiagnostic ( SourceLocation  Loc,
PartialDiagnostic  PD 
)
inline

Set the diagnostic which caused the SFINAE failure.

Definition at line 140 of file TemplateDeduction.h.

◆ addSuppressedDiagnostic()

void clang::sema::TemplateDeductionInfo::addSuppressedDiagnostic ( SourceLocation  Loc,
PartialDiagnostic  PD 
)
inline

Add a new diagnostic to the set of diagnostics.

Definition at line 150 of file TemplateDeduction.h.

◆ clearSFINAEDiagnostic()

void clang::sema::TemplateDeductionInfo::clearSFINAEDiagnostic ( )
inline

Discard any SFINAE diagnostics.

Definition at line 110 of file TemplateDeduction.h.

Referenced by clang::Sema::isMoreSpecializedThanPrimary(), and takeSFINAEDiagnostic().

◆ diag_begin()

diag_iterator clang::sema::TemplateDeductionInfo::diag_begin ( ) const
inline

Returns an iterator at the beginning of the sequence of suppressed diagnostics.

Definition at line 162 of file TemplateDeduction.h.

◆ diag_end()

diag_iterator clang::sema::TemplateDeductionInfo::diag_end ( ) const
inline

Returns an iterator at the end of the sequence of suppressed diagnostics.

Definition at line 166 of file TemplateDeduction.h.

◆ getDeducedDepth()

unsigned clang::sema::TemplateDeductionInfo::getDeducedDepth ( ) const
inline

The depth of template parameters for which deduction is being performed.

Definition at line 85 of file TemplateDeduction.h.

Referenced by DeduceNonTypeTemplateArgument(), DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), and getDeducedParameterFromExpr().

◆ getLocation()

SourceLocation clang::sema::TemplateDeductionInfo::getLocation ( ) const
inline

◆ getNumExplicitArgs()

unsigned clang::sema::TemplateDeductionInfo::getNumExplicitArgs ( ) const
inline

Get the number of explicitly-specified arguments.

Definition at line 90 of file TemplateDeduction.h.

◆ hasSFINAEDiagnostic()

bool clang::sema::TemplateDeductionInfo::hasSFINAEDiagnostic ( ) const
inline

Is a SFINAE diagnostic available?

Definition at line 135 of file TemplateDeduction.h.

◆ operator=()

TemplateDeductionInfo& clang::sema::TemplateDeductionInfo::operator= ( const TemplateDeductionInfo )
delete

◆ peekSFINAEDiagnostic()

const PartialDiagnosticAt& clang::sema::TemplateDeductionInfo::peekSFINAEDiagnostic ( ) const
inline

Peek at the SFINAE diagnostic.

Definition at line 116 of file TemplateDeduction.h.

◆ reset()

void clang::sema::TemplateDeductionInfo::reset ( TemplateArgumentList NewDeduced)
inline

Provide a new template argument list that contains the results of template argument deduction.

Definition at line 130 of file TemplateDeduction.h.

Referenced by CheckDeducedArgumentConstraints().

◆ setExplicitArgs()

void clang::sema::TemplateDeductionInfo::setExplicitArgs ( TemplateArgumentList NewDeduced)
inline

Provide an initial template argument list that contains the explicitly-specified arguments.

Definition at line 123 of file TemplateDeduction.h.

References clang::TemplateArgumentList::size().

◆ take()

TemplateArgumentList* clang::sema::TemplateDeductionInfo::take ( )
inline

Take ownership of the deduced template argument list.

Definition at line 95 of file TemplateDeduction.h.

◆ takeSFINAEDiagnostic()

void clang::sema::TemplateDeductionInfo::takeSFINAEDiagnostic ( PartialDiagnosticAt PD)
inline

Take ownership of the SFINAE diagnostic.

Definition at line 102 of file TemplateDeduction.h.

References clearSFINAEDiagnostic().

Member Data Documentation

◆ AssociatedConstraintsSatisfaction

ConstraintSatisfaction clang::sema::TemplateDeductionInfo::AssociatedConstraintsSatisfaction

The constraint satisfaction details resulting from the associated constraints satisfaction tests.

Definition at line 234 of file TemplateDeduction.h.

Referenced by CheckDeducedArgumentConstraints().

◆ CallArgIndex

unsigned clang::sema::TemplateDeductionInfo::CallArgIndex = 0

The index of the function argument that caused a deduction failure.

TDK_DeducedMismatch: this is the index of the argument that had a different argument type from its substituted parameter type.

Definition at line 225 of file TemplateDeduction.h.

◆ FirstArg

TemplateArgument clang::sema::TemplateDeductionInfo::FirstArg

The first template argument to which the template argument deduction failure refers.

Depending on the result of the template argument deduction, this template argument may have different meanings:

TDK_IncompletePack: this is the number of arguments we deduced for the pack.

TDK_Inconsistent: this argument is the first value deduced for the corresponding template parameter.

TDK_SubstitutionFailure: this argument is the template argument we were instantiating when we encountered an error.

TDK_DeducedMismatch: this is the parameter type, after substituting deduced arguments.

TDK_NonDeducedMismatch: this is the component of the 'parameter' of the deduction, directly provided in the source code.

Definition at line 204 of file TemplateDeduction.h.

Referenced by DeduceNonTypeTemplateArgument(), DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), and diagnoseAutoDeductionFailure().

◆ Param

TemplateParameter clang::sema::TemplateDeductionInfo::Param

The template parameter to which a template argument deduction failure refers.

Depending on the result of template argument deduction, this template parameter may have different meanings:

TDK_Incomplete: this is the first template parameter whose corresponding template argument was not deduced.

TDK_IncompletePack: this is the expanded parameter pack for which we deduced too few arguments.

TDK_Inconsistent: this is the template parameter for which two different template argument values were deduced.

Definition at line 182 of file TemplateDeduction.h.

Referenced by DeduceNonTypeTemplateArgument(), and DeduceTemplateArguments().

◆ PendingDeducedPacks

SmallVector<DeducedPack *, 8> clang::sema::TemplateDeductionInfo::PendingDeducedPacks

Information on packs that we're currently expanding.

FIXME: This should be kept internal to SemaTemplateDeduction.

Definition at line 230 of file TemplateDeduction.h.

◆ SecondArg

TemplateArgument clang::sema::TemplateDeductionInfo::SecondArg

The second template argument to which the template argument deduction failure refers.

TDK_Inconsistent: this argument is the second value deduced for the corresponding template parameter.

TDK_DeducedMismatch: this is the (adjusted) call argument type.

TDK_NonDeducedMismatch: this is the mismatching component of the 'argument' of the deduction, from which we are deducing arguments.

FIXME: Finish documenting this.

Definition at line 218 of file TemplateDeduction.h.

Referenced by DeduceNonTypeTemplateArgument(), DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), and diagnoseAutoDeductionFailure().


The documentation for this class was generated from the following file: