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 if (ExprReq->isExprSubstitutionFailure())
107 if (
auto *E = ExprReq->getExpr())
108 return E->containsErrors();
112 if (
auto *NestedReq = dyn_cast<concepts::NestedRequirement>(R))
113 return !NestedReq->hasInvalidConstraint() &&
114 NestedReq->getConstraintExpr() &&
115 NestedReq->getConstraintExpr()->containsErrors();
119RequiresExpr::RequiresExpr(ASTContext &
C, SourceLocation RequiresKWLoc,
120 RequiresExprBodyDecl *Body, SourceLocation LParenLoc,
121 ArrayRef<ParmVarDecl *> LocalParameters,
122 SourceLocation RParenLoc,
123 ArrayRef<concepts::Requirement *> Requirements,
124 SourceLocation RBraceLoc)
126 NumLocalParameters(LocalParameters.size()),
127 NumRequirements(Requirements.size()), Body(Body), LParenLoc(LParenLoc),
128 RParenLoc(RParenLoc), RBraceLoc(RBraceLoc) {
129 RequiresExprBits.IsSatisfied =
false;
130 RequiresExprBits.RequiresKWLoc = RequiresKWLoc;
132 bool ContainsUnexpandedParameterPack =
false;
134 Dependent |= P->getType()->isInstantiationDependentType();
135 ContainsUnexpandedParameterPack |=
136 P->getType()->containsUnexpandedParameterPack();
138 RequiresExprBits.IsSatisfied =
true;
141 ContainsUnexpandedParameterPack |= R->containsUnexpandedParameterPack();
143 RequiresExprBits.IsSatisfied = R->isSatisfied();
144 if (!RequiresExprBits.IsSatisfied)
149 setDependence(getDependence() | ExprDependence::Error);
151 llvm::copy(LocalParameters, getTrailingObjects<ParmVarDecl *>());
152 llvm::copy(Requirements, getTrailingObjects<concepts::Requirement *>());
153 RequiresExprBits.IsSatisfied |=
Dependent;
155 if (ContainsUnexpandedParameterPack)
156 setDependence(getDependence() | ExprDependence::UnexpandedPack);
162 setDependence(getDependence() | ExprDependence::ValueInstantiation);
166 unsigned NumLocalParameters,
167 unsigned NumRequirements)
168 :
Expr(RequiresExprClass,
Empty), NumLocalParameters(NumLocalParameters),
169 NumRequirements(NumRequirements) { }
177 C.Allocate(totalSizeToAlloc<ParmVarDecl *, concepts::Requirement *>(
178 LocalParameters.size(), Requirements.size()),
179 alignof(RequiresExpr));
181 RequiresExpr(
C, RequiresKWLoc, Body, LParenLoc, LocalParameters,
182 RParenLoc, Requirements, RBraceLoc);
187 unsigned NumLocalParameters,
unsigned NumRequirements) {
189 C.Allocate(totalSizeToAlloc<ParmVarDecl *, concepts::Requirement *>(
190 NumLocalParameters, NumRequirements),
191 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 OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > PL, ArrayRef< Expr * > IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.
@ 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....