clang: include/clang/AST/ASTConcept.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_CLANG_AST_ASTCONCEPT_H
15#define LLVM_CLANG_AST_ASTCONCEPT_H
16
21#include "llvm/ADT/FoldingSet.h"
22#include "llvm/ADT/PointerUnion.h"
23#include "llvm/ADT/SmallVector.h"
24#include
25
27
28class ConceptDecl;
29class Expr;
30class NamedDecl;
31struct PrintingPolicy;
32
33
34
36
37
38 const NamedDecl *ConstraintOwner = nullptr;
40
41public:
42
44
47 : ConstraintOwner(ConstraintOwner), TemplateArgs(TemplateArgs) {}
48
50 using Detail = llvm::PointerUnion<Expr *, SubstitutionDiagnostic *>;
51
54
55
56
57
59
61 Profile(ID, C, ConstraintOwner, TemplateArgs);
62 }
63
67
71 return true;
72 return false;
73 }
74};
75
76
77
78
79
81 llvm::PointerUnion<Expr *, std::pair<SourceLocation, StringRef> *>;
82
83
84
85
86
88 llvm::TrailingObjects<ASTConstraintSatisfaction,
89 UnsatisfiedConstraintRecord> {
93
95 return getTrailingObjects();
96 }
97
99 return getTrailingObjects() + NumRecords;
100 }
101
106
111};
112
113
114
115
116
117
118
119
120
121
122
123
125
127
128
129
131
132
134
135
136
137
138
140
141
143
144
145
147
152 : NestedNameSpec(NNS), TemplateKWLoc(TemplateKWLoc),
153 ConceptName(ConceptNameInfo), FoundDecl(FoundDecl),
154 NamedConcept(NamedConcept), ArgsAsWritten(ArgsAsWritten) {}
155
156public:
162
164 return NestedNameSpec;
165 }
166
168
171 }
172
174
176
178
180 return QualifierLoc.getBeginLoc();
182 }
183
189 }
190
193 }
194
196 return FoundDecl;
197 }
198
200 return NamedConcept;
201 }
202
204 return ArgsAsWritten;
205 }
206
207
208
210 return ArgsAsWritten != nullptr;
211 }
212
214 void dump() const;
215 void dump(llvm::raw_ostream &) const;
216};
217
218
219
220
221
222
223
224
225
226
228
229
230 Expr *ImmediatelyDeclaredConstraint = nullptr;
232
233public:
235 Expr *ImmediatelyDeclaredConstraint)
236 : ImmediatelyDeclaredConstraint(ImmediatelyDeclaredConstraint),
237 ConceptRef(ConceptRef) {}
238
239
240
241
243 return ImmediatelyDeclaredConstraint;
244 }
245
247
248
249
251
254 }
255
258 }
259
262 }
263
266 }
267
269
272 }
273
276 }
277
279 ConceptRef->print(OS, Policy);
280 }
281};
282
283}
284
285#endif
Defines the clang::SourceLocation class and associated facilities.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Declaration of a C++20 concept.
A reference to a concept and its template args, as it appears in the code.
bool hasExplicitTemplateArgs() const
Whether or not template arguments were explicitly specified in the concept reference (they might not ...
const NestedNameSpecifierLoc & getNestedNameSpecifierLoc() const
NamedDecl * getFoundDecl() const
const DeclarationNameInfo & getConceptNameInfo() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation getConceptNameLoc() const
ConceptDecl * getNamedConcept() const
SourceLocation getLocation() const
SourceLocation getBeginLoc() const LLVM_READONLY
void print(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
SourceLocation getEndLoc() const LLVM_READONLY
void dump(llvm::raw_ostream &) const
SourceLocation getTemplateKWLoc() const
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
llvm::PointerUnion< Expr *, SubstitutionDiagnostic * > Detail
ConstraintSatisfaction(const NamedDecl *ConstraintOwner, ArrayRef< TemplateArgument > TemplateArgs)
std::pair< SourceLocation, StringRef > SubstitutionDiagnostic
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &C)
ConstraintSatisfaction()=default
llvm::SmallVector< Detail, 4 > Details
The substituted constraint expr, if the template arguments could be substituted into them,...
bool HasSubstitutionFailure()
This represents one expression.
This represents a decl that may have a name.
A C++ nested-name-specifier augmented with source location information.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
void print(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const
ConceptDecl * getNamedConcept() const
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
NamedDecl * getFoundDecl() const
const NestedNameSpecifierLoc & getNestedNameSpecifierLoc() const
const DeclarationNameInfo & getConceptNameInfo() const
bool hasExplicitTemplateArgs() const
SourceLocation getConceptNameLoc() const
SourceLocation getTemplateKWLoc() const
TypeConstraint(ConceptReference *ConceptRef, Expr *ImmediatelyDeclaredConstraint)
ConceptReference * getConceptReference() const
The JSON file list parser is used to communicate input to InstallAPI.
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
llvm::PointerUnion< Expr *, std::pair< SourceLocation, StringRef > * > UnsatisfiedConstraintRecord
Pairs of unsatisfied atomic constraint expressions along with the substituted constraint expr,...
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
const UnsatisfiedConstraintRecord * end() const
static ASTConstraintSatisfaction * Rebuild(const ASTContext &C, const ASTConstraintSatisfaction &Satisfaction)
const UnsatisfiedConstraintRecord * begin() const
Represents an explicit template argument list in C++, e.g., the "" in "sort".
SourceLocation getRAngleLoc() const
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
SourceLocation getBeginLoc() const
getBeginLoc - Retrieve the location of the first token.
SourceLocation getEndLoc() const LLVM_READONLY
Describes how types, statements, expressions, and declarations should be printed.