29ConceptSpecializationExpr::ConceptSpecializationExpr(
34 ConceptRef(
Loc), SpecDecl(SpecDecl),
35 Satisfaction(Satisfaction
41 assert(!
Loc->getNestedNameSpecifierLoc() ||
42 (!
Loc->getNestedNameSpecifierLoc()
43 .getNestedNameSpecifier()
44 .isInstantiationDependent() &&
45 !
Loc->getNestedNameSpecifierLoc()
46 .getNestedNameSpecifier()
47 .containsUnexpandedParameterPack()));
48 assert((!isValueDependent() || isInstantiationDependent()) &&
49 "should not be value-dependent");
52ConceptSpecializationExpr::ConceptSpecializationExpr(EmptyShell
Empty)
53 :
Expr(ConceptSpecializationExprClass,
Empty) {}
62ConceptSpecializationExpr::ConceptSpecializationExpr(
66 bool ContainsUnexpandedParameterPack)
68 ConceptRef(
Loc), SpecDecl(SpecDecl),
69 Satisfaction(Satisfaction
74 D |= ExprDependence::Value;
76 D |= ExprDependence::Instantiation;
77 if (ContainsUnexpandedParameterPack)
78 D |= ExprDependence::UnexpandedPack;
87 bool ContainsUnexpandedParameterPack) {
90 ContainsUnexpandedParameterPack);
96 auto TPL = cast<TemplateParameterList *>(TypeConstraintInfo.getPointer());
97 return cast<TemplateTypeParmDecl>(TPL->getParam(0))
98 ->getTypeConstraint();
104 if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(R))
105 return ExprReq->getExpr() && ExprReq->getExpr()->containsErrors();
107 if (
auto *NestedReq = dyn_cast<concepts::NestedRequirement>(R))
108 return !NestedReq->hasInvalidConstraint() &&
109 NestedReq->getConstraintExpr() &&
110 NestedReq->getConstraintExpr()->containsErrors();
121 NumLocalParameters(LocalParameters.size()),
122 NumRequirements(Requirements.size()), Body(Body), LParenLoc(LParenLoc),
123 RParenLoc(RParenLoc), RBraceLoc(RBraceLoc) {
124 RequiresExprBits.IsSatisfied =
false;
125 RequiresExprBits.RequiresKWLoc = RequiresKWLoc;
127 bool ContainsUnexpandedParameterPack =
false;
129 Dependent |=
P->getType()->isInstantiationDependentType();
130 ContainsUnexpandedParameterPack |=
131 P->getType()->containsUnexpandedParameterPack();
133 RequiresExprBits.IsSatisfied =
true;
136 ContainsUnexpandedParameterPack |= R->containsUnexpandedParameterPack();
138 RequiresExprBits.IsSatisfied = R->isSatisfied();
139 if (!RequiresExprBits.IsSatisfied)
144 setDependence(getDependence() | ExprDependence::Error);
146 llvm::copy(LocalParameters, getTrailingObjects<ParmVarDecl *>());
147 llvm::copy(Requirements, getTrailingObjects<concepts::Requirement *>());
148 RequiresExprBits.IsSatisfied |=
Dependent;
150 if (ContainsUnexpandedParameterPack)
151 setDependence(getDependence() | ExprDependence::UnexpandedPack);
157 setDependence(getDependence() | ExprDependence::ValueInstantiation);
161 unsigned NumLocalParameters,
162 unsigned NumRequirements)
163 :
Expr(RequiresExprClass,
Empty), NumLocalParameters(NumLocalParameters),
164 NumRequirements(NumRequirements) { }
172 C.Allocate(totalSizeToAlloc<ParmVarDecl *, concepts::Requirement *>(
173 LocalParameters.size(), Requirements.size()),
176 RequiresExpr(
C, RequiresKWLoc, Body, LParenLoc, LocalParameters,
177 RParenLoc, Requirements, RBraceLoc);
182 unsigned NumLocalParameters,
unsigned NumRequirements) {
184 C.Allocate(totalSizeToAlloc<ParmVarDecl *, concepts::Requirement *>(
185 NumLocalParameters, NumRequirements),
This file provides AST data structures related to concepts.
Defines the clang::ASTContext interface.
Defines the C++ template declaration subclasses.
static bool RequirementContainsError(concepts::Requirement *R)
Defines Expressions and AST nodes for C++2a concepts.
Defines the clang::SourceLocation class and associated facilities.
C Language Family Type Representation.
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.
Represents the specialization of a concept - evaluates to a prvalue of type bool.
static ConceptSpecializationExpr * Create(const ASTContext &C, ConceptReference *ConceptRef, ImplicitConceptSpecializationDecl *SpecDecl, const ConstraintSatisfaction *Satisfaction)
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
This represents one expression.
void setDependence(ExprDependence Deps)
Each concrete expr subclass is expected to compute its dependence and call this in the constructor.
Represents a parameter to a function.
Represents the body of a requires-expression.
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation RBraceLoc)
Encodes a location in the source.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
bool isTypeConstraint() const
const TypeConstraint * getTypeConstraint() const
A static requirement that can be used in a requires-expression to check properties of types and expre...
The JSON file list parser is used to communicate input to InstallAPI.
@ OK_Ordinary
An ordinary object is located at an address in memory.
ExprDependence computeDependence(FullExpr *E)
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
@ Dependent
Parse the block as a dependent block, which may be used in some template instantiations but not other...
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
A placeholder type used to construct an empty shell of a type, that will be filled in later (e....