clang 19.0.0git
SemaOpenACC.cpp
Go to the documentation of this file.
1//===--- SemaOpenACC.cpp - Semantic Analysis for OpenACC constructs -------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8/// \file
9/// This file implements semantic analysis for OpenACC constructs and
10/// clauses.
11///
12//===----------------------------------------------------------------------===//
13
18#include "clang/Sema/Sema.h"
19#include "llvm/Support/Casting.h"
20
21using namespace clang;
22
23namespace {
24bool diagnoseConstructAppertainment(SemaOpenACC &S, OpenACCDirectiveKind K,
25 SourceLocation StartLoc, bool IsStmt) {
26 switch (K) {
27 default:
28 case OpenACCDirectiveKind::Invalid:
29 // Nothing to do here, both invalid and unimplemented don't really need to
30 // do anything.
31 break;
32 case OpenACCDirectiveKind::Parallel:
33 case OpenACCDirectiveKind::Serial:
34 case OpenACCDirectiveKind::Kernels:
35 if (!IsStmt)
36 return S.Diag(StartLoc, diag::err_acc_construct_appertainment) << K;
37 break;
38 }
39 return false;
40}
41
42bool doesClauseApplyToDirective(OpenACCDirectiveKind DirectiveKind,
43 OpenACCClauseKind ClauseKind) {
44 switch (ClauseKind) {
45 // FIXME: For each clause as we implement them, we can add the
46 // 'legalization' list here.
47 case OpenACCClauseKind::Default:
48 switch (DirectiveKind) {
49 case OpenACCDirectiveKind::Parallel:
50 case OpenACCDirectiveKind::Serial:
51 case OpenACCDirectiveKind::Kernels:
52 case OpenACCDirectiveKind::ParallelLoop:
53 case OpenACCDirectiveKind::SerialLoop:
54 case OpenACCDirectiveKind::KernelsLoop:
55 case OpenACCDirectiveKind::Data:
56 return true;
57 default:
58 return false;
59 }
60 case OpenACCClauseKind::If:
61 switch (DirectiveKind) {
62 case OpenACCDirectiveKind::Parallel:
63 case OpenACCDirectiveKind::Serial:
64 case OpenACCDirectiveKind::Kernels:
65 case OpenACCDirectiveKind::Data:
66 case OpenACCDirectiveKind::EnterData:
67 case OpenACCDirectiveKind::ExitData:
68 case OpenACCDirectiveKind::HostData:
69 case OpenACCDirectiveKind::Init:
70 case OpenACCDirectiveKind::Shutdown:
71 case OpenACCDirectiveKind::Set:
72 case OpenACCDirectiveKind::Update:
73 case OpenACCDirectiveKind::Wait:
74 case OpenACCDirectiveKind::ParallelLoop:
75 case OpenACCDirectiveKind::SerialLoop:
76 case OpenACCDirectiveKind::KernelsLoop:
77 return true;
78 default:
79 return false;
80 }
81 case OpenACCClauseKind::Self:
82 switch (DirectiveKind) {
83 case OpenACCDirectiveKind::Parallel:
84 case OpenACCDirectiveKind::Serial:
85 case OpenACCDirectiveKind::Kernels:
86 case OpenACCDirectiveKind::Update:
87 case OpenACCDirectiveKind::ParallelLoop:
88 case OpenACCDirectiveKind::SerialLoop:
89 case OpenACCDirectiveKind::KernelsLoop:
90 return true;
91 default:
92 return false;
93 }
94 case OpenACCClauseKind::NumGangs:
95 case OpenACCClauseKind::NumWorkers:
96 case OpenACCClauseKind::VectorLength:
97 switch (DirectiveKind) {
98 case OpenACCDirectiveKind::Parallel:
99 case OpenACCDirectiveKind::Kernels:
100 case OpenACCDirectiveKind::ParallelLoop:
101 case OpenACCDirectiveKind::KernelsLoop:
102 return true;
103 default:
104 return false;
105 }
106 case OpenACCClauseKind::Private:
107 switch (DirectiveKind) {
108 case OpenACCDirectiveKind::Parallel:
109 case OpenACCDirectiveKind::Serial:
110 case OpenACCDirectiveKind::Loop:
111 case OpenACCDirectiveKind::ParallelLoop:
112 case OpenACCDirectiveKind::SerialLoop:
113 case OpenACCDirectiveKind::KernelsLoop:
114 return true;
115 default:
116 return false;
117 }
118 default:
119 // Do nothing so we can go to the 'unimplemented' diagnostic instead.
120 return true;
121 }
122 llvm_unreachable("Invalid clause kind");
123}
124
125bool checkAlreadyHasClauseOfKind(
128 const auto *Itr = llvm::find_if(ExistingClauses, [&](const OpenACCClause *C) {
129 return C->getClauseKind() == Clause.getClauseKind();
130 });
131 if (Itr != ExistingClauses.end()) {
132 S.Diag(Clause.getBeginLoc(), diag::err_acc_duplicate_clause_disallowed)
133 << Clause.getDirectiveKind() << Clause.getClauseKind();
134 S.Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
135 return true;
136 }
137 return false;
138}
139
140} // namespace
141
143
146 OpenACCParsedClause &Clause) {
148 return nullptr;
149
150 // Diagnose that we don't support this clause on this directive.
151 if (!doesClauseApplyToDirective(Clause.getDirectiveKind(),
152 Clause.getClauseKind())) {
153 Diag(Clause.getBeginLoc(), diag::err_acc_clause_appertainment)
154 << Clause.getDirectiveKind() << Clause.getClauseKind();
155 return nullptr;
156 }
157
158 switch (Clause.getClauseKind()) {
160 // Restrictions only properly implemented on 'compute' constructs, and
161 // 'compute' constructs are the only construct that can do anything with
162 // this yet, so skip/treat as unimplemented in this case.
164 break;
165
166 // Don't add an invalid clause to the AST.
168 return nullptr;
169
170 // OpenACC 3.3, Section 2.5.4:
171 // At most one 'default' clause may appear, and it must have a value of
172 // either 'none' or 'present'.
173 // Second half of the sentence is diagnosed during parsing.
174 if (checkAlreadyHasClauseOfKind(*this, ExistingClauses, Clause))
175 return nullptr;
176
178 getASTContext(), Clause.getDefaultClauseKind(), Clause.getBeginLoc(),
179 Clause.getLParenLoc(), Clause.getEndLoc());
180 }
181
183 // Restrictions only properly implemented on 'compute' constructs, and
184 // 'compute' constructs are the only construct that can do anything with
185 // this yet, so skip/treat as unimplemented in this case.
187 break;
188
189 // There is no prose in the standard that says duplicates aren't allowed,
190 // but this diagnostic is present in other compilers, as well as makes
191 // sense.
192 if (checkAlreadyHasClauseOfKind(*this, ExistingClauses, Clause))
193 return nullptr;
194
195 // The parser has ensured that we have a proper condition expr, so there
196 // isn't really much to do here.
197
198 // If the 'if' clause is true, it makes the 'self' clause have no effect,
199 // diagnose that here.
200 // TODO OpenACC: When we add these two to other constructs, we might not
201 // want to warn on this (for example, 'update').
202 const auto *Itr =
203 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCSelfClause>);
204 if (Itr != ExistingClauses.end()) {
205 Diag(Clause.getBeginLoc(), diag::warn_acc_if_self_conflict);
206 Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
207 }
208
210 getASTContext(), Clause.getBeginLoc(), Clause.getLParenLoc(),
211 Clause.getConditionExpr(), Clause.getEndLoc());
212 }
213
215 // Restrictions only properly implemented on 'compute' constructs, and
216 // 'compute' constructs are the only construct that can do anything with
217 // this yet, so skip/treat as unimplemented in this case.
219 break;
220
221 // TODO OpenACC: When we implement this for 'update', this takes a
222 // 'var-list' instead of a condition expression, so semantics/handling has
223 // to happen differently here.
224
225 // There is no prose in the standard that says duplicates aren't allowed,
226 // but this diagnostic is present in other compilers, as well as makes
227 // sense.
228 if (checkAlreadyHasClauseOfKind(*this, ExistingClauses, Clause))
229 return nullptr;
230
231 // If the 'if' clause is true, it makes the 'self' clause have no effect,
232 // diagnose that here.
233 // TODO OpenACC: When we add these two to other constructs, we might not
234 // want to warn on this (for example, 'update').
235 const auto *Itr =
236 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCIfClause>);
237 if (Itr != ExistingClauses.end()) {
238 Diag(Clause.getBeginLoc(), diag::warn_acc_if_self_conflict);
239 Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
240 }
241
243 getASTContext(), Clause.getBeginLoc(), Clause.getLParenLoc(),
244 Clause.getConditionExpr(), Clause.getEndLoc());
245 }
247 // Restrictions only properly implemented on 'compute' constructs, and
248 // 'compute' constructs are the only construct that can do anything with
249 // this yet, so skip/treat as unimplemented in this case.
251 break;
252
253 // There is no prose in the standard that says duplicates aren't allowed,
254 // but this diagnostic is present in other compilers, as well as makes
255 // sense.
256 if (checkAlreadyHasClauseOfKind(*this, ExistingClauses, Clause))
257 return nullptr;
258
259 if (Clause.getIntExprs().empty())
260 Diag(Clause.getBeginLoc(), diag::err_acc_num_gangs_num_args)
261 << /*NoArgs=*/0;
262
263 unsigned MaxArgs =
266 ? 3
267 : 1;
268 if (Clause.getIntExprs().size() > MaxArgs)
269 Diag(Clause.getBeginLoc(), diag::err_acc_num_gangs_num_args)
270 << /*NoArgs=*/1 << Clause.getDirectiveKind() << MaxArgs
271 << Clause.getIntExprs().size();
272
273 // Create the AST node for the clause even if the number of expressions is
274 // incorrect.
276 getASTContext(), Clause.getBeginLoc(), Clause.getLParenLoc(),
277 Clause.getIntExprs(), Clause.getEndLoc());
278 break;
279 }
281 // Restrictions only properly implemented on 'compute' constructs, and
282 // 'compute' constructs are the only construct that can do anything with
283 // this yet, so skip/treat as unimplemented in this case.
285 break;
286
287 // There is no prose in the standard that says duplicates aren't allowed,
288 // but this diagnostic is present in other compilers, as well as makes
289 // sense.
290 if (checkAlreadyHasClauseOfKind(*this, ExistingClauses, Clause))
291 return nullptr;
292
293 assert(Clause.getIntExprs().size() == 1 &&
294 "Invalid number of expressions for NumWorkers");
296 getASTContext(), Clause.getBeginLoc(), Clause.getLParenLoc(),
297 Clause.getIntExprs()[0], Clause.getEndLoc());
298 }
300 // Restrictions only properly implemented on 'compute' constructs, and
301 // 'compute' constructs are the only construct that can do anything with
302 // this yet, so skip/treat as unimplemented in this case.
304 break;
305
306 // There is no prose in the standard that says duplicates aren't allowed,
307 // but this diagnostic is present in other compilers, as well as makes
308 // sense.
309 if (checkAlreadyHasClauseOfKind(*this, ExistingClauses, Clause))
310 return nullptr;
311
312 assert(Clause.getIntExprs().size() == 1 &&
313 "Invalid number of expressions for VectorLength");
315 getASTContext(), Clause.getBeginLoc(), Clause.getLParenLoc(),
316 Clause.getIntExprs()[0], Clause.getEndLoc());
317 }
319 // Restrictions only properly implemented on 'compute' constructs, and
320 // 'compute' constructs are the only construct that can do anything with
321 // this yet, so skip/treat as unimplemented in this case.
323 break;
324
325 // ActOnVar ensured that everything is a valid variable reference, so there
326 // really isn't anything to do here. GCC does some duplicate-finding, though
327 // it isn't apparent in the standard where this is justified.
328
330 getASTContext(), Clause.getBeginLoc(), Clause.getLParenLoc(),
331 Clause.getVarList(), Clause.getEndLoc());
332 }
333 default:
334 break;
335 }
336
337 Diag(Clause.getBeginLoc(), diag::warn_acc_clause_unimplemented)
338 << Clause.getClauseKind();
339 return nullptr;
340}
341
343 SourceLocation StartLoc) {
344 switch (K) {
346 // Nothing to do here, an invalid kind has nothing we can check here. We
347 // want to continue parsing clauses as far as we can, so we will just
348 // ensure that we can still work and don't check any construct-specific
349 // rules anywhere.
350 break;
354 // Nothing to do here, there is no real legalization that needs to happen
355 // here as these constructs do not take any arguments.
356 break;
357 default:
358 Diag(StartLoc, diag::warn_acc_construct_unimplemented) << K;
359 break;
360 }
361}
362
365 Expr *IntExpr) {
366
367 assert(((DK != OpenACCDirectiveKind::Invalid &&
371 "Only one of directive or clause kind should be provided");
372
373 class IntExprConverter : public Sema::ICEConvertDiagnoser {
374 OpenACCDirectiveKind DirectiveKind;
375 OpenACCClauseKind ClauseKind;
376 Expr *IntExpr;
377
378 public:
379 IntExprConverter(OpenACCDirectiveKind DK, OpenACCClauseKind CK,
380 Expr *IntExpr)
381 : ICEConvertDiagnoser(/*AllowScopedEnumerations=*/false,
382 /*Suppress=*/false,
383 /*SuppressConversion=*/true),
384 DirectiveKind(DK), ClauseKind(CK), IntExpr(IntExpr) {}
385
386 bool match(QualType T) override {
387 // OpenACC spec just calls this 'integer expression' as having an
388 // 'integer type', so fall back on C99's 'integer type'.
389 return T->isIntegerType();
390 }
392 QualType T) override {
393 if (ClauseKind != OpenACCClauseKind::Invalid)
394 return S.Diag(Loc, diag::err_acc_int_expr_requires_integer) <<
395 /*Clause=*/0 << ClauseKind << T;
396
397 return S.Diag(Loc, diag::err_acc_int_expr_requires_integer) <<
398 /*Directive=*/1 << DirectiveKind << T;
399 }
400
402 diagnoseIncomplete(Sema &S, SourceLocation Loc, QualType T) override {
403 return S.Diag(Loc, diag::err_acc_int_expr_incomplete_class_type)
404 << T << IntExpr->getSourceRange();
405 }
406
408 diagnoseExplicitConv(Sema &S, SourceLocation Loc, QualType T,
409 QualType ConvTy) override {
410 return S.Diag(Loc, diag::err_acc_int_expr_explicit_conversion)
411 << T << ConvTy;
412 }
413
414 SemaBase::SemaDiagnosticBuilder noteExplicitConv(Sema &S,
415 CXXConversionDecl *Conv,
416 QualType ConvTy) override {
417 return S.Diag(Conv->getLocation(), diag::note_acc_int_expr_conversion)
418 << ConvTy->isEnumeralType() << ConvTy;
419 }
420
422 diagnoseAmbiguous(Sema &S, SourceLocation Loc, QualType T) override {
423 return S.Diag(Loc, diag::err_acc_int_expr_multiple_conversions) << T;
424 }
425
427 noteAmbiguous(Sema &S, CXXConversionDecl *Conv, QualType ConvTy) override {
428 return S.Diag(Conv->getLocation(), diag::note_acc_int_expr_conversion)
429 << ConvTy->isEnumeralType() << ConvTy;
430 }
431
433 diagnoseConversion(Sema &S, SourceLocation Loc, QualType T,
434 QualType ConvTy) override {
435 llvm_unreachable("conversion functions are permitted");
436 }
437 } IntExprDiagnoser(DK, CK, IntExpr);
438
440 Loc, IntExpr, IntExprDiagnoser);
441 if (IntExprResult.isInvalid())
442 return ExprError();
443
444 IntExpr = IntExprResult.get();
445 if (!IntExpr->isTypeDependent() && !IntExpr->getType()->isIntegerType())
446 return ExprError();
447
448 // TODO OpenACC: Do we want to perform usual unary conversions here? When
449 // doing codegen we might find that is necessary, but skip it for now.
450 return IntExpr;
451}
452
454 // We still need to retain the array subscript/subarray exprs, so work on a
455 // copy.
456 Expr *CurVarExpr = VarExpr->IgnoreParenImpCasts();
457
458 // Sub-arrays/subscript-exprs are fine as long as the base is a
459 // VarExpr/MemberExpr. So strip all of those off.
460 while (isa<ArraySectionExpr, ArraySubscriptExpr>(CurVarExpr)) {
461 if (auto *SubScrpt = dyn_cast<ArraySubscriptExpr>(CurVarExpr))
462 CurVarExpr = SubScrpt->getBase()->IgnoreParenImpCasts();
463 else
464 CurVarExpr =
465 cast<ArraySectionExpr>(CurVarExpr)->getBase()->IgnoreParenImpCasts();
466 }
467
468 // References to a VarDecl are fine.
469 if (const auto *DRE = dyn_cast<DeclRefExpr>(CurVarExpr)) {
470 if (isa<VarDecl, NonTypeTemplateParmDecl>(
471 DRE->getDecl()->getCanonicalDecl()))
472 return VarExpr;
473 }
474
475 // A MemberExpr that references a Field is valid.
476 if (const auto *ME = dyn_cast<MemberExpr>(CurVarExpr)) {
477 if (isa<FieldDecl>(ME->getMemberDecl()->getCanonicalDecl()))
478 return VarExpr;
479 }
480
481 // Referring to 'this' is always OK.
482 if (isa<CXXThisExpr>(CurVarExpr))
483 return VarExpr;
484
485 // Nothing really we can do here, as these are dependent. So just return they
486 // are valid.
487 if (isa<DependentScopeDeclRefExpr, CXXDependentScopeMemberExpr>(CurVarExpr))
488 return VarExpr;
489
490 // There isn't really anything we can do in the case of a recovery expr, so
491 // skip the diagnostic rather than produce a confusing diagnostic.
492 if (isa<RecoveryExpr>(CurVarExpr))
493 return ExprError();
494
495 Diag(VarExpr->getExprLoc(), diag::err_acc_not_a_var_ref);
496 return ExprError();
497}
498
500 Expr *LowerBound,
501 SourceLocation ColonLoc,
502 Expr *Length,
503 SourceLocation RBLoc) {
504 ASTContext &Context = getASTContext();
505
506 // TODO OpenACC: We likely have to reproduce a lot of the same logic from the
507 // OMP version of this, but at the moment we don't have a good way to test it,
508 // so for now we'll just create the node.
509 return new (Context)
510 ArraySectionExpr(Base, LowerBound, Length, Context.ArraySectionTy,
511 VK_LValue, OK_Ordinary, ColonLoc, RBLoc);
512}
513
515 SourceLocation StartLoc) {
516 return diagnoseConstructAppertainment(*this, K, StartLoc, /*IsStmt=*/true);
517}
518
520 SourceLocation StartLoc,
521 SourceLocation EndLoc,
523 StmtResult AssocStmt) {
524 switch (K) {
525 default:
526 return StmtEmpty();
528 return StmtError();
532 // TODO OpenACC: Add clauses to the construct here.
534 getASTContext(), K, StartLoc, EndLoc, Clauses,
535 AssocStmt.isUsable() ? AssocStmt.get() : nullptr);
536 }
537 llvm_unreachable("Unhandled case in directive handling?");
538}
539
541 StmtResult AssocStmt) {
542 switch (K) {
543 default:
544 llvm_unreachable("Unimplemented associated statement application");
548 // There really isn't any checking here that could happen. As long as we
549 // have a statement to associate, this should be fine.
550 // OpenACC 3.3 Section 6:
551 // Structured Block: in C or C++, an executable statement, possibly
552 // compound, with a single entry at the top and a single exit at the
553 // bottom.
554 // FIXME: Should we reject DeclStmt's here? The standard isn't clear, and
555 // an interpretation of it is to allow this and treat the initializer as
556 // the 'structured block'.
557 return AssocStmt;
558 }
559 llvm_unreachable("Invalid associated statement application");
560}
561
563 SourceLocation StartLoc) {
564 return diagnoseConstructAppertainment(*this, K, StartLoc, /*IsStmt=*/false);
565}
566
Defines some OpenACC-specific enums and functions.
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 ...
Definition: ASTContext.h:182
CanQualType ArraySectionTy
Definition: ASTContext.h:1130
PtrTy get() const
Definition: Ownership.h:170
bool isInvalid() const
Definition: Ownership.h:166
bool isUsable() const
Definition: Ownership.h:168
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
Definition: Expr.h:6734
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2862
SourceLocation getLocation() const
Definition: DeclBase.h:445
This represents one expression.
Definition: Expr.h:110
bool isTypeDependent() const
Determines whether the type of this expression depends on.
Definition: Expr.h:192
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
Definition: Expr.cpp:3059
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Definition: Expr.cpp:277
QualType getType() const
Definition: Expr.h:142
This is the base type for all OpenACC Clauses.
Definition: OpenACCClause.h:22
static OpenACCComputeConstruct * Create(const ASTContext &C, OpenACCDirectiveKind K, SourceLocation BeginLoc, SourceLocation EndLoc, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
Definition: StmtOpenACC.cpp:27
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static OpenACCIfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, 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 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)
A (possibly-)qualified type.
Definition: Type.h:940
A generic diagnostic builder for errors which may or may not be deferred.
Definition: SemaBase.h:110
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
Definition: SemaBase.cpp:56
ASTContext & getASTContext() const
Definition: SemaBase.cpp:9
Sema & SemaRef
Definition: SemaBase.h:40
A type to represent all the data for an OpenACC Clause that has been parsed, but not yet created/sema...
Definition: SemaOpenACC.h:33
OpenACCDirectiveKind getDirectiveKind() const
Definition: SemaOpenACC.h:64
SourceLocation getEndLoc() const
Definition: SemaOpenACC.h:72
OpenACCClauseKind getClauseKind() const
Definition: SemaOpenACC.h:66
const Expr * getConditionExpr() const
Definition: SemaOpenACC.h:80
SourceLocation getLParenLoc() const
Definition: SemaOpenACC.h:70
SourceLocation getBeginLoc() const
Definition: SemaOpenACC.h:68
OpenACCDefaultClauseKind getDefaultClauseKind() const
Definition: SemaOpenACC.h:74
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.
Definition: Sema.h:457
ExprResult PerformContextualImplicitConversion(SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter)
Perform a contextual implicit conversion.
Encodes a location in the source.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition: Stmt.cpp:326
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
Definition: Type.h:7945
bool isEnumeralType() const
Definition: Type.h:7710
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.
Definition: OpenACCKinds.h:164
@ 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...
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ 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...
bool isOpenACCComputeDirectiveKind(OpenACCDirectiveKind K)
Definition: OpenACCKinds.h:149
@ OK_Ordinary
An ordinary object is located at an address in memory.
Definition: Specifiers.h:148
StmtResult StmtError()
Definition: Ownership.h:265
@ Invalid
Not a valid option.
OpenACCDirectiveKind
Definition: OpenACCKinds.h:25
ExprResult ExprError()
Definition: Ownership.h:264
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
Definition: Specifiers.h:136
const FunctionProtoType * T
StmtResult StmtEmpty()
Definition: Ownership.h:272