1*0fca6ea1SDimitry Andric //===---- OpenACCClause.cpp - Classes for OpenACC Clauses ----------------===//
2*0fca6ea1SDimitry Andric //
3*0fca6ea1SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0fca6ea1SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0fca6ea1SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0fca6ea1SDimitry Andric //
7*0fca6ea1SDimitry Andric //===----------------------------------------------------------------------===//
8*0fca6ea1SDimitry Andric //
9*0fca6ea1SDimitry Andric // This file implements the subclasses of the OpenACCClause class declared in
10*0fca6ea1SDimitry Andric // OpenACCClause.h
11*0fca6ea1SDimitry Andric //
12*0fca6ea1SDimitry Andric //===----------------------------------------------------------------------===//
13*0fca6ea1SDimitry Andric
14*0fca6ea1SDimitry Andric #include "clang/AST/OpenACCClause.h"
15*0fca6ea1SDimitry Andric #include "clang/AST/ASTContext.h"
16*0fca6ea1SDimitry Andric #include "clang/AST/Expr.h"
17*0fca6ea1SDimitry Andric
18*0fca6ea1SDimitry Andric using namespace clang;
19*0fca6ea1SDimitry Andric
classof(const OpenACCClause * C)20*0fca6ea1SDimitry Andric bool OpenACCClauseWithParams::classof(const OpenACCClause *C) {
21*0fca6ea1SDimitry Andric return OpenACCDeviceTypeClause::classof(C) ||
22*0fca6ea1SDimitry Andric OpenACCClauseWithCondition::classof(C) ||
23*0fca6ea1SDimitry Andric OpenACCClauseWithExprs::classof(C);
24*0fca6ea1SDimitry Andric }
classof(const OpenACCClause * C)25*0fca6ea1SDimitry Andric bool OpenACCClauseWithExprs::classof(const OpenACCClause *C) {
26*0fca6ea1SDimitry Andric return OpenACCWaitClause::classof(C) || OpenACCNumGangsClause::classof(C) ||
27*0fca6ea1SDimitry Andric OpenACCClauseWithSingleIntExpr::classof(C) ||
28*0fca6ea1SDimitry Andric OpenACCClauseWithVarList::classof(C);
29*0fca6ea1SDimitry Andric }
classof(const OpenACCClause * C)30*0fca6ea1SDimitry Andric bool OpenACCClauseWithVarList::classof(const OpenACCClause *C) {
31*0fca6ea1SDimitry Andric return OpenACCPrivateClause::classof(C) ||
32*0fca6ea1SDimitry Andric OpenACCFirstPrivateClause::classof(C) ||
33*0fca6ea1SDimitry Andric OpenACCDevicePtrClause::classof(C) ||
34*0fca6ea1SDimitry Andric OpenACCDevicePtrClause::classof(C) ||
35*0fca6ea1SDimitry Andric OpenACCAttachClause::classof(C) || OpenACCNoCreateClause::classof(C) ||
36*0fca6ea1SDimitry Andric OpenACCPresentClause::classof(C) || OpenACCCopyClause::classof(C) ||
37*0fca6ea1SDimitry Andric OpenACCCopyInClause::classof(C) || OpenACCCopyOutClause::classof(C) ||
38*0fca6ea1SDimitry Andric OpenACCReductionClause::classof(C) || OpenACCCreateClause::classof(C);
39*0fca6ea1SDimitry Andric }
classof(const OpenACCClause * C)40*0fca6ea1SDimitry Andric bool OpenACCClauseWithCondition::classof(const OpenACCClause *C) {
41*0fca6ea1SDimitry Andric return OpenACCIfClause::classof(C) || OpenACCSelfClause::classof(C);
42*0fca6ea1SDimitry Andric }
classof(const OpenACCClause * C)43*0fca6ea1SDimitry Andric bool OpenACCClauseWithSingleIntExpr::classof(const OpenACCClause *C) {
44*0fca6ea1SDimitry Andric return OpenACCNumWorkersClause::classof(C) ||
45*0fca6ea1SDimitry Andric OpenACCVectorLengthClause::classof(C) ||
46*0fca6ea1SDimitry Andric OpenACCAsyncClause::classof(C);
47*0fca6ea1SDimitry Andric }
Create(const ASTContext & C,OpenACCDefaultClauseKind K,SourceLocation BeginLoc,SourceLocation LParenLoc,SourceLocation EndLoc)48*0fca6ea1SDimitry Andric OpenACCDefaultClause *OpenACCDefaultClause::Create(const ASTContext &C,
49*0fca6ea1SDimitry Andric OpenACCDefaultClauseKind K,
50*0fca6ea1SDimitry Andric SourceLocation BeginLoc,
51*0fca6ea1SDimitry Andric SourceLocation LParenLoc,
52*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
53*0fca6ea1SDimitry Andric void *Mem =
54*0fca6ea1SDimitry Andric C.Allocate(sizeof(OpenACCDefaultClause), alignof(OpenACCDefaultClause));
55*0fca6ea1SDimitry Andric
56*0fca6ea1SDimitry Andric return new (Mem) OpenACCDefaultClause(K, BeginLoc, LParenLoc, EndLoc);
57*0fca6ea1SDimitry Andric }
58*0fca6ea1SDimitry Andric
Create(const ASTContext & C,SourceLocation BeginLoc,SourceLocation LParenLoc,Expr * ConditionExpr,SourceLocation EndLoc)59*0fca6ea1SDimitry Andric OpenACCIfClause *OpenACCIfClause::Create(const ASTContext &C,
60*0fca6ea1SDimitry Andric SourceLocation BeginLoc,
61*0fca6ea1SDimitry Andric SourceLocation LParenLoc,
62*0fca6ea1SDimitry Andric Expr *ConditionExpr,
63*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
64*0fca6ea1SDimitry Andric void *Mem = C.Allocate(sizeof(OpenACCIfClause), alignof(OpenACCIfClause));
65*0fca6ea1SDimitry Andric return new (Mem) OpenACCIfClause(BeginLoc, LParenLoc, ConditionExpr, EndLoc);
66*0fca6ea1SDimitry Andric }
67*0fca6ea1SDimitry Andric
OpenACCIfClause(SourceLocation BeginLoc,SourceLocation LParenLoc,Expr * ConditionExpr,SourceLocation EndLoc)68*0fca6ea1SDimitry Andric OpenACCIfClause::OpenACCIfClause(SourceLocation BeginLoc,
69*0fca6ea1SDimitry Andric SourceLocation LParenLoc, Expr *ConditionExpr,
70*0fca6ea1SDimitry Andric SourceLocation EndLoc)
71*0fca6ea1SDimitry Andric : OpenACCClauseWithCondition(OpenACCClauseKind::If, BeginLoc, LParenLoc,
72*0fca6ea1SDimitry Andric ConditionExpr, EndLoc) {
73*0fca6ea1SDimitry Andric assert(ConditionExpr && "if clause requires condition expr");
74*0fca6ea1SDimitry Andric assert((ConditionExpr->isInstantiationDependent() ||
75*0fca6ea1SDimitry Andric ConditionExpr->getType()->isScalarType()) &&
76*0fca6ea1SDimitry Andric "Condition expression type not scalar/dependent");
77*0fca6ea1SDimitry Andric }
78*0fca6ea1SDimitry Andric
Create(const ASTContext & C,SourceLocation BeginLoc,SourceLocation LParenLoc,Expr * ConditionExpr,SourceLocation EndLoc)79*0fca6ea1SDimitry Andric OpenACCSelfClause *OpenACCSelfClause::Create(const ASTContext &C,
80*0fca6ea1SDimitry Andric SourceLocation BeginLoc,
81*0fca6ea1SDimitry Andric SourceLocation LParenLoc,
82*0fca6ea1SDimitry Andric Expr *ConditionExpr,
83*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
84*0fca6ea1SDimitry Andric void *Mem = C.Allocate(sizeof(OpenACCIfClause), alignof(OpenACCIfClause));
85*0fca6ea1SDimitry Andric return new (Mem)
86*0fca6ea1SDimitry Andric OpenACCSelfClause(BeginLoc, LParenLoc, ConditionExpr, EndLoc);
87*0fca6ea1SDimitry Andric }
88*0fca6ea1SDimitry Andric
OpenACCSelfClause(SourceLocation BeginLoc,SourceLocation LParenLoc,Expr * ConditionExpr,SourceLocation EndLoc)89*0fca6ea1SDimitry Andric OpenACCSelfClause::OpenACCSelfClause(SourceLocation BeginLoc,
90*0fca6ea1SDimitry Andric SourceLocation LParenLoc,
91*0fca6ea1SDimitry Andric Expr *ConditionExpr, SourceLocation EndLoc)
92*0fca6ea1SDimitry Andric : OpenACCClauseWithCondition(OpenACCClauseKind::Self, BeginLoc, LParenLoc,
93*0fca6ea1SDimitry Andric ConditionExpr, EndLoc) {
94*0fca6ea1SDimitry Andric assert((!ConditionExpr || ConditionExpr->isInstantiationDependent() ||
95*0fca6ea1SDimitry Andric ConditionExpr->getType()->isScalarType()) &&
96*0fca6ea1SDimitry Andric "Condition expression type not scalar/dependent");
97*0fca6ea1SDimitry Andric }
98*0fca6ea1SDimitry Andric
children()99*0fca6ea1SDimitry Andric OpenACCClause::child_range OpenACCClause::children() {
100*0fca6ea1SDimitry Andric switch (getClauseKind()) {
101*0fca6ea1SDimitry Andric default:
102*0fca6ea1SDimitry Andric assert(false && "Clause children function not implemented");
103*0fca6ea1SDimitry Andric break;
104*0fca6ea1SDimitry Andric #define VISIT_CLAUSE(CLAUSE_NAME) \
105*0fca6ea1SDimitry Andric case OpenACCClauseKind::CLAUSE_NAME: \
106*0fca6ea1SDimitry Andric return cast<OpenACC##CLAUSE_NAME##Clause>(this)->children();
107*0fca6ea1SDimitry Andric #define CLAUSE_ALIAS(ALIAS_NAME, CLAUSE_NAME, DEPRECATED) \
108*0fca6ea1SDimitry Andric case OpenACCClauseKind::ALIAS_NAME: \
109*0fca6ea1SDimitry Andric return cast<OpenACC##CLAUSE_NAME##Clause>(this)->children();
110*0fca6ea1SDimitry Andric
111*0fca6ea1SDimitry Andric #include "clang/Basic/OpenACCClauses.def"
112*0fca6ea1SDimitry Andric }
113*0fca6ea1SDimitry Andric return child_range(child_iterator(), child_iterator());
114*0fca6ea1SDimitry Andric }
115*0fca6ea1SDimitry Andric
OpenACCNumWorkersClause(SourceLocation BeginLoc,SourceLocation LParenLoc,Expr * IntExpr,SourceLocation EndLoc)116*0fca6ea1SDimitry Andric OpenACCNumWorkersClause::OpenACCNumWorkersClause(SourceLocation BeginLoc,
117*0fca6ea1SDimitry Andric SourceLocation LParenLoc,
118*0fca6ea1SDimitry Andric Expr *IntExpr,
119*0fca6ea1SDimitry Andric SourceLocation EndLoc)
120*0fca6ea1SDimitry Andric : OpenACCClauseWithSingleIntExpr(OpenACCClauseKind::NumWorkers, BeginLoc,
121*0fca6ea1SDimitry Andric LParenLoc, IntExpr, EndLoc) {
122*0fca6ea1SDimitry Andric assert((!IntExpr || IntExpr->isInstantiationDependent() ||
123*0fca6ea1SDimitry Andric IntExpr->getType()->isIntegerType()) &&
124*0fca6ea1SDimitry Andric "Condition expression type not scalar/dependent");
125*0fca6ea1SDimitry Andric }
126*0fca6ea1SDimitry Andric
127*0fca6ea1SDimitry Andric OpenACCNumWorkersClause *
Create(const ASTContext & C,SourceLocation BeginLoc,SourceLocation LParenLoc,Expr * IntExpr,SourceLocation EndLoc)128*0fca6ea1SDimitry Andric OpenACCNumWorkersClause::Create(const ASTContext &C, SourceLocation BeginLoc,
129*0fca6ea1SDimitry Andric SourceLocation LParenLoc, Expr *IntExpr,
130*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
131*0fca6ea1SDimitry Andric void *Mem = C.Allocate(sizeof(OpenACCNumWorkersClause),
132*0fca6ea1SDimitry Andric alignof(OpenACCNumWorkersClause));
133*0fca6ea1SDimitry Andric return new (Mem)
134*0fca6ea1SDimitry Andric OpenACCNumWorkersClause(BeginLoc, LParenLoc, IntExpr, EndLoc);
135*0fca6ea1SDimitry Andric }
136*0fca6ea1SDimitry Andric
OpenACCVectorLengthClause(SourceLocation BeginLoc,SourceLocation LParenLoc,Expr * IntExpr,SourceLocation EndLoc)137*0fca6ea1SDimitry Andric OpenACCVectorLengthClause::OpenACCVectorLengthClause(SourceLocation BeginLoc,
138*0fca6ea1SDimitry Andric SourceLocation LParenLoc,
139*0fca6ea1SDimitry Andric Expr *IntExpr,
140*0fca6ea1SDimitry Andric SourceLocation EndLoc)
141*0fca6ea1SDimitry Andric : OpenACCClauseWithSingleIntExpr(OpenACCClauseKind::VectorLength, BeginLoc,
142*0fca6ea1SDimitry Andric LParenLoc, IntExpr, EndLoc) {
143*0fca6ea1SDimitry Andric assert((!IntExpr || IntExpr->isInstantiationDependent() ||
144*0fca6ea1SDimitry Andric IntExpr->getType()->isIntegerType()) &&
145*0fca6ea1SDimitry Andric "Condition expression type not scalar/dependent");
146*0fca6ea1SDimitry Andric }
147*0fca6ea1SDimitry Andric
148*0fca6ea1SDimitry Andric OpenACCVectorLengthClause *
Create(const ASTContext & C,SourceLocation BeginLoc,SourceLocation LParenLoc,Expr * IntExpr,SourceLocation EndLoc)149*0fca6ea1SDimitry Andric OpenACCVectorLengthClause::Create(const ASTContext &C, SourceLocation BeginLoc,
150*0fca6ea1SDimitry Andric SourceLocation LParenLoc, Expr *IntExpr,
151*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
152*0fca6ea1SDimitry Andric void *Mem = C.Allocate(sizeof(OpenACCVectorLengthClause),
153*0fca6ea1SDimitry Andric alignof(OpenACCVectorLengthClause));
154*0fca6ea1SDimitry Andric return new (Mem)
155*0fca6ea1SDimitry Andric OpenACCVectorLengthClause(BeginLoc, LParenLoc, IntExpr, EndLoc);
156*0fca6ea1SDimitry Andric }
157*0fca6ea1SDimitry Andric
OpenACCAsyncClause(SourceLocation BeginLoc,SourceLocation LParenLoc,Expr * IntExpr,SourceLocation EndLoc)158*0fca6ea1SDimitry Andric OpenACCAsyncClause::OpenACCAsyncClause(SourceLocation BeginLoc,
159*0fca6ea1SDimitry Andric SourceLocation LParenLoc, Expr *IntExpr,
160*0fca6ea1SDimitry Andric SourceLocation EndLoc)
161*0fca6ea1SDimitry Andric : OpenACCClauseWithSingleIntExpr(OpenACCClauseKind::Async, BeginLoc,
162*0fca6ea1SDimitry Andric LParenLoc, IntExpr, EndLoc) {
163*0fca6ea1SDimitry Andric assert((!IntExpr || IntExpr->isInstantiationDependent() ||
164*0fca6ea1SDimitry Andric IntExpr->getType()->isIntegerType()) &&
165*0fca6ea1SDimitry Andric "Condition expression type not scalar/dependent");
166*0fca6ea1SDimitry Andric }
167*0fca6ea1SDimitry Andric
Create(const ASTContext & C,SourceLocation BeginLoc,SourceLocation LParenLoc,Expr * IntExpr,SourceLocation EndLoc)168*0fca6ea1SDimitry Andric OpenACCAsyncClause *OpenACCAsyncClause::Create(const ASTContext &C,
169*0fca6ea1SDimitry Andric SourceLocation BeginLoc,
170*0fca6ea1SDimitry Andric SourceLocation LParenLoc,
171*0fca6ea1SDimitry Andric Expr *IntExpr,
172*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
173*0fca6ea1SDimitry Andric void *Mem =
174*0fca6ea1SDimitry Andric C.Allocate(sizeof(OpenACCAsyncClause), alignof(OpenACCAsyncClause));
175*0fca6ea1SDimitry Andric return new (Mem) OpenACCAsyncClause(BeginLoc, LParenLoc, IntExpr, EndLoc);
176*0fca6ea1SDimitry Andric }
177*0fca6ea1SDimitry Andric
Create(const ASTContext & C,SourceLocation BeginLoc,SourceLocation LParenLoc,Expr * DevNumExpr,SourceLocation QueuesLoc,ArrayRef<Expr * > QueueIdExprs,SourceLocation EndLoc)178*0fca6ea1SDimitry Andric OpenACCWaitClause *OpenACCWaitClause::Create(
179*0fca6ea1SDimitry Andric const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
180*0fca6ea1SDimitry Andric Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef<Expr *> QueueIdExprs,
181*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
182*0fca6ea1SDimitry Andric // Allocates enough room in trailing storage for all the int-exprs, plus a
183*0fca6ea1SDimitry Andric // placeholder for the devnum.
184*0fca6ea1SDimitry Andric void *Mem = C.Allocate(
185*0fca6ea1SDimitry Andric OpenACCWaitClause::totalSizeToAlloc<Expr *>(QueueIdExprs.size() + 1));
186*0fca6ea1SDimitry Andric return new (Mem) OpenACCWaitClause(BeginLoc, LParenLoc, DevNumExpr, QueuesLoc,
187*0fca6ea1SDimitry Andric QueueIdExprs, EndLoc);
188*0fca6ea1SDimitry Andric }
189*0fca6ea1SDimitry Andric
Create(const ASTContext & C,SourceLocation BeginLoc,SourceLocation LParenLoc,ArrayRef<Expr * > IntExprs,SourceLocation EndLoc)190*0fca6ea1SDimitry Andric OpenACCNumGangsClause *OpenACCNumGangsClause::Create(const ASTContext &C,
191*0fca6ea1SDimitry Andric SourceLocation BeginLoc,
192*0fca6ea1SDimitry Andric SourceLocation LParenLoc,
193*0fca6ea1SDimitry Andric ArrayRef<Expr *> IntExprs,
194*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
195*0fca6ea1SDimitry Andric void *Mem = C.Allocate(
196*0fca6ea1SDimitry Andric OpenACCNumGangsClause::totalSizeToAlloc<Expr *>(IntExprs.size()));
197*0fca6ea1SDimitry Andric return new (Mem) OpenACCNumGangsClause(BeginLoc, LParenLoc, IntExprs, EndLoc);
198*0fca6ea1SDimitry Andric }
199*0fca6ea1SDimitry Andric
Create(const ASTContext & C,SourceLocation BeginLoc,SourceLocation LParenLoc,ArrayRef<Expr * > VarList,SourceLocation EndLoc)200*0fca6ea1SDimitry Andric OpenACCPrivateClause *OpenACCPrivateClause::Create(const ASTContext &C,
201*0fca6ea1SDimitry Andric SourceLocation BeginLoc,
202*0fca6ea1SDimitry Andric SourceLocation LParenLoc,
203*0fca6ea1SDimitry Andric ArrayRef<Expr *> VarList,
204*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
205*0fca6ea1SDimitry Andric void *Mem = C.Allocate(
206*0fca6ea1SDimitry Andric OpenACCPrivateClause::totalSizeToAlloc<Expr *>(VarList.size()));
207*0fca6ea1SDimitry Andric return new (Mem) OpenACCPrivateClause(BeginLoc, LParenLoc, VarList, EndLoc);
208*0fca6ea1SDimitry Andric }
209*0fca6ea1SDimitry Andric
Create(const ASTContext & C,SourceLocation BeginLoc,SourceLocation LParenLoc,ArrayRef<Expr * > VarList,SourceLocation EndLoc)210*0fca6ea1SDimitry Andric OpenACCFirstPrivateClause *OpenACCFirstPrivateClause::Create(
211*0fca6ea1SDimitry Andric const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
212*0fca6ea1SDimitry Andric ArrayRef<Expr *> VarList, SourceLocation EndLoc) {
213*0fca6ea1SDimitry Andric void *Mem = C.Allocate(
214*0fca6ea1SDimitry Andric OpenACCFirstPrivateClause::totalSizeToAlloc<Expr *>(VarList.size()));
215*0fca6ea1SDimitry Andric return new (Mem)
216*0fca6ea1SDimitry Andric OpenACCFirstPrivateClause(BeginLoc, LParenLoc, VarList, EndLoc);
217*0fca6ea1SDimitry Andric }
218*0fca6ea1SDimitry Andric
Create(const ASTContext & C,SourceLocation BeginLoc,SourceLocation LParenLoc,ArrayRef<Expr * > VarList,SourceLocation EndLoc)219*0fca6ea1SDimitry Andric OpenACCAttachClause *OpenACCAttachClause::Create(const ASTContext &C,
220*0fca6ea1SDimitry Andric SourceLocation BeginLoc,
221*0fca6ea1SDimitry Andric SourceLocation LParenLoc,
222*0fca6ea1SDimitry Andric ArrayRef<Expr *> VarList,
223*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
224*0fca6ea1SDimitry Andric void *Mem =
225*0fca6ea1SDimitry Andric C.Allocate(OpenACCAttachClause::totalSizeToAlloc<Expr *>(VarList.size()));
226*0fca6ea1SDimitry Andric return new (Mem) OpenACCAttachClause(BeginLoc, LParenLoc, VarList, EndLoc);
227*0fca6ea1SDimitry Andric }
228*0fca6ea1SDimitry Andric
Create(const ASTContext & C,SourceLocation BeginLoc,SourceLocation LParenLoc,ArrayRef<Expr * > VarList,SourceLocation EndLoc)229*0fca6ea1SDimitry Andric OpenACCDevicePtrClause *OpenACCDevicePtrClause::Create(const ASTContext &C,
230*0fca6ea1SDimitry Andric SourceLocation BeginLoc,
231*0fca6ea1SDimitry Andric SourceLocation LParenLoc,
232*0fca6ea1SDimitry Andric ArrayRef<Expr *> VarList,
233*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
234*0fca6ea1SDimitry Andric void *Mem = C.Allocate(
235*0fca6ea1SDimitry Andric OpenACCDevicePtrClause::totalSizeToAlloc<Expr *>(VarList.size()));
236*0fca6ea1SDimitry Andric return new (Mem) OpenACCDevicePtrClause(BeginLoc, LParenLoc, VarList, EndLoc);
237*0fca6ea1SDimitry Andric }
238*0fca6ea1SDimitry Andric
Create(const ASTContext & C,SourceLocation BeginLoc,SourceLocation LParenLoc,ArrayRef<Expr * > VarList,SourceLocation EndLoc)239*0fca6ea1SDimitry Andric OpenACCNoCreateClause *OpenACCNoCreateClause::Create(const ASTContext &C,
240*0fca6ea1SDimitry Andric SourceLocation BeginLoc,
241*0fca6ea1SDimitry Andric SourceLocation LParenLoc,
242*0fca6ea1SDimitry Andric ArrayRef<Expr *> VarList,
243*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
244*0fca6ea1SDimitry Andric void *Mem = C.Allocate(
245*0fca6ea1SDimitry Andric OpenACCNoCreateClause::totalSizeToAlloc<Expr *>(VarList.size()));
246*0fca6ea1SDimitry Andric return new (Mem) OpenACCNoCreateClause(BeginLoc, LParenLoc, VarList, EndLoc);
247*0fca6ea1SDimitry Andric }
248*0fca6ea1SDimitry Andric
Create(const ASTContext & C,SourceLocation BeginLoc,SourceLocation LParenLoc,ArrayRef<Expr * > VarList,SourceLocation EndLoc)249*0fca6ea1SDimitry Andric OpenACCPresentClause *OpenACCPresentClause::Create(const ASTContext &C,
250*0fca6ea1SDimitry Andric SourceLocation BeginLoc,
251*0fca6ea1SDimitry Andric SourceLocation LParenLoc,
252*0fca6ea1SDimitry Andric ArrayRef<Expr *> VarList,
253*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
254*0fca6ea1SDimitry Andric void *Mem = C.Allocate(
255*0fca6ea1SDimitry Andric OpenACCPresentClause::totalSizeToAlloc<Expr *>(VarList.size()));
256*0fca6ea1SDimitry Andric return new (Mem) OpenACCPresentClause(BeginLoc, LParenLoc, VarList, EndLoc);
257*0fca6ea1SDimitry Andric }
258*0fca6ea1SDimitry Andric
259*0fca6ea1SDimitry Andric OpenACCCopyClause *
Create(const ASTContext & C,OpenACCClauseKind Spelling,SourceLocation BeginLoc,SourceLocation LParenLoc,ArrayRef<Expr * > VarList,SourceLocation EndLoc)260*0fca6ea1SDimitry Andric OpenACCCopyClause::Create(const ASTContext &C, OpenACCClauseKind Spelling,
261*0fca6ea1SDimitry Andric SourceLocation BeginLoc, SourceLocation LParenLoc,
262*0fca6ea1SDimitry Andric ArrayRef<Expr *> VarList, SourceLocation EndLoc) {
263*0fca6ea1SDimitry Andric void *Mem =
264*0fca6ea1SDimitry Andric C.Allocate(OpenACCCopyClause::totalSizeToAlloc<Expr *>(VarList.size()));
265*0fca6ea1SDimitry Andric return new (Mem)
266*0fca6ea1SDimitry Andric OpenACCCopyClause(Spelling, BeginLoc, LParenLoc, VarList, EndLoc);
267*0fca6ea1SDimitry Andric }
268*0fca6ea1SDimitry Andric
269*0fca6ea1SDimitry Andric OpenACCCopyInClause *
Create(const ASTContext & C,OpenACCClauseKind Spelling,SourceLocation BeginLoc,SourceLocation LParenLoc,bool IsReadOnly,ArrayRef<Expr * > VarList,SourceLocation EndLoc)270*0fca6ea1SDimitry Andric OpenACCCopyInClause::Create(const ASTContext &C, OpenACCClauseKind Spelling,
271*0fca6ea1SDimitry Andric SourceLocation BeginLoc, SourceLocation LParenLoc,
272*0fca6ea1SDimitry Andric bool IsReadOnly, ArrayRef<Expr *> VarList,
273*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
274*0fca6ea1SDimitry Andric void *Mem =
275*0fca6ea1SDimitry Andric C.Allocate(OpenACCCopyInClause::totalSizeToAlloc<Expr *>(VarList.size()));
276*0fca6ea1SDimitry Andric return new (Mem) OpenACCCopyInClause(Spelling, BeginLoc, LParenLoc,
277*0fca6ea1SDimitry Andric IsReadOnly, VarList, EndLoc);
278*0fca6ea1SDimitry Andric }
279*0fca6ea1SDimitry Andric
280*0fca6ea1SDimitry Andric OpenACCCopyOutClause *
Create(const ASTContext & C,OpenACCClauseKind Spelling,SourceLocation BeginLoc,SourceLocation LParenLoc,bool IsZero,ArrayRef<Expr * > VarList,SourceLocation EndLoc)281*0fca6ea1SDimitry Andric OpenACCCopyOutClause::Create(const ASTContext &C, OpenACCClauseKind Spelling,
282*0fca6ea1SDimitry Andric SourceLocation BeginLoc, SourceLocation LParenLoc,
283*0fca6ea1SDimitry Andric bool IsZero, ArrayRef<Expr *> VarList,
284*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
285*0fca6ea1SDimitry Andric void *Mem = C.Allocate(
286*0fca6ea1SDimitry Andric OpenACCCopyOutClause::totalSizeToAlloc<Expr *>(VarList.size()));
287*0fca6ea1SDimitry Andric return new (Mem) OpenACCCopyOutClause(Spelling, BeginLoc, LParenLoc, IsZero,
288*0fca6ea1SDimitry Andric VarList, EndLoc);
289*0fca6ea1SDimitry Andric }
290*0fca6ea1SDimitry Andric
291*0fca6ea1SDimitry Andric OpenACCCreateClause *
Create(const ASTContext & C,OpenACCClauseKind Spelling,SourceLocation BeginLoc,SourceLocation LParenLoc,bool IsZero,ArrayRef<Expr * > VarList,SourceLocation EndLoc)292*0fca6ea1SDimitry Andric OpenACCCreateClause::Create(const ASTContext &C, OpenACCClauseKind Spelling,
293*0fca6ea1SDimitry Andric SourceLocation BeginLoc, SourceLocation LParenLoc,
294*0fca6ea1SDimitry Andric bool IsZero, ArrayRef<Expr *> VarList,
295*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
296*0fca6ea1SDimitry Andric void *Mem =
297*0fca6ea1SDimitry Andric C.Allocate(OpenACCCreateClause::totalSizeToAlloc<Expr *>(VarList.size()));
298*0fca6ea1SDimitry Andric return new (Mem) OpenACCCreateClause(Spelling, BeginLoc, LParenLoc, IsZero,
299*0fca6ea1SDimitry Andric VarList, EndLoc);
300*0fca6ea1SDimitry Andric }
301*0fca6ea1SDimitry Andric
Create(const ASTContext & C,OpenACCClauseKind K,SourceLocation BeginLoc,SourceLocation LParenLoc,ArrayRef<DeviceTypeArgument> Archs,SourceLocation EndLoc)302*0fca6ea1SDimitry Andric OpenACCDeviceTypeClause *OpenACCDeviceTypeClause::Create(
303*0fca6ea1SDimitry Andric const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc,
304*0fca6ea1SDimitry Andric SourceLocation LParenLoc, ArrayRef<DeviceTypeArgument> Archs,
305*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
306*0fca6ea1SDimitry Andric void *Mem =
307*0fca6ea1SDimitry Andric C.Allocate(OpenACCDeviceTypeClause::totalSizeToAlloc<DeviceTypeArgument>(
308*0fca6ea1SDimitry Andric Archs.size()));
309*0fca6ea1SDimitry Andric return new (Mem)
310*0fca6ea1SDimitry Andric OpenACCDeviceTypeClause(K, BeginLoc, LParenLoc, Archs, EndLoc);
311*0fca6ea1SDimitry Andric }
312*0fca6ea1SDimitry Andric
Create(const ASTContext & C,SourceLocation BeginLoc,SourceLocation LParenLoc,OpenACCReductionOperator Operator,ArrayRef<Expr * > VarList,SourceLocation EndLoc)313*0fca6ea1SDimitry Andric OpenACCReductionClause *OpenACCReductionClause::Create(
314*0fca6ea1SDimitry Andric const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
315*0fca6ea1SDimitry Andric OpenACCReductionOperator Operator, ArrayRef<Expr *> VarList,
316*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
317*0fca6ea1SDimitry Andric void *Mem = C.Allocate(
318*0fca6ea1SDimitry Andric OpenACCReductionClause::totalSizeToAlloc<Expr *>(VarList.size()));
319*0fca6ea1SDimitry Andric return new (Mem)
320*0fca6ea1SDimitry Andric OpenACCReductionClause(BeginLoc, LParenLoc, Operator, VarList, EndLoc);
321*0fca6ea1SDimitry Andric }
322*0fca6ea1SDimitry Andric
Create(const ASTContext & C,SourceLocation BeginLoc,SourceLocation EndLoc)323*0fca6ea1SDimitry Andric OpenACCAutoClause *OpenACCAutoClause::Create(const ASTContext &C,
324*0fca6ea1SDimitry Andric SourceLocation BeginLoc,
325*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
326*0fca6ea1SDimitry Andric void *Mem = C.Allocate(sizeof(OpenACCAutoClause));
327*0fca6ea1SDimitry Andric return new (Mem) OpenACCAutoClause(BeginLoc, EndLoc);
328*0fca6ea1SDimitry Andric }
329*0fca6ea1SDimitry Andric
330*0fca6ea1SDimitry Andric OpenACCIndependentClause *
Create(const ASTContext & C,SourceLocation BeginLoc,SourceLocation EndLoc)331*0fca6ea1SDimitry Andric OpenACCIndependentClause::Create(const ASTContext &C, SourceLocation BeginLoc,
332*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
333*0fca6ea1SDimitry Andric void *Mem = C.Allocate(sizeof(OpenACCIndependentClause));
334*0fca6ea1SDimitry Andric return new (Mem) OpenACCIndependentClause(BeginLoc, EndLoc);
335*0fca6ea1SDimitry Andric }
336*0fca6ea1SDimitry Andric
Create(const ASTContext & C,SourceLocation BeginLoc,SourceLocation EndLoc)337*0fca6ea1SDimitry Andric OpenACCSeqClause *OpenACCSeqClause::Create(const ASTContext &C,
338*0fca6ea1SDimitry Andric SourceLocation BeginLoc,
339*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
340*0fca6ea1SDimitry Andric void *Mem = C.Allocate(sizeof(OpenACCSeqClause));
341*0fca6ea1SDimitry Andric return new (Mem) OpenACCSeqClause(BeginLoc, EndLoc);
342*0fca6ea1SDimitry Andric }
343*0fca6ea1SDimitry Andric
Create(const ASTContext & C,SourceLocation BeginLoc,SourceLocation EndLoc)344*0fca6ea1SDimitry Andric OpenACCGangClause *OpenACCGangClause::Create(const ASTContext &C,
345*0fca6ea1SDimitry Andric SourceLocation BeginLoc,
346*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
347*0fca6ea1SDimitry Andric void *Mem = C.Allocate(sizeof(OpenACCGangClause));
348*0fca6ea1SDimitry Andric return new (Mem) OpenACCGangClause(BeginLoc, EndLoc);
349*0fca6ea1SDimitry Andric }
350*0fca6ea1SDimitry Andric
Create(const ASTContext & C,SourceLocation BeginLoc,SourceLocation EndLoc)351*0fca6ea1SDimitry Andric OpenACCWorkerClause *OpenACCWorkerClause::Create(const ASTContext &C,
352*0fca6ea1SDimitry Andric SourceLocation BeginLoc,
353*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
354*0fca6ea1SDimitry Andric void *Mem = C.Allocate(sizeof(OpenACCWorkerClause));
355*0fca6ea1SDimitry Andric return new (Mem) OpenACCWorkerClause(BeginLoc, EndLoc);
356*0fca6ea1SDimitry Andric }
357*0fca6ea1SDimitry Andric
Create(const ASTContext & C,SourceLocation BeginLoc,SourceLocation EndLoc)358*0fca6ea1SDimitry Andric OpenACCVectorClause *OpenACCVectorClause::Create(const ASTContext &C,
359*0fca6ea1SDimitry Andric SourceLocation BeginLoc,
360*0fca6ea1SDimitry Andric SourceLocation EndLoc) {
361*0fca6ea1SDimitry Andric void *Mem = C.Allocate(sizeof(OpenACCVectorClause));
362*0fca6ea1SDimitry Andric return new (Mem) OpenACCVectorClause(BeginLoc, EndLoc);
363*0fca6ea1SDimitry Andric }
364*0fca6ea1SDimitry Andric
365*0fca6ea1SDimitry Andric //===----------------------------------------------------------------------===//
366*0fca6ea1SDimitry Andric // OpenACC clauses printing methods
367*0fca6ea1SDimitry Andric //===----------------------------------------------------------------------===//
368*0fca6ea1SDimitry Andric
printExpr(const Expr * E)369*0fca6ea1SDimitry Andric void OpenACCClausePrinter::printExpr(const Expr *E) {
370*0fca6ea1SDimitry Andric E->printPretty(OS, nullptr, Policy, 0);
371*0fca6ea1SDimitry Andric }
372*0fca6ea1SDimitry Andric
VisitDefaultClause(const OpenACCDefaultClause & C)373*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitDefaultClause(const OpenACCDefaultClause &C) {
374*0fca6ea1SDimitry Andric OS << "default(" << C.getDefaultClauseKind() << ")";
375*0fca6ea1SDimitry Andric }
376*0fca6ea1SDimitry Andric
VisitIfClause(const OpenACCIfClause & C)377*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitIfClause(const OpenACCIfClause &C) {
378*0fca6ea1SDimitry Andric OS << "if(";
379*0fca6ea1SDimitry Andric printExpr(C.getConditionExpr());
380*0fca6ea1SDimitry Andric OS << ")";
381*0fca6ea1SDimitry Andric }
382*0fca6ea1SDimitry Andric
VisitSelfClause(const OpenACCSelfClause & C)383*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitSelfClause(const OpenACCSelfClause &C) {
384*0fca6ea1SDimitry Andric OS << "self";
385*0fca6ea1SDimitry Andric if (const Expr *CondExpr = C.getConditionExpr()) {
386*0fca6ea1SDimitry Andric OS << "(";
387*0fca6ea1SDimitry Andric printExpr(CondExpr);
388*0fca6ea1SDimitry Andric OS << ")";
389*0fca6ea1SDimitry Andric }
390*0fca6ea1SDimitry Andric }
391*0fca6ea1SDimitry Andric
VisitNumGangsClause(const OpenACCNumGangsClause & C)392*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitNumGangsClause(const OpenACCNumGangsClause &C) {
393*0fca6ea1SDimitry Andric OS << "num_gangs(";
394*0fca6ea1SDimitry Andric llvm::interleaveComma(C.getIntExprs(), OS,
395*0fca6ea1SDimitry Andric [&](const Expr *E) { printExpr(E); });
396*0fca6ea1SDimitry Andric OS << ")";
397*0fca6ea1SDimitry Andric }
398*0fca6ea1SDimitry Andric
VisitNumWorkersClause(const OpenACCNumWorkersClause & C)399*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitNumWorkersClause(
400*0fca6ea1SDimitry Andric const OpenACCNumWorkersClause &C) {
401*0fca6ea1SDimitry Andric OS << "num_workers(";
402*0fca6ea1SDimitry Andric printExpr(C.getIntExpr());
403*0fca6ea1SDimitry Andric OS << ")";
404*0fca6ea1SDimitry Andric }
405*0fca6ea1SDimitry Andric
VisitVectorLengthClause(const OpenACCVectorLengthClause & C)406*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitVectorLengthClause(
407*0fca6ea1SDimitry Andric const OpenACCVectorLengthClause &C) {
408*0fca6ea1SDimitry Andric OS << "vector_length(";
409*0fca6ea1SDimitry Andric printExpr(C.getIntExpr());
410*0fca6ea1SDimitry Andric OS << ")";
411*0fca6ea1SDimitry Andric }
412*0fca6ea1SDimitry Andric
VisitAsyncClause(const OpenACCAsyncClause & C)413*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitAsyncClause(const OpenACCAsyncClause &C) {
414*0fca6ea1SDimitry Andric OS << "async";
415*0fca6ea1SDimitry Andric if (C.hasIntExpr()) {
416*0fca6ea1SDimitry Andric OS << "(";
417*0fca6ea1SDimitry Andric printExpr(C.getIntExpr());
418*0fca6ea1SDimitry Andric OS << ")";
419*0fca6ea1SDimitry Andric }
420*0fca6ea1SDimitry Andric }
421*0fca6ea1SDimitry Andric
VisitPrivateClause(const OpenACCPrivateClause & C)422*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitPrivateClause(const OpenACCPrivateClause &C) {
423*0fca6ea1SDimitry Andric OS << "private(";
424*0fca6ea1SDimitry Andric llvm::interleaveComma(C.getVarList(), OS,
425*0fca6ea1SDimitry Andric [&](const Expr *E) { printExpr(E); });
426*0fca6ea1SDimitry Andric OS << ")";
427*0fca6ea1SDimitry Andric }
428*0fca6ea1SDimitry Andric
VisitFirstPrivateClause(const OpenACCFirstPrivateClause & C)429*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitFirstPrivateClause(
430*0fca6ea1SDimitry Andric const OpenACCFirstPrivateClause &C) {
431*0fca6ea1SDimitry Andric OS << "firstprivate(";
432*0fca6ea1SDimitry Andric llvm::interleaveComma(C.getVarList(), OS,
433*0fca6ea1SDimitry Andric [&](const Expr *E) { printExpr(E); });
434*0fca6ea1SDimitry Andric OS << ")";
435*0fca6ea1SDimitry Andric }
436*0fca6ea1SDimitry Andric
VisitAttachClause(const OpenACCAttachClause & C)437*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitAttachClause(const OpenACCAttachClause &C) {
438*0fca6ea1SDimitry Andric OS << "attach(";
439*0fca6ea1SDimitry Andric llvm::interleaveComma(C.getVarList(), OS,
440*0fca6ea1SDimitry Andric [&](const Expr *E) { printExpr(E); });
441*0fca6ea1SDimitry Andric OS << ")";
442*0fca6ea1SDimitry Andric }
443*0fca6ea1SDimitry Andric
VisitDevicePtrClause(const OpenACCDevicePtrClause & C)444*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitDevicePtrClause(
445*0fca6ea1SDimitry Andric const OpenACCDevicePtrClause &C) {
446*0fca6ea1SDimitry Andric OS << "deviceptr(";
447*0fca6ea1SDimitry Andric llvm::interleaveComma(C.getVarList(), OS,
448*0fca6ea1SDimitry Andric [&](const Expr *E) { printExpr(E); });
449*0fca6ea1SDimitry Andric OS << ")";
450*0fca6ea1SDimitry Andric }
451*0fca6ea1SDimitry Andric
VisitNoCreateClause(const OpenACCNoCreateClause & C)452*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitNoCreateClause(const OpenACCNoCreateClause &C) {
453*0fca6ea1SDimitry Andric OS << "no_create(";
454*0fca6ea1SDimitry Andric llvm::interleaveComma(C.getVarList(), OS,
455*0fca6ea1SDimitry Andric [&](const Expr *E) { printExpr(E); });
456*0fca6ea1SDimitry Andric OS << ")";
457*0fca6ea1SDimitry Andric }
458*0fca6ea1SDimitry Andric
VisitPresentClause(const OpenACCPresentClause & C)459*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitPresentClause(const OpenACCPresentClause &C) {
460*0fca6ea1SDimitry Andric OS << "present(";
461*0fca6ea1SDimitry Andric llvm::interleaveComma(C.getVarList(), OS,
462*0fca6ea1SDimitry Andric [&](const Expr *E) { printExpr(E); });
463*0fca6ea1SDimitry Andric OS << ")";
464*0fca6ea1SDimitry Andric }
465*0fca6ea1SDimitry Andric
VisitCopyClause(const OpenACCCopyClause & C)466*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitCopyClause(const OpenACCCopyClause &C) {
467*0fca6ea1SDimitry Andric OS << C.getClauseKind() << '(';
468*0fca6ea1SDimitry Andric llvm::interleaveComma(C.getVarList(), OS,
469*0fca6ea1SDimitry Andric [&](const Expr *E) { printExpr(E); });
470*0fca6ea1SDimitry Andric OS << ")";
471*0fca6ea1SDimitry Andric }
472*0fca6ea1SDimitry Andric
VisitCopyInClause(const OpenACCCopyInClause & C)473*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitCopyInClause(const OpenACCCopyInClause &C) {
474*0fca6ea1SDimitry Andric OS << C.getClauseKind() << '(';
475*0fca6ea1SDimitry Andric if (C.isReadOnly())
476*0fca6ea1SDimitry Andric OS << "readonly: ";
477*0fca6ea1SDimitry Andric llvm::interleaveComma(C.getVarList(), OS,
478*0fca6ea1SDimitry Andric [&](const Expr *E) { printExpr(E); });
479*0fca6ea1SDimitry Andric OS << ")";
480*0fca6ea1SDimitry Andric }
481*0fca6ea1SDimitry Andric
VisitCopyOutClause(const OpenACCCopyOutClause & C)482*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitCopyOutClause(const OpenACCCopyOutClause &C) {
483*0fca6ea1SDimitry Andric OS << C.getClauseKind() << '(';
484*0fca6ea1SDimitry Andric if (C.isZero())
485*0fca6ea1SDimitry Andric OS << "zero: ";
486*0fca6ea1SDimitry Andric llvm::interleaveComma(C.getVarList(), OS,
487*0fca6ea1SDimitry Andric [&](const Expr *E) { printExpr(E); });
488*0fca6ea1SDimitry Andric OS << ")";
489*0fca6ea1SDimitry Andric }
490*0fca6ea1SDimitry Andric
VisitCreateClause(const OpenACCCreateClause & C)491*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitCreateClause(const OpenACCCreateClause &C) {
492*0fca6ea1SDimitry Andric OS << C.getClauseKind() << '(';
493*0fca6ea1SDimitry Andric if (C.isZero())
494*0fca6ea1SDimitry Andric OS << "zero: ";
495*0fca6ea1SDimitry Andric llvm::interleaveComma(C.getVarList(), OS,
496*0fca6ea1SDimitry Andric [&](const Expr *E) { printExpr(E); });
497*0fca6ea1SDimitry Andric OS << ")";
498*0fca6ea1SDimitry Andric }
499*0fca6ea1SDimitry Andric
VisitReductionClause(const OpenACCReductionClause & C)500*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitReductionClause(
501*0fca6ea1SDimitry Andric const OpenACCReductionClause &C) {
502*0fca6ea1SDimitry Andric OS << "reduction(" << C.getReductionOp() << ": ";
503*0fca6ea1SDimitry Andric llvm::interleaveComma(C.getVarList(), OS,
504*0fca6ea1SDimitry Andric [&](const Expr *E) { printExpr(E); });
505*0fca6ea1SDimitry Andric OS << ")";
506*0fca6ea1SDimitry Andric }
507*0fca6ea1SDimitry Andric
VisitWaitClause(const OpenACCWaitClause & C)508*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitWaitClause(const OpenACCWaitClause &C) {
509*0fca6ea1SDimitry Andric OS << "wait";
510*0fca6ea1SDimitry Andric if (!C.getLParenLoc().isInvalid()) {
511*0fca6ea1SDimitry Andric OS << "(";
512*0fca6ea1SDimitry Andric if (C.hasDevNumExpr()) {
513*0fca6ea1SDimitry Andric OS << "devnum: ";
514*0fca6ea1SDimitry Andric printExpr(C.getDevNumExpr());
515*0fca6ea1SDimitry Andric OS << " : ";
516*0fca6ea1SDimitry Andric }
517*0fca6ea1SDimitry Andric
518*0fca6ea1SDimitry Andric if (C.hasQueuesTag())
519*0fca6ea1SDimitry Andric OS << "queues: ";
520*0fca6ea1SDimitry Andric
521*0fca6ea1SDimitry Andric llvm::interleaveComma(C.getQueueIdExprs(), OS,
522*0fca6ea1SDimitry Andric [&](const Expr *E) { printExpr(E); });
523*0fca6ea1SDimitry Andric OS << ")";
524*0fca6ea1SDimitry Andric }
525*0fca6ea1SDimitry Andric }
526*0fca6ea1SDimitry Andric
VisitDeviceTypeClause(const OpenACCDeviceTypeClause & C)527*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitDeviceTypeClause(
528*0fca6ea1SDimitry Andric const OpenACCDeviceTypeClause &C) {
529*0fca6ea1SDimitry Andric OS << C.getClauseKind();
530*0fca6ea1SDimitry Andric OS << "(";
531*0fca6ea1SDimitry Andric llvm::interleaveComma(C.getArchitectures(), OS,
532*0fca6ea1SDimitry Andric [&](const DeviceTypeArgument &Arch) {
533*0fca6ea1SDimitry Andric if (Arch.first == nullptr)
534*0fca6ea1SDimitry Andric OS << "*";
535*0fca6ea1SDimitry Andric else
536*0fca6ea1SDimitry Andric OS << Arch.first->getName();
537*0fca6ea1SDimitry Andric });
538*0fca6ea1SDimitry Andric OS << ")";
539*0fca6ea1SDimitry Andric }
540*0fca6ea1SDimitry Andric
VisitAutoClause(const OpenACCAutoClause & C)541*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitAutoClause(const OpenACCAutoClause &C) {
542*0fca6ea1SDimitry Andric OS << "auto";
543*0fca6ea1SDimitry Andric }
544*0fca6ea1SDimitry Andric
VisitIndependentClause(const OpenACCIndependentClause & C)545*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitIndependentClause(
546*0fca6ea1SDimitry Andric const OpenACCIndependentClause &C) {
547*0fca6ea1SDimitry Andric OS << "independent";
548*0fca6ea1SDimitry Andric }
549*0fca6ea1SDimitry Andric
VisitSeqClause(const OpenACCSeqClause & C)550*0fca6ea1SDimitry Andric void OpenACCClausePrinter::VisitSeqClause(const OpenACCSeqClause &C) {
551*0fca6ea1SDimitry Andric OS << "seq";
552*0fca6ea1SDimitry Andric }
553