14 #ifndef LLVM_CLANG_SEMA_TEMPLATEDEDUCTION_H 15 #define LLVM_CLANG_SEMA_TEMPLATEDEDUCTION_H 25 #include "llvm/ADT/Optional.h" 26 #include "llvm/ADT/SmallVector.h" 51 bool HasSFINAEDiagnostic =
false;
54 unsigned DeducedDepth;
58 unsigned ExplicitArgs = 0;
66 : Loc(Loc), DeducedDepth(DeducedDepth) {}
96 assert(HasSFINAEDiagnostic);
97 PD.first = SuppressedDiagnostics.front().first;
98 PD.second.swap(SuppressedDiagnostics.front().second);
104 SuppressedDiagnostics.clear();
105 HasSFINAEDiagnostic =
false;
110 assert(HasSFINAEDiagnostic);
111 return SuppressedDiagnostics.front();
117 Deduced = NewDeduced;
118 ExplicitArgs = Deduced->
size();
124 Deduced = NewDeduced;
129 return HasSFINAEDiagnostic;
135 if (HasSFINAEDiagnostic)
137 SuppressedDiagnostics.clear();
138 SuppressedDiagnostics.emplace_back(Loc, std::move(PD));
139 HasSFINAEDiagnostic =
true;
145 if (HasSFINAEDiagnostic)
147 SuppressedDiagnostics.emplace_back(Loc, std::move(PD));
297 Specialization = Spec;
298 DeductionFailure = Info;
302 void NoteDeductionFailure(
Sema &S,
bool ForTakingAddress);
316 bool ForTakingAddress;
318 void destroyCandidates();
322 : Loc(Loc), ForTakingAddress(ForTakingAddress) {}
339 size_t size()
const {
return Candidates.size(); }
340 bool empty()
const {
return Candidates.empty(); }
345 Candidates.emplace_back();
346 return Candidates.back();
358 #endif // LLVM_CLANG_SEMA_TEMPLATEDEDUCTION_H const PartialDiagnosticAt & peekSFINAEDiagnostic() const
Peek at the SFINAE diagnostic.
A structure used to record information about a failed template argument deduction, for diagnosis.
Provides information about an attempted template argument deduction, whose success or failure was des...
unsigned size() const
Retrieve the number of template arguments in this template argument list.
Decl - This represents one declaration (or definition), e.g.
TemplateDeductionInfo & operator=(const TemplateDeductionInfo &)=delete
Defines the C++ template declaration subclasses.
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
void addSuppressedDiagnostic(SourceLocation Loc, PartialDiagnostic PD)
Add a new diagnostic to the set of diagnostics.
void clearSFINAEDiagnostic()
Discard any SFINAE diagnostics.
Decl * Specialization
Specialization - The actual specialization that this candidate represents.
TemplateParameter Param
The template parameter to which a template argument deduction failure refers.
ConstraintSatisfaction AssociatedConstraintsSatisfaction
The constraint satisfaction details resulting from the associated constraints satisfaction tests...
void NoteCandidates(Sema &S, SourceLocation Loc) const
TemplateSpecCandidateSet - A set of generalized overload candidates, used in template specializations...
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...
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
unsigned Result
A Sema::TemplateDeductionResult.
void setExplicitArgs(TemplateArgumentList *NewDeduced)
Provide an initial template argument list that contains the explicitly-specified arguments.
TemplateSpecCandidateSet(SourceLocation Loc, bool ForTakingAddress=false)
bool Destroy(InterpState &S, CodePtr OpPC, uint32_t I)
SourceLocation getLocation() const
Returns the location at which template argument is occurring.
void takeSFINAEDiagnostic(PartialDiagnosticAt &PD)
Take ownership of the SFINAE diagnostic.
llvm::PointerUnion< TemplateTypeParmDecl *, NonTypeTemplateParmDecl *, TemplateTemplateParmDecl * > TemplateParameter
Stores a template parameter of any kind.
TemplateDeductionInfo(SourceLocation Loc, unsigned DeducedDepth=0)
SmallVector< DeducedPack *, 8 > PendingDeducedPacks
Information on packs that we're currently expanding.
Encodes a location in the source.
void addSFINAEDiagnostic(SourceLocation Loc, PartialDiagnostic PD)
Set the diagnostic which caused the SFINAE 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.
unsigned getDeducedDepth() const
The depth of template parameters for which deduction is being performed.
diag_iterator diag_end() const
Returns an iterator at the end of the sequence of suppressed diagnostics.
DeclAccessPair FoundDecl
The declaration that was looked up, together with its access.
SourceLocation getLocation() const
A POD class for pairing a NamedDecl* with an access specifier.
Represents a template argument.
Dataflow Directional Tag Classes.
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.
bool hasSFINAEDiagnostic() const
Is a SFINAE diagnostic available?
TemplateArgumentList * take()
Take ownership of the deduced template argument list.
TemplateSpecCandidate - This is a generalization of OverloadCandidate which keeps track of template a...
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream...
~TemplateSpecCandidateSet()
A template argument list.
Defines the clang::SourceLocation class and associated facilities.
unsigned getNumExplicitArgs() const
Get the number of explicitly-specified arguments.
TemplateArgument SecondArg
The second template argument to which the template argument deduction failure refers.
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine) ...
unsigned CallArgIndex
The index of the function argument that caused a deduction failure.
TemplateArgument FirstArg
The first template argument to which the template argument deduction failure refers.
SmallVectorImpl< PartialDiagnosticAt >::const_iterator diag_iterator
Iterator over the set of suppressed diagnostics.
This file provides AST data structures related to concepts.
diag_iterator diag_begin() const
Returns an iterator at the beginning of the sequence of suppressed diagnostics.