clang  10.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  bool Dependent : 1;
153  bool ContainsUnexpandedParameterPack : 1;
154  bool Satisfied : 1;
155 public:
157  StringRef SubstitutedEntity;
158  // FIXME: Store diagnostics semantically and not as prerendered strings.
159  // Fixing this probably requires serialization of PartialDiagnostic
160  // objects.
162  StringRef DiagMessage;
163  };
164 
165  Requirement(RequirementKind Kind, bool IsDependent,
166  bool ContainsUnexpandedParameterPack, bool IsSatisfied = true) :
167  Kind(Kind), Dependent(IsDependent),
168  ContainsUnexpandedParameterPack(ContainsUnexpandedParameterPack),
169  Satisfied(IsSatisfied) {}
170 
171  RequirementKind getKind() const { return Kind; }
172 
173  bool isSatisfied() const {
174  assert(!Dependent &&
175  "isSatisfied can only be called on non-dependent requirements.");
176  return Satisfied;
177  }
178 
179  void setSatisfied(bool IsSatisfied) {
180  assert(!Dependent &&
181  "setSatisfied can only be called on non-dependent requirements.");
182  Satisfied = IsSatisfied;
183  }
184 
185  void setDependent(bool IsDependent) { Dependent = IsDependent; }
186  bool isDependent() const { return Dependent; }
187 
189  ContainsUnexpandedParameterPack = Contains;
190  }
192  return ContainsUnexpandedParameterPack;
193  }
194 };
195 
196 /// \brief A requires-expression requirement which queries the existence of a
197 /// type name or type template specialization ('type' requirements).
198 class TypeRequirement : public Requirement {
199 public:
203  SS_Satisfied
204  };
205 private:
206  llvm::PointerUnion<SubstitutionDiagnostic *, TypeSourceInfo *> Value;
207  SatisfactionStatus Status;
208 public:
211 
212  /// \brief Construct a type requirement from a type. If the given type is not
213  /// dependent, this indicates that the type exists and the requirement will be
214  /// satisfied. Otherwise, the SubstitutionDiagnostic constructor is to be
215  /// used.
217 
218  /// \brief Construct a type requirement when the nested name specifier is
219  /// invalid due to a bad substitution. The requirement is unsatisfied.
221  Requirement(RK_Type, false, false, false), Value(Diagnostic),
222  Status(SS_SubstitutionFailure) {}
223 
224  SatisfactionStatus getSatisfactionStatus() const { return Status; }
226  this->Status = Status;
227  }
228 
229  bool isSubstitutionFailure() const {
230  return Status == SS_SubstitutionFailure;
231  }
232 
234  assert(Status == SS_SubstitutionFailure &&
235  "Attempted to get substitution diagnostic when there has been no "
236  "substitution failure.");
237  return Value.get<SubstitutionDiagnostic *>();
238  }
239 
241  assert(!isSubstitutionFailure() &&
242  "Attempted to get type when there has been a substitution failure.");
243  return Value.get<TypeSourceInfo *>();
244  }
245 
246  static bool classof(const Requirement *R) {
247  return R->getKind() == RK_Type;
248  }
249 };
250 
251 /// \brief A requires-expression requirement which queries the validity and
252 /// properties of an expression ('simple' and 'compound' requirements).
253 class ExprRequirement : public Requirement {
254 public:
261  SS_Satisfied
262  };
264  llvm::PointerIntPair<
265  llvm::PointerUnion<TemplateParameterList *, SubstitutionDiagnostic *>,
266  1, bool>
267  TypeConstraintInfo;
268  public:
271 
272  /// \brief No return type requirement was specified.
273  ReturnTypeRequirement() : TypeConstraintInfo(nullptr, 0) {}
274 
275  /// \brief A return type requirement was specified but it was a
276  /// substitution failure.
278  TypeConstraintInfo(SubstDiag, 0) {}
279 
280  /// \brief A 'type constraint' style return type requirement.
281  /// \param TPL an invented template parameter list containing a single
282  /// type parameter with a type-constraint.
283  // TODO: Can we maybe not save the whole template parameter list and just
284  // the type constraint? Saving the whole TPL makes it easier to handle in
285  // serialization but is less elegant.
287 
288  bool isDependent() const {
289  return TypeConstraintInfo.getInt();
290  }
291 
293  if (!isTypeConstraint())
294  return false;
295  return getTypeConstraintTemplateParameterList()
296  ->containsUnexpandedParameterPack();
297  }
298 
299  bool isEmpty() const {
300  return TypeConstraintInfo.getPointer().isNull();
301  }
302 
303  bool isSubstitutionFailure() const {
304  return !isEmpty() &&
305  TypeConstraintInfo.getPointer().is<SubstitutionDiagnostic *>();
306  }
307 
308  bool isTypeConstraint() const {
309  return !isEmpty() &&
310  TypeConstraintInfo.getPointer().is<TemplateParameterList *>();
311  }
312 
314  assert(isSubstitutionFailure());
315  return TypeConstraintInfo.getPointer().get<SubstitutionDiagnostic *>();
316  }
317 
318  const TypeConstraint *getTypeConstraint() const;
319 
321  assert(isTypeConstraint());
322  return TypeConstraintInfo.getPointer().get<TemplateParameterList *>();
323  }
324  };
325 private:
326  llvm::PointerUnion<Expr *, SubstitutionDiagnostic *> Value;
327  SourceLocation NoexceptLoc; // May be empty if noexcept wasn't specified.
328  ReturnTypeRequirement TypeReq;
329  ConceptSpecializationExpr *SubstitutedConstraintExpr;
330  SatisfactionStatus Status;
331 public:
334 
335  /// \brief Construct a compound requirement.
336  /// \param E the expression which is checked by this requirement.
337  /// \param IsSimple whether this was a simple requirement in source.
338  /// \param NoexceptLoc the location of the noexcept keyword, if it was
339  /// specified, otherwise an empty location.
340  /// \param Req the requirement for the type of the checked expression.
341  /// \param Status the satisfaction status of this requirement.
343  Expr *E, bool IsSimple, SourceLocation NoexceptLoc,
345  ConceptSpecializationExpr *SubstitutedConstraintExpr = nullptr);
346 
347  /// \brief Construct a compound requirement whose expression was a
348  /// substitution failure. The requirement is not satisfied.
349  /// \param E the diagnostic emitted while instantiating the original
350  /// expression.
351  /// \param IsSimple whether this was a simple requirement in source.
352  /// \param NoexceptLoc the location of the noexcept keyword, if it was
353  /// specified, otherwise an empty location.
354  /// \param Req the requirement for the type of the checked expression (omit
355  /// if no requirement was specified).
356  ExprRequirement(SubstitutionDiagnostic *E, bool IsSimple,
357  SourceLocation NoexceptLoc, ReturnTypeRequirement Req = {});
358 
359  bool isSimple() const { return getKind() == RK_Simple; }
360  bool isCompound() const { return getKind() == RK_Compound; }
361 
362  bool hasNoexceptRequirement() const { return NoexceptLoc.isValid(); }
363  SourceLocation getNoexceptLoc() const { return NoexceptLoc; }
364 
365  SatisfactionStatus getSatisfactionStatus() const { return Status; }
366 
368  return Status == SS_ExprSubstitutionFailure;
369  }
370 
372  return TypeReq;
373  }
374 
377  assert(Status >= SS_TypeRequirementSubstitutionFailure);
378  return SubstitutedConstraintExpr;
379  }
380 
382  assert(isExprSubstitutionFailure() &&
383  "Attempted to get expression substitution diagnostic when there has "
384  "been no expression substitution failure");
385  return Value.get<SubstitutionDiagnostic *>();
386  }
387 
388  Expr *getExpr() const {
389  assert(!isExprSubstitutionFailure() &&
390  "ExprRequirement has no expression because there has been a "
391  "substitution failure.");
392  return Value.get<Expr *>();
393  }
394 
395  static bool classof(const Requirement *R) {
396  return R->getKind() == RK_Compound || R->getKind() == RK_Simple;
397  }
398 };
399 
400 /// \brief A requires-expression requirement which is satisfied when a general
401 /// constraint expression is satisfied ('nested' requirements).
403  llvm::PointerUnion<Expr *, SubstitutionDiagnostic *> Value;
404  const ASTConstraintSatisfaction *Satisfaction = nullptr;
405 
406 public:
409 
411  Requirement(RK_Nested, /*Dependent=*/false,
412  /*ContainsUnexpandedParameterPack*/false,
413  /*Satisfied=*/false), Value(SubstDiag) {}
414 
415  NestedRequirement(Expr *Constraint) :
416  Requirement(RK_Nested, /*Dependent=*/true,
417  Constraint->containsUnexpandedParameterPack()),
418  Value(Constraint) {
419  assert(Constraint->isInstantiationDependent() &&
420  "Nested requirement with non-dependent constraint must be "
421  "constructed with a ConstraintSatisfaction object");
422  }
423 
425  const ConstraintSatisfaction &Satisfaction) :
426  Requirement(RK_Nested, Constraint->isInstantiationDependent(),
427  Constraint->containsUnexpandedParameterPack(),
428  Satisfaction.IsSatisfied),
429  Value(Constraint),
430  Satisfaction(ASTConstraintSatisfaction::Create(C, Satisfaction)) {}
431 
432  bool isSubstitutionFailure() const {
433  return Value.is<SubstitutionDiagnostic *>();
434  }
435 
437  assert(isSubstitutionFailure() &&
438  "getSubstitutionDiagnostic() may not be called when there was no "
439  "substitution failure.");
440  return Value.get<SubstitutionDiagnostic *>();
441  }
442 
444  assert(!isSubstitutionFailure() && "getConstraintExpr() may not be called "
445  "on nested requirements with "
446  "substitution failures.");
447  return Value.get<Expr *>();
448  }
449 
451  assert(!isSubstitutionFailure() && "getConstraintSatisfaction() may not be "
452  "called on nested requirements with "
453  "substitution failures.");
454  return *Satisfaction;
455  }
456 
457  static bool classof(const Requirement *R) {
458  return R->getKind() == RK_Nested;
459  }
460 };
461 
462 } // namespace concepts
463 
464 /// C++2a [expr.prim.req]:
465 /// A requires-expression provides a concise way to express requirements on
466 /// template arguments. A requirement is one that can be checked by name
467 /// lookup (6.4) or by checking properties of types and expressions.
468 /// [...]
469 /// A requires-expression is a prvalue of type bool [...]
470 class RequiresExpr final : public Expr,
471  llvm::TrailingObjects<RequiresExpr, ParmVarDecl *,
472  concepts::Requirement *> {
473  friend TrailingObjects;
474  friend class ASTStmtReader;
475 
476  unsigned NumLocalParameters;
477  unsigned NumRequirements;
478  RequiresExprBodyDecl *Body;
479  SourceLocation RBraceLoc;
480 
481  unsigned numTrailingObjects(OverloadToken<ParmVarDecl *>) const {
482  return NumLocalParameters;
483  }
484 
485  unsigned numTrailingObjects(OverloadToken<concepts::Requirement *>) const {
486  return NumRequirements;
487  }
488 
489  RequiresExpr(ASTContext &C, SourceLocation RequiresKWLoc,
490  RequiresExprBodyDecl *Body,
491  ArrayRef<ParmVarDecl *> LocalParameters,
493  SourceLocation RBraceLoc);
494  RequiresExpr(ASTContext &C, EmptyShell Empty, unsigned NumLocalParameters,
495  unsigned NumRequirements);
496 
497 public:
498  static RequiresExpr *
499  Create(ASTContext &C, SourceLocation RequiresKWLoc,
500  RequiresExprBodyDecl *Body, ArrayRef<ParmVarDecl *> LocalParameters,
502  SourceLocation RBraceLoc);
503  static RequiresExpr *
504  Create(ASTContext &C, EmptyShell Empty, unsigned NumLocalParameters,
505  unsigned NumRequirements);
506 
508  return {getTrailingObjects<ParmVarDecl *>(), NumLocalParameters};
509  }
510 
511  RequiresExprBodyDecl *getBody() const { return Body; }
512 
514  return {getTrailingObjects<concepts::Requirement *>(), NumRequirements};
515  }
516 
517  /// \brief Whether or not the requires clause is satisfied.
518  /// The expression must not be dependent.
519  bool isSatisfied() const {
520  assert(!isValueDependent()
521  && "isSatisfied called on a dependent RequiresExpr");
522  return RequiresExprBits.IsSatisfied;
523  }
524 
526  return RequiresExprBits.RequiresKWLoc;
527  }
528 
529  SourceLocation getRBraceLoc() const { return RBraceLoc; }
530 
531  static bool classof(const Stmt *T) {
532  return T->getStmtClass() == RequiresExprClass;
533  }
534 
535  SourceLocation getBeginLoc() const LLVM_READONLY {
536  return RequiresExprBits.RequiresKWLoc;
537  }
538  SourceLocation getEndLoc() const LLVM_READONLY {
539  return RBraceLoc;
540  }
541 
542  // Iterators
545  }
548  }
549 };
550 
551 } // namespace clang
552 
553 #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:253
ArrayRef< ParmVarDecl * > getLocalParameters() const
Definition: ExprConcepts.h:507
Stmt - This represents one statement.
Definition: Stmt.h:66
static bool classof(const Stmt *T)
Definition: ExprConcepts.h:531
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:1180
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprConcepts.h:535
TypeRequirement(SubstitutionDiagnostic *Diagnostic)
Construct a type requirement when the nested name specifier is invalid due to a bad substitution...
Definition: ExprConcepts.h:220
A container of type source information.
Definition: Type.h:6227
void setSatisfied(bool IsSatisfied)
Definition: ExprConcepts.h:179
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:233
SubstitutionDiagnostic * getExprSubstitutionDiagnostic() const
Definition: ExprConcepts.h:381
ReturnTypeRequirement(SubstitutionDiagnostic *SubstDiag)
A return type requirement was specified but it was a substitution failure.
Definition: ExprConcepts.h:277
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:603
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:470
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:168
A C++ nested-name-specifier augmented with source location information.
SourceLocation getRequiresKWLoc() const
Definition: ExprConcepts.h:525
SatisfactionStatus getSatisfactionStatus() const
Definition: ExprConcepts.h:365
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:225
SourceLocation RAngleLoc
The source location of the right angle bracket (&#39;>&#39;).
Definition: TemplateBase.h:617
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
Definition: ExprConcepts.h:436
NestedRequirement(SubstitutionDiagnostic *SubstDiag)
Definition: ExprConcepts.h:410
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprConcepts.h:128
llvm::iterator_range< const_child_iterator > const_child_range
Definition: Stmt.h:1181
A requires-expression requirement which queries the existence of a type name or type template special...
Definition: ExprConcepts.h:198
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:1178
This represents one expression.
Definition: Expr.h:108
ConceptSpecializationExpr * getReturnTypeRequirementSubstitutedConstraintExpr() const
Definition: ExprConcepts.h:376
Represents the body of a requires-expression.
Definition: DeclCXX.h:1909
const_child_range children() const
Definition: ExprConcepts.h:136
Requirement(RequirementKind Kind, bool IsDependent, bool ContainsUnexpandedParameterPack, bool IsSatisfied=true)
Definition: ExprConcepts.h:165
SatisfactionStatus getSatisfactionStatus() const
Definition: ExprConcepts.h:224
TypeSourceInfo * getType() const
Definition: ExprConcepts.h:240
bool isSatisfied() const
Whether or not the requires clause is satisfied.
Definition: ExprConcepts.h:519
child_range children()
Definition: ExprConcepts.h:543
StmtIterator child_iterator
Child Iterators: All subclasses must implement &#39;children&#39; to permit easy iteration over the substatem...
Definition: Stmt.h:1177
TemplateParameterList * getTypeConstraintTemplateParameterList() const
Definition: ExprConcepts.h:320
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:513
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:538
#define false
Definition: stdbool.h:17
Kind
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
Definition: Expr.h:200
Encodes a location in the source.
void setContainsUnexpandedParameterPack(bool Contains)
Definition: ExprConcepts.h:188
static bool classof(const Requirement *R)
Definition: ExprConcepts.h:246
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:363
const_child_range children() const
Definition: ExprConcepts.h:546
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
Definition: Expr.h:158
NestedRequirement(ASTContext &C, Expr *Constraint, const ConstraintSatisfaction &Satisfaction)
Definition: ExprConcepts.h:424
SourceLocation getRBraceLoc() const
Definition: ExprConcepts.h:529
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
Definition: ExprConcepts.h:313
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:1056
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:511
const ASTConstraintSatisfaction & getConstraintSatisfaction() const
Definition: ExprConcepts.h:450
static bool classof(const Requirement *R)
Definition: ExprConcepts.h:395
StmtClass getStmtClass() const
Definition: Stmt.h:1109
ReturnTypeRequirement()
No return type requirement was specified.
Definition: ExprConcepts.h:273
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
void setDependent(bool IsDependent)
Definition: ExprConcepts.h:185
RequiresExprBitfields RequiresExprBits
Definition: Stmt.h:1022
static bool classof(const Requirement *R)
Definition: ExprConcepts.h:457
friend TrailingObjects
Definition: OpenMPClause.h:98
bool containsUnexpandedParameterPack() const
Definition: ExprConcepts.h:191
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:402
RequirementKind getKind() const
Definition: ExprConcepts.h:171
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:223
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine) ...
Definition: Diagnostic.h:1327
static Decl::Kind getKind(const Decl *D)
Definition: DeclBase.cpp:947
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:371