29ConceptSpecializationExpr::ConceptSpecializationExpr(
34 ConceptRef(Loc), SpecDecl(SpecDecl),
35 Satisfaction(Satisfaction
48 assert((!isValueDependent() || isInstantiationDependent()) &&
49 "should not be value-dependent");
52ConceptSpecializationExpr::ConceptSpecializationExpr(EmptyShell
Empty)
53 :
Expr(ConceptSpecializationExprClass,
Empty) {}
59 return new (
C) ConceptSpecializationExpr(
C, Loc, SpecDecl, Satisfaction);
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) {
89 ConceptSpecializationExpr(
C, Loc, SpecDecl, Satisfaction,
Dependent,
90 ContainsUnexpandedParameterPack);
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();
114RequiresExpr::RequiresExpr(ASTContext &
C, SourceLocation RequiresKWLoc,
115 RequiresExprBodyDecl *Body, SourceLocation LParenLoc,
116 ArrayRef<ParmVarDecl *> LocalParameters,
117 SourceLocation RParenLoc,
118 ArrayRef<concepts::Requirement *> Requirements,
119 SourceLocation RBraceLoc)
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()),
174 alignof(RequiresExpr));
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),
186 alignof(RequiresExpr));
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.
const NestedNameSpecifierLoc & getNestedNameSpecifierLoc() const
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.
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
bool isInstantiationDependent() const
Whether this nested name specifier involves a template parameter.
bool containsUnexpandedParameterPack() const
Whether this nested-name-specifier contains an unexpanded parameter pack (for C++11 variadic template...
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.
ExprDependenceScope::ExprDependence ExprDependence
@ OK_Ordinary
An ordinary object is located at an address in memory.
ExprDependence computeDependence(FullExpr *E)
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
@ Dependent
Parse the block as a dependent block, which may be used in some template instantiations but not other...
static OpenACCComputeConstruct * Create(const ASTContext &C, OpenACCDirectiveKind K, SourceLocation BeginLoc, SourceLocation DirectiveLoc, SourceLocation EndLoc, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
U cast(CodeGen::Address addr)
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....