19#include "llvm/ADT/StringExtras.h"
29 else if (
const auto *E = llvm::dyn_cast<const Expr *>(Detail))
32 llvm::dyn_cast<const ConceptReference *>(Detail))
35 auto &SubstitutionDiagnostic =
37 StringRef Message =
C.backupStr(SubstitutionDiagnostic.second);
39 SubstitutionDiagnostic.first, Message);
51 getTrailingObjects() + I);
61 getTrailingObjects() + I);
68 totalSizeToAlloc<UnsatisfiedConstraintRecord>(
77 totalSizeToAlloc<UnsatisfiedConstraintRecord>(Satisfaction.
NumRecords);
86 ID.AddPointer(ConstraintOwner);
87 ID.AddInteger(TemplateArgs.size());
88 for (
auto &Arg : TemplateArgs)
105 return QualifierLoc.getBeginLoc();
115 llvm::ListSeparator Sep(
", ");
119 ArgLoc.getArgument().print(Policy, OS,
false);
128 llvm::raw_string_ostream OS(NameStr);
135 return DB << NameStr;
147 Value(E), NoexceptLoc(NoexceptLoc), TypeReq(Req),
148 SubstitutedConstraintExpr(SubstitutedConstraintExpr), Status(Status) {
149 assert((!IsSimple || (Req.
isEmpty() && NoexceptLoc.isInvalid())) &&
150 "Simple requirement must not have a return type requirement or a "
151 "noexcept specification");
161 Value(ExprSubstDiag), NoexceptLoc(NoexceptLoc), TypeReq(Req),
163 assert((!IsSimple || (Req.
isEmpty() && NoexceptLoc.isInvalid())) &&
164 "Simple requirement must not have a return type requirement or a "
165 "noexcept specification");
170 : TypeConstraintInfo(TPL,
false) {
171 assert(TPL->
size() == 1);
175 "TPL must have a template type parameter with a type constraint");
179 Constraint->getTemplateArgsAsWritten() &&
180 TemplateSpecializationType::anyInstantiationDependentTemplateArguments(
181 Constraint->getTemplateArgsAsWritten()->arguments().drop_front(1));
182 TypeConstraintInfo.setInt(Dependent ?
true :
false);
187 : TypeConstraintInfo(TPL, IsDependent) {}
static void CreateUnsatisfiedConstraintRecord(const ASTContext &C, const UnsatisfiedConstraintRecord &Detail, UnsatisfiedConstraintRecord *TrailingObject)
This file provides AST data structures related to concepts.
Defines the clang::ASTContext interface.
Defines Expressions and AST nodes for C++2a concepts.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A reference to a concept and its template args, as it appears in the code.
NestedNameSpecifierLoc NestedNameSpec
bool hasExplicitTemplateArgs() const
Whether or not template arguments were explicitly specified in the concept reference (they might not ...
DeclarationNameInfo ConceptName
The concept name used.
const NestedNameSpecifierLoc & getNestedNameSpecifierLoc() const
const DeclarationNameInfo & getConceptNameInfo() const
SourceLocation TemplateKWLoc
The location of the template keyword, if specified when naming the concept.
TemplateDecl * NamedConcept
The concept named.
SourceLocation getBeginLoc() const LLVM_READONLY
const ASTTemplateArgumentListInfo * ArgsAsWritten
The template argument list source info used to specialize the concept.
NamedDecl * FoundDecl
The declaration found by name lookup when the expression was created.
void print(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const
ConceptReference(NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, TemplateDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, TemplateDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
Represents the specialization of a concept - evaluates to a prvalue of type bool.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &C)
llvm::SmallVector< UnsatisfiedConstraintRecord, 4 > Details
The substituted constraint expr, if the template arguments could be substituted into them,...
This represents one expression.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
This represents a decl that may have a name.
A C++ nested-name-specifier augmented with source location information.
Encodes a location in the source.
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl * getParam(unsigned Idx)
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
A container of type source information.
ReturnTypeRequirement()
No return type requirement was specified.
bool isTypeConstraint() const
@ SS_TypeRequirementSubstitutionFailure
@ SS_ExprSubstitutionFailure
ExprRequirement(Expr *E, bool IsSimple, SourceLocation NoexceptLoc, ReturnTypeRequirement Req, SatisfactionStatus Status, ConceptSpecializationExpr *SubstitutedConstraintExpr=nullptr)
Construct a compound requirement.
bool containsUnexpandedParameterPack() const
Requirement(RequirementKind Kind, bool IsDependent, bool ContainsUnexpandedParameterPack, bool IsSatisfied=true)
TypeSourceInfo * getType() const
TypeRequirement(TypeSourceInfo *T)
Construct a type requirement from a type.
The JSON file list parser is used to communicate input to InstallAPI.
llvm::PointerUnion< const Expr *, const ConceptReference *, const ConstraintSubstitutionDiagnostic * > UnsatisfiedConstraintRecord
const FunctionProtoType * T
@ Concept
The name was classified as a concept name.
std::pair< SourceLocation, StringRef > ConstraintSubstitutionDiagnostic
Unsatisfied constraint expressions if the template arguments could be substituted into them,...
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ConceptReference *C)
Insertion operator for diagnostics.
U cast(CodeGen::Address addr)
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
static ASTConstraintSatisfaction * Rebuild(const ASTContext &C, const ASTConstraintSatisfaction &Satisfaction)
ASTConstraintSatisfaction(const ASTContext &C, const ConstraintSatisfaction &Satisfaction)
const UnsatisfiedConstraintRecord * begin() const
static ASTConstraintSatisfaction * Create(const ASTContext &C, const ConstraintSatisfaction &Satisfaction)
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getBeginLoc() const
getBeginLoc - Retrieve the location of the first token.
Describes how types, statements, expressions, and declarations should be printed.