19#include "llvm/ADT/StringExtras.h"
20#include "llvm/Support/Casting.h"
29 case OpenACCDirectiveKind::Invalid:
33 case OpenACCDirectiveKind::Parallel:
34 case OpenACCDirectiveKind::Serial:
35 case OpenACCDirectiveKind::Kernels:
37 return S.
Diag(StartLoc, diag::err_acc_construct_appertainment) << K;
48 case OpenACCClauseKind::Default:
49 switch (DirectiveKind) {
50 case OpenACCDirectiveKind::Parallel:
51 case OpenACCDirectiveKind::Serial:
52 case OpenACCDirectiveKind::Kernels:
53 case OpenACCDirectiveKind::ParallelLoop:
54 case OpenACCDirectiveKind::SerialLoop:
55 case OpenACCDirectiveKind::KernelsLoop:
56 case OpenACCDirectiveKind::Data:
61 case OpenACCClauseKind::If:
62 switch (DirectiveKind) {
63 case OpenACCDirectiveKind::Parallel:
64 case OpenACCDirectiveKind::Serial:
65 case OpenACCDirectiveKind::Kernels:
66 case OpenACCDirectiveKind::Data:
67 case OpenACCDirectiveKind::EnterData:
68 case OpenACCDirectiveKind::ExitData:
69 case OpenACCDirectiveKind::HostData:
70 case OpenACCDirectiveKind::Init:
71 case OpenACCDirectiveKind::Shutdown:
72 case OpenACCDirectiveKind::Set:
73 case OpenACCDirectiveKind::Update:
74 case OpenACCDirectiveKind::Wait:
75 case OpenACCDirectiveKind::ParallelLoop:
76 case OpenACCDirectiveKind::SerialLoop:
77 case OpenACCDirectiveKind::KernelsLoop:
82 case OpenACCClauseKind::Self:
83 switch (DirectiveKind) {
84 case OpenACCDirectiveKind::Parallel:
85 case OpenACCDirectiveKind::Serial:
86 case OpenACCDirectiveKind::Kernels:
87 case OpenACCDirectiveKind::Update:
88 case OpenACCDirectiveKind::ParallelLoop:
89 case OpenACCDirectiveKind::SerialLoop:
90 case OpenACCDirectiveKind::KernelsLoop:
95 case OpenACCClauseKind::NumGangs:
96 case OpenACCClauseKind::NumWorkers:
97 case OpenACCClauseKind::VectorLength:
98 switch (DirectiveKind) {
99 case OpenACCDirectiveKind::Parallel:
100 case OpenACCDirectiveKind::Kernels:
101 case OpenACCDirectiveKind::ParallelLoop:
102 case OpenACCDirectiveKind::KernelsLoop:
107 case OpenACCClauseKind::FirstPrivate:
108 switch (DirectiveKind) {
109 case OpenACCDirectiveKind::Parallel:
110 case OpenACCDirectiveKind::Serial:
111 case OpenACCDirectiveKind::ParallelLoop:
112 case OpenACCDirectiveKind::SerialLoop:
117 case OpenACCClauseKind::Private:
118 switch (DirectiveKind) {
119 case OpenACCDirectiveKind::Parallel:
120 case OpenACCDirectiveKind::Serial:
121 case OpenACCDirectiveKind::Loop:
122 case OpenACCDirectiveKind::ParallelLoop:
123 case OpenACCDirectiveKind::SerialLoop:
124 case OpenACCDirectiveKind::KernelsLoop:
129 case OpenACCClauseKind::NoCreate:
130 switch (DirectiveKind) {
131 case OpenACCDirectiveKind::Parallel:
132 case OpenACCDirectiveKind::Serial:
133 case OpenACCDirectiveKind::Kernels:
134 case OpenACCDirectiveKind::Data:
135 case OpenACCDirectiveKind::ParallelLoop:
136 case OpenACCDirectiveKind::SerialLoop:
137 case OpenACCDirectiveKind::KernelsLoop:
142 case OpenACCClauseKind::Present:
143 switch (DirectiveKind) {
144 case OpenACCDirectiveKind::Parallel:
145 case OpenACCDirectiveKind::Serial:
146 case OpenACCDirectiveKind::Kernels:
147 case OpenACCDirectiveKind::Data:
148 case OpenACCDirectiveKind::Declare:
149 case OpenACCDirectiveKind::ParallelLoop:
150 case OpenACCDirectiveKind::SerialLoop:
151 case OpenACCDirectiveKind::KernelsLoop:
157 case OpenACCClauseKind::Copy:
158 case OpenACCClauseKind::PCopy:
159 case OpenACCClauseKind::PresentOrCopy:
160 switch (DirectiveKind) {
161 case OpenACCDirectiveKind::Parallel:
162 case OpenACCDirectiveKind::Serial:
163 case OpenACCDirectiveKind::Kernels:
164 case OpenACCDirectiveKind::Data:
165 case OpenACCDirectiveKind::Declare:
166 case OpenACCDirectiveKind::ParallelLoop:
167 case OpenACCDirectiveKind::SerialLoop:
168 case OpenACCDirectiveKind::KernelsLoop:
173 case OpenACCClauseKind::Attach:
174 switch (DirectiveKind) {
175 case OpenACCDirectiveKind::Parallel:
176 case OpenACCDirectiveKind::Serial:
177 case OpenACCDirectiveKind::Kernels:
178 case OpenACCDirectiveKind::Data:
179 case OpenACCDirectiveKind::EnterData:
180 case OpenACCDirectiveKind::ParallelLoop:
181 case OpenACCDirectiveKind::SerialLoop:
182 case OpenACCDirectiveKind::KernelsLoop:
187 case OpenACCClauseKind::DevicePtr:
188 switch (DirectiveKind) {
189 case OpenACCDirectiveKind::Parallel:
190 case OpenACCDirectiveKind::Serial:
191 case OpenACCDirectiveKind::Kernels:
192 case OpenACCDirectiveKind::Data:
193 case OpenACCDirectiveKind::Declare:
194 case OpenACCDirectiveKind::ParallelLoop:
195 case OpenACCDirectiveKind::SerialLoop:
196 case OpenACCDirectiveKind::KernelsLoop:
201 case OpenACCClauseKind::Async:
202 switch (DirectiveKind) {
203 case OpenACCDirectiveKind::Parallel:
204 case OpenACCDirectiveKind::Serial:
205 case OpenACCDirectiveKind::Kernels:
206 case OpenACCDirectiveKind::Data:
207 case OpenACCDirectiveKind::EnterData:
208 case OpenACCDirectiveKind::ExitData:
209 case OpenACCDirectiveKind::Set:
210 case OpenACCDirectiveKind::Update:
211 case OpenACCDirectiveKind::Wait:
212 case OpenACCDirectiveKind::ParallelLoop:
213 case OpenACCDirectiveKind::SerialLoop:
214 case OpenACCDirectiveKind::KernelsLoop:
219 case OpenACCClauseKind::Wait:
220 switch (DirectiveKind) {
221 case OpenACCDirectiveKind::Parallel:
222 case OpenACCDirectiveKind::Serial:
223 case OpenACCDirectiveKind::Kernels:
224 case OpenACCDirectiveKind::Data:
225 case OpenACCDirectiveKind::EnterData:
226 case OpenACCDirectiveKind::ExitData:
227 case OpenACCDirectiveKind::Update:
228 case OpenACCDirectiveKind::ParallelLoop:
229 case OpenACCDirectiveKind::SerialLoop:
230 case OpenACCDirectiveKind::KernelsLoop:
240 llvm_unreachable(
"Invalid clause kind");
243bool checkAlreadyHasClauseOfKind(
246 const auto *Itr = llvm::find_if(ExistingClauses, [&](
const OpenACCClause *
C) {
249 if (Itr != ExistingClauses.end()) {
250 S.
Diag(Clause.
getBeginLoc(), diag::err_acc_duplicate_clause_disallowed)
252 S.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
261bool checkValidAfterDeviceType(
269 case OpenACCClauseKind::Async:
270 case OpenACCClauseKind::Wait:
271 case OpenACCClauseKind::NumGangs:
272 case OpenACCClauseKind::NumWorkers:
273 case OpenACCClauseKind::VectorLength:
274 case OpenACCClauseKind::DType:
275 case OpenACCClauseKind::DeviceType:
278 S.
Diag(NewClause.
getBeginLoc(), diag::err_acc_clause_after_device_type)
280 S.
Diag(DeviceTypeClause.
getBeginLoc(), diag::note_acc_previous_clause_here);
303 if (
const auto *DevTypeClause =
304 llvm::find_if(ExistingClauses,
306 return isa<OpenACCDeviceTypeClause>(
C);
308 DevTypeClause != ExistingClauses.end()) {
309 if (checkValidAfterDeviceType(
310 *
this, *cast<OpenACCDeviceTypeClause>(*DevTypeClause), Clause))
330 if (checkAlreadyHasClauseOfKind(*
this, ExistingClauses, Clause))
348 if (checkAlreadyHasClauseOfKind(*
this, ExistingClauses, Clause))
359 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCSelfClause>);
360 if (Itr != ExistingClauses.end()) {
362 Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
384 if (checkAlreadyHasClauseOfKind(*
this, ExistingClauses, Clause))
392 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCIfClause>);
393 if (Itr != ExistingClauses.end()) {
395 Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
412 if (checkAlreadyHasClauseOfKind(*
this, ExistingClauses, Clause))
446 if (checkAlreadyHasClauseOfKind(*
this, ExistingClauses, Clause))
450 "Invalid number of expressions for NumWorkers");
465 if (checkAlreadyHasClauseOfKind(*
this, ExistingClauses, Clause))
469 "Invalid number of expressions for VectorLength");
484 if (checkAlreadyHasClauseOfKind(*
this, ExistingClauses, Clause))
488 "Invalid number of expressions for Async");
649 VarList.erase(std::remove_if(VarList.begin(), VarList.end(), [&](
Expr *E) {
650 return CheckVarIsPointerType(OpenACCClauseKind::Attach, E);
670 VarList.erase(std::remove_if(VarList.begin(), VarList.end(), [&](
Expr *E) {
671 return CheckVarIsPointerType(OpenACCClauseKind::DevicePtr, E);
734 Diag(StartLoc, diag::warn_acc_construct_unimplemented) << K;
749 "Only one of directive or clause kind should be provided");
758 unsigned getDiagKind()
const {
759 if (ClauseKind != OpenACCClauseKind::Invalid)
761 if (DirectiveKind != OpenACCDirectiveKind::Invalid)
769 : ICEConvertDiagnoser(
false,
772 DirectiveKind(DK), ClauseKind(CK), IntExpr(IntExpr) {}
781 return S.
Diag(
Loc, diag::err_acc_int_expr_requires_integer)
782 << getDiagKind() << ClauseKind << DirectiveKind <<
T;
787 return S.
Diag(
Loc, diag::err_acc_int_expr_incomplete_class_type)
794 return S.
Diag(
Loc, diag::err_acc_int_expr_explicit_conversion)
807 return S.
Diag(
Loc, diag::err_acc_int_expr_multiple_conversions) <<
T;
819 llvm_unreachable(
"conversion functions are permitted");
821 } IntExprDiagnoser(DK, CK, IntExpr);
824 Loc, IntExpr, IntExprDiagnoser);
828 IntExpr = IntExprResult.
get();
862 return Diag(VarExpr->
getExprLoc(), diag::err_acc_var_not_pointer_type)
874 while (isa<ArraySectionExpr, ArraySubscriptExpr>(CurVarExpr)) {
875 if (
auto *SubScrpt = dyn_cast<ArraySubscriptExpr>(CurVarExpr))
883 if (
const auto *DRE = dyn_cast<DeclRefExpr>(CurVarExpr)) {
884 if (isa<VarDecl, NonTypeTemplateParmDecl>(
885 DRE->getDecl()->getCanonicalDecl()))
890 if (
const auto *ME = dyn_cast<MemberExpr>(CurVarExpr)) {
891 if (isa<FieldDecl>(ME->getMemberDecl()->getCanonicalDecl()))
896 if (isa<CXXThisExpr>(CurVarExpr))
901 if (isa<DependentScopeDeclRefExpr, CXXDependentScopeMemberExpr>(CurVarExpr))
906 if (isa<RecoveryExpr>(CurVarExpr))
921 if (
Base->hasPlaceholderType() &&
922 !
Base->hasPlaceholderType(BuiltinType::ArraySection)) {
935 LowerBound =
Result.get();
937 if (Length && Length->getType()->isNonOverloadPlaceholderType()) {
951 if (!
Base->isTypeDependent()) {
958 Diag(
Base->getExprLoc(), diag::err_acc_typecheck_subarray_value)
959 <<
Base->getSourceRange());
963 Diag(
Base->getExprLoc(), diag::err_acc_subarray_function_type)
964 << ResultTy <<
Base->getSourceRange();
969 diag::err_acc_subarray_incomplete_type,
973 if (!
Base->hasPlaceholderType(BuiltinType::ArraySection)) {
984 return Recovery.
isUsable() ? Recovery.
get() :
nullptr;
999 if (Length && !Length->isTypeDependent()) {
1002 Length->getExprLoc(), Length);
1011 if (!Length && (OriginalBaseTy.
isNull() ||
1016 Diag(ColonLoc, diag::err_acc_subarray_no_length) << IsArray;
1022 Length = Recovery.
isUsable() ? Recovery.
get() :
nullptr;
1033 std::optional<llvm::APSInt> BaseSize;
1036 BaseSize = ArrayTy->
getSize();
1039 auto GetBoundValue = [&](
Expr *E) -> std::optional<llvm::APSInt> {
1041 return std::nullopt;
1045 return std::nullopt;
1049 std::optional<llvm::APSInt> LowerBoundValue = GetBoundValue(LowerBound);
1050 std::optional<llvm::APSInt> LengthValue = GetBoundValue(Length);
1053 if (LowerBoundValue.has_value()) {
1054 if (LowerBoundValue->isNegative()) {
1056 << 0 <<
toString(*LowerBoundValue, 10);
1057 LowerBoundValue.reset();
1058 LowerBound = GetRecovery(LowerBound, LowerBound->
getType());
1059 }
else if (BaseSize.has_value() &&
1060 llvm::APSInt::compareValues(*LowerBoundValue, *BaseSize) >= 0) {
1062 Diag(LowerBound->
getExprLoc(), diag::err_acc_subarray_out_of_range)
1063 << 0 <<
toString(*LowerBoundValue, 10)
1065 LowerBoundValue.reset();
1066 LowerBound = GetRecovery(LowerBound, LowerBound->
getType());
1071 if (LengthValue.has_value()) {
1072 if (LengthValue->isNegative()) {
1073 Diag(Length->getExprLoc(), diag::err_acc_subarray_negative)
1074 << 1 <<
toString(*LengthValue, 10);
1075 LengthValue.reset();
1076 Length = GetRecovery(Length, Length->getType());
1077 }
else if (BaseSize.has_value() &&
1078 llvm::APSInt::compareValues(*LengthValue, *BaseSize) > 0) {
1080 Diag(Length->getExprLoc(), diag::err_acc_subarray_out_of_range)
1083 LengthValue.reset();
1084 Length = GetRecovery(Length, Length->getType());
1089 auto AddAPSInt = [](llvm::APSInt LHS, llvm::APSInt RHS) -> llvm::APSInt {
1090 if (LHS.isSigned() == RHS.isSigned())
1093 unsigned Width = std::max(LHS.getBitWidth(), RHS.getBitWidth()) + 1;
1094 return llvm::APSInt(LHS.sext(Width) + RHS.sext(Width),
true);
1099 if (BaseSize.has_value() && LowerBoundValue.has_value() &&
1100 LengthValue.has_value() &&
1101 llvm::APSInt::compareValues(AddAPSInt(*LowerBoundValue, *LengthValue),
1104 diag::err_acc_subarray_base_plus_length_out_of_range)
1109 LowerBoundValue.reset();
1110 LowerBound = GetRecovery(LowerBound, LowerBound->
getType());
1111 LengthValue.reset();
1112 Length = GetRecovery(Length, Length->getType());
1117 if (
Base->isTypeDependent() ||
1119 (Length && Length->isInstantiationDependent()))
1122 return new (Context)
1129 return diagnoseConstructAppertainment(*
this, K, StartLoc,
true);
1148 AssocStmt.
isUsable() ? AssocStmt.
get() :
nullptr);
1150 llvm_unreachable(
"Unhandled case in directive handling?");
1157 llvm_unreachable(
"Unimplemented associated statement application");
1172 llvm_unreachable(
"Invalid associated statement application");
1177 return diagnoseConstructAppertainment(*
this, K, StartLoc,
false);
Defines some OpenACC-specific enums and functions.
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
This file declares semantic analysis for OpenACC constructs and clauses.
This file defines OpenACC AST classes for statement-level contructs.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const ConstantArrayType * getAsConstantArrayType(QualType T) const
CanQualType ArraySectionTy
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
static QualType getBaseOriginalType(const Expr *Base)
Return original type of the base expression for array section.
QualType getElementType() const
Represents a C++ conversion function within a class.
llvm::APInt getSize() const
Return the constant array size as an APInt.
SourceLocation getLocation() const
This represents one expression.
bool EvaluateAsInt(EvalResult &Result, const ASTContext &Ctx, SideEffectsKind AllowSideEffects=SE_NoSideEffects, bool InConstantContext=false) const
EvaluateAsInt - Return true if this is a constant which we can fold and convert to an integer,...
bool isTypeDependent() const
Determines whether the type of this expression depends on.
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
bool containsErrors() const
Whether this expression contains subexpressions which had errors, e.g.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
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)
This is the base type for all OpenACC Clauses.
OpenACCClauseKind getClauseKind() const
SourceLocation getBeginLoc() const
static OpenACCComputeConstruct * Create(const ASTContext &C, OpenACCDirectiveKind K, SourceLocation BeginLoc, SourceLocation EndLoc, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsReadOnly, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
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)
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 OpenACCFirstPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCIfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
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 OpenACCNumWorkersClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCSelfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCVectorLengthClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCWaitClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef< Expr * > QueueIdExprs, SourceLocation EndLoc)
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
A generic diagnostic builder for errors which may or may not be deferred.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
ASTContext & getASTContext() const
A type to represent all the data for an OpenACC Clause that has been parsed, but not yet created/sema...
ArrayRef< Expr * > getIntExprs()
ArrayRef< Expr * > getQueueIdExprs() const
OpenACCDirectiveKind getDirectiveKind() const
SourceLocation getEndLoc() const
OpenACCClauseKind getClauseKind() const
const Expr * getConditionExpr() const
SourceLocation getLParenLoc() const
ArrayRef< DeviceTypeArgument > getDeviceTypeArchitectures() const
SourceLocation getBeginLoc() const
SourceLocation getQueuesLoc() const
void setVarListDetails(ArrayRef< Expr * > VarList, bool IsReadOnly, bool IsZero)
Expr * getDevNumExpr() const
ArrayRef< Expr * > getVarList()
unsigned getNumIntExprs() const
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 CheckVarIsPointerType(OpenACCClauseKind ClauseKind, Expr *VarExpr)
Called to check the 'var' type is a variable of pointer type, necessary for 'deviceptr' and 'attach' ...
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.
ExprResult PerformContextualImplicitConversion(SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter)
Perform a contextual implicit conversion.
ExprResult DefaultFunctionArrayLvalueConversion(Expr *E, bool Diagnose=true)
ExprResult DefaultLvalueConversion(Expr *E)
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
Encodes a location in the source.
SourceLocation getEndLoc() const LLVM_READONLY
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
SourceLocation getBeginLoc() const LLVM_READONLY
bool isDependentSizedArrayType() const
bool isConstantArrayType() const
bool isPointerType() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
bool isEnumeralType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isNonOverloadPlaceholderType() const
Test for a placeholder type other than Overload; see BuiltinType::isNonOverloadPlaceholderType.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type.
bool isFunctionType() const
bool isAnyPointerType() const
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
The JSON file list parser is used to communicate input to InstallAPI.
OpenACCClauseKind
Represents the kind of an OpenACC clause.
@ 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...
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ 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'.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ CopyOut
'copyout' clause, allowed on Compute and Combined constructs, plus 'data', 'exit data',...
@ 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',...
@ NumWorkers
'num_workers' clause, allowed on 'parallel', 'kernels', parallel loop', and 'kernels loop' constructs...
@ PresentOrCopyIn
'copyin' clause alias 'present_or_copyin'.
bool isOpenACCComputeDirectiveKind(OpenACCDirectiveKind K)
@ OK_Ordinary
An ordinary object is located at an address in memory.
@ Result
The result type of a method or function.
@ Invalid
Not a valid option.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
const FunctionProtoType * T
EvalResult is a struct with detailed info about an evaluated expression.
APValue Val
Val - This is the value the expression can be folded to.