73 return new (Mem)
OpenACCIfClause(BeginLoc, LParenLoc, ConditionExpr, EndLoc);
80 ConditionExpr, EndLoc) {
81 assert(ConditionExpr &&
"if clause requires condition expr");
84 "Condition expression type not scalar/dependent");
92 void *Mem =
C.Allocate(OpenACCSelfClause::totalSizeToAlloc<Expr *>(1));
103 C.Allocate(OpenACCSelfClause::totalSizeToAlloc<Expr *>(VarList.size()));
113 HasConditionExpr(
std::nullopt), NumExprs(VarList.size()) {
114 std::uninitialized_copy(VarList.begin(), VarList.end(),
115 getTrailingObjects<Expr *>());
123 HasConditionExpr(ConditionExpr != nullptr), NumExprs(1) {
126 "Condition expression type not scalar/dependent");
127 std::uninitialized_copy(&ConditionExpr, &ConditionExpr + 1,
128 getTrailingObjects<Expr *>());
134 assert(
false &&
"Clause children function not implemented");
136#define VISIT_CLAUSE(CLAUSE_NAME) \
137 case OpenACCClauseKind::CLAUSE_NAME: \
138 return cast<OpenACC##CLAUSE_NAME##Clause>(this)->children();
139#define CLAUSE_ALIAS(ALIAS_NAME, CLAUSE_NAME, DEPRECATED) \
140 case OpenACCClauseKind::ALIAS_NAME: \
141 return cast<OpenACC##CLAUSE_NAME##Clause>(this)->children();
143#include "clang/Basic/OpenACCClauses.def"
148OpenACCNumWorkersClause::OpenACCNumWorkersClause(
SourceLocation BeginLoc,
153 LParenLoc, IntExpr, EndLoc) {
156 "Condition expression type not scalar/dependent");
166 assert(GangKinds.size() == IntExprs.size() &&
"Mismatch exprs/kind?");
167 std::uninitialized_copy(IntExprs.begin(), IntExprs.end(),
168 getTrailingObjects<Expr *>());
170 std::uninitialized_copy(GangKinds.begin(), GangKinds.end(),
171 getTrailingObjects<OpenACCGangKind>());
184OpenACCCollapseClause::OpenACCCollapseClause(
SourceLocation BeginLoc,
186 bool HasForce,
Expr *LoopCount,
189 LParenLoc, LoopCount, EndLoc),
191 assert(LoopCount &&
"LoopCount required");
201 "Loop count not constant expression");
208OpenACCVectorLengthClause::OpenACCVectorLengthClause(
SourceLocation BeginLoc,
213 LParenLoc, IntExpr, EndLoc) {
216 "Condition expression type not scalar/dependent");
233 LParenLoc, IntExpr, EndLoc) {
236 "Condition expression type not scalar/dependent");
249OpenACCDeviceNumClause::OpenACCDeviceNumClause(
SourceLocation BeginLoc,
253 LParenLoc, IntExpr, EndLoc) {
256 "device_num expression type not scalar/dependent");
269OpenACCDefaultAsyncClause::OpenACCDefaultAsyncClause(
SourceLocation BeginLoc,
274 LParenLoc, IntExpr, EndLoc) {
277 "default_async expression type not scalar/dependent");
296 void *Mem =
C.Allocate(
297 OpenACCWaitClause::totalSizeToAlloc<Expr *>(QueueIdExprs.size() + 1));
299 QueueIdExprs, EndLoc);
307 void *Mem =
C.Allocate(
308 OpenACCNumGangsClause::totalSizeToAlloc<Expr *>(IntExprs.size()));
318 C.Allocate(OpenACCTileClause::totalSizeToAlloc<Expr *>(SizeExprs.size()));
327 void *Mem =
C.Allocate(
328 OpenACCPrivateClause::totalSizeToAlloc<Expr *>(VarList.size()));
335 void *Mem =
C.Allocate(
336 OpenACCFirstPrivateClause::totalSizeToAlloc<Expr *>(VarList.size()));
347 C.Allocate(OpenACCAttachClause::totalSizeToAlloc<Expr *>(VarList.size()));
357 C.Allocate(OpenACCDetachClause::totalSizeToAlloc<Expr *>(VarList.size()));
367 C.Allocate(OpenACCDeleteClause::totalSizeToAlloc<Expr *>(VarList.size()));
376 void *Mem =
C.Allocate(
377 OpenACCUseDeviceClause::totalSizeToAlloc<Expr *>(VarList.size()));
386 void *Mem =
C.Allocate(
387 OpenACCDevicePtrClause::totalSizeToAlloc<Expr *>(VarList.size()));
396 void *Mem =
C.Allocate(
397 OpenACCNoCreateClause::totalSizeToAlloc<Expr *>(VarList.size()));
406 void *Mem =
C.Allocate(
407 OpenACCPresentClause::totalSizeToAlloc<Expr *>(VarList.size()));
417 C.Allocate(OpenACCHostClause::totalSizeToAlloc<Expr *>(VarList.size()));
427 C.Allocate(OpenACCDeviceClause::totalSizeToAlloc<Expr *>(VarList.size()));
436 C.Allocate(OpenACCCopyClause::totalSizeToAlloc<Expr *>(VarList.size()));
447 C.Allocate(OpenACCCopyInClause::totalSizeToAlloc<Expr *>(VarList.size()));
449 IsReadOnly, VarList, EndLoc);
457 void *Mem =
C.Allocate(
458 OpenACCCopyOutClause::totalSizeToAlloc<Expr *>(VarList.size()));
469 C.Allocate(OpenACCCreateClause::totalSizeToAlloc<Expr *>(VarList.size()));
479 C.Allocate(OpenACCDeviceTypeClause::totalSizeToAlloc<DeviceTypeArgument>(
489 void *Mem =
C.Allocate(
490 OpenACCReductionClause::totalSizeToAlloc<Expr *>(VarList.size()));
522 C.Allocate(OpenACCGangClause::totalSizeToAlloc<Expr *, OpenACCGangKind>(
523 IntExprs.size(), GangKinds.size()));
532 LParenLoc, IntExpr, EndLoc) {
535 "Int expression type not scalar/dependent");
552 LParenLoc, IntExpr, EndLoc) {
555 "Int expression type not scalar/dependent");
588void OpenACCClausePrinter::printExpr(
const Expr *
E) {
593 OS <<
"default(" <<
C.getDefaultClauseKind() <<
")";
598 printExpr(
C.getConditionExpr());
605 if (
C.isConditionExprClause()) {
606 if (
const Expr *CondExpr =
C.getConditionExpr()) {
613 llvm::interleaveComma(
C.getVarList(), OS,
614 [&](
const Expr *
E) { printExpr(E); });
621 llvm::interleaveComma(
C.getIntExprs(), OS,
622 [&](
const Expr *
E) { printExpr(E); });
628 llvm::interleaveComma(
C.getSizeExprs(), OS,
629 [&](
const Expr *
E) { printExpr(E); });
633void OpenACCClausePrinter::VisitNumWorkersClause(
635 OS <<
"num_workers(";
636 printExpr(
C.getIntExpr());
640void OpenACCClausePrinter::VisitVectorLengthClause(
642 OS <<
"vector_length(";
643 printExpr(
C.getIntExpr());
647void OpenACCClausePrinter::VisitDeviceNumClause(
650 printExpr(
C.getIntExpr());
654void OpenACCClausePrinter::VisitDefaultAsyncClause(
656 OS <<
"default_async(";
657 printExpr(
C.getIntExpr());
663 if (
C.hasIntExpr()) {
665 printExpr(
C.getIntExpr());
672 llvm::interleaveComma(
C.getVarList(), OS,
673 [&](
const Expr *
E) { printExpr(E); });
677void OpenACCClausePrinter::VisitFirstPrivateClause(
679 OS <<
"firstprivate(";
680 llvm::interleaveComma(
C.getVarList(), OS,
681 [&](
const Expr *
E) { printExpr(E); });
687 llvm::interleaveComma(
C.getVarList(), OS,
688 [&](
const Expr *
E) { printExpr(E); });
694 llvm::interleaveComma(
C.getVarList(), OS,
695 [&](
const Expr *
E) { printExpr(E); });
701 llvm::interleaveComma(
C.getVarList(), OS,
702 [&](
const Expr *
E) { printExpr(E); });
706void OpenACCClausePrinter::VisitUseDeviceClause(
709 llvm::interleaveComma(
C.getVarList(), OS,
710 [&](
const Expr *
E) { printExpr(E); });
714void OpenACCClausePrinter::VisitDevicePtrClause(
717 llvm::interleaveComma(
C.getVarList(), OS,
718 [&](
const Expr *
E) { printExpr(E); });
724 llvm::interleaveComma(
C.getVarList(), OS,
725 [&](
const Expr *
E) { printExpr(E); });
731 llvm::interleaveComma(
C.getVarList(), OS,
732 [&](
const Expr *
E) { printExpr(E); });
738 llvm::interleaveComma(
C.getVarList(), OS,
739 [&](
const Expr *
E) { printExpr(E); });
745 llvm::interleaveComma(
C.getVarList(), OS,
746 [&](
const Expr *
E) { printExpr(E); });
751 OS <<
C.getClauseKind() <<
'(';
752 llvm::interleaveComma(
C.getVarList(), OS,
753 [&](
const Expr *
E) { printExpr(E); });
758 OS <<
C.getClauseKind() <<
'(';
761 llvm::interleaveComma(
C.getVarList(), OS,
762 [&](
const Expr *
E) { printExpr(E); });
767 OS <<
C.getClauseKind() <<
'(';
770 llvm::interleaveComma(
C.getVarList(), OS,
771 [&](
const Expr *
E) { printExpr(E); });
776 OS <<
C.getClauseKind() <<
'(';
779 llvm::interleaveComma(
C.getVarList(), OS,
780 [&](
const Expr *
E) { printExpr(E); });
784void OpenACCClausePrinter::VisitReductionClause(
786 OS <<
"reduction(" <<
C.getReductionOp() <<
": ";
787 llvm::interleaveComma(
C.getVarList(), OS,
788 [&](
const Expr *
E) { printExpr(E); });
794 if (!
C.getLParenLoc().isInvalid()) {
796 if (
C.hasDevNumExpr()) {
798 printExpr(
C.getDevNumExpr());
802 if (
C.hasQueuesTag())
805 llvm::interleaveComma(
C.getQueueIdExprs(), OS,
806 [&](
const Expr *
E) { printExpr(E); });
811void OpenACCClausePrinter::VisitDeviceTypeClause(
813 OS <<
C.getClauseKind();
815 llvm::interleaveComma(
C.getArchitectures(), OS,
817 if (Arch.first == nullptr)
820 OS << Arch.first->getName();
829void OpenACCClausePrinter::VisitIndependentClause(
842 printExpr(
C.getLoopCount());
849 if (
C.getNumExprs() > 0) {
852 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
857 OS <<
C.getExpr(I).first <<
": ";
858 printExpr(
C.getExpr(I).second);
867 if (
C.hasIntExpr()) {
869 printExpr(
C.getIntExpr());
877 if (
C.hasIntExpr()) {
879 printExpr(
C.getIntExpr());
888void OpenACCClausePrinter::VisitIfPresentClause(
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)
Represents a clause that has one or more expressions associated with it.
static bool classof(const OpenACCClause *C)
void setExprs(MutableArrayRef< Expr * > NewExprs)
Used only for initialization, the leaf class can initialize this to trailing storage.
Represents a clause that has a list of parameters.
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
Represents a 'collapse' clause on a 'loop' construct.
static OpenACCCollapseClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, bool HasForce, Expr *LoopCount, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
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)
static bool classof(const OpenACCClause *C)
static OpenACCDefaultAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, 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 OpenACCDeleteClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCDetachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
static OpenACCDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceNumClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
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 OpenACCFinalizeClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
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 LParenLoc, ArrayRef< OpenACCGangKind > GangKinds, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
OpenACCGangClause(SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< OpenACCGangKind > GangKinds, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCHostClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
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 OpenACCIfPresentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
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, or, in the event of an 'update' directiv...
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 OpenACCTileClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > SizeExprs, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCUseDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCVectorClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
OpenACCVectorClause(SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
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 bool classof(const OpenACCClause *C)
static OpenACCWorkerClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
OpenACCWorkerClause(SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, 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.
@ Gang
'gang' clause, allowed on 'loop' and Combined constructs.
@ 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.
@ Collapse
'collapse' clause, allowed on 'loop' and Combined constructs.
@ DeviceNum
'device_num' clause, allowed on 'init', 'shutdown', and 'set' constructs.
@ Vector
'vector' clause, allowed on 'loop', Combined, and 'routine' directives.
@ Worker
'worker' clause, allowed on 'loop', Combined, and 'routine' directives.
@ DefaultAsync
'default_async' clause, allowed on 'set' construct.
@ 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