clang: include/clang/AST/ExprOpenMP.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef LLVM_CLANG_AST_EXPROPENMP_H
14#define LLVM_CLANG_AST_EXPROPENMP_H
15
18
20
21
23 : public Expr,
24 private llvm::TrailingObjects<OMPArrayShapingExpr, Expr *, SourceRange> {
25 friend TrailingObjects;
28
29 SourceLocation LPLoc;
30 SourceLocation RPLoc;
31 unsigned NumDims = 0;
32
33
36
37
39 : Expr(OMPArrayShapingExprClass, Shell), NumDims(NumDims) {}
40
41
43
44
45 void setBase(Expr *Op) { getTrailingObjects<Expr *>()[NumDims] = Op; }
46
47
48 void setBracketsRanges(ArrayRef BR);
49
50 unsigned numTrailingObjects(OverloadToken<Expr *>) const {
51
52 return NumDims + 1;
53 }
54
55 unsigned numTrailingObjects(OverloadToken) const {
56 return NumDims;
57 }
58
59public:
60 static OMPArrayShapingExpr *Create(const ASTContext &Context, QualType T,
61 Expr *Op, SourceLocation L,
62 SourceLocation R, ArrayRef<Expr *> Dims,
63 ArrayRef BracketRanges);
64
65 static OMPArrayShapingExpr *CreateEmpty(const ASTContext &Context,
66 unsigned NumDims);
67
70
73
77 }
78
79
81 return llvm::ArrayRef(getTrailingObjects<Expr *>(), NumDims);
82 }
83
84
86 return llvm::ArrayRef(getTrailingObjects(), NumDims);
87 }
88
89
90 Expr *getBase() { return getTrailingObjects<Expr *>()[NumDims]; }
91 const Expr *getBase() const { return getTrailingObjects<Expr *>()[NumDims]; }
92
94 return T->getStmtClass() == OMPArrayShapingExprClass;
95 }
96
97
99 Stmt **Begin = reinterpret_cast<Stmt **>(getTrailingObjects<Expr *>());
101 }
104 reinterpret_cast<Stmt *const *>(getTrailingObjects<Expr *>());
106 }
107};
108
109
110
112
114
115
117
118
120
122};
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
149 : public Expr,
150 private llvm::TrailingObjects<OMPIteratorExpr, Decl *, Expr *,
151 SourceLocation, OMPIteratorHelperData> {
152public:
153
158 };
159
165 };
166
167private:
168 friend TrailingObjects;
171
172
173 enum class RangeExprOffset {
175 End = 1,
176 Step = 2,
177 Total = 3,
178 };
179
180
181 enum class RangeLocOffset {
182 AssignLoc = 0,
183 FirstColonLoc = 1,
184 SecondColonLoc = 2,
185 Total = 3,
186 };
187
188 SourceLocation IteratorKwLoc;
189
190 SourceLocation LPLoc;
191
192 SourceLocation RPLoc;
193
194 unsigned NumIterators = 0;
195
196 OMPIteratorExpr(QualType ExprTy, SourceLocation IteratorKwLoc,
197 SourceLocation L, SourceLocation R,
198 ArrayRef Data,
199 ArrayRef Helpers);
200
201
202 explicit OMPIteratorExpr(EmptyShell Shell, unsigned NumIterators)
203 : Expr(OMPIteratorExprClass, Shell), NumIterators(NumIterators) {}
204
205
206 void setIteratorDeclaration(unsigned I, Decl *D);
207
208
209
210 void setAssignmentLoc(unsigned I, SourceLocation Loc);
211
212
213
214 void setIteratorRange(unsigned I, Expr *Begin, SourceLocation ColonLoc,
215 Expr *End, SourceLocation SecondColonLoc, Expr *Step);
216
217
218 void setHelper(unsigned I, const OMPIteratorHelperData &D);
219
220 unsigned numTrailingObjects(OverloadToken<Decl *>) const {
221 return NumIterators;
222 }
223
224 unsigned numTrailingObjects(OverloadToken<Expr *>) const {
225 return NumIterators * static_cast<int>(RangeExprOffset::Total);
226 }
227
228 unsigned numTrailingObjects(OverloadToken) const {
229 return NumIterators * static_cast<int>(RangeLocOffset::Total);
230 }
231
232public:
233 static OMPIteratorExpr *Create(const ASTContext &Context, QualType T,
234 SourceLocation IteratorKwLoc, SourceLocation L,
235 SourceLocation R,
236 ArrayRef Data,
237 ArrayRef Helpers);
238
239 static OMPIteratorExpr *CreateEmpty(const ASTContext &Context,
240 unsigned NumIterators);
241
244
247
252
253
257 }
258
259
263 }
264
265
267
268
270
271
273
274
276
277
280
282 return T->getStmtClass() == OMPIteratorExprClass;
283 }
284
285
287 Stmt **Begin = reinterpret_cast<Stmt **>(getTrailingObjects<Expr *>());
289 Begin, Begin + NumIterators * static_cast<int>(RangeExprOffset::Total));
290 }
293 reinterpret_cast<Stmt *const *>(getTrailingObjects<Expr *>());
295 Begin, Begin + NumIterators * static_cast<int>(RangeExprOffset::Total));
296 }
297};
298
299}
300
301#endif
Decl - This represents one declaration (or definition), e.g.
This represents one expression.
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
const_child_range children() const
Expr * getBase()
Fetches base expression of array shaping expression.
void setLParenLoc(SourceLocation L)
SourceLocation getEndLoc() const LLVM_READONLY
static OMPArrayShapingExpr * CreateEmpty(const ASTContext &Context, unsigned NumDims)
SourceLocation getLParenLoc() const
ArrayRef< Expr * > getDimensions() const
Fetches the dimensions for array shaping expression.
SourceLocation getRParenLoc() const
SourceLocation getBeginLoc() const LLVM_READONLY
void setRParenLoc(SourceLocation L)
static bool classof(const Stmt *T)
ArrayRef< SourceRange > getBracketsRanges() const
Fetches source ranges for the brackets os the array shaping expression.
const Expr * getBase() const
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
void setLParenLoc(SourceLocation L)
SourceLocation getLParenLoc() const
static OMPIteratorExpr * CreateEmpty(const ASTContext &Context, unsigned NumIterators)
SourceLocation getSecondColonLoc(unsigned I) const
Gets the location of the second ':' (if any) in the range for the given iteratori definition.
void setRParenLoc(SourceLocation L)
SourceLocation getColonLoc(unsigned I) const
Gets the location of the first ':' in the range for the given iterator definition.
SourceLocation getRParenLoc() const
const IteratorRange getIteratorRange(unsigned I) const
SourceLocation getBeginLoc() const LLVM_READONLY
IteratorRange getIteratorRange(unsigned I)
Gets the iterator range for the given iterator.
const Decl * getIteratorDecl(unsigned I) const
OMPIteratorHelperData & getHelper(unsigned I)
Fetches helper data for the specified iteration space.
const_child_range children() const
void setIteratorKwLoc(SourceLocation L)
SourceLocation getAssignLoc(unsigned I) const
Gets the location of '=' for the given iterator definition.
SourceLocation getIteratorKwLoc() const
unsigned numOfIterators() const
Returns number of iterator definitions.
Decl * getIteratorDecl(unsigned I)
Gets the iterator declaration for the given iterator.
SourceLocation getEndLoc() const LLVM_READONLY
static bool classof(const Stmt *T)
A (possibly-)qualified type.
Encodes a location in the source.
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
llvm::iterator_range< child_iterator > child_range
llvm::iterator_range< const_child_iterator > const_child_range
Represents a variable declaration or definition.
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',...
const FunctionProtoType * T
Iterator definition representation.
SourceLocation AssignmentLoc
SourceLocation SecondColonLoc
Iterator range representation begin:end[:step].
Helper expressions and declaration for OMPIteratorExpr class for each iteration space.
Expr * CounterUpdate
Updater for the internal counter: ++CounterVD;.
Expr * Upper
Normalized upper bound.
Expr * Update
Update expression for the originally specified iteration variable, calculated as VD = Begin + Counter...
VarDecl * CounterVD
Internal normalized counter.
A placeholder type used to construct an empty shell of a type, that will be filled in later (e....