14#ifndef LLVM_CLANG_AST_OPENACCCLAUSE_H
15#define LLVM_CLANG_AST_OPENACCCLAUSE_H
31 : Kind(K), Location(BeginLoc, EndLoc) {
33 "Begin and end location must be valid for OpenACCClause");
129 llvm_unreachable(
"Not yet implemented");
155 llvm_unreachable(
"Not yet implemented");
181 llvm_unreachable(
"Not yet implemented");
208 :
OpenACCClause(K, BeginLoc, EndLoc), LParenLoc(LParenLoc) {}
228 public llvm::TrailingObjects<OpenACCDeviceTypeClause,
229 DeviceTypeArgument> {
238 NumArchs(Archs.size()) {
241 "Invalid clause kind for device-type");
244 return Arg.second.isInvalid();
245 }) &&
"Invalid SourceLocation for an argument");
248 (Archs.size() == 1 || !llvm::any_of(Archs,
250 return Arg.first == nullptr;
252 "Only a single asterisk version is permitted, and must be the "
255 std::uninitialized_copy(Archs.begin(), Archs.end(),
256 getTrailingObjects<DeviceTypeArgument>());
271 getTrailingObjects<DeviceTypeArgument>(), NumArchs);
292 DefaultClauseKind(K) {
295 "Invalid Clause Kind");
303 return DefaultClauseKind;
316 Expr *ConditionExpr =
nullptr;
323 ConditionExpr(ConditionExpr) {}
335 reinterpret_cast<Stmt **
>(&ConditionExpr + 1));
342 reinterpret_cast<Stmt *
const *
>(&ConditionExpr),
343 reinterpret_cast<Stmt *
const *
>(&ConditionExpr + 1));
389 assert(Exprs.empty() &&
"Cannot change Exprs list");
401 reinterpret_cast<Stmt **
>(Exprs.end()));
414 public llvm::TrailingObjects<OpenACCWaitClause, Expr *> {
421 QueuesLoc(QueuesLoc) {
424 std::uninitialized_copy(&DevNumExpr, &DevNumExpr + 1,
425 getTrailingObjects<Expr *>());
426 std::uninitialized_copy(QueueIdExprs.begin(), QueueIdExprs.end(),
427 getTrailingObjects<Expr *>() + 1);
429 MutableArrayRef(getTrailingObjects<Expr *>(), QueueIdExprs.size() + 1));
456 public llvm::TrailingObjects<OpenACCNumGangsClause, Expr *> {
462 std::uninitialized_copy(IntExprs.begin(), IntExprs.end(),
463 getTrailingObjects<Expr *>());
568 public llvm::TrailingObjects<OpenACCPrivateClause, Expr *> {
574 std::uninitialized_copy(VarList.begin(), VarList.end(),
575 getTrailingObjects<Expr *>());
590 public llvm::TrailingObjects<OpenACCFirstPrivateClause, Expr *> {
596 std::uninitialized_copy(VarList.begin(), VarList.end(),
597 getTrailingObjects<Expr *>());
612 public llvm::TrailingObjects<OpenACCDevicePtrClause, Expr *> {
618 std::uninitialized_copy(VarList.begin(), VarList.end(),
619 getTrailingObjects<Expr *>());
634 public llvm::TrailingObjects<OpenACCAttachClause, Expr *> {
640 std::uninitialized_copy(VarList.begin(), VarList.end(),
641 getTrailingObjects<Expr *>());
656 public llvm::TrailingObjects<OpenACCNoCreateClause, Expr *> {
662 std::uninitialized_copy(VarList.begin(), VarList.end(),
663 getTrailingObjects<Expr *>());
678 public llvm::TrailingObjects<OpenACCPresentClause, Expr *> {
684 std::uninitialized_copy(VarList.begin(), VarList.end(),
685 getTrailingObjects<Expr *>());
700 public llvm::TrailingObjects<OpenACCCopyClause, Expr *> {
709 "Invalid clause kind for copy-clause");
710 std::uninitialized_copy(VarList.begin(), VarList.end(),
711 getTrailingObjects<Expr *>());
729 public llvm::TrailingObjects<OpenACCCopyInClause, Expr *> {
736 IsReadOnly(IsReadOnly) {
740 "Invalid clause kind for copyin-clause");
741 std::uninitialized_copy(VarList.begin(), VarList.end(),
742 getTrailingObjects<Expr *>());
761 public llvm::TrailingObjects<OpenACCCopyOutClause, Expr *> {
772 "Invalid clause kind for copyout-clause");
773 std::uninitialized_copy(VarList.begin(), VarList.end(),
774 getTrailingObjects<Expr *>());
793 public llvm::TrailingObjects<OpenACCCreateClause, Expr *> {
804 "Invalid clause kind for create-clause");
805 std::uninitialized_copy(VarList.begin(), VarList.end(),
806 getTrailingObjects<Expr *>());
825 public llvm::TrailingObjects<OpenACCReductionClause, Expr *> {
834 std::uninitialized_copy(VarList.begin(), VarList.end(),
835 getTrailingObjects<Expr *>());
853 Impl &getDerived() {
return static_cast<Impl &
>(*this); }
865 switch (
C->getClauseKind()) {
866#define VISIT_CLAUSE(CLAUSE_NAME) \
867 case OpenACCClauseKind::CLAUSE_NAME: \
868 Visit##CLAUSE_NAME##Clause(*cast<OpenACC##CLAUSE_NAME##Clause>(C)); \
870#define CLAUSE_ALIAS(ALIAS_NAME, CLAUSE_NAME, DEPRECATED) \
871 case OpenACCClauseKind::ALIAS_NAME: \
872 Visit##CLAUSE_NAME##Clause(*cast<OpenACC##CLAUSE_NAME##Clause>(C)); \
874#include "clang/Basic/OpenACCClauses.def"
877 llvm_unreachable(
"Clause visitor not yet implemented");
879 llvm_unreachable(
"Invalid Clause kind");
882#define VISIT_CLAUSE(CLAUSE_NAME) \
883 void Visit##CLAUSE_NAME##Clause( \
884 const OpenACC##CLAUSE_NAME##Clause &Clause) { \
885 return getDerived().Visit##CLAUSE_NAME##Clause(Clause); \
888#include "clang/Basic/OpenACCClauses.def"
896 void printExpr(
const Expr *
E);
903 if (Clause != List.back())
908 : OS(OS), Policy(Policy) {}
910#define VISIT_CLAUSE(CLAUSE_NAME) \
911 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
912#include "clang/Basic/OpenACCClauses.def"
Defines the clang::ASTContext interface.
Defines some OpenACC-specific enums and functions.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
This represents one expression.
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
const_child_range children() const
OpenACCAutoClause(SourceLocation BeginLoc, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
OpenACCClausePrinter(raw_ostream &OS, const PrintingPolicy &Policy)
void VisitClauseList(ArrayRef< const OpenACCClause * > List)
void Visit(const OpenACCClause *C)
void VisitClauseList(ArrayRef< const OpenACCClause * > List)
Represents one of the handful of classes that has an optional/required 'condition' expression as an a...
static bool classof(const OpenACCClause *C)
bool hasConditionExpr() const
const Expr * getConditionExpr() const
Expr * getConditionExpr()
OpenACCClauseWithCondition(OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
const_child_range children() const
Represents a clause that has one or more expressions associated with it.
static bool classof(const OpenACCClause *C)
OpenACCClauseWithExprs(OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
llvm::ArrayRef< Expr * > getExprs() const
Gets the entire list of expressions, but leave it to the individual clauses to expose this how they'd...
const_child_range children() const
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.
SourceLocation getLParenLoc() const
static bool classof(const OpenACCClause *C)
OpenACCClauseWithParams(OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
const_child_range children() const
Represents one of a handful of clauses that have a single integer expression.
OpenACCClauseWithSingleIntExpr(OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
const Expr * getIntExpr() const
static bool classof(const OpenACCClause *C)
Represents a clause with one or more 'var' objects, represented as an expr, as its arguments.
OpenACCClauseWithVarList(OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
ArrayRef< Expr * > getVarList()
ArrayRef< Expr * > getVarList() const
This is the base type for all OpenACC Clauses.
StmtIterator child_iterator
OpenACCClauseKind getClauseKind() const
SourceLocation getBeginLoc() const
const_child_range children() const
static bool classof(const OpenACCClause *)
llvm::iterator_range< child_iterator > child_range
ConstStmtIterator const_child_iterator
OpenACCClause(OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation EndLoc)
virtual ~OpenACCClause()=default
llvm::iterator_range< const_child_iterator > const_child_range
SourceLocation getEndLoc() const
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
A 'default' clause, has the optional 'none' or 'present' argument.
OpenACCDefaultClause(OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
friend class ASTWriterStmt
OpenACCDefaultClauseKind getDefaultClauseKind() const
static bool classof(const OpenACCClause *C)
friend class ASTReaderStmt
static bool classof(const OpenACCClause *C)
A 'device_type' or 'dtype' clause, takes a list of either an 'asterisk' or an identifier.
ArrayRef< DeviceTypeArgument > getArchitectures() const
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
OpenACCGangClause(SourceLocation BeginLoc, SourceLocation EndLoc)
const_child_range children() const
static bool classof(const OpenACCClause *C)
An 'if' clause, which has a required condition expression.
static bool classof(const OpenACCClause *C)
OpenACCIndependentClause(SourceLocation BeginLoc, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
const_child_range children() const
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
llvm::ArrayRef< Expr * > getIntExprs() const
llvm::ArrayRef< Expr * > getIntExprs()
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
OpenACCReductionOperator getReductionOp() const
A 'self' clause, which has an optional condition expression.
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
const_child_range children() const
OpenACCSeqClause(SourceLocation BeginLoc, SourceLocation EndLoc)
OpenACCVectorClause(SourceLocation BeginLoc, SourceLocation EndLoc)
const_child_range children() const
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
Expr * getDevNumExpr() const
llvm::ArrayRef< Expr * > getQueueIdExprs()
bool hasDevNumExpr() const
bool hasQueuesTag() const
llvm::ArrayRef< Expr * > getQueueIdExprs() const
SourceLocation getQueuesLoc() const
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
OpenACCWorkerClause(SourceLocation BeginLoc, SourceLocation EndLoc)
const_child_range children() const
Encodes a location in the source.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
Stmt - This represents one statement.
The JSON file list parser is used to communicate input to InstallAPI.
OpenACCClauseKind
Represents the kind of an OpenACC clause.
@ Auto
'auto' clause, allowed on 'loop' directives.
@ Gang
'gang' clause, allowed on 'loop' and Combined constructs.
@ Wait
'wait' clause, allowed on Compute, Data, 'update', and Combined constructs.
@ DevicePtr
'deviceptr' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ PCopyOut
'copyout' clause alias 'pcopyout'. Preserved for diagnostic purposes.
@ 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.
@ PresentOrCreate
'create' clause alias 'present_or_create'.
@ PresentOrCopy
'copy' clause alias 'present_or_copy'. Preserved for diagnostic purposes.
@ Private
'private' clause, allowed on 'parallel', 'serial', 'loop', 'parallel loop', and 'serial loop' constru...
@ Vector
'vector' clause, allowed on 'loop', Combined, and 'routine' directives.
@ Copy
'copy' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
@ DeviceType
'device_type' clause, allowed on Compute, 'data', 'init', 'shutdown', 'set', update',...
@ Attach
'attach' clause, allowed on Compute and Combined constructs, plus 'data' and 'enter data'.
@ NumGangs
'num_gangs' clause, allowed on 'parallel', 'kernels', parallel loop', and 'kernels loop' constructs.
@ If
'if' clause, allowed on all the Compute Constructs, Data Constructs, Executable Constructs,...
@ Default
'default' clause, allowed on parallel, serial, kernel (and compound) constructs.
@ NoCreate
'no_create' clause, allowed on allowed on Compute and Combined constructs, plus 'data'.
@ PresentOrCopyOut
'copyout' clause alias 'present_or_copyout'.
@ Reduction
'reduction' clause, allowed on Parallel, Serial, Loop, and the combined constructs.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ CopyOut
'copyout' clause, allowed on Compute and Combined constructs, plus 'data', 'exit data',...
@ Seq
'seq' clause, allowed on 'loop' and 'routine' directives.
@ FirstPrivate
'firstprivate' clause, allowed on 'parallel', 'serial', 'parallel loop', and 'serial loop' constructs...
@ PCopy
'copy' clause alias 'pcopy'. Preserved for diagnostic purposes.
@ PCopyIn
'copyin' clause alias 'pcopyin'. Preserved for diagnostic purposes.
@ PCreate
'create' clause alias 'pcreate'. Preserved for diagnostic purposes.
@ Present
'present' clause, allowed on Compute and Combined constructs, plus 'data' and 'declare'.
@ DType
'dtype' clause, an alias for 'device_type', stored separately for diagnostic purposes.
@ CopyIn
'copyin' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
@ Independent
'independent' clause, allowed on 'loop' directives.
@ NumWorkers
'num_workers' clause, allowed on 'parallel', 'kernels', parallel loop', and 'kernels loop' constructs...
@ PresentOrCopyIn
'copyin' clause alias 'present_or_copyin'.
@ Present
'present' option.
std::pair< IdentifierInfo *, SourceLocation > DeviceTypeArgument
Describes how types, statements, expressions, and declarations should be printed.