13 #ifndef LLVM_CLANG_SEMA_TEMPLATEDEDUCTION_H
14 #define LLVM_CLANG_SEMA_TEMPLATEDEDUCTION_H
18 #include "llvm/ADT/SmallVector.h"
23 class TemplateArgumentList;
41 bool HasSFINAEDiagnostic;
52 : Deduced(nullptr), Loc(Loc), HasSFINAEDiagnostic(
false),
70 assert(HasSFINAEDiagnostic);
71 PD.first = SuppressedDiagnostics.front().first;
72 PD.second.swap(SuppressedDiagnostics.front().second);
73 SuppressedDiagnostics.clear();
74 HasSFINAEDiagnostic =
false;
85 return HasSFINAEDiagnostic;
91 if (HasSFINAEDiagnostic)
93 SuppressedDiagnostics.clear();
94 SuppressedDiagnostics.emplace_back(Loc, std::move(PD));
95 HasSFINAEDiagnostic =
true;
101 if (HasSFINAEDiagnostic)
103 SuppressedDiagnostics.emplace_back(Loc, std::move(PD));
254 void destroyCandidates();
270 size_t size()
const {
return Candidates.size(); }
271 bool empty()
const {
return Candidates.empty(); }
276 Candidates.emplace_back();
277 return Candidates.back();
SmallVector< TemplateSpecCandidate, 16 >::iterator iterator
const TemplateArgument * getSecondArg()
Return the second template argument this deduction failure refers to, if any.
void NoteCandidates(Sema &S, SourceLocation Loc) const
Provides information about an attempted template argument deduction, whose success or failure was des...
void clear()
Clear out all of the candidates. TODO: This may be unnecessary.
Defines the C++ template declaration subclasses.
Expr * getExpr()
Return the expression this deduction failure refers to, if any.
void addSuppressedDiagnostic(SourceLocation Loc, PartialDiagnostic PD)
Add a new diagnostic to the set of diagnostics.
TemplateParameter Param
The template parameter to which a template argument deduction failure refers.
void Destroy()
Free any memory associated with this deduction failure.
TemplateParameter getTemplateParameter()
Retrieve the template parameter this deduction failure refers to, if any.
diag_iterator diag_end() const
Returns an iterator at the end of the sequence of suppressed diagnostics.
DeductionFailureInfo DeductionFailure
Template argument deduction info.
Sema - This implements semantic analysis and AST building for C.
void reset(TemplateArgumentList *NewDeduced)
Provide a new template argument list that contains the results of template argument deduction...
unsigned Result
A Sema::TemplateDeductionResult.
void takeSFINAEDiagnostic(PartialDiagnosticAt &PD)
Take ownership of the SFINAE diagnostic.
TemplateSpecCandidateSet(SourceLocation Loc)
diag_iterator diag_begin() const
Returns an iterator at the beginning of the sequence of suppressed diagnostics.
SourceLocation getLocation() const
TemplateDeductionInfo(SourceLocation Loc)
void NoteDeductionFailure(Sema &S)
Diagnose a template argument deduction failure.
The result type of a method or function.
SmallVector< DeducedPack *, 8 > PendingDeducedPacks
Information on packs that we're currently expanding.
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
void addSFINAEDiagnostic(SourceLocation Loc, PartialDiagnostic PD)
Set the diagnostic which caused the SFINAE failure.
void set(Decl *Spec, DeductionFailureInfo Info)
Expr * Expression
The expression which caused a deduction failure.
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs. ...
unsigned HasDiagnostic
Indicates whether a diagnostic is stored in Diagnostic.
const TemplateArgument * getFirstArg()
Return the first template argument this deduction failure refers to, if any.
Represents a template argument.
llvm::PointerUnion3< TemplateTypeParmDecl *, NonTypeTemplateParmDecl *, TemplateTemplateParmDecl * > TemplateParameter
Stores a template parameter of any kind.
PartialDiagnosticAt * getSFINAEDiagnostic()
Retrieve the diagnostic which caused this deduction failure, if any.
bool hasSFINAEDiagnostic() const
Is a SFINAE diagnostic available?
TemplateSpecCandidate & addCandidate()
Add a new candidate with NumConversions conversion sequence slots to the overload set...
void * Data
Opaque pointer containing additional data about this deduction failure.
TemplateArgumentList * take()
Take ownership of the deduced template argument list.
SourceLocation getLocation() const
Returns the location at which template argument is occurring.
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream...
~TemplateSpecCandidateSet()
TemplateArgumentList * getTemplateArgumentList()
Retrieve the template argument list associated with this deduction failure, if any.
A template argument list.
SmallVectorImpl< PartialDiagnosticAt >::const_iterator diag_iterator
Iterator over the set of suppressed diagnostics.
TemplateArgument SecondArg
The second template argument to which the template argument deduction failure refers.
void NoteCandidates(Sema &S, SourceLocation Loc)
TemplateArgument FirstArg
The first template argument to which the template argument deduction failure refers.