65 return new (Mem)
OpenACCIfClause(BeginLoc, LParenLoc, ConditionExpr, EndLoc);
72 ConditionExpr, EndLoc) {
73 assert(ConditionExpr &&
"if clause requires condition expr");
76 "Condition expression type not scalar/dependent");
93 ConditionExpr, EndLoc) {
96 "Condition expression type not scalar/dependent");
102 assert(
false &&
"Clause children function not implemented");
104#define VISIT_CLAUSE(CLAUSE_NAME) \
105 case OpenACCClauseKind::CLAUSE_NAME: \
106 return cast<OpenACC##CLAUSE_NAME##Clause>(this)->children();
107#define CLAUSE_ALIAS(ALIAS_NAME, CLAUSE_NAME, DEPRECATED) \
108 case OpenACCClauseKind::ALIAS_NAME: \
109 return cast<OpenACC##CLAUSE_NAME##Clause>(this)->children();
111#include "clang/Basic/OpenACCClauses.def"
116OpenACCNumWorkersClause::OpenACCNumWorkersClause(
SourceLocation BeginLoc,
121 LParenLoc, IntExpr, EndLoc) {
124 "Condition expression type not scalar/dependent");
137OpenACCVectorLengthClause::OpenACCVectorLengthClause(
SourceLocation BeginLoc,
142 LParenLoc, IntExpr, EndLoc) {
145 "Condition expression type not scalar/dependent");
162 LParenLoc, IntExpr, EndLoc) {
165 "Condition expression type not scalar/dependent");
184 void *Mem =
C.Allocate(
185 OpenACCWaitClause::totalSizeToAlloc<Expr *>(QueueIdExprs.size() + 1));
187 QueueIdExprs, EndLoc);
195 void *Mem =
C.Allocate(
196 OpenACCNumGangsClause::totalSizeToAlloc<Expr *>(IntExprs.size()));
205 void *Mem =
C.Allocate(
206 OpenACCPrivateClause::totalSizeToAlloc<Expr *>(VarList.size()));
213 void *Mem =
C.Allocate(
214 OpenACCFirstPrivateClause::totalSizeToAlloc<Expr *>(VarList.size()));
225 C.Allocate(OpenACCAttachClause::totalSizeToAlloc<Expr *>(VarList.size()));
234 void *Mem =
C.Allocate(
235 OpenACCDevicePtrClause::totalSizeToAlloc<Expr *>(VarList.size()));
244 void *Mem =
C.Allocate(
245 OpenACCNoCreateClause::totalSizeToAlloc<Expr *>(VarList.size()));
254 void *Mem =
C.Allocate(
255 OpenACCPresentClause::totalSizeToAlloc<Expr *>(VarList.size()));
264 C.Allocate(OpenACCCopyClause::totalSizeToAlloc<Expr *>(VarList.size()));
275 C.Allocate(OpenACCCopyInClause::totalSizeToAlloc<Expr *>(VarList.size()));
277 IsReadOnly, VarList, EndLoc);
285 void *Mem =
C.Allocate(
286 OpenACCCopyOutClause::totalSizeToAlloc<Expr *>(VarList.size()));
297 C.Allocate(OpenACCCreateClause::totalSizeToAlloc<Expr *>(VarList.size()));
307 C.Allocate(OpenACCDeviceTypeClause::totalSizeToAlloc<DeviceTypeArgument>(
317 void *Mem =
C.Allocate(
318 OpenACCReductionClause::totalSizeToAlloc<Expr *>(VarList.size()));
369void OpenACCClausePrinter::printExpr(
const Expr *
E) {
374 OS <<
"default(" <<
C.getDefaultClauseKind() <<
")";
379 printExpr(
C.getConditionExpr());
385 if (
const Expr *CondExpr =
C.getConditionExpr()) {
394 llvm::interleaveComma(
C.getIntExprs(), OS,
395 [&](
const Expr *
E) { printExpr(E); });
399void OpenACCClausePrinter::VisitNumWorkersClause(
401 OS <<
"num_workers(";
402 printExpr(
C.getIntExpr());
406void OpenACCClausePrinter::VisitVectorLengthClause(
408 OS <<
"vector_length(";
409 printExpr(
C.getIntExpr());
415 if (
C.hasIntExpr()) {
417 printExpr(
C.getIntExpr());
424 llvm::interleaveComma(
C.getVarList(), OS,
425 [&](
const Expr *
E) { printExpr(E); });
429void OpenACCClausePrinter::VisitFirstPrivateClause(
431 OS <<
"firstprivate(";
432 llvm::interleaveComma(
C.getVarList(), OS,
433 [&](
const Expr *
E) { printExpr(E); });
439 llvm::interleaveComma(
C.getVarList(), OS,
440 [&](
const Expr *
E) { printExpr(E); });
444void OpenACCClausePrinter::VisitDevicePtrClause(
447 llvm::interleaveComma(
C.getVarList(), OS,
448 [&](
const Expr *
E) { printExpr(E); });
454 llvm::interleaveComma(
C.getVarList(), OS,
455 [&](
const Expr *
E) { printExpr(E); });
461 llvm::interleaveComma(
C.getVarList(), OS,
462 [&](
const Expr *
E) { printExpr(E); });
467 OS <<
C.getClauseKind() <<
'(';
468 llvm::interleaveComma(
C.getVarList(), OS,
469 [&](
const Expr *
E) { printExpr(E); });
474 OS <<
C.getClauseKind() <<
'(';
477 llvm::interleaveComma(
C.getVarList(), OS,
478 [&](
const Expr *
E) { printExpr(E); });
483 OS <<
C.getClauseKind() <<
'(';
486 llvm::interleaveComma(
C.getVarList(), OS,
487 [&](
const Expr *
E) { printExpr(E); });
492 OS <<
C.getClauseKind() <<
'(';
495 llvm::interleaveComma(
C.getVarList(), OS,
496 [&](
const Expr *
E) { printExpr(E); });
500void OpenACCClausePrinter::VisitReductionClause(
502 OS <<
"reduction(" <<
C.getReductionOp() <<
": ";
503 llvm::interleaveComma(
C.getVarList(), OS,
504 [&](
const Expr *
E) { printExpr(E); });
510 if (!
C.getLParenLoc().isInvalid()) {
512 if (
C.hasDevNumExpr()) {
514 printExpr(
C.getDevNumExpr());
518 if (
C.hasQueuesTag())
521 llvm::interleaveComma(
C.getQueueIdExprs(), OS,
522 [&](
const Expr *
E) { printExpr(E); });
527void OpenACCClausePrinter::VisitDeviceTypeClause(
529 OS <<
C.getClauseKind();
531 llvm::interleaveComma(
C.getArchitectures(), OS,
533 if (Arch.first == nullptr)
536 OS << Arch.first->getName();
545void OpenACCClausePrinter::VisitIndependentClause(
Defines the clang::ASTContext interface.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
This represents one expression.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
static bool classof(const OpenACCClause *C)
static OpenACCAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCAttachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCAutoClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
Represents one of the handful of classes that has an optional/required 'condition' expression as an a...
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
Represents one of a handful of clauses that have a single integer expression.
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
This is the base type for all OpenACC Clauses.
StmtIterator child_iterator
OpenACCClauseKind getClauseKind() const
llvm::iterator_range< child_iterator > child_range
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsReadOnly, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
A 'default' clause, has the optional 'none' or 'present' argument.
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static OpenACCDevicePtrClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
A 'device_type' or 'dtype' clause, takes a list of either an 'asterisk' or an identifier.
static OpenACCDeviceTypeClause * Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< DeviceTypeArgument > Archs, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCFirstPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCGangClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
An 'if' clause, which has a required condition expression.
OpenACCIfClause(SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCIfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCIndependentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCNoCreateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNumGangsClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCNumWorkersClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCReductionClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCReductionOperator Operator, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
A 'self' clause, which has an optional condition expression.
static bool classof(const OpenACCClause *C)
static OpenACCSelfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCSeqClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCVectorClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCVectorLengthClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCWaitClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef< Expr * > QueueIdExprs, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCWorkerClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
Encodes a location in the source.
void printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\n", const ASTContext *Context=nullptr) const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
bool isScalarType() const
The JSON file list parser is used to communicate input to InstallAPI.
OpenACCClauseKind
Represents the kind of an OpenACC clause.
@ VectorLength
'vector_length' clause, allowed on 'parallel', 'kernels', 'parallel loop', and 'kernels loop' constru...
@ Async
'async' clause, allowed on Compute, Data, 'update', 'wait', and Combined constructs.
@ If
'if' clause, allowed on all the Compute Constructs, Data Constructs, Executable Constructs,...
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ NumWorkers
'num_workers' clause, allowed on 'parallel', 'kernels', parallel loop', and 'kernels loop' constructs...
std::pair< IdentifierInfo *, SourceLocation > DeviceTypeArgument