clang  12.0.0git
ExprConcepts.h
Go to the documentation of this file.
1 //===- ExprConcepts.h - C++2a Concepts expressions --------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 /// \file
10 /// Defines Expressions and AST nodes for C++2a concepts.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_AST_EXPRCONCEPTS_H
15 #define LLVM_CLANG_AST_EXPRCONCEPTS_H
16 
17 #include "clang/AST/ASTContext.h"
18 #include "clang/AST/ASTConcept.h"
19 #include "clang/AST/Decl.h"
21 #include "clang/AST/DeclTemplate.h"
22 #include "clang/AST/Expr.h"
24 #include "clang/AST/TemplateBase.h"
25 #include "clang/AST/Type.h"
27 #include "llvm/Support/TrailingObjects.h"
28 #include <utility>
29 #include <string>
30 
31 namespace clang {
32 class ASTStmtReader;
33 class ASTStmtWriter;
34 
35 /// \brief Represents the specialization of a concept - evaluates to a prvalue
36 /// of type bool.
37 ///
38 /// According to C++2a [expr.prim.id]p3 an id-expression that denotes the
39 /// specialization of a concept results in a prvalue of type bool.
40 class ConceptSpecializationExpr final : public Expr, public ConceptReference,
41  private llvm::TrailingObjects<ConceptSpecializationExpr,
42  TemplateArgument> {
43  friend class ASTStmtReader;
44  friend TrailingObjects;
45 public:
46  using SubstitutionDiagnostic = std::pair<SourceLocation, std::string>;
47 
48 protected:
49  /// \brief The number of template arguments in the tail-allocated list of
50  /// converted template arguments.
51  unsigned NumTemplateArgs;
52 
53  /// \brief Information about the satisfaction of the named concept with the
54  /// given arguments. If this expression is value dependent, this is to be
55  /// ignored.
57 
60  DeclarationNameInfo ConceptNameInfo,
63  ArrayRef<TemplateArgument> ConvertedArgs,
64  const ConstraintSatisfaction *Satisfaction);
65 
67  ArrayRef<TemplateArgument> ConvertedArgs,
68  const ConstraintSatisfaction *Satisfaction,
69  bool Dependent,
70  bool ContainsUnexpandedParameterPack);
71 
72  ConceptSpecializationExpr(EmptyShell Empty, unsigned NumTemplateArgs);
73 
74 public:
75 
81  ArrayRef<TemplateArgument> ConvertedArgs,
82  const ConstraintSatisfaction *Satisfaction);
83 
86  ArrayRef<TemplateArgument> ConvertedArgs,
87  const ConstraintSatisfaction *Satisfaction,
88  bool Dependent,
89  bool ContainsUnexpandedParameterPack);
90 
92  Create(ASTContext &C, EmptyShell Empty, unsigned NumTemplateArgs);
93 
95  return ArrayRef<TemplateArgument>(getTrailingObjects<TemplateArgument>(),
96  NumTemplateArgs);
97  }
98 
99  /// \brief Set new template arguments for this concept specialization.
101 
102  /// \brief Whether or not the concept with the given arguments was satisfied
103  /// when the expression was created.
104  /// The expression must not be dependent.
105  bool isSatisfied() const {
106  assert(!isValueDependent()
107  && "isSatisfied called on a dependent ConceptSpecializationExpr");
108  return Satisfaction->IsSatisfied;
109  }
110 
111  /// \brief Get elaborated satisfaction info about the template arguments'
112  /// satisfaction of the named concept.
113  /// The expression must not be dependent.
115  assert(!isValueDependent()
116  && "getSatisfaction called on dependent ConceptSpecializationExpr");
117  return *Satisfaction;
118  }
119 
120  static bool classof(const Stmt *T) {
121  return T->getStmtClass() == ConceptSpecializationExprClass;
122  }
123 
124  SourceLocation getBeginLoc() const LLVM_READONLY {
125  return ConceptName.getBeginLoc();
126  }
127 
128  SourceLocation getEndLoc() const LLVM_READONLY {
129  return ArgsAsWritten->RAngleLoc;
130  }
131 
132  // Iterators
135  }
138  }
139 };
140 
141 namespace concepts {
142 
143 /// \brief A static requirement that can be used in a requires-expression to
144 /// check properties of types and expression.
145 class Requirement {
146 public:
147  // Note - simple and compound requirements are both represented by the same
148  // class (ExprRequirement).
149  enum RequirementKind { RK_Type, RK_Simple, RK_Compound, RK_Nested };
150 private:
151  const RequirementKind Kind;
152  // FIXME: use RequirementDependence to model dependence?
153  bool Dependent : 1;
154  bool ContainsUnexpandedParameterPack : 1;
155  bool Satisfied : 1;
156 public:
158  StringRef SubstitutedEntity;
159  // FIXME: Store diagnostics semantically and not as prerendered strings.
160  // Fixing this probably requires serialization of PartialDiagnostic
161  // objects.
163  StringRef DiagMessage;
164  };
165 
166  Requirement(RequirementKind Kind, bool IsDependent,
167  bool ContainsUnexpandedParameterPack, bool IsSatisfied = true) :
168  Kind(Kind), Dependent(IsDependent),
169  ContainsUnexpandedParameterPack(ContainsUnexpandedParameterPack),
170  Satisfied(IsSatisfied) {}
171 
172  RequirementKind getKind() const { return Kind; }
173 
174  bool isSatisfied() const {
175  assert(!Dependent &&
176  "isSatisfied can only be called on non-dependent requirements.");
177  return Satisfied;
178  }
179 
180  void setSatisfied(bool IsSatisfied) {
181  assert(!Dependent &&
182  "setSatisfied can only be called on non-dependent requirements.");
183  Satisfied = IsSatisfied;
184  }
185 
186  void setDependent(bool IsDependent) { Dependent = IsDependent; }
187  bool isDependent() const { return Dependent; }
188 
190  ContainsUnexpandedParameterPack = Contains;
191  }
193  return ContainsUnexpandedParameterPack;
194  }
195 };
196 
197 /// \brief A requires-expression requirement which queries the existence of a
198 /// type name or type template specialization ('type' requirements).
199 class TypeRequirement : public Requirement {
200 public:
204  SS_Satisfied
205  };
206 private:
207  llvm::PointerUnion<SubstitutionDiagnostic *, TypeSourceInfo *> Value;
208  SatisfactionStatus Status;
209 public:
212 
213  /// \brief Construct a type requirement from a type. If the given type is not
214  /// dependent, this indicates that the type exists and the requirement will be
215  /// satisfied. Otherwise, the SubstitutionDiagnostic constructor is to be
216  /// used.
218 
219  /// \brief Construct a type requirement when the nested name specifier is
220  /// invalid due to a bad substitution. The requirement is unsatisfied.
222  Requirement(RK_Type, false, false, false), Value(Diagnostic),
223  Status(SS_SubstitutionFailure) {}
224 
225  SatisfactionStatus getSatisfactionStatus() const { return Status; }
227  this->Status = Status;
228  }
229 
230  bool isSubstitutionFailure() const {
231  return Status == SS_SubstitutionFailure;
232  }
233 
235  assert(Status == SS_SubstitutionFailure &&
236  "Attempted to get substitution diagnostic when there has been no "
237  "substitution failure.");
238  return Value.get<SubstitutionDiagnostic *>();
239  }
240 
242  assert(!isSubstitutionFailure() &&
243  "Attempted to get type when there has been a substitution failure.");
244  return Value.get<TypeSourceInfo *>();
245  }
246 
247  static bool classof(const Requirement *R) {
248  return R->getKind() == RK_Type;
249  }
250 };
251 
252 /// \brief A requires-expression requirement which queries the validity and
253 /// properties of an expression ('simple' and 'compound' requirements).
254 class ExprRequirement : public Requirement {
255 public:
262  SS_Satisfied
263  };
265  llvm::PointerIntPair<
266  llvm::PointerUnion<TemplateParameterList *, SubstitutionDiagnostic *>,
267  1, bool>
268  TypeConstraintInfo;
269  public:
272 
273  /// \brief No return type requirement was specified.
274  ReturnTypeRequirement() : TypeConstraintInfo(nullptr, 0) {}
275 
276  /// \brief A return type requirement was specified but it was a
277  /// substitution failure.
279  TypeConstraintInfo(SubstDiag, 0) {}
280 
281  /// \brief A 'type constraint' style return type requirement.
282  /// \param TPL an invented template parameter list containing a single
283  /// type parameter with a type-constraint.
284  // TODO: Can we maybe not save the whole template parameter list and just
285  // the type constraint? Saving the whole TPL makes it easier to handle in
286  // serialization but is less elegant.
288 
289  bool isDependent() const {
290  return TypeConstraintInfo.getInt();
291  }
292 
294  if (!isTypeConstraint())
295  return false;
296  return getTypeConstraintTemplateParameterList()
297  ->containsUnexpandedParameterPack();
298  }
299 
300  bool isEmpty() const {
301  return TypeConstraintInfo.getPointer().isNull();
302  }
303 
304  bool isSubstitutionFailure() const {
305  return !isEmpty() &&
306  TypeConstraintInfo.getPointer().is<SubstitutionDiagnostic *>();
307  }
308 
309  bool isTypeConstraint() const {
310  return !isEmpty() &&
311  TypeConstraintInfo.getPointer().is<TemplateParameterList *>();
312  }
313 
315  assert(isSubstitutionFailure());
316  return TypeConstraintInfo.getPointer().get<SubstitutionDiagnostic *>();
317  }
318 
319  const TypeConstraint *getTypeConstraint() const;
320 
322  assert(isTypeConstraint());
323  return TypeConstraintInfo.getPointer().get<TemplateParameterList *>();
324  }
325  };
326 private:
327  llvm::PointerUnion<Expr *, SubstitutionDiagnostic *> Value;
328  SourceLocation NoexceptLoc; // May be empty if noexcept wasn't specified.
329  ReturnTypeRequirement TypeReq;
330  ConceptSpecializationExpr *SubstitutedConstraintExpr;
331  SatisfactionStatus Status;
332 public:
335 
336  /// \brief Construct a compound requirement.
337  /// \param E the expression which is checked by this requirement.
338  /// \param IsSimple whether this was a simple requirement in source.
339  /// \param NoexceptLoc the location of the noexcept keyword, if it was
340  /// specified, otherwise an empty location.
341  /// \param Req the requirement for the type of the checked expression.
342  /// \param Status the satisfaction status of this requirement.
344  Expr *E, bool IsSimple, SourceLocation NoexceptLoc,
346  ConceptSpecializationExpr *SubstitutedConstraintExpr = nullptr);
347 
348  /// \brief Construct a compound requirement whose expression was a
349  /// substitution failure. The requirement is not satisfied.
350  /// \param E the diagnostic emitted while instantiating the original
351  /// expression.
352  /// \param IsSimple whether this was a simple requirement in source.
353  /// \param NoexceptLoc the location of the noexcept keyword, if it was
354  /// specified, otherwise an empty location.
355  /// \param Req the requirement for the type of the checked expression (omit
356  /// if no requirement was specified).
357  ExprRequirement(SubstitutionDiagnostic *E, bool IsSimple,
358  SourceLocation NoexceptLoc, ReturnTypeRequirement Req = {});
359 
360  bool isSimple() const { return getKind() == RK_Simple; }
361  bool isCompound() const { return getKind() == RK_Compound; }
362 
363  bool hasNoexceptRequirement() const { return NoexceptLoc.isValid(); }
364  SourceLocation getNoexceptLoc() const { return NoexceptLoc; }
365 
366  SatisfactionStatus getSatisfactionStatus() const { return Status; }
367 
369  return Status == SS_ExprSubstitutionFailure;
370  }
371 
373  return TypeReq;
374  }
375 
378  assert(Status >= SS_TypeRequirementSubstitutionFailure);
379  return SubstitutedConstraintExpr;
380  }
381 
383  assert(isExprSubstitutionFailure() &&
384  "Attempted to get expression substitution diagnostic when there has "
385  "been no expression substitution failure");
386  return Value.get<SubstitutionDiagnostic *>();
387  }
388 
389  Expr *getExpr() const {
390  assert(!isExprSubstitutionFailure() &&
391  "ExprRequirement has no expression because there has been a "
392  "substitution failure.");
393  return Value.get<Expr *>();
394  }
395 
396  static bool classof(const Requirement *R) {
397  return R->getKind() == RK_Compound || R->getKind() == RK_Simple;
398  }
399 };
400 
401 /// \brief A requires-expression requirement which is satisfied when a general
402 /// constraint expression is satisfied ('nested' requirements).
404  llvm::PointerUnion<Expr *, SubstitutionDiagnostic *> Value;
405  const ASTConstraintSatisfaction *Satisfaction = nullptr;
406 
407 public:
410 
412  Requirement(RK_Nested, /*Dependent=*/false,
413  /*ContainsUnexpandedParameterPack*/false,
414  /*Satisfied=*/false), Value(SubstDiag) {}
415 
416  NestedRequirement(Expr *Constraint) :
417  Requirement(RK_Nested, /*Dependent=*/true,
418  Constraint->containsUnexpandedParameterPack()),
419  Value(Constraint) {
420  assert(Constraint->isInstantiationDependent() &&
421  "Nested requirement with non-dependent constraint must be "
422  "constructed with a ConstraintSatisfaction object");
423  }
424 
426  const ConstraintSatisfaction &Satisfaction) :
427  Requirement(RK_Nested, Constraint->isInstantiationDependent(),
428  Constraint->containsUnexpandedParameterPack(),
429  Satisfaction.IsSatisfied),
430  Value(Constraint),
431  Satisfaction(ASTConstraintSatisfaction::Create(C, Satisfaction)) {}
432 
433  bool isSubstitutionFailure() const {
434  return Value.is<SubstitutionDiagnostic *>();
435  }
436 
438  assert(isSubstitutionFailure() &&
439  "getSubstitutionDiagnostic() may not be called when there was no "
440  "substitution failure.");
441  return Value.get<SubstitutionDiagnostic *>();
442  }
443 
445  assert(!isSubstitutionFailure() && "getConstraintExpr() may not be called "
446  "on nested requirements with "
447  "substitution failures.");
448  return Value.get<Expr *>();
449  }
450 
452  assert(!isSubstitutionFailure() && "getConstraintSatisfaction() may not be "
453  "called on nested requirements with "
454  "substitution failures.");
455  return *Satisfaction;
456  }
457 
458  static bool classof(const Requirement *R) {
459  return R->getKind() == RK_Nested;
460  }
461 };
462 
463 } // namespace concepts
464 
465 /// C++2a [expr.prim.req]:
466 /// A requires-expression provides a concise way to express requirements on
467 /// template arguments. A requirement is one that can be checked by name
468 /// lookup (6.4) or by checking properties of types and expressions.
469 /// [...]
470 /// A requires-expression is a prvalue of type bool [...]
471 class RequiresExpr final : public Expr,
472  llvm::TrailingObjects<RequiresExpr, ParmVarDecl *,
473  concepts::Requirement *> {
474  friend TrailingObjects;
475  friend class ASTStmtReader;
476 
477  unsigned NumLocalParameters;
478  unsigned NumRequirements;
479  RequiresExprBodyDecl *Body;
480  SourceLocation RBraceLoc;
481 
482  unsigned numTrailingObjects(OverloadToken<ParmVarDecl *>) const {
483  return NumLocalParameters;
484  }
485 
486  unsigned numTrailingObjects(OverloadToken<concepts::Requirement *>) const {
487  return NumRequirements;
488  }
489 
490  RequiresExpr(ASTContext &C, SourceLocation RequiresKWLoc,
491  RequiresExprBodyDecl *Body,
492  ArrayRef<ParmVarDecl *> LocalParameters,
494  SourceLocation RBraceLoc);
495  RequiresExpr(ASTContext &C, EmptyShell Empty, unsigned NumLocalParameters,
496  unsigned NumRequirements);
497 
498 public:
499  static RequiresExpr *
500  Create(ASTContext &C, SourceLocation RequiresKWLoc,
501  RequiresExprBodyDecl *Body, ArrayRef<ParmVarDecl *> LocalParameters,
503  SourceLocation RBraceLoc);
504  static RequiresExpr *
505  Create(ASTContext &C, EmptyShell Empty, unsigned NumLocalParameters,
506  unsigned NumRequirements);
507 
509  return {getTrailingObjects<ParmVarDecl *>(), NumLocalParameters};
510  }
511 
512  RequiresExprBodyDecl *getBody() const { return Body; }
513 
515  return {getTrailingObjects<concepts::Requirement *>(), NumRequirements};
516  }
517 
518  /// \brief Whether or not the requires clause is satisfied.
519  /// The expression must not be dependent.
520  bool isSatisfied() const {
521  assert(!isValueDependent()
522  && "isSatisfied called on a dependent RequiresExpr");
523  return RequiresExprBits.IsSatisfied;
524  }
525 
527  return RequiresExprBits.RequiresKWLoc;
528  }
529 
530  SourceLocation getRBraceLoc() const { return RBraceLoc; }
531 
532  static bool classof(const Stmt *T) {
533  return T->getStmtClass() == RequiresExprClass;
534  }
535 
536  SourceLocation getBeginLoc() const LLVM_READONLY {
537  return RequiresExprBits.RequiresKWLoc;
538  }
539  SourceLocation getEndLoc() const LLVM_READONLY {
540  return RBraceLoc;
541  }
542 
543  // Iterators
546  }
549  }
550 };
551 
552 } // namespace clang
553 
554 #endif // LLVM_CLANG_AST_EXPRCONCEPTS_H
ConceptSpecializationExpr(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten, ArrayRef< TemplateArgument > ConvertedArgs, const ConstraintSatisfaction *Satisfaction)
Defines the clang::ASTContext interface.
A requires-expression requirement which queries the validity and properties of an expression (&#39;simple...
Definition: ExprConcepts.h:254
ArrayRef< ParmVarDecl * > getLocalParameters() const
Definition: ExprConcepts.h:508
Stmt - This represents one statement.
Definition: Stmt.h:68
static bool classof(const Stmt *T)
Definition: ExprConcepts.h:532
C Language Family Type Representation.
Defines the C++ template declaration subclasses.
SourceLocation getBeginLoc() const
getBeginLoc - Retrieve the location of the first token.
llvm::iterator_range< child_iterator > child_range
Definition: Stmt.h:1212
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprConcepts.h:536
TypeRequirement(SubstitutionDiagnostic *Diagnostic)
Construct a type requirement when the nested name specifier is invalid due to a bad substitution...
Definition: ExprConcepts.h:221
A container of type source information.
Definition: Type.h:6373
void setSatisfied(bool IsSatisfied)
Definition: ExprConcepts.h:180
bool isSatisfied() const
Whether or not the concept with the given arguments was satisfied when the expression was created...
Definition: ExprConcepts.h:105
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
Definition: ExprConcepts.h:234
SubstitutionDiagnostic * getExprSubstitutionDiagnostic() const
Definition: ExprConcepts.h:382
ReturnTypeRequirement(SubstitutionDiagnostic *SubstDiag)
A return type requirement was specified but it was a substitution failure.
Definition: ExprConcepts.h:278
ASTConstraintSatisfaction * Satisfaction
Information about the satisfaction of the named concept with the given arguments. ...
Definition: ExprConcepts.h:56
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
Definition: TemplateBase.h:605
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:69
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
Definition: ExprConcepts.h:471
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:174
A C++ nested-name-specifier augmented with source location information.
SourceLocation getRequiresKWLoc() const
Definition: ExprConcepts.h:526
SatisfactionStatus getSatisfactionStatus() const
Definition: ExprConcepts.h:366
unsigned NumTemplateArgs
The number of template arguments in the tail-allocated list of converted template arguments...
Definition: ExprConcepts.h:51
void setSatisfactionStatus(SatisfactionStatus Status)
Definition: ExprConcepts.h:226
SourceLocation RAngleLoc
The source location of the right angle bracket (&#39;>&#39;).
Definition: TemplateBase.h:619
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
Definition: ExprConcepts.h:437
NestedRequirement(SubstitutionDiagnostic *SubstDiag)
Definition: ExprConcepts.h:411
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprConcepts.h:128
llvm::iterator_range< const_child_iterator > const_child_range
Definition: Stmt.h:1213
A requires-expression requirement which queries the existence of a type name or type template special...
Definition: ExprConcepts.h:199
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Definition: ASTConcept.h:29
ConstStmtIterator const_child_iterator
Definition: Stmt.h:1210
This represents one expression.
Definition: Expr.h:110
ConceptSpecializationExpr * getReturnTypeRequirementSubstitutedConstraintExpr() const
Definition: ExprConcepts.h:377
Represents the body of a requires-expression.
Definition: DeclCXX.h:1938
const_child_range children() const
Definition: ExprConcepts.h:136
Requirement(RequirementKind Kind, bool IsDependent, bool ContainsUnexpandedParameterPack, bool IsSatisfied=true)
Definition: ExprConcepts.h:166
SatisfactionStatus getSatisfactionStatus() const
Definition: ExprConcepts.h:225
TypeSourceInfo * getType() const
Definition: ExprConcepts.h:241
bool isSatisfied() const
Whether or not the requires clause is satisfied.
Definition: ExprConcepts.h:520
child_range children()
Definition: ExprConcepts.h:544
StmtIterator child_iterator
Child Iterators: All subclasses must implement &#39;children&#39; to permit easy iteration over the substatem...
Definition: Stmt.h:1209
TemplateParameterList * getTypeConstraintTemplateParameterList() const
Definition: ExprConcepts.h:321
NamedDecl * FoundDecl
The declaration found by name lookup when the expression was created.
Definition: ASTConcept.h:116
ArrayRef< concepts::Requirement * > getRequirements() const
Definition: ExprConcepts.h:514
SourceLocation TemplateKWLoc
The location of the template keyword, if specified when naming the concept.
Definition: ASTConcept.h:107
static bool classof(const Stmt *T)
Definition: ExprConcepts.h:120
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprConcepts.h:539
#define false
Definition: stdbool.h:17
Kind
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on...
Definition: Expr.h:215
Encodes a location in the source.
void setContainsUnexpandedParameterPack(bool Contains)
Definition: ExprConcepts.h:189
static bool classof(const Requirement *R)
Definition: ExprConcepts.h:247
Common data class for constructs that reference concepts with template arguments. ...
Definition: ASTConcept.h:100
std::pair< SourceLocation, std::string > SubstitutionDiagnostic
Definition: ExprConcepts.h:46
SourceLocation getNoexceptLoc() const
Definition: ExprConcepts.h:364
const_child_range children() const
Definition: ExprConcepts.h:547
bool isValueDependent() const
Determines whether the value of this expression depends on.
Definition: Expr.h:169
NestedRequirement(ASTContext &C, Expr *Constraint, const ConstraintSatisfaction &Satisfaction)
Definition: ExprConcepts.h:425
SourceLocation getRBraceLoc() const
Definition: ExprConcepts.h:530
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
Definition: ExprConcepts.h:314
DeclarationNameInfo ConceptName
The concept name used.
Definition: ASTConcept.h:110
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprConcepts.h:124
A static requirement that can be used in a requires-expression to check properties of types and expre...
Definition: ExprConcepts.h:145
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...
Definition: Stmt.h:1096
Dataflow Directional Tag Classes.
bool isValid() const
Return true if this is a valid SourceLocation object.
const ASTConstraintSatisfaction & getSatisfaction() const
Get elaborated satisfaction info about the template arguments&#39; satisfaction of the named concept...
Definition: ExprConcepts.h:114
RequiresExprBodyDecl * getBody() const
Definition: ExprConcepts.h:512
const ASTConstraintSatisfaction & getConstraintSatisfaction() const
Definition: ExprConcepts.h:451
static bool classof(const Requirement *R)
Definition: ExprConcepts.h:396
StmtClass getStmtClass() const
Definition: Stmt.h:1148
ReturnTypeRequirement()
No return type requirement was specified.
Definition: ExprConcepts.h:274
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
void setDependent(bool IsDependent)
Definition: ExprConcepts.h:186
RequiresExprBitfields RequiresExprBits
Definition: Stmt.h:1062
static bool classof(const Requirement *R)
Definition: ExprConcepts.h:458
friend TrailingObjects
bool containsUnexpandedParameterPack() const
Definition: ExprConcepts.h:192
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Definition: ASTConcept.h:77
ConceptDecl * NamedConcept
The concept named.
Definition: ASTConcept.h:119
void setTemplateArguments(ArrayRef< TemplateArgument > Converted)
Set new template arguments for this concept specialization.
Defines the clang::SourceLocation class and associated facilities.
ArrayRef< TemplateArgument > getTemplateArguments() const
Definition: ExprConcepts.h:94
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
Definition: ExprConcepts.h:403
RequirementKind getKind() const
Definition: ExprConcepts.h:172
Represents the specialization of a concept - evaluates to a prvalue of type bool. ...
Definition: ExprConcepts.h:40
bool containsUnexpandedParameterPack() const
Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates)...
Definition: Expr.h:233
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine) ...
Definition: Diagnostic.h:1354
static Decl::Kind getKind(const Decl *D)
Definition: DeclBase.cpp:996
const ASTTemplateArgumentListInfo * ArgsAsWritten
The template argument list source info used to specialize the concept.
Definition: ASTConcept.h:123
#define true
Definition: stdbool.h:16
This represents a decl that may have a name.
Definition: Decl.h:223
This file provides AST data structures related to concepts.
const ReturnTypeRequirement & getReturnTypeRequirement() const
Definition: ExprConcepts.h:372