24 #include "llvm/Support/TrailingObjects.h" 29 using namespace clang;
43 NamedConcept, ArgsAsWritten),
44 NumTemplateArgs(ConvertedArgs.size()),
45 Satisfaction(Satisfaction ?
49 bool IsInstantiationDependent =
false;
50 bool ContainsUnexpandedParameterPack =
false;
52 if (ArgLoc.getArgument().isInstantiationDependent())
53 IsInstantiationDependent =
true;
54 if (ArgLoc.getArgument().containsUnexpandedParameterPack())
55 ContainsUnexpandedParameterPack =
true;
56 if (ContainsUnexpandedParameterPack && IsInstantiationDependent)
68 "should not be value-dependent");
74 NumTemplateArgs(NumTemplateArgs) { }
79 std::uninitialized_copy(Converted.begin(), Converted.end(),
80 getTrailingObjects<TemplateArgument>());
93 void *Buffer = C.
Allocate(totalSizeToAlloc<TemplateArgument>(
94 ConvertedArgs.size()));
96 ConceptNameInfo, FoundDecl,
97 NamedConcept, ArgsAsWritten,
98 ConvertedArgs, Satisfaction);
105 bool ContainsUnexpandedParameterPack)
108 !Satisfaction, Dependent,
109 ContainsUnexpandedParameterPack),
112 NamedConcept, nullptr),
114 Satisfaction(Satisfaction ?
126 bool ContainsUnexpandedParameterPack) {
127 void *Buffer = C.
Allocate(totalSizeToAlloc<TemplateArgument>(
128 ConvertedArgs.size()));
130 C, NamedConcept, ConvertedArgs, Satisfaction, Dependent,
131 ContainsUnexpandedParameterPack);
137 void *Buffer = C.
Allocate(totalSizeToAlloc<TemplateArgument>(
144 assert(isTypeConstraint());
147 return cast<TemplateTypeParmDecl>(TPL->getParam(0))
148 ->getTypeConstraint();
159 NumLocalParameters(LocalParameters.size()),
160 NumRequirements(Requirements.size()), Body(Body), RBraceLoc(RBraceLoc) {
163 bool Dependent =
false;
164 bool ContainsUnexpandedParameterPack =
false;
166 Dependent |=
P->getType()->isInstantiationDependentType();
167 ContainsUnexpandedParameterPack |=
168 P->getType()->containsUnexpandedParameterPack();
172 Dependent |= R->isDependent();
173 ContainsUnexpandedParameterPack |= R->containsUnexpandedParameterPack();
180 std::copy(LocalParameters.begin(), LocalParameters.end(),
181 getTrailingObjects<ParmVarDecl *>());
182 std::copy(Requirements.begin(), Requirements.end(),
183 getTrailingObjects<concepts::Requirement *>());
190 RequiresExpr::RequiresExpr(
ASTContext &C, EmptyShell Empty,
191 unsigned NumLocalParameters,
192 unsigned NumRequirements)
193 :
Expr(RequiresExprClass, Empty), NumLocalParameters(NumLocalParameters),
194 NumRequirements(NumRequirements) { }
203 C.
Allocate(totalSizeToAlloc<ParmVarDecl *, concepts::Requirement *>(
204 LocalParameters.size(), Requirements.size()),
206 return new (Mem)
RequiresExpr(C, RequiresKWLoc, Body, LocalParameters,
207 Requirements, RBraceLoc);
212 unsigned NumLocalParameters,
unsigned NumRequirements) {
214 C.
Allocate(totalSizeToAlloc<ParmVarDecl *, concepts::Requirement *>(
215 NumLocalParameters, NumRequirements),
217 return new (Mem)
RequiresExpr(C, Empty, NumLocalParameters, NumRequirements);
ConceptSpecializationExpr(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten, ArrayRef< TemplateArgument > ConvertedArgs, const ConstraintSatisfaction *Satisfaction)
void setValueDependent(bool VD)
Set whether this expression is value-dependent or not.
Defines the clang::ASTContext interface.
C Language Family Type Representation.
Defines the C++ template declaration subclasses.
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, ArrayRef< ParmVarDecl *> LocalParameters, ArrayRef< concepts::Requirement *> Requirements, SourceLocation RBraceLoc)
ASTConstraintSatisfaction * Satisfaction
Information about the satisfaction of the named concept with the given arguments. ...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
Stores a list of template parameters for a TemplateDecl and its derived classes.
void setContainsUnexpandedParameterPack(bool PP=true)
Set the bit that describes whether this expression contains an unexpanded parameter pack...
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
Represents a parameter to a function.
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
unsigned NumTemplateArgs
The number of template arguments in the tail-allocated list of converted template arguments...
An ordinary object is located at an address in memory.
bool isInstantiationDependent() const
Whether this nested name specifier involves a template parameter.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
This represents one expression.
Represents the body of a requires-expression.
NestedNameSpecifierLoc NestedNameSpec
NamedDecl * FoundDecl
The declaration found by name lookup when the expression was created.
SourceLocation TemplateKWLoc
The location of the template keyword, if specified when naming the concept.
bool containsUnexpandedParameterPack() const
Whether this nested-name-specifier contains an unexpanded parameter pack (for C++11 variadic template...
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
Encodes a location in the source.
Common data class for constructs that reference concepts with template arguments. ...
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
A static requirement that can be used in a requires-expression to check properties of types and expre...
static ConceptSpecializationExpr * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten, ArrayRef< TemplateArgument > ConvertedArgs, const ConstraintSatisfaction *Satisfaction)
A placeholder type used to construct an empty shell of a type, that will be filled in later (e...
void * Allocate(size_t Size, unsigned Align=8) const
Dataflow Directional Tag Classes.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
void setInstantiationDependent(bool ID)
Set whether this expression is instantiation-dependent or not.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
RequiresExprBitfields RequiresExprBits
Location wrapper for a TemplateArgument.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
ConceptDecl * NamedConcept
The concept named.
void setTemplateArguments(ArrayRef< TemplateArgument > Converted)
Set new template arguments for this concept specialization.
Defines the clang::SourceLocation class and associated facilities.
Defines Expressions and AST nodes for C++2a concepts.
Represents the specialization of a concept - evaluates to a prvalue of type bool. ...
const ASTTemplateArgumentListInfo * ArgsAsWritten
The template argument list source info used to specialize the concept.
This represents a decl that may have a name.
const TypeConstraint * getTypeConstraint() const
This file provides AST data structures related to concepts.
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, 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.