@@ -36,7 +36,7 @@ class OpenACCClause {
36
36
SourceLocation getBeginLoc () const { return Location.getBegin (); }
37
37
SourceLocation getEndLoc () const { return Location.getEnd (); }
38
38
39
- static bool classof (const OpenACCClause *) { return true ; }
39
+ static bool classof (const OpenACCClause *) { return false ; }
40
40
41
41
using child_iterator = StmtIterator;
42
42
using const_child_iterator = ConstStmtIterator;
@@ -63,6 +63,8 @@ class OpenACCClauseWithParams : public OpenACCClause {
63
63
: OpenACCClause(K, BeginLoc, EndLoc), LParenLoc(LParenLoc) {}
64
64
65
65
public:
66
+ static bool classof (const OpenACCClause *C);
67
+
66
68
SourceLocation getLParenLoc () const { return LParenLoc; }
67
69
68
70
child_range children () {
@@ -92,6 +94,9 @@ class OpenACCDefaultClause : public OpenACCClauseWithParams {
92
94
}
93
95
94
96
public:
97
+ static bool classof (const OpenACCClause *C) {
98
+ return C->getClauseKind () == OpenACCClauseKind::Default;
99
+ }
95
100
OpenACCDefaultClauseKind getDefaultClauseKind () const {
96
101
return DefaultClauseKind;
97
102
}
@@ -116,6 +121,8 @@ class OpenACCClauseWithCondition : public OpenACCClauseWithParams {
116
121
ConditionExpr (ConditionExpr) {}
117
122
118
123
public:
124
+ static bool classof (const OpenACCClause *C);
125
+
119
126
bool hasConditionExpr () const { return ConditionExpr; }
120
127
const Expr *getConditionExpr () const { return ConditionExpr; }
121
128
Expr *getConditionExpr () { return ConditionExpr; }
@@ -143,6 +150,9 @@ class OpenACCIfClause : public OpenACCClauseWithCondition {
143
150
Expr *ConditionExpr, SourceLocation EndLoc);
144
151
145
152
public:
153
+ static bool classof (const OpenACCClause *C) {
154
+ return C->getClauseKind () == OpenACCClauseKind::If;
155
+ }
146
156
static OpenACCIfClause *Create (const ASTContext &C, SourceLocation BeginLoc,
147
157
SourceLocation LParenLoc, Expr *ConditionExpr,
148
158
SourceLocation EndLoc);
@@ -154,6 +164,9 @@ class OpenACCSelfClause : public OpenACCClauseWithCondition {
154
164
Expr *ConditionExpr, SourceLocation EndLoc);
155
165
156
166
public:
167
+ static bool classof (const OpenACCClause *C) {
168
+ return C->getClauseKind () == OpenACCClauseKind::Self;
169
+ }
157
170
static OpenACCSelfClause *Create (const ASTContext &C, SourceLocation BeginLoc,
158
171
SourceLocation LParenLoc,
159
172
Expr *ConditionExpr, SourceLocation EndLoc);
@@ -180,6 +193,7 @@ class OpenACCClauseWithExprs : public OpenACCClauseWithParams {
180
193
llvm::ArrayRef<Expr *> getExprs () const { return Exprs; }
181
194
182
195
public:
196
+ static bool classof (const OpenACCClause *C);
183
197
child_range children () {
184
198
return child_range (reinterpret_cast <Stmt **>(Exprs.begin ()),
185
199
reinterpret_cast <Stmt **>(Exprs.end ()));
@@ -214,6 +228,9 @@ class OpenACCWaitClause final
214
228
}
215
229
216
230
public:
231
+ static bool classof (const OpenACCClause *C) {
232
+ return C->getClauseKind () == OpenACCClauseKind::Wait;
233
+ }
217
234
static OpenACCWaitClause *Create (const ASTContext &C, SourceLocation BeginLoc,
218
235
SourceLocation LParenLoc, Expr *DevNumExpr,
219
236
SourceLocation QueuesLoc,
@@ -246,6 +263,9 @@ class OpenACCNumGangsClause final
246
263
}
247
264
248
265
public:
266
+ static bool classof (const OpenACCClause *C) {
267
+ return C->getClauseKind () == OpenACCClauseKind::NumGangs;
268
+ }
249
269
static OpenACCNumGangsClause *
250
270
Create (const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
251
271
ArrayRef<Expr *> IntExprs, SourceLocation EndLoc);
@@ -275,6 +295,7 @@ class OpenACCClauseWithSingleIntExpr : public OpenACCClauseWithExprs {
275
295
}
276
296
277
297
public:
298
+ static bool classof (const OpenACCClause *C);
278
299
bool hasIntExpr () const { return !getExprs ().empty (); }
279
300
const Expr *getIntExpr () const {
280
301
return hasIntExpr () ? getExprs ()[0 ] : nullptr ;
@@ -288,6 +309,9 @@ class OpenACCNumWorkersClause : public OpenACCClauseWithSingleIntExpr {
288
309
Expr *IntExpr, SourceLocation EndLoc);
289
310
290
311
public:
312
+ static bool classof (const OpenACCClause *C) {
313
+ return C->getClauseKind () == OpenACCClauseKind::NumWorkers;
314
+ }
291
315
static OpenACCNumWorkersClause *Create (const ASTContext &C,
292
316
SourceLocation BeginLoc,
293
317
SourceLocation LParenLoc,
@@ -299,6 +323,9 @@ class OpenACCVectorLengthClause : public OpenACCClauseWithSingleIntExpr {
299
323
Expr *IntExpr, SourceLocation EndLoc);
300
324
301
325
public:
326
+ static bool classof (const OpenACCClause *C) {
327
+ return C->getClauseKind () == OpenACCClauseKind::VectorLength;
328
+ }
302
329
static OpenACCVectorLengthClause *
303
330
Create (const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
304
331
Expr *IntExpr, SourceLocation EndLoc);
@@ -309,6 +336,9 @@ class OpenACCAsyncClause : public OpenACCClauseWithSingleIntExpr {
309
336
Expr *IntExpr, SourceLocation EndLoc);
310
337
311
338
public:
339
+ static bool classof (const OpenACCClause *C) {
340
+ return C->getClauseKind () == OpenACCClauseKind::Async;
341
+ }
312
342
static OpenACCAsyncClause *Create (const ASTContext &C,
313
343
SourceLocation BeginLoc,
314
344
SourceLocation LParenLoc, Expr *IntExpr,
@@ -326,6 +356,7 @@ class OpenACCClauseWithVarList : public OpenACCClauseWithExprs {
326
356
: OpenACCClauseWithExprs(K, BeginLoc, LParenLoc, EndLoc) {}
327
357
328
358
public:
359
+ static bool classof (const OpenACCClause *C);
329
360
ArrayRef<Expr *> getVarList () { return getExprs (); }
330
361
ArrayRef<Expr *> getVarList () const { return getExprs (); }
331
362
};
@@ -344,6 +375,9 @@ class OpenACCPrivateClause final
344
375
}
345
376
346
377
public:
378
+ static bool classof (const OpenACCClause *C) {
379
+ return C->getClauseKind () == OpenACCClauseKind::Private;
380
+ }
347
381
static OpenACCPrivateClause *
348
382
Create (const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
349
383
ArrayRef<Expr *> VarList, SourceLocation EndLoc);
@@ -363,6 +397,9 @@ class OpenACCFirstPrivateClause final
363
397
}
364
398
365
399
public:
400
+ static bool classof (const OpenACCClause *C) {
401
+ return C->getClauseKind () == OpenACCClauseKind::FirstPrivate;
402
+ }
366
403
static OpenACCFirstPrivateClause *
367
404
Create (const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
368
405
ArrayRef<Expr *> VarList, SourceLocation EndLoc);
@@ -382,6 +419,9 @@ class OpenACCDevicePtrClause final
382
419
}
383
420
384
421
public:
422
+ static bool classof (const OpenACCClause *C) {
423
+ return C->getClauseKind () == OpenACCClauseKind::DevicePtr;
424
+ }
385
425
static OpenACCDevicePtrClause *
386
426
Create (const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
387
427
ArrayRef<Expr *> VarList, SourceLocation EndLoc);
@@ -401,6 +441,9 @@ class OpenACCAttachClause final
401
441
}
402
442
403
443
public:
444
+ static bool classof (const OpenACCClause *C) {
445
+ return C->getClauseKind () == OpenACCClauseKind::Attach;
446
+ }
404
447
static OpenACCAttachClause *
405
448
Create (const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
406
449
ArrayRef<Expr *> VarList, SourceLocation EndLoc);
@@ -420,6 +463,9 @@ class OpenACCNoCreateClause final
420
463
}
421
464
422
465
public:
466
+ static bool classof (const OpenACCClause *C) {
467
+ return C->getClauseKind () == OpenACCClauseKind::NoCreate;
468
+ }
423
469
static OpenACCNoCreateClause *
424
470
Create (const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
425
471
ArrayRef<Expr *> VarList, SourceLocation EndLoc);
@@ -439,6 +485,9 @@ class OpenACCPresentClause final
439
485
}
440
486
441
487
public:
488
+ static bool classof (const OpenACCClause *C) {
489
+ return C->getClauseKind () == OpenACCClauseKind::Present;
490
+ }
442
491
static OpenACCPresentClause *
443
492
Create (const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
444
493
ArrayRef<Expr *> VarList, SourceLocation EndLoc);
@@ -462,6 +511,11 @@ class OpenACCCopyClause final
462
511
}
463
512
464
513
public:
514
+ static bool classof (const OpenACCClause *C) {
515
+ return C->getClauseKind () == OpenACCClauseKind::Copy ||
516
+ C->getClauseKind () == OpenACCClauseKind::PCopy ||
517
+ C->getClauseKind () == OpenACCClauseKind::PresentOrCopy;
518
+ }
465
519
static OpenACCCopyClause *
466
520
Create (const ASTContext &C, OpenACCClauseKind Spelling,
467
521
SourceLocation BeginLoc, SourceLocation LParenLoc,
@@ -488,6 +542,11 @@ class OpenACCCopyInClause final
488
542
}
489
543
490
544
public:
545
+ static bool classof (const OpenACCClause *C) {
546
+ return C->getClauseKind () == OpenACCClauseKind::CopyIn ||
547
+ C->getClauseKind () == OpenACCClauseKind::PCopyIn ||
548
+ C->getClauseKind () == OpenACCClauseKind::PresentOrCopyIn;
549
+ }
491
550
bool isReadOnly () const { return IsReadOnly; }
492
551
static OpenACCCopyInClause *
493
552
Create (const ASTContext &C, OpenACCClauseKind Spelling,
@@ -515,6 +574,11 @@ class OpenACCCopyOutClause final
515
574
}
516
575
517
576
public:
577
+ static bool classof (const OpenACCClause *C) {
578
+ return C->getClauseKind () == OpenACCClauseKind::CopyOut ||
579
+ C->getClauseKind () == OpenACCClauseKind::PCopyOut ||
580
+ C->getClauseKind () == OpenACCClauseKind::PresentOrCopyOut;
581
+ }
518
582
bool isZero () const { return IsZero; }
519
583
static OpenACCCopyOutClause *
520
584
Create (const ASTContext &C, OpenACCClauseKind Spelling,
@@ -542,6 +606,11 @@ class OpenACCCreateClause final
542
606
}
543
607
544
608
public:
609
+ static bool classof (const OpenACCClause *C) {
610
+ return C->getClauseKind () == OpenACCClauseKind::Create ||
611
+ C->getClauseKind () == OpenACCClauseKind::PCreate ||
612
+ C->getClauseKind () == OpenACCClauseKind::PresentOrCreate;
613
+ }
545
614
bool isZero () const { return IsZero; }
546
615
static OpenACCCreateClause *
547
616
Create (const ASTContext &C, OpenACCClauseKind Spelling,
0 commit comments