14#ifndef LLVM_CLANG_SEMA_SEMAOPENACC_H
15#define LLVM_CLANG_SEMA_SEMAOPENACC_H
39 struct DefaultDetails {
43 struct ConditionDetails {
47 struct IntExprDetails {
51 struct VarListDetails {
55 std::variant<std::monostate, DefaultDetails, ConditionDetails,
56 IntExprDetails, VarListDetails>
57 Details = std::monostate{};
62 : DirKind(DirKind), ClauseKind(ClauseKind), ClauseRange(BeginLoc, {}) {}
76 "Parsed clause is not a default clause");
77 return std::get<DefaultDetails>(Details).DefaultClauseKind;
88 "Parsed clause kind does not have a condition expr");
93 std::holds_alternative<std::monostate>(Details))
96 return std::get<ConditionDetails>(Details).ConditionExpr;
103 "Parsed clause kind does not have a int exprs");
104 return std::get<IntExprDetails>(Details).IntExprs.size();
111 "Parsed clause kind does not have a int exprs");
112 return std::get<IntExprDetails>(Details).IntExprs;
121 "Parsed clause kind does not have a var-list");
122 return std::get<VarListDetails>(Details).VarList;
134 "Parsed clause is not a default clause");
135 Details = DefaultDetails{DefKind};
142 "Parsed clause kind does not have a condition expr");
147 "Condition expression type not scalar/dependent");
149 Details = ConditionDetails{ConditionExpr};
156 "Parsed clause kind does not have a int exprs");
157 Details = IntExprDetails{{IntExprs.begin(), IntExprs.end()}};
163 "Parsed clause kind does not have a int exprs");
164 Details = IntExprDetails{std::move(IntExprs)};
169 "Parsed clause kind does not have a var-list");
170 Details = VarListDetails{{VarList.begin(), VarList.end()}};
175 "Parsed clause kind does not have a var-list");
176 Details = VarListDetails{std::move(VarList)};
184 OpenACCParsedClause &Clause);
Defines some OpenACC-specific enums and functions.
Defines the clang::SourceLocation class and associated facilities.
This represents one expression.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
This is the base type for all OpenACC Clauses.
A type to represent all the data for an OpenACC Clause that has been parsed, but not yet created/sema...
ArrayRef< Expr * > getIntExprs()
OpenACCDirectiveKind getDirectiveKind() const
OpenACCParsedClause(OpenACCDirectiveKind DirKind, OpenACCClauseKind ClauseKind, SourceLocation BeginLoc)
SourceLocation getEndLoc() const
void setLParenLoc(SourceLocation EndLoc)
void setConditionDetails(Expr *ConditionExpr)
OpenACCClauseKind getClauseKind() const
const Expr * getConditionExpr() const
SourceLocation getLParenLoc() const
void setIntExprDetails(llvm::SmallVector< Expr * > &&IntExprs)
void setVarListDetails(ArrayRef< Expr * > VarList)
void setVarListDetails(llvm::SmallVector< Expr * > &&VarList)
Expr * getConditionExpr()
ArrayRef< Expr * > getVarList() const
SourceLocation getBeginLoc() const
void setDefaultDetails(OpenACCDefaultClauseKind DefKind)
ArrayRef< Expr * > getVarList()
unsigned getNumIntExprs() const
void setEndLoc(SourceLocation EndLoc)
ArrayRef< Expr * > getIntExprs() const
void setIntExprDetails(ArrayRef< Expr * > IntExprs)
OpenACCDefaultClauseKind getDefaultClauseKind() const
ExprResult ActOnVar(Expr *VarExpr)
Called when encountering a 'var' for OpenACC, ensures it is actually a declaration reference to a var...
ExprResult ActOnIntExpr(OpenACCDirectiveKind DK, OpenACCClauseKind CK, SourceLocation Loc, Expr *IntExpr)
Called when encountering an 'int-expr' for OpenACC, and manages conversions and diagnostics to 'int'.
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OpenACCClause * > Clauses, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
OpenACCClause * ActOnClause(ArrayRef< const OpenACCClause * > ExistingClauses, OpenACCParsedClause &Clause)
Called after parsing an OpenACC Clause so that it can be checked.
bool ActOnStartDeclDirective(OpenACCDirectiveKind K, SourceLocation StartLoc)
Called after the directive, including its clauses, have been parsed and parsing has consumed the 'ann...
bool ActOnStartStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc)
Called after the directive, including its clauses, have been parsed and parsing has consumed the 'ann...
DeclGroupRef ActOnEndDeclDirective()
Called after the directive has been completely parsed, including the declaration group or associated ...
void ActOnConstruct(OpenACCDirectiveKind K, SourceLocation StartLoc)
Called after the construct has been parsed, but clauses haven't been parsed.
StmtResult ActOnAssociatedStmt(OpenACCDirectiveKind K, StmtResult AssocStmt)
Called when we encounter an associated statement for our construct, this should check legality of the...
ExprResult ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, Expr *Length, SourceLocation RBLoc)
Checks and creates an Array Section used in an OpenACC construct/clause.
Sema - This implements semantic analysis and AST building for C.
Encodes a location in the source.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
void setEnd(SourceLocation e)
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...
@ Private
'private' clause, allowed on 'parallel', 'serial', 'loop', 'parallel loop', and 'serial loop' constru...
@ 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.
@ 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...