clang 24.0.0git
SemaOpenMP.h
Go to the documentation of this file.
1//===----- SemaOpenMP.h -- Semantic Analysis for OpenMP 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 declares semantic analysis for OpenMP constructs and
10/// clauses.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_SEMA_SEMAOPENMP_H
15#define LLVM_CLANG_SEMA_SEMAOPENMP_H
16
17#include "clang/AST/ASTFwd.h"
18#include "clang/AST/Attr.h"
24#include "clang/Basic/LLVM.h"
28#include "clang/Sema/DeclSpec.h"
30#include "clang/Sema/SemaBase.h"
31#include "llvm/ADT/DenseMap.h"
32#include "llvm/Frontend/OpenMP/OMP.h.inc"
33#include "llvm/Frontend/OpenMP/OMPConstants.h"
34#include <array>
35#include <optional>
36#include <string>
37#include <utility>
38
39namespace clang {
40namespace sema {
42} // namespace sema
43
44class DeclContext;
45class DeclGroupRef;
47class ParsedAttr;
48class Scope;
49
50class SemaOpenMP : public SemaBase {
51public:
52 SemaOpenMP(Sema &S);
53
54 friend class Parser;
55 friend class Sema;
56
58 using CapturedParamNameType = std::pair<StringRef, QualType>;
59
60 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
61 /// context is "used as device code".
62 ///
63 /// - If CurContext is a `declare target` function or it is known that the
64 /// function is emitted for the device, emits the diagnostics immediately.
65 /// - If CurContext is a non-`declare target` function and we are compiling
66 /// for the device, creates a diagnostic which is emitted if and when we
67 /// realize that the function will be codegen'ed.
68 ///
69 /// Example usage:
70 ///
71 /// // Variable-length arrays are not allowed in NVPTX device code.
72 /// if (diagIfOpenMPDeviceCode(Loc, diag::err_vla_unsupported))
73 /// return ExprError();
74 /// // Otherwise, continue parsing as normal.
76 unsigned DiagID,
77 const FunctionDecl *FD);
78
79 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
80 /// context is "used as host code".
81 ///
82 /// - If CurContext is a `declare target` function or it is known that the
83 /// function is emitted for the host, emits the diagnostics immediately.
84 /// - If CurContext is a non-host function, just ignore it.
85 ///
86 /// Example usage:
87 ///
88 /// // Variable-length arrays are not allowed in NVPTX device code.
89 /// if (diagIfOpenMPHostode(Loc, diag::err_vla_unsupported))
90 /// return ExprError();
91 /// // Otherwise, continue parsing as normal.
93 unsigned DiagID,
94 const FunctionDecl *FD);
95
96 /// The declarator \p D defines a function in the scope \p S which is nested
97 /// in an `omp begin/end declare variant` scope. In this method we create a
98 /// declaration for \p D and rename \p D according to the OpenMP context
99 /// selector of the surrounding scope. Return all base functions in \p Bases.
101 Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists,
103
104 /// Register \p D as specialization of all base functions in \p Bases in the
105 /// current `omp begin/end declare variant` scope.
108
109 /// Act on \p D, a function definition inside of an `omp [begin/end] assumes`.
111
112 /// Can we exit an OpenMP declare variant scope at the moment.
114 return !OMPDeclareVariantScopes.empty();
115 }
116
119 bool StrictlyPositive = true,
120 bool SuppressExprDiags = false);
121
122 /// Given the potential call expression \p Call, determine if there is a
123 /// specialization via the OpenMP declare variant mechanism available. If
124 /// there is, return the specialized call expression, otherwise return the
125 /// original \p Call.
127 SourceLocation LParenLoc, MultiExprArg ArgExprs,
128 SourceLocation RParenLoc, Expr *ExecConfig);
129
130 /// Handle a `omp begin declare variant`.
132
133 /// Handle a `omp end declare variant`.
135
136 /// Function tries to capture lambda's captured variables in the OpenMP region
137 /// before the original lambda is captured.
139
140 /// Return true if the provided declaration \a VD should be captured by
141 /// reference.
142 /// \param Level Relative level of nested OpenMP construct for that the check
143 /// is performed.
144 /// \param OpenMPCaptureLevel Capture level within an OpenMP construct.
145 bool isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level,
146 unsigned OpenMPCaptureLevel) const;
147
148 /// Check if the specified variable is used in one of the private
149 /// clauses (private, firstprivate, lastprivate, reduction etc.) in OpenMP
150 /// constructs.
151 VarDecl *isOpenMPCapturedDecl(ValueDecl *D, bool CheckScopeInfo = false,
152 unsigned StopAt = 0);
153
154 /// The member expression(this->fd) needs to be rebuilt in the template
155 /// instantiation to generate private copy for OpenMP when default
156 /// clause is used. The function will return true if default
157 /// cluse is used.
159
162
163 /// If the current region is a loop-based region, mark the start of the loop
164 /// construct.
165 void startOpenMPLoop();
166
167 /// If the current region is a range loop-based region, mark the start of the
168 /// loop construct.
170
171 /// Check if the specified variable is used in 'private' clause.
172 /// \param Level Relative level of nested OpenMP construct for that the check
173 /// is performed.
175 unsigned CapLevel) const;
176
177 /// Sets OpenMP capture kind (OMPC_private, OMPC_firstprivate, OMPC_map etc.)
178 /// for \p FD based on DSA for the provided corresponding captured declaration
179 /// \p D.
180 void setOpenMPCaptureKind(FieldDecl *FD, const ValueDecl *D, unsigned Level);
181
182 /// Check if the specified variable is captured by 'target' directive.
183 /// \param Level Relative level of nested OpenMP construct for that the check
184 /// is performed.
185 bool isOpenMPTargetCapturedDecl(const ValueDecl *D, unsigned Level,
186 unsigned CaptureLevel) const;
187
188 /// Check if the specified global variable must be captured by outer capture
189 /// regions.
190 /// \param Level Relative level of nested OpenMP construct for that
191 /// the check is performed.
192 bool isOpenMPGlobalCapturedDecl(ValueDecl *D, unsigned Level,
193 unsigned CaptureLevel) const;
194
196 Expr *Op);
197 /// Called on start of new data sharing attribute block.
199 const DeclarationNameInfo &DirName, Scope *CurScope,
200 SourceLocation Loc);
201 /// Start analysis of clauses.
203 /// End analysis of clauses.
204 void EndOpenMPClause();
205 /// Called on end of data sharing attribute block.
206 void EndOpenMPDSABlock(Stmt *CurDirective);
207
208 /// Check if the current region is an OpenMP loop region and if it is,
209 /// mark loop control variable, used in \p Init for loop initialization, as
210 /// private by default.
211 /// \param Init First part of the for loop.
213
214 /// Called for metadirectives with user conditions that require runtime
215 /// selection. \p Variants holds one complete directive (or the plain
216 /// associated statement) per entry of \p TraitInfos.
218 SourceLocation EndLoc,
219 ArrayRef<OMPTraitInfo *> TraitInfos,
220 ArrayRef<Stmt *> Variants);
221
222 // OpenMP directives and clauses.
223 /// Called on correct id-expression from the '#pragma omp
224 /// threadprivate'.
226 const DeclarationNameInfo &Id,
228 /// Called on well-formed '#pragma omp threadprivate'.
230 ArrayRef<Expr *> VarList);
231 /// Builds a new OpenMPThreadPrivateDecl and checks its correctness.
233 ArrayRef<Expr *> VarList);
234 /// Called on well-formed '#pragma omp groupprivate'.
236 ArrayRef<Expr *> VarList);
237 /// Builds a new OpenMPGroupPrivateDecl and checks its correctness.
239 ArrayRef<Expr *> VarList);
240 /// Called on well-formed '#pragma omp allocate'.
242 ArrayRef<Expr *> VarList,
243 ArrayRef<OMPClause *> Clauses,
244 DeclContext *Owner = nullptr);
245
246 /// Called on well-formed '#pragma omp [begin] assume[s]'.
249 ArrayRef<std::string> Assumptions,
250 bool SkippedClauses);
251
252 /// Check if there is an active global `omp begin assumes` directive.
253 bool isInOpenMPAssumeScope() const { return !OMPAssumeScoped.empty(); }
254
255 /// Check if there is an active global `omp assumes` directive.
256 bool hasGlobalOpenMPAssumes() const { return !OMPAssumeGlobal.empty(); }
257
258 /// Called on well-formed '#pragma omp end assumes'.
260
261 /// Called on well-formed '#pragma omp requires'.
263 ArrayRef<OMPClause *> ClauseList);
264
265 /// Registers a 'requires' directive deserialized from an AST file.
267
268 /// The 'requires' directives seen so far in this translation unit.
270 /// Check restrictions on Requires directive
272 ArrayRef<OMPClause *> Clauses);
273 /// Check if the specified type is allowed to be used in 'omp declare
274 /// reduction' construct.
277 /// Called on start of '#pragma omp declare reduction'.
279 Scope *S, DeclContext *DC, DeclarationName Name,
280 ArrayRef<std::pair<QualType, SourceLocation>> ReductionTypes,
281 AccessSpecifier AS, Decl *PrevDeclInScope = nullptr);
282 /// Initialize declare reduction construct initializer.
284 /// Finish current declare reduction construct initializer.
286 /// Initialize declare reduction construct initializer.
287 /// \return omp_priv variable.
289 /// Finish current declare reduction construct initializer.
291 VarDecl *OmpPrivParm);
292 /// Called at the end of '#pragma omp declare reduction'.
294 Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid);
295
296 /// Check variable declaration in 'omp declare mapper' construct.
298 /// Check if the specified type is allowed to be used in 'omp declare
299 /// mapper' construct.
302 /// Called for '#pragma omp declare mapper'.
304 Scope *S, DeclContext *DC, DeclarationName Name, QualType MapperType,
306 Expr *MapperVarRef, ArrayRef<OMPClause *> Clauses,
307 Decl *PrevDeclInScope = nullptr);
308 /// Build the mapper variable of '#pragma omp declare mapper'.
310 QualType MapperType,
311 SourceLocation StartLoc,
312 DeclarationName VN);
314 bool isOpenMPDeclareMapperVarDeclAllowed(const VarDecl *VD) const;
316
318 struct MapInfo {
319 OMPDeclareTargetDeclAttr::MapTypeTy MT;
321 };
322 /// Explicitly listed variables and functions in a 'to' or 'link' clause.
323 llvm::DenseMap<NamedDecl *, MapInfo> ExplicitlyMapped;
324
325 /// The 'device_type' as parsed from the clause.
326 OMPDeclareTargetDeclAttr::DevTypeTy DT = OMPDeclareTargetDeclAttr::DT_Any;
327
328 /// The directive kind, `begin declare target` or `declare target`.
330
331 /// The directive with indirect clause.
332 std::optional<Expr *> Indirect;
333
334 /// The directive location.
336
339 };
340
341 /// Called on the start of target region i.e. '#pragma omp declare target'.
342 bool ActOnStartOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI);
343
344 /// Called at the end of target region i.e. '#pragma omp end declare target'.
345 const DeclareTargetContextInfo ActOnOpenMPEndDeclareTargetDirective();
346
347 /// Called once a target context is completed, that can be when a
348 /// '#pragma omp end declare target' was encountered or when a
349 /// '#pragma omp declare target' without declaration-definition-seq was
350 /// encountered.
351 void ActOnFinishedOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI);
352
353 /// Report unterminated 'omp declare target' or 'omp begin declare target' at
354 /// the end of a compilation unit.
356
357 /// Searches for the provided declaration name for OpenMP declare target
358 /// directive.
360 CXXScopeSpec &ScopeSpec,
361 const DeclarationNameInfo &Id);
362
363 /// Called on correct id-expression from the '#pragma omp declare target'.
365 OMPDeclareTargetDeclAttr::MapTypeTy MT,
366 DeclareTargetContextInfo &DTCI);
367
368 /// Check declaration inside target region.
369 void
372
373 /// Adds OMPDeclareTargetDeclAttr to referenced variables in declare target
374 /// directive.
376
377 /// Finishes analysis of the deferred functions calls that may be declared as
378 /// host/nohost during device/host compilation.
380 const FunctionDecl *Callee,
381 SourceLocation Loc);
382
383 /// Return true if currently in OpenMP task with untied clause context.
384 bool isInOpenMPTaskUntiedContext() const;
385
386 /// Return true inside OpenMP declare target region.
388 return !DeclareTargetNesting.empty();
389 }
390 /// Return true inside OpenMP target region.
392
393 /// Return the number of captured regions created for an OpenMP directive.
395
396 /// Initialization of captured region for OpenMP region.
397 void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope);
398
399 /// Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to
400 /// an OpenMP loop directive.
402
403 /// Process a canonical OpenMP loop nest that can either be a canonical
404 /// literal loop (ForStmt or CXXForRangeStmt), or the generated loop of an
405 /// OpenMP loop transformation construct.
407
408 /// End of OpenMP region.
409 ///
410 /// \param S Statement associated with the current OpenMP region.
411 /// \param Clauses List of clauses for the current OpenMP region.
412 ///
413 /// \returns Statement for finished OpenMP region.
416 OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName,
417 OpenMPDirectiveKind CancelRegion, ArrayRef<OMPClause *> Clauses,
418 Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc);
419 /// Process an OpenMP informational directive.
420 ///
421 /// \param Kind The directive kind.
422 /// \param DirName Declaration name info.
423 /// \param Clauses Array of clauses for directive.
424 /// \param AStmt The associated statement.
425 /// \param StartLoc The start location.
426 /// \param EndLoc The end location.
428 OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName,
429 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
430 SourceLocation EndLoc);
431 /// Process an OpenMP assume directive.
432 ///
433 /// \param Clauses Array of clauses for directive.
434 /// \param AStmt The associated statement.
435 /// \param StartLoc The start location.
436 /// \param EndLoc The end location.
438 Stmt *AStmt, SourceLocation StartLoc,
439 SourceLocation EndLoc);
440
441 /// Called on well-formed '\#pragma omp parallel' after parsing
442 /// of the associated statement.
444 Stmt *AStmt, SourceLocation StartLoc,
445 SourceLocation EndLoc);
447 llvm::SmallDenseMap<const ValueDecl *, const Expr *, 4>;
448 /// Called on well-formed '\#pragma omp simd' after parsing
449 /// of the associated statement.
452 SourceLocation StartLoc, SourceLocation EndLoc,
453 VarsWithInheritedDSAType &VarsWithImplicitDSA);
454 /// Called on well-formed '#pragma omp tile' after parsing of its clauses and
455 /// the associated statement.
457 Stmt *AStmt, SourceLocation StartLoc,
458 SourceLocation EndLoc);
460 Stmt *AStmt, SourceLocation StartLoc,
461 SourceLocation EndLoc);
462 /// Called on well-formed '#pragma omp unroll' after parsing of its clauses
463 /// and the associated statement.
465 Stmt *AStmt, SourceLocation StartLoc,
466 SourceLocation EndLoc);
467 /// Called on well-formed '#pragma omp reverse'.
469 SourceLocation EndLoc);
470 /// Called on well-formed '#pragma omp split' after parsing of its
471 /// associated statement.
473 Stmt *AStmt, SourceLocation StartLoc,
474 SourceLocation EndLoc);
475 /// Called on well-formed '#pragma omp interchange' after parsing of its
476 /// clauses and the associated statement.
478 Stmt *AStmt,
479 SourceLocation StartLoc,
480 SourceLocation EndLoc);
481
482 /// Called on well-formed '#pragma omp flatten' after parsing of its
483 /// clauses and the associated statement.
485 Stmt *AStmt, SourceLocation StartLoc,
486 SourceLocation EndLoc);
487
488 /// Called on well-formed '#pragma omp fuse' after parsing of its
489 /// clauses and the associated statement.
491 Stmt *AStmt, SourceLocation StartLoc,
492 SourceLocation EndLoc);
493
494 /// Called on well-formed '\#pragma omp for' after parsing
495 /// of the associated statement.
498 SourceLocation StartLoc, SourceLocation EndLoc,
499 VarsWithInheritedDSAType &VarsWithImplicitDSA);
500 /// Called on well-formed '\#pragma omp for simd' after parsing
501 /// of the associated statement.
504 SourceLocation StartLoc, SourceLocation EndLoc,
505 VarsWithInheritedDSAType &VarsWithImplicitDSA);
506 /// Called on well-formed '\#pragma omp sections' after parsing
507 /// of the associated statement.
509 Stmt *AStmt, SourceLocation StartLoc,
510 SourceLocation EndLoc);
511 /// Called on well-formed '\#pragma omp section' after parsing of the
512 /// associated statement.
514 SourceLocation EndLoc);
515 /// Called on well-formed '\#pragma omp scope' after parsing of the
516 /// associated statement.
518 Stmt *AStmt, SourceLocation StartLoc,
519 SourceLocation EndLoc);
520 /// Called on well-formed '\#pragma omp single' after parsing of the
521 /// associated statement.
523 Stmt *AStmt, SourceLocation StartLoc,
524 SourceLocation EndLoc);
525 /// Called on well-formed '\#pragma omp master' after parsing of the
526 /// associated statement.
528 SourceLocation EndLoc);
529 /// Called on well-formed '\#pragma omp critical' after parsing of the
530 /// associated statement.
532 ArrayRef<OMPClause *> Clauses,
533 Stmt *AStmt, SourceLocation StartLoc,
534 SourceLocation EndLoc);
535 /// Called on well-formed '\#pragma omp parallel for' after parsing
536 /// of the associated statement.
538 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
539 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
540 /// Called on well-formed '\#pragma omp parallel for simd' after
541 /// parsing of the associated statement.
543 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
544 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
545 /// Called on well-formed '\#pragma omp parallel master' after
546 /// parsing of the associated statement.
548 Stmt *AStmt,
549 SourceLocation StartLoc,
550 SourceLocation EndLoc);
551 /// Called on well-formed '\#pragma omp parallel masked' after
552 /// parsing of the associated statement.
554 Stmt *AStmt,
555 SourceLocation StartLoc,
556 SourceLocation EndLoc);
557 /// Called on well-formed '\#pragma omp parallel sections' after
558 /// parsing of the associated statement.
560 Stmt *AStmt,
561 SourceLocation StartLoc,
562 SourceLocation EndLoc);
563 /// Called on well-formed '\#pragma omp task' after parsing of the
564 /// associated statement.
566 Stmt *AStmt, SourceLocation StartLoc,
567 SourceLocation EndLoc);
568 /// Called on well-formed '\#pragma omp taskyield'.
570 SourceLocation EndLoc);
571 /// Called on well-formed '\#pragma omp error'.
572 /// Error direcitive is allowed in both declared and excutable contexts.
573 /// Adding InExContext to identify which context is called from.
575 SourceLocation StartLoc,
576 SourceLocation EndLoc,
577 bool InExContext = true);
578 /// Called on well-formed '\#pragma omp barrier'.
580 SourceLocation EndLoc);
581 /// Called on well-formed '\#pragma omp taskwait'.
583 SourceLocation StartLoc,
584 SourceLocation EndLoc);
585 /// Called on well-formed '\#pragma omp taskgroup'.
587 Stmt *AStmt, SourceLocation StartLoc,
588 SourceLocation EndLoc);
589 /// Called on well-formed '\#pragma omp flush'.
591 SourceLocation StartLoc,
592 SourceLocation EndLoc);
593 /// Called on well-formed '\#pragma omp depobj'.
595 SourceLocation StartLoc,
596 SourceLocation EndLoc);
597 /// Called on well-formed '\#pragma omp scan'.
599 SourceLocation StartLoc,
600 SourceLocation EndLoc);
601 /// Called on well-formed '\#pragma omp ordered' after parsing of the
602 /// associated statement.
604 Stmt *AStmt, SourceLocation StartLoc,
605 SourceLocation EndLoc);
606 /// Called on well-formed '\#pragma omp atomic' after parsing of the
607 /// associated statement.
609 Stmt *AStmt, SourceLocation StartLoc,
610 SourceLocation EndLoc);
611 /// Called on well-formed '\#pragma omp target' after parsing of the
612 /// associated statement.
614 Stmt *AStmt, SourceLocation StartLoc,
615 SourceLocation EndLoc);
616 /// Called on well-formed '\#pragma omp target data' after parsing of
617 /// the associated statement.
619 Stmt *AStmt,
620 SourceLocation StartLoc,
621 SourceLocation EndLoc);
622 /// Called on well-formed '\#pragma omp target enter data' after
623 /// parsing of the associated statement.
625 SourceLocation StartLoc,
626 SourceLocation EndLoc,
627 Stmt *AStmt);
628 /// Called on well-formed '\#pragma omp target exit data' after
629 /// parsing of the associated statement.
631 SourceLocation StartLoc,
632 SourceLocation EndLoc,
633 Stmt *AStmt);
634 /// Called on well-formed '\#pragma omp target parallel' after
635 /// parsing of the associated statement.
637 Stmt *AStmt,
638 SourceLocation StartLoc,
639 SourceLocation EndLoc);
640 /// Called on well-formed '\#pragma omp target parallel for' after
641 /// parsing of the associated statement.
643 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
644 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
645 /// Called on well-formed '\#pragma omp teams' after parsing of the
646 /// associated statement.
648 Stmt *AStmt, SourceLocation StartLoc,
649 SourceLocation EndLoc);
650 /// Called on well-formed '\#pragma omp teams loop' after parsing of the
651 /// associated statement.
653 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
654 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
655 /// Called on well-formed '\#pragma omp target teams loop' after parsing of
656 /// the associated statement.
658 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
659 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
660 /// Called on well-formed '\#pragma omp parallel loop' after parsing of the
661 /// associated statement.
663 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
664 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
665 /// Called on well-formed '\#pragma omp target parallel loop' after parsing
666 /// of the associated statement.
668 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
669 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
670 /// Called on well-formed '\#pragma omp cancellation point'.
673 SourceLocation EndLoc,
674 OpenMPDirectiveKind CancelRegion);
675 /// Called on well-formed '\#pragma omp cancel'.
677 SourceLocation StartLoc,
678 SourceLocation EndLoc,
679 OpenMPDirectiveKind CancelRegion);
680 /// Called on well-formed '\#pragma omp taskloop' after parsing of the
681 /// associated statement.
684 SourceLocation StartLoc, SourceLocation EndLoc,
685 VarsWithInheritedDSAType &VarsWithImplicitDSA);
686 /// Called on well-formed '\#pragma omp taskloop simd' after parsing of
687 /// the associated statement.
689 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
690 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
691 /// Called on well-formed '\#pragma omp master taskloop' after parsing of the
692 /// associated statement.
694 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
695 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
696 /// Called on well-formed '\#pragma omp master taskloop simd' after parsing of
697 /// the associated statement.
699 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
700 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
701 /// Called on well-formed '\#pragma omp parallel master taskloop' after
702 /// parsing of the associated statement.
704 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
705 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
706 /// Called on well-formed '\#pragma omp parallel master taskloop simd' after
707 /// parsing of the associated statement.
709 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
710 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
711 /// Called on well-formed '\#pragma omp masked taskloop' after parsing of the
712 /// associated statement.
714 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
715 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
716 /// Called on well-formed '\#pragma omp masked taskloop simd' after parsing of
717 /// the associated statement.
719 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
720 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
721 /// Called on well-formed '\#pragma omp parallel masked taskloop' after
722 /// parsing of the associated statement.
724 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
725 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
726 /// Called on well-formed '\#pragma omp parallel masked taskloop simd' after
727 /// parsing of the associated statement.
729 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
730 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
731 /// Called on well-formed '\#pragma omp distribute' after parsing
732 /// of the associated statement.
735 SourceLocation StartLoc, SourceLocation EndLoc,
736 VarsWithInheritedDSAType &VarsWithImplicitDSA);
737 /// Called on well-formed '\#pragma omp target update'.
739 SourceLocation StartLoc,
740 SourceLocation EndLoc,
741 Stmt *AStmt);
742 /// Called on well-formed '\#pragma omp distribute parallel for' after
743 /// parsing of the associated statement.
745 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
746 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
747 /// Called on well-formed '\#pragma omp distribute parallel for simd'
748 /// after parsing of the associated statement.
750 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
751 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
752 /// Called on well-formed '\#pragma omp distribute simd' after
753 /// parsing of the associated statement.
755 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
756 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
757 /// Called on well-formed '\#pragma omp target parallel for simd' after
758 /// parsing of the associated statement.
760 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
761 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
762 /// Called on well-formed '\#pragma omp target simd' after parsing of
763 /// the associated statement.
766 SourceLocation StartLoc, SourceLocation EndLoc,
767 VarsWithInheritedDSAType &VarsWithImplicitDSA);
768 /// Called on well-formed '\#pragma omp teams distribute' after parsing of
769 /// the associated statement.
771 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
772 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
773 /// Called on well-formed '\#pragma omp teams distribute simd' after parsing
774 /// of the associated statement.
776 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
777 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
778 /// Called on well-formed '\#pragma omp teams distribute parallel for simd'
779 /// after parsing of the associated statement.
781 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
782 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
783 /// Called on well-formed '\#pragma omp teams distribute parallel for'
784 /// after parsing of the associated statement.
786 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
787 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
788 /// Called on well-formed '\#pragma omp target teams' after parsing of the
789 /// associated statement.
791 Stmt *AStmt,
792 SourceLocation StartLoc,
793 SourceLocation EndLoc);
794 /// Called on well-formed '\#pragma omp target teams distribute' after parsing
795 /// of the associated statement.
797 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
798 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
799 /// Called on well-formed '\#pragma omp target teams distribute parallel for'
800 /// after parsing of the associated statement.
802 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
803 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
804 /// Called on well-formed '\#pragma omp target teams distribute parallel for
805 /// simd' after parsing of the associated statement.
807 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
808 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
809 /// Called on well-formed '\#pragma omp target teams distribute simd' after
810 /// parsing of the associated statement.
812 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
813 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
814 /// Called on well-formed '\#pragma omp interop'.
816 SourceLocation StartLoc,
817 SourceLocation EndLoc);
818 /// Called on well-formed '\#pragma omp dispatch' after parsing of the
819 // /associated statement.
821 Stmt *AStmt, SourceLocation StartLoc,
822 SourceLocation EndLoc);
823 /// Called on well-formed '\#pragma omp masked' after parsing of the
824 // /associated statement.
826 Stmt *AStmt, SourceLocation StartLoc,
827 SourceLocation EndLoc);
828
829 /// Called on well-formed '\#pragma omp loop' after parsing of the
830 /// associated statement.
832 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
833 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
834
835 /// Checks correctness of linear modifiers.
837 SourceLocation LinLoc);
838 /// Checks that the specified declaration matches requirements for the linear
839 /// decls.
842 bool IsDeclareSimd = false);
843
844 /// Called on well-formed '\#pragma omp declare simd' after parsing of
845 /// the associated method/function.
847 DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS,
848 Expr *Simdlen, ArrayRef<Expr *> Uniforms, ArrayRef<Expr *> Aligneds,
849 ArrayRef<Expr *> Alignments, ArrayRef<Expr *> Linears,
850 ArrayRef<unsigned> LinModifiers, ArrayRef<Expr *> Steps, SourceRange SR);
851
852 /// Checks '\#pragma omp declare variant' variant function and original
853 /// functions after parsing of the associated method/function.
854 /// \param DG Function declaration to which declare variant directive is
855 /// applied to.
856 /// \param VariantRef Expression that references the variant function, which
857 /// must be used instead of the original one, specified in \p DG.
858 /// \param TI The trait info object representing the match clause.
859 /// \param NumAppendArgs The number of omp_interop_t arguments to account for
860 /// in checking.
861 /// \returns std::nullopt, if the function/variant function are not compatible
862 /// with the pragma, pair of original function/variant ref expression
863 /// otherwise.
864 std::optional<std::pair<FunctionDecl *, Expr *>>
866 OMPTraitInfo &TI, unsigned NumAppendArgs,
867 SourceRange SR);
868
869 /// Called on well-formed 'adjust_args' clause of a '\#pragma omp declare
870 /// variant' directive. Returns nullptr if the clause is invalid.
873 OpenMPNeedDevicePtrModifier NeedDevicePtrModifier,
875 SourceLocation Loc);
876
877 /// Called on well-formed '\#pragma omp declare variant' after parsing of
878 /// the associated method/function.
879 /// \param FD Function declaration to which declare variant directive is
880 /// applied to.
881 /// \param VariantRef Expression that references the variant function, which
882 /// must be used instead of the original one, specified in \p DG.
883 /// \param TI The context traits associated with the function variant.
884 /// \param AdjustArgs The list of 'adjust_args' clauses.
885 /// \param AppendArgs The list of 'append_args' arguments.
886 /// \param AdjustArgsLoc The Location of an 'adjust_args' clause.
887 /// \param AppendArgsLoc The Location of an 'append_args' clause.
888 /// \param SR The SourceRange of the 'declare variant' directive.
890 FunctionDecl *FD, Expr *VariantRef, OMPTraitInfo &TI,
892 ArrayRef<OMPInteropInfo> AppendArgs, SourceLocation AdjustArgsLoc,
893 SourceLocation AppendArgsLoc, SourceRange SR);
894
895 /// Called on device_num selector in context selectors.
896 void ActOnOpenMPDeviceNum(Expr *DeviceNumExpr);
897
899 SourceLocation StartLoc,
900 SourceLocation LParenLoc,
901 SourceLocation EndLoc);
902 /// Called on well-formed 'allocator' clause.
904 SourceLocation StartLoc,
905 SourceLocation LParenLoc,
906 SourceLocation EndLoc);
907 /// Called on well-formed 'if' clause.
909 Expr *Condition, SourceLocation StartLoc,
910 SourceLocation LParenLoc,
911 SourceLocation NameModifierLoc,
912 SourceLocation ColonLoc,
913 SourceLocation EndLoc);
914 /// Called on well-formed 'final' clause.
916 SourceLocation LParenLoc,
917 SourceLocation EndLoc);
918 /// Called on well-formed 'num_threads' clause.
920 ArrayRef<Expr *> VarList, OpenMPNumThreadsClauseModifier SimpleModifier,
921 SourceLocation SimpleModifierLoc,
922 OpenMPNumThreadsClauseModifier ComplexModifier, Expr *ComplexModifierExpr,
923 SourceLocation ComplexModifierLoc, SourceLocation StartLoc,
924 SourceLocation LParenLoc, SourceLocation EndLoc);
925 /// Called on well-formed 'align' clause.
927 SourceLocation LParenLoc,
928 SourceLocation EndLoc);
929 /// Called on well-formed 'safelen' clause.
931 SourceLocation LParenLoc,
932 SourceLocation EndLoc);
933 /// Called on well-formed 'simdlen' clause.
935 SourceLocation LParenLoc,
936 SourceLocation EndLoc);
937 /// Called on well-form 'sizes' clause.
939 SourceLocation StartLoc,
940 SourceLocation LParenLoc,
941 SourceLocation EndLoc);
942 /// Called on well-formed 'counts' clause after parsing its arguments.
943 OMPClause *
945 SourceLocation LParenLoc, SourceLocation EndLoc,
946 std::optional<unsigned> FillIdx,
947 SourceLocation FillLoc, unsigned FillCount);
948 /// Called on well-form 'permutation' clause after parsing its arguments.
950 SourceLocation StartLoc,
951 SourceLocation LParenLoc,
952 SourceLocation EndLoc);
953 /// Called on well-form 'full' clauses.
955 SourceLocation EndLoc);
956 /// Called on well-form 'partial' clauses.
958 SourceLocation LParenLoc,
959 SourceLocation EndLoc);
960 /// Called on well-formed 'depth' clause.
962 SourceLocation LParenLoc,
963 SourceLocation EndLoc);
964 /// Called on well-formed 'collapse' clause.
966 SourceLocation StartLoc,
967 SourceLocation LParenLoc,
968 SourceLocation EndLoc);
969
970 /// Called on well-form 'looprange' clause after parsing its arguments.
971 OMPClause *
973 SourceLocation LParenLoc, SourceLocation FirstLoc,
974 SourceLocation CountLoc, SourceLocation EndLoc);
975 /// Called on well-formed 'ordered' clause.
976 OMPClause *
978 SourceLocation LParenLoc = SourceLocation(),
979 Expr *NumForLoops = nullptr);
980 /// Called on well-formed 'grainsize' clause.
982 Expr *Size, SourceLocation StartLoc,
983 SourceLocation LParenLoc,
984 SourceLocation ModifierLoc,
985 SourceLocation EndLoc);
986 /// Called on well-formed 'num_tasks' clause.
988 Expr *NumTasks, SourceLocation StartLoc,
989 SourceLocation LParenLoc,
990 SourceLocation ModifierLoc,
991 SourceLocation EndLoc);
992 /// Called on well-formed 'hint' clause.
994 SourceLocation LParenLoc,
995 SourceLocation EndLoc);
996 /// Called on well-formed 'detach' clause.
998 SourceLocation LParenLoc,
999 SourceLocation EndLoc);
1000
1001 OMPClause *ActOnOpenMPSimpleClause(OpenMPClauseKind Kind, unsigned Argument,
1002 SourceLocation ArgumentLoc,
1003 SourceLocation StartLoc,
1004 SourceLocation LParenLoc,
1005 SourceLocation EndLoc);
1006 /// Called on well-formed 'default' clause.
1007 OMPClause *
1008 ActOnOpenMPDefaultClause(llvm::omp::DefaultKind M, SourceLocation MLoc,
1010 SourceLocation VCKindLoc, SourceLocation StartLoc,
1011 SourceLocation LParenLoc, SourceLocation EndLoc);
1012 /// Called on well-formed 'threadset' clause.
1014 SourceLocation KindLoc,
1015 SourceLocation StartLoc,
1016 SourceLocation LParenLoc,
1017 SourceLocation EndLoc);
1018 /// Called on well-formed 'transparent' clause.
1020 SourceLocation StartLoc,
1021 SourceLocation LParenLoc,
1022 SourceLocation EndLoc);
1023 /// Called on well-formed 'proc_bind' clause.
1024 OMPClause *ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind,
1025 SourceLocation KindLoc,
1026 SourceLocation StartLoc,
1027 SourceLocation LParenLoc,
1028 SourceLocation EndLoc);
1029 /// Called on well-formed 'order' clause.
1032 SourceLocation StartLoc,
1033 SourceLocation LParenLoc,
1034 SourceLocation MLoc, SourceLocation KindLoc,
1035 SourceLocation EndLoc);
1036 /// Called on well-formed 'update_depend_objects' clause.
1038 SourceLocation KindLoc,
1039 SourceLocation StartLoc,
1040 SourceLocation LParenLoc,
1041 SourceLocation EndLoc);
1042 /// Called on well-formed 'holds' clause.
1044 SourceLocation LParenLoc,
1045 SourceLocation EndLoc);
1046 /// Called on well-formed 'absent' or 'contains' clauses.
1051 SourceLocation Loc,
1052 SourceLocation RLoc);
1053
1055 OpenMPClauseKind Kind, ArrayRef<unsigned> Arguments, Expr *Expr,
1056 SourceLocation StartLoc, SourceLocation LParenLoc,
1057 ArrayRef<SourceLocation> ArgumentsLoc, SourceLocation DelimLoc,
1058 SourceLocation EndLoc);
1059 /// Called on well-formed 'schedule' clause.
1062 OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc,
1063 SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc,
1064 SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc);
1065
1067 SourceLocation EndLoc);
1068 /// Called on well-formed 'nowait' clause.
1070 SourceLocation EndLoc,
1071 SourceLocation LParenLoc, Expr *Condition);
1072 /// Called on well-formed 'untied' clause.
1074 SourceLocation EndLoc);
1075 /// Called on well-formed 'mergeable' clause.
1077 SourceLocation EndLoc);
1078 /// Called on well-formed 'read' clause.
1080 SourceLocation EndLoc);
1081 /// Called on well-formed 'write' clause.
1083 SourceLocation EndLoc);
1084 /// Called on well-formed 'update' clause.
1086 SourceLocation EndLoc);
1087 /// Called on well-formed 'capture' clause.
1089 SourceLocation EndLoc);
1090 /// Called on well-formed 'compare' clause.
1092 SourceLocation EndLoc);
1093 /// Called on well-formed 'fail' clause.
1095 SourceLocation EndLoc);
1097 SourceLocation KindLoc,
1098 SourceLocation StartLoc,
1099 SourceLocation LParenLoc,
1100 SourceLocation EndLoc);
1101
1102 /// Called on well-formed 'seq_cst' clause.
1104 SourceLocation EndLoc);
1105 /// Called on well-formed 'acq_rel' clause.
1107 SourceLocation EndLoc);
1108 /// Called on well-formed 'acquire' clause.
1110 SourceLocation EndLoc);
1111 /// Called on well-formed 'release' clause.
1113 SourceLocation EndLoc);
1114 /// Called on well-formed 'relaxed' clause.
1116 SourceLocation EndLoc);
1117 /// Called on well-formed 'weak' clause.
1119 SourceLocation EndLoc);
1120
1121 /// Called on well-formed 'init' clause.
1122 OMPClause *
1123 ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo,
1124 SourceLocation StartLoc, SourceLocation LParenLoc,
1125 SourceLocation VarLoc, SourceLocation EndLoc);
1126
1127 /// Called on well-formed 'use' clause.
1128 OMPClause *ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc,
1129 SourceLocation LParenLoc,
1130 SourceLocation VarLoc, SourceLocation EndLoc);
1131
1132 /// Called on well-formed 'destroy' clause.
1134 SourceLocation LParenLoc,
1135 SourceLocation VarLoc,
1136 SourceLocation EndLoc);
1137 /// Called on well-formed 'novariants' clause.
1139 SourceLocation StartLoc,
1140 SourceLocation LParenLoc,
1141 SourceLocation EndLoc);
1142 /// Called on well-formed 'nocontext' clause.
1144 SourceLocation StartLoc,
1145 SourceLocation LParenLoc,
1146 SourceLocation EndLoc);
1147 /// Called on well-formed 'filter' clause.
1149 SourceLocation LParenLoc,
1150 SourceLocation EndLoc);
1151 /// Called on well-formed 'threads' clause.
1153 SourceLocation EndLoc);
1154 /// Called on well-formed 'simd' clause.
1156 SourceLocation EndLoc);
1157 /// Called on well-formed 'nogroup' clause.
1159 SourceLocation EndLoc);
1160 /// Called on well-formed 'unified_address' clause.
1162 SourceLocation EndLoc);
1163
1164 /// Called on well-formed 'unified_address' clause.
1166 SourceLocation EndLoc);
1167
1168 /// Called on well-formed 'reverse_offload' clause.
1170 SourceLocation EndLoc);
1171
1172 /// Called on well-formed 'dynamic_allocators' clause.
1174 SourceLocation EndLoc);
1175
1176 /// Called on well-formed 'atomic_default_mem_order' clause.
1179 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
1180
1181 /// Called on well-formed 'self_maps' clause.
1183 SourceLocation EndLoc);
1184
1185 /// Called on well-formed 'at' clause.
1187 SourceLocation KindLoc,
1188 SourceLocation StartLoc,
1189 SourceLocation LParenLoc,
1190 SourceLocation EndLoc);
1191
1192 /// Called on well-formed 'severity' clause.
1194 SourceLocation KindLoc,
1195 SourceLocation StartLoc,
1196 SourceLocation LParenLoc,
1197 SourceLocation EndLoc);
1198
1199 /// Called on well-formed 'message' clause.
1200 /// passing string for message.
1202 SourceLocation LParenLoc,
1203 SourceLocation EndLoc);
1204
1205 /// Data used for processing a list of variables in OpenMP clauses.
1206 struct OpenMPVarListDataTy final {
1208 Expr *IteratorExpr = nullptr;
1213 std::array<int, 2> ExtraModifierArray = {-1, -1};
1214 std::array<Expr *, 2> ExtraModifierExprArray = {nullptr, nullptr};
1215 std::array<SourceLocation, 2> ExtraModifierLocArray = {SourceLocation(),
1216 SourceLocation()};
1217 /// Additional modifier for linear, map, depend, lastprivate,
1218 /// use_device_ptr, or num_teams clause.
1222 int OriginalSharingModifier = 0; // Default is shared
1232 bool IsMapTypeImplicit = false;
1236 StepModifierLoc; /// 'step' modifier location for linear clause
1249 };
1250
1252 ArrayRef<Expr *> Vars,
1253 const OMPVarListLocTy &Locs,
1254 OpenMPVarListDataTy &Data);
1255 /// Called on well-formed 'inclusive' clause.
1257 SourceLocation StartLoc,
1258 SourceLocation LParenLoc,
1259 SourceLocation EndLoc);
1260 /// Called on well-formed 'exclusive' clause.
1262 SourceLocation StartLoc,
1263 SourceLocation LParenLoc,
1264 SourceLocation EndLoc);
1265 /// Called on well-formed 'allocate' clause.
1266 OMPClause *
1267 ActOnOpenMPAllocateClause(Expr *Allocator, Expr *Alignment,
1268 OpenMPAllocateClauseModifier FirstModifier,
1269 SourceLocation FirstModifierLoc,
1270 OpenMPAllocateClauseModifier SecondModifier,
1271 SourceLocation SecondModifierLoc,
1272 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1273 SourceLocation ColonLoc, SourceLocation LParenLoc,
1274 SourceLocation EndLoc);
1275 /// Called on well-formed 'private' clause.
1277 SourceLocation StartLoc,
1278 SourceLocation LParenLoc,
1279 SourceLocation EndLoc);
1280 /// Called on well-formed 'firstprivate' clause.
1282 SourceLocation StartLoc,
1283 SourceLocation LParenLoc,
1284 SourceLocation EndLoc);
1285 /// Called on well-formed 'lastprivate' clause.
1288 SourceLocation LPKindLoc, SourceLocation ColonLoc,
1289 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
1290 /// Called on well-formed 'shared' clause.
1292 SourceLocation StartLoc,
1293 SourceLocation LParenLoc,
1294 SourceLocation EndLoc);
1295 /// Called on well-formed 'reduction' clause.
1297 ArrayRef<Expr *> VarList,
1298 OpenMPVarListDataTy::OpenMPReductionClauseModifiers Modifiers,
1299 SourceLocation StartLoc, SourceLocation LParenLoc,
1300 SourceLocation ModifierLoc, SourceLocation ColonLoc,
1301 SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec,
1302 const DeclarationNameInfo &ReductionId,
1303 ArrayRef<Expr *> UnresolvedReductions = {});
1304 /// Called on well-formed 'task_reduction' clause.
1306 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1307 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
1308 CXXScopeSpec &ReductionIdScopeSpec,
1309 const DeclarationNameInfo &ReductionId,
1310 ArrayRef<Expr *> UnresolvedReductions = {});
1311 /// Called on well-formed 'in_reduction' clause.
1313 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1314 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
1315 CXXScopeSpec &ReductionIdScopeSpec,
1316 const DeclarationNameInfo &ReductionId,
1317 ArrayRef<Expr *> UnresolvedReductions = {});
1318 /// Called on well-formed 'linear' clause.
1319 OMPClause *ActOnOpenMPLinearClause(
1320 ArrayRef<Expr *> VarList, Expr *Step, SourceLocation StartLoc,
1321 SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind,
1322 SourceLocation LinLoc, SourceLocation ColonLoc,
1323 SourceLocation StepModifierLoc, SourceLocation EndLoc);
1324 /// Called on well-formed 'aligned' clause.
1325 OMPClause *ActOnOpenMPAlignedClause(ArrayRef<Expr *> VarList, Expr *Alignment,
1326 SourceLocation StartLoc,
1327 SourceLocation LParenLoc,
1328 SourceLocation ColonLoc,
1329 SourceLocation EndLoc);
1330 /// Called on well-formed 'copyin' clause.
1331 OMPClause *ActOnOpenMPCopyinClause(ArrayRef<Expr *> VarList,
1332 SourceLocation StartLoc,
1333 SourceLocation LParenLoc,
1334 SourceLocation EndLoc);
1335 /// Called on well-formed 'copyprivate' clause.
1336 OMPClause *ActOnOpenMPCopyprivateClause(ArrayRef<Expr *> VarList,
1337 SourceLocation StartLoc,
1338 SourceLocation LParenLoc,
1339 SourceLocation EndLoc);
1340 /// Called on well-formed 'flush' pseudo clause.
1341 OMPClause *ActOnOpenMPFlushClause(ArrayRef<Expr *> VarList,
1342 SourceLocation StartLoc,
1343 SourceLocation LParenLoc,
1344 SourceLocation EndLoc);
1345 /// Called on well-formed 'depobj' pseudo clause.
1346 OMPClause *ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc,
1347 SourceLocation LParenLoc,
1348 SourceLocation EndLoc);
1349 /// Called on well-formed 'depend' clause.
1350 OMPClause *ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data,
1351 Expr *DepModifier,
1352 ArrayRef<Expr *> VarList,
1353 SourceLocation StartLoc,
1354 SourceLocation LParenLoc,
1355 SourceLocation EndLoc);
1356 /// Called on well-formed 'device' clause.
1358 Expr *Device, SourceLocation StartLoc,
1359 SourceLocation LParenLoc,
1360 SourceLocation ModifierLoc,
1361 SourceLocation EndLoc);
1362 /// Called on well-formed 'map' clause.
1363 OMPClause *ActOnOpenMPMapClause(
1364 Expr *IteratorModifier, ArrayRef<OpenMPMapModifierKind> MapTypeModifiers,
1365 ArrayRef<SourceLocation> MapTypeModifiersLoc,
1366 CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId,
1367 OpenMPMapClauseKind MapType, bool IsMapTypeImplicit,
1368 SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VarList,
1369 const OMPVarListLocTy &Locs, bool NoDiagnose = false,
1370 ArrayRef<Expr *> UnresolvedMappers = {});
1371 /// Called on well-formed 'num_teams' clause.
1372 OMPClause *ActOnOpenMPNumTeamsClause(
1373 ArrayRef<Expr *> VarList, OpenMPNumTeamsClauseModifier Modifier,
1374 Expr *ModifierExpr, SourceLocation ModifierLoc,
1375 OpenMPNumTeamsClauseModifier ModifierExtra, Expr *ModifierExtraExpr,
1376 SourceLocation ModifierExtraLoc, SourceLocation StartLoc,
1377 SourceLocation LParenLoc, SourceLocation EndLoc);
1378 /// Called on well-formed 'thread_limit' clause.
1380 ArrayRef<Expr *> VarList, OpenMPThreadLimitClauseModifier Modifier,
1381 Expr *ModifierExpr, SourceLocation ModifierLoc, SourceLocation StartLoc,
1382 SourceLocation LParenLoc, SourceLocation EndLoc);
1383 /// Called on well-formed 'priority' clause.
1384 OMPClause *ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc,
1385 SourceLocation LParenLoc,
1386 SourceLocation EndLoc);
1387 /// Called on well-formed 'dist_schedule' clause.
1389 OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize,
1390 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc,
1391 SourceLocation CommaLoc, SourceLocation EndLoc);
1392 /// Called on well-formed 'defaultmap' clause.
1393 OMPClause *ActOnOpenMPDefaultmapClause(
1395 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc,
1396 SourceLocation KindLoc, SourceLocation EndLoc);
1397 /// Called on well-formed 'to' clause.
1398 OMPClause *
1399 ActOnOpenMPToClause(ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
1400 ArrayRef<SourceLocation> MotionModifiersLoc,
1401 Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec,
1402 DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
1403 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
1404 ArrayRef<Expr *> UnresolvedMappers = {});
1405 /// Called on well-formed 'from' clause.
1406 OMPClause *
1407 ActOnOpenMPFromClause(ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
1408 ArrayRef<SourceLocation> MotionModifiersLoc,
1409 Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec,
1410 DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
1411 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
1412 ArrayRef<Expr *> UnresolvedMappers = {});
1413 /// Called on well-formed 'use_device_ptr' clause.
1415 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
1416 OpenMPUseDevicePtrFallbackModifier FallbackModifier,
1417 SourceLocation FallbackModifierLoc);
1418 /// Called on well-formed 'use_device_addr' clause.
1419 OMPClause *ActOnOpenMPUseDeviceAddrClause(ArrayRef<Expr *> VarList,
1420 const OMPVarListLocTy &Locs);
1421 /// Called on well-formed 'is_device_ptr' clause.
1422 OMPClause *ActOnOpenMPIsDevicePtrClause(ArrayRef<Expr *> VarList,
1423 const OMPVarListLocTy &Locs);
1424 /// Called on well-formed 'has_device_addr' clause.
1425 OMPClause *ActOnOpenMPHasDeviceAddrClause(ArrayRef<Expr *> VarList,
1426 const OMPVarListLocTy &Locs);
1427 /// Called on well-formed 'nontemporal' clause.
1428 OMPClause *ActOnOpenMPNontemporalClause(ArrayRef<Expr *> VarList,
1429 SourceLocation StartLoc,
1430 SourceLocation LParenLoc,
1431 SourceLocation EndLoc);
1432
1433 /// Data for list of allocators.
1435 /// Allocator.
1436 Expr *Allocator = nullptr;
1437 /// Allocator traits.
1439 /// Locations of '(' and ')' symbols.
1441 };
1442 /// Called on well-formed 'uses_allocators' clause.
1444 SourceLocation LParenLoc,
1445 SourceLocation EndLoc,
1447 /// Called on well-formed 'affinity' clause.
1449 SourceLocation LParenLoc,
1450 SourceLocation ColonLoc,
1451 SourceLocation EndLoc, Expr *Modifier,
1452 ArrayRef<Expr *> Locators);
1453 /// Called on a well-formed 'bind' clause.
1455 SourceLocation KindLoc,
1456 SourceLocation StartLoc,
1457 SourceLocation LParenLoc,
1458 SourceLocation EndLoc);
1459
1460 /// Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
1462 SourceLocation LParenLoc,
1463 SourceLocation EndLoc);
1464
1465 /// Called on a well-formed 'dyn_groupprivate' clause.
1469 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc,
1470 SourceLocation M2Loc, SourceLocation EndLoc);
1471
1472 /// Called on well-formed 'doacross' clause.
1473 OMPClause *
1475 SourceLocation DepLoc, SourceLocation ColonLoc,
1476 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1477 SourceLocation LParenLoc, SourceLocation EndLoc);
1478
1479 /// Called on a well-formed 'ompx_attribute' clause.
1481 SourceLocation StartLoc,
1482 SourceLocation LParenLoc,
1483 SourceLocation EndLoc);
1484
1485 /// Called on a well-formed 'ompx_bare' clause.
1487 SourceLocation EndLoc);
1488
1490 Expr *LowerBound,
1491 SourceLocation ColonLocFirst,
1492 SourceLocation ColonLocSecond,
1493 Expr *Length, Expr *Stride,
1494 SourceLocation RBLoc);
1496 SourceLocation RParenLoc,
1497 ArrayRef<Expr *> Dims,
1498 ArrayRef<SourceRange> Brackets);
1499
1500 /// Data structure for iterator expression.
1510
1512 SourceLocation LLoc, SourceLocation RLoc,
1514
1516 Expr *ModifierExpr,
1517 SourceLocation ModifierLoc,
1518 ArrayRef<Expr *> VarList,
1519 SourceLocation VarListEndLoc);
1520
1521 void handleOMPAssumeAttr(Decl *D, const ParsedAttr &AL);
1522
1523 /// Setter and getter functions for device_num.
1524 void setOpenMPDeviceNum(int Num);
1525
1526 int getOpenMPDeviceNum() const;
1527
1528 void setOpenMPDeviceNumID(StringRef ID);
1529
1536
1537private:
1538 void *VarDataSharingAttributesStack;
1539
1540 /// Number of nested '#pragma omp declare target' directives.
1541 SmallVector<DeclareTargetContextInfo, 4> DeclareTargetNesting;
1542
1543 /// Initialization of data-sharing attributes stack.
1544 void InitDataSharingAttributesStack();
1545 void DestroyDataSharingAttributesStack();
1546
1547 /// Returns OpenMP nesting level for current directive.
1548 unsigned getOpenMPNestingLevel() const;
1549
1550 /// Adjusts the function scopes index for the target-based regions.
1551 void adjustOpenMPTargetScopeIndex(unsigned &FunctionScopesIndex,
1552 unsigned Level) const;
1553
1554 /// Returns the number of scopes associated with the construct on the given
1555 /// OpenMP level.
1556 int getNumberOfConstructScopes(unsigned Level) const;
1557
1558 /// Push new OpenMP function region for non-capturing function.
1559 void pushOpenMPFunctionRegion();
1560
1561 /// Pop OpenMP function region for non-capturing function.
1562 void popOpenMPFunctionRegion(const sema::FunctionScopeInfo *OldFSI);
1563
1564 /// Analyzes and checks a loop nest for use by a loop transformation.
1565 ///
1566 /// \param Kind The loop transformation directive kind.
1567 /// \param NumLoops How many nested loops the directive is expecting.
1568 /// \param AStmt Associated statement of the transformation directive.
1569 /// \param LoopHelpers [out] The loop analysis result.
1570 /// \param Body [out] The body code nested in \p NumLoops loop.
1571 /// \param OriginalInits [out] Collection of statements and declarations that
1572 /// must have been executed/declared before entering the
1573 /// loop.
1574 /// \param NestedFinals [out] If non-null, per loop, the Finals of a nested
1575 /// loop transformation consumed by this one.
1576 ///
1577 /// \return Whether there was any error.
1578 bool checkTransformableLoopNest(
1579 OpenMPDirectiveKind Kind, Stmt *AStmt, int NumLoops,
1581 Stmt *&Body, SmallVectorImpl<SmallVector<Stmt *>> &OriginalInits,
1582 SmallVectorImpl<Stmt *> *NestedFinals = nullptr);
1583
1584 /// Holds the result of the analysis of a (possibly canonical) loop.
1585 struct LoopAnalysis {
1586 /// The analyzed loop or loop transformation.
1587 Stmt *AStmt = nullptr;
1588 /// Loop analyses results.
1589 OMPLoopBasedDirective::HelperExprs HelperExprs;
1590 /// The for-statement of the loop. TheForStmt equals AStmt only when the
1591 /// latter is a canonical loop (i.e. not a loop transformation).
1592 Stmt *TheForStmt = nullptr;
1593 /// Initialization statements before transformations.
1594 SmallVector<Stmt *> OriginalInits;
1595 /// Initialization statements required after transformation of this loop.
1596 SmallVector<Stmt *> TransformsPreInits;
1597 /// Finals from a nested loop-transformation (e.g. `omp reverse`); must
1598 /// run right after this loop when it is not consumed by an enclosing
1599 /// transformation.
1600 Stmt *TransformFinals = nullptr;
1601
1602 explicit LoopAnalysis(Stmt *S) : AStmt(S) {}
1603
1604 bool isRegularLoop() const { return isRegularLoop(AStmt); }
1605 bool isLoopTransformation() const { return isLoopTransformation(AStmt); }
1606
1607 // Convenience functions used when building LoopSequenceAnalysis.
1608 static bool isRegularLoop(Stmt *S) {
1610 }
1611 static bool isLoopTransformation(Stmt *S) {
1613 }
1614 };
1615
1616 /// Holds the result of the analysis of a (possibly canonical) loop sequence.
1617 struct LoopSequenceAnalysis {
1618 /// Number of top level canonical loops.
1619 unsigned LoopSeqSize = 0;
1620 /// For each loop results of the analysis.
1621 SmallVector<LoopAnalysis, 2> Loops;
1622 /// Additional code required before entering the transformed loop sequence.
1623 SmallVector<Stmt *> LoopSequencePreInits;
1624
1625 // Convenience function used when building the LoopSequenceAnalysis.
1626 static bool isLoopSequenceDerivation(Stmt *S) {
1627 return LoopAnalysis::isRegularLoop(S) ||
1628 LoopAnalysis::isLoopTransformation(S);
1629 }
1630 };
1631
1632 /// The main recursive process of `checkTransformableLoopSequence` that
1633 /// performs grammatical parsing of a canonical loop sequence. It extracts
1634 /// key information, such as the number of top-level loops, loop statements,
1635 /// helper expressions, and other relevant loop-related data, all in a single
1636 /// execution to avoid redundant traversals. This analysis flattens inner
1637 /// Loop Sequences
1638 ///
1639 /// \param LoopSeqStmt The AST of the original statement.
1640 /// \param SeqAnalysis [out] Result of the analysis of \p LoopSeqStmt
1641 /// \param Context
1642 /// \param Kind The loop transformation directive kind.
1643 /// \param IsGeneratedSequence Whether \p LoopSeqStmt was generated by a
1644 /// loop-sequence-generating transformation (e.g.
1645 /// looprange fuse) rather than written by the user.
1646 /// \return Whether the original statement is both syntactically and
1647 /// semantically correct according to OpenMP 6.0 canonical loop
1648 /// sequence definition.
1649 bool analyzeLoopSequence(Stmt *LoopSeqStmt, LoopSequenceAnalysis &SeqAnalysis,
1650 ASTContext &Context, OpenMPDirectiveKind Kind,
1651 bool IsGeneratedSequence = false);
1652
1653 /// Validates and checks whether a loop sequence can be transformed according
1654 /// to the given directive, providing necessary setup and initialization
1655 /// (Driver function) before recursion using `analyzeLoopSequence`.
1656 ///
1657 /// \param Kind The loop transformation directive kind.
1658 /// \param AStmt The AST of the original statement
1659 /// \param SeqAnalysis [out] Result of the analysis of \p LoopSeqStmt
1660 /// \param Context
1661 /// \return Whether there was an absence of errors or not
1662 bool checkTransformableLoopSequence(OpenMPDirectiveKind Kind, Stmt *AStmt,
1663 LoopSequenceAnalysis &SeqAnalysis,
1664 ASTContext &Context);
1665
1666 /// Helper to keep information about the current `omp begin/end declare
1667 /// variant` nesting.
1668 struct OMPDeclareVariantScope {
1669 /// The associated OpenMP context selector.
1670 OMPTraitInfo *TI;
1671
1672 /// The associated OpenMP context selector mangling.
1673 std::string NameSuffix;
1674
1675 OMPDeclareVariantScope(OMPTraitInfo &TI);
1676 };
1677
1678 /// Return the OMPTraitInfo for the surrounding scope, if any.
1679 OMPTraitInfo *getOMPTraitInfoForSurroundingScope() {
1680 return OMPDeclareVariantScopes.empty() ? nullptr
1681 : OMPDeclareVariantScopes.back().TI;
1682 }
1683
1684 /// The current `omp begin/end declare variant` scopes.
1685 SmallVector<OMPDeclareVariantScope, 4> OMPDeclareVariantScopes;
1686
1687 /// The current `omp begin/end assumes` scopes.
1688 SmallVector<OMPAssumeAttr *, 4> OMPAssumeScoped;
1689
1690 /// All `omp assumes` we encountered so far.
1691 SmallVector<OMPAssumeAttr *, 4> OMPAssumeGlobal;
1692
1693 /// Device number specified by the context selector.
1694 int DeviceNum = -1;
1695
1696 /// Device number identifier specified by the context selector.
1697 StringRef DeviceNumID;
1698};
1699
1700} // namespace clang
1701
1702#endif // LLVM_CLANG_SEMA_SEMAOPENMP_H
#define V(N, I)
Forward declaration of all AST node types.
This file defines the classes used to store parsed information about declaration-specifiers and decla...
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
This file defines OpenMP AST classes for executable directives and clauses.
Represents a C++ nested-name-specifier or a global scope specifier.
Definition DeclSpec.h:77
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition DeclBase.h:1467
Decl - This represents one declaration (or definition), e.g.
Definition DeclBase.h:86
The name of a declaration.
Information about one declarator, including the parsed type information and the identifier.
Definition DeclSpec.h:1996
An instance of this object exists for each enum constant that is defined.
Definition Decl.h:3574
This represents one expression.
Definition Expr.h:114
Represents a member of a struct/union/class.
Definition Decl.h:3311
Represents a function declaration or definition.
Definition Decl.h:2071
One of these records is kept for each identifier that is lexed.
This represents a decl that may have a name.
Definition Decl.h:276
Describes the source-level contents of one OpenMP 'adjust_args' clause.
This is a basic class for representing single OpenMP clause.
This represents 'pragma omp groupprivate ...' directive.
Definition DeclOpenMP.h:173
This represents 'pragma omp requires...' directive.
Definition DeclOpenMP.h:479
This represents 'pragma omp threadprivate ...' directive.
Definition DeclOpenMP.h:110
Wrapper for void* pointer.
Definition Ownership.h:51
ParsedAttr - Represents a syntactic attribute.
Definition ParsedAttr.h:119
A (possibly-)qualified type.
Definition TypeBase.h:938
Scope - A scope is a transient data structure that is used while parsing the program.
Definition Scope.h:41
A generic diagnostic builder for errors which may or may not be deferred.
Definition SemaBase.h:111
SemaBase(Sema &S)
Definition SemaBase.cpp:7
StmtResult ActOnOpenMPTargetParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target parallel for' after parsing of the associated statement.
OMPClause * ActOnOpenMPNocontextClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nocontext' clause.
OMPClause * ActOnOpenMPXDynCGroupMemClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveEnd(Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid)
Called at the end of 'pragma omp declare reduction'.
bool isInOpenMPTaskUntiedContext() const
Return true if currently in OpenMP task with untied clause context.
OMPClause * ActOnOpenMPUntiedClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'untied' clause.
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
OMPClause * ActOnOpenMPThreadsetClause(OpenMPThreadsetKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'threadset' clause.
OMPClause * ActOnOpenMPHoldsClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'holds' clause.
StmtResult ActOnOpenMPParallelMasterTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel master taskloop simd' after parsing of the associated sta...
StmtResult ActOnOpenMPParallelMasterDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp parallel master' after parsing of the associated statement.
StmtResult ActOnOpenMPDispatchDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp dispatch' after parsing of the.
OMPClause * ActOnOpenMPReadClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'read' clause.
OMPClause * ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'filter' clause.
void ActOnOpenMPDeclareReductionCombinerEnd(Decl *D, Expr *Combiner)
Finish current declare reduction construct initializer.
ExprResult ActOnOpenMPCall(ExprResult Call, Scope *Scope, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig)
Given the potential call expression Call, determine if there is a specialization via the OpenMP decla...
void setOpenMPDeviceNum(int Num)
Setter and getter functions for device_num.
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
StmtResult ActOnOpenMPSplitDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'pragma omp split' after parsing of its associated statement.
StmtResult ActOnOpenMPTargetEnterDataDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AStmt)
Called on well-formed '#pragma omp target enter data' after parsing of the associated statement.
StmtResult ActOnOpenMPTargetTeamsGenericLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams loop' after parsing of the associated statement.
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
StmtResult ActOnOpenMPFlattenDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'pragma omp flatten' after parsing of its clauses and the associated statement.
OMPClause * ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'use' clause.
OMPClause * ActOnOpenMPFailClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'fail' clause.
StmtResult ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute parallel for simd' after parsing of the as...
StmtResult ActOnOpenMPAssumeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Process an OpenMP assume directive.
ExprResult ActOnOpenMPDimsModifier(OpenMPClauseKind Kind, int Modifier, Expr *ModifierExpr, SourceLocation ModifierLoc, ArrayRef< Expr * > VarList, SourceLocation VarListEndLoc)
void ActOnFinishedOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI)
Called once a target context is completed, that can be when a 'pragma omp end declare target' was enc...
OMPClause * ActOnOpenMPDirectivePresenceClause(OpenMPClauseKind CK, llvm::ArrayRef< OpenMPDirectiveKind > DKVec, SourceLocation Loc, SourceLocation LLoc, SourceLocation RLoc)
Called on well-formed 'absent' or 'contains' clauses.
void tryCaptureOpenMPLambdas(ValueDecl *V)
Function tries to capture lambda's captured variables in the OpenMP region before the original lambda...
ArrayRef< const OMPRequiresDecl * > getRequiresDecls() const
The 'requires' directives seen so far in this translation unit.
StmtResult ActOnOpenMPParallelMaskedDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp parallel masked' after parsing of the associated statement.
StmtResult ActOnOpenMPTargetTeamsDistributeParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute parallel for' after parsing of the associa...
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
void StartOpenMPClause(OpenMPClauseKind K)
Start analysis of clauses.
bool CheckOpenMPLinearModifier(OpenMPLinearClauseKind LinKind, SourceLocation LinLoc)
Checks correctness of linear modifiers.
ExprResult ActOnOpenMPDeclareMapperDirectiveVarDecl(Scope *S, QualType MapperType, SourceLocation StartLoc, DeclarationName VN)
Build the mapper variable of 'pragma omp declare mapper'.
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
OMPClause * ActOnOpenMPSelfMapsClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'self_maps' clause.
bool CheckOpenMPLinearDecl(const ValueDecl *D, SourceLocation ELoc, OpenMPLinearClauseKind LinKind, QualType Type, bool IsDeclareSimd=false)
Checks that the specified declaration matches requirements for the linear decls.
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
OMPClause * ActOnOpenMPCountsClause(ArrayRef< Expr * > CountExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, std::optional< unsigned > FillIdx, SourceLocation FillLoc, unsigned FillCount)
Called on well-formed 'counts' clause after parsing its arguments.
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
StmtResult ActOnOpenMPErrorDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, bool InExContext=true)
Called on well-formed '#pragma omp error'.
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
OMPClause * ActOnOpenMPUpdateClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'update' clause.
StmtResult ActOnOpenMPSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp simd' after parsing of the associated statement.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
void ActOnOpenMPDeclareTargetName(NamedDecl *ND, SourceLocation Loc, OMPDeclareTargetDeclAttr::MapTypeTy MT, DeclareTargetContextInfo &DTCI)
Called on correct id-expression from the 'pragma omp declare target'.
DeclGroupPtrTy ActOnOpenMPRequiresDirective(SourceLocation Loc, ArrayRef< OMPClause * > ClauseList)
Called on well-formed 'pragma omp requires'.
OMPGroupPrivateDecl * CheckOMPGroupPrivateDecl(SourceLocation Loc, ArrayRef< Expr * > VarList)
Builds a new OpenMPGroupPrivateDecl and checks its correctness.
StmtResult ActOnOpenMPDistributeSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute simd' after parsing of the associated statement.
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
StmtResult ActOnOpenMPDepobjDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp depobj'.
ExprResult getOpenMPCapturedExpr(VarDecl *Capture, ExprValueKind VK, ExprObjectKind OK, SourceLocation Loc)
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
OMPClause * ActOnOpenMPSingleExprWithArgClause(OpenMPClauseKind Kind, ArrayRef< unsigned > Arguments, Expr *Expr, SourceLocation StartLoc, SourceLocation LParenLoc, ArrayRef< SourceLocation > ArgumentsLoc, SourceLocation DelimLoc, SourceLocation EndLoc)
StmtResult ActOnOpenMPTargetParallelDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target parallel' after parsing of the associated statement.
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
OpenMPClauseKind isOpenMPPrivateDecl(ValueDecl *D, unsigned Level, unsigned CapLevel) const
Check if the specified variable is used in 'private' clause.
OMPClause * ActOnOpenMPLoopRangeClause(Expr *First, Expr *Count, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation FirstLoc, SourceLocation CountLoc, SourceLocation EndLoc)
Called on well-form 'looprange' clause after parsing its arguments.
OMPClause * ActOnOpenMPPermutationClause(ArrayRef< Expr * > PermExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'permutation' clause after parsing its arguments.
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
OMPClause * ActOnOpenMPThreadsClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'threads' clause.
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
StmtResult ActOnOpenMPTargetExitDataDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AStmt)
Called on well-formed '#pragma omp target exit data' after parsing of the associated statement.
StmtResult ActOnOpenMPTeamsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp teams' after parsing of the associated statement.
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
OMPClause * ActOnOpenMPMergeableClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'mergeable' clause.
void startOpenMPCXXRangeFor()
If the current region is a range loop-based region, mark the start of the loop construct.
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
StmtResult ActOnOpenMPParallelMaskedTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel masked taskloop' after parsing of the associated statemen...
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
OMPClause * ActOnOpenMPCompareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'compare' clause.
StmtResult ActOnOpenMPFuseDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'pragma omp fuse' after parsing of its clauses and the associated statement.
StmtResult ActOnOpenMPParallelSectionsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp parallel sections' after parsing of the associated statement.
OMPClause * ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, Expr *DepModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
OMPClause * ActOnOpenMPDoacrossClause(OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'doacross' clause.
VarDecl * ActOnOpenMPDeclareReductionInitializerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
StmtResult ActOnOpenMPTeamsDistributeParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute parallel for' after parsing of the associated sta...
StmtResult ActOnOpenMPMasterDirective(Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp master' after parsing of the associated statement.
StmtResult ActOnOpenMPTaskgroupDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskgroup'.
VarDecl * isOpenMPCapturedDecl(ValueDecl *D, bool CheckScopeInfo=false, unsigned StopAt=0)
Check if the specified variable is used in one of the private clauses (private, firstprivate,...
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, OpenMPUseDevicePtrFallbackModifier FallbackModifier, SourceLocation FallbackModifierLoc)
Called on well-formed 'use_device_ptr' clause.
StmtResult ActOnOpenMPMasterTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp master taskloop simd' after parsing of the associated statement.
friend class Sema
Definition SemaOpenMP.h:55
ExprResult ActOnOpenMPIdExpression(Scope *CurScope, CXXScopeSpec &ScopeSpec, const DeclarationNameInfo &Id, OpenMPDirectiveKind Kind)
Called on correct id-expression from the 'pragma omp threadprivate'.
void ActOnOpenMPEndAssumesDirective()
Called on well-formed 'pragma omp end assumes'.
OMPClause * ActOnOpenMPNogroupClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'nogroup' clause.
OMPClause * ActOnOpenMPGrainsizeClause(OpenMPGrainsizeClauseModifier Modifier, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
bool isOpenMPRebuildMemberExpr(ValueDecl *D)
The member expression(this->fd) needs to be rebuilt in the template instantiation to generate private...
void ActOnOpenMPDeviceNum(Expr *DeviceNumExpr)
Called on device_num selector in context selectors.
QualType ActOnOpenMPDeclareReductionType(SourceLocation TyLoc, TypeResult ParsedType)
Check if the specified type is allowed to be used in 'omp declare reduction' construct.
StmtResult ActOnOpenMPMaskedTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp masked taskloop simd' after parsing of the associated statement.
bool isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level, unsigned OpenMPCaptureLevel) const
Return true if the provided declaration VD should be captured by reference.
StmtResult ActOnOpenMPParallelGenericLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel loop' after parsing of the associated statement.
DeclGroupPtrTy ActOnOpenMPAllocateDirective(SourceLocation Loc, ArrayRef< Expr * > VarList, ArrayRef< OMPClause * > Clauses, DeclContext *Owner=nullptr)
Called on well-formed 'pragma omp allocate'.
OMPClause * ActOnOpenMPUpdateDependObjectsClause(OpenMPDependClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'update_depend_objects' clause.
OMPClause * ActOnOpenMPSimpleClause(OpenMPClauseKind Kind, unsigned Argument, SourceLocation ArgumentLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
OMPClause * ActOnOpenMPUnifiedAddressClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'unified_address' clause.
static int getOpenMPCaptureLevels(OpenMPDirectiveKind Kind)
Return the number of captured regions created for an OpenMP directive.
bool isOpenMPTargetCapturedDecl(const ValueDecl *D, unsigned Level, unsigned CaptureLevel) const
Check if the specified variable is captured by 'target' directive.
StmtResult ActOnOpenMPParallelMaskedTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel masked taskloop simd' after parsing of the associated sta...
OMPClause * ActOnOpenMPDynamicAllocatorsClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'dynamic_allocators' clause.
StmtResult ActOnOpenMPScopeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp scope' after parsing of the associated statement.
void ActOnOpenMPIteratorVarDecl(VarDecl *VD)
bool isInOpenMPDeclareVariantScope() const
Can we exit an OpenMP declare variant scope at the moment.
Definition SemaOpenMP.h:113
OMPAdjustArgsDescriptor * ActOnOpenMPAdjustArgsClause(OpenMPAdjustArgsOpKind AdjustOp, OpenMPNeedDevicePtrModifier NeedDevicePtrModifier, ArrayRef< OMPAdjustArgsItem > Items, SourceLocation Loc)
Called on well-formed 'adjust_args' clause of a '#pragma omp declare variant' directive.
StmtResult ActOnOpenMPDistributeParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute parallel for simd' after parsing of the associated stat...
StmtResult ActOnOpenMPBarrierDirective(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp barrier'.
TypeResult ActOnOpenMPDeclareMapperVarDecl(Scope *S, Declarator &D)
Check variable declaration in 'omp declare mapper' construct.
ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, SourceLocation LLoc, SourceLocation RLoc, ArrayRef< OMPIteratorData > Data)
void addRequiresDecl(OMPRequiresDecl *D)
Registers a 'requires' directive deserialized from an AST file.
OMPClause * ActOnOpenMPUsesAllocatorClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< UsesAllocatorsData > Data)
Called on well-formed 'uses_allocators' clause.
StmtResult ActOnOpenMPRegionEnd(StmtResult S, ArrayRef< OMPClause * > Clauses)
End of OpenMP region.
DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveStart(Scope *S, DeclContext *DC, DeclarationName Name, ArrayRef< std::pair< QualType, SourceLocation > > ReductionTypes, AccessSpecifier AS, Decl *PrevDeclInScope=nullptr)
Called on start of 'pragma omp declare reduction'.
OMPClause * ActOnOpenMPAcqRelClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'acq_rel' clause.
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
ExprResult VerifyPositiveIntegerConstantInClause(Expr *Op, OpenMPClauseKind CKind, bool StrictlyPositive=true, bool SuppressExprDiags=false)
DeclGroupPtrTy ActOnOpenMPGroupPrivateDirective(SourceLocation Loc, ArrayRef< Expr * > VarList)
Called on well-formed 'pragma omp groupprivate'.
bool isOpenMPDeclareMapperVarDeclAllowed(const VarDecl *VD) const
OMPClause * ActOnOpenMPInclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'inclusive' clause.
SemaDiagnosticBuilder diagIfOpenMPHostCode(SourceLocation Loc, unsigned DiagID, const FunctionDecl *FD)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as host cod...
SemaDiagnosticBuilder diagIfOpenMPDeviceCode(SourceLocation Loc, unsigned DiagID, const FunctionDecl *FD)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
StmtResult ActOnOpenMPSectionsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp sections' after parsing of the associated statement.
void ActOnOpenMPEndDeclareVariant()
Handle a omp end declare variant.
OMPClause * ActOnOpenMPTaskReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'task_reduction' clause.
bool hasGlobalOpenMPAssumes() const
Check if there is an active global omp assumes directive.
Definition SemaOpenMP.h:256
OMPClause * ActOnOpenMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc, Expr *Condition)
Called on well-formed 'nowait' clause.
StmtResult ActOnOpenMPCriticalDirective(const DeclarationNameInfo &DirName, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp critical' after parsing of the associated statement.
StmtResult ActOnOpenMPMaskedDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp masked' after parsing of the.
StmtResult ActOnOpenMPStripeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
void ActOnFinishedFunctionDefinitionInOpenMPAssumeScope(Decl *D)
Act on D, a function definition inside of an omp [begin/end] assumes.
void EndOpenMPDSABlock(Stmt *CurDirective)
Called on end of data sharing attribute block.
OMPClause * ActOnOpenMPOrderClause(OpenMPOrderClauseModifier Modifier, OpenMPOrderClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'order' clause.
llvm::SmallDenseMap< const ValueDecl *, const Expr *, 4 > VarsWithInheritedDSAType
Definition SemaOpenMP.h:446
OMPClause * ActOnOpenMPSizesClause(ArrayRef< Expr * > SizeExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'sizes' clause.
bool ActOnStartOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI)
Called on the start of target region i.e. 'pragma omp declare target'.
StmtResult ActOnOpenMPTeamsDistributeParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute parallel for simd' after parsing of the associate...
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
OMPClause * ActOnOpenMPNumThreadsClause(ArrayRef< Expr * > VarList, OpenMPNumThreadsClauseModifier SimpleModifier, SourceLocation SimpleModifierLoc, OpenMPNumThreadsClauseModifier ComplexModifier, Expr *ComplexModifierExpr, SourceLocation ComplexModifierLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
StmtResult ActOnOpenMPDistributeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute' after parsing of the associated statement.
StmtResult ActOnOpenMPSectionDirective(Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp section' after parsing of the associated statement.
StmtResult ActOnOpenMPInterchangeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'pragma omp interchange' after parsing of its clauses and the associated statem...
bool isOpenMPGlobalCapturedDecl(ValueDecl *D, unsigned Level, unsigned CaptureLevel) const
Check if the specified global variable must be captured by outer capture regions.
OMPClause * ActOnOpenMPInReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'in_reduction' clause.
StmtResult ActOnOpenMPGenericLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp loop' after parsing of the associated statement.
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
OMPRequiresDecl * CheckOMPRequiresDecl(SourceLocation Loc, ArrayRef< OMPClause * > Clauses)
Check restrictions on Requires directive.
void ActOnFinishedFunctionDefinitionInOpenMPDeclareVariantScope(Decl *D, SmallVectorImpl< FunctionDecl * > &Bases)
Register D as specialization of all base functions in Bases in the current omp begin/end declare vari...
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
void EndOpenMPClause()
End analysis of clauses.
bool isInOpenMPAssumeScope() const
Check if there is an active global omp begin assumes directive.
Definition SemaOpenMP.h:253
void setOpenMPDeviceNumID(StringRef ID)
StmtResult ActOnOpenMPDistributeParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute parallel for' after parsing of the associated statement...
QualType ActOnOpenMPDeclareMapperType(SourceLocation TyLoc, TypeResult ParsedType)
Check if the specified type is allowed to be used in 'omp declare mapper' construct.
StmtResult ActOnOpenMPTeamsDistributeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute' after parsing of the associated statement.
StmtResult ActOnOpenMPTargetTeamsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target teams' after parsing of the associated statement.
OMPClause * ActOnOpenMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'message' clause.
OMPClause * ActOnOpenMPThreadLimitClause(ArrayRef< Expr * > VarList, OpenMPThreadLimitClauseModifier Modifier, Expr *ModifierExpr, SourceLocation ModifierLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
int getOpenMPDeviceNum() const
StmtResult ActOnOpenMPScanDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp scan'.
OMPClause * ActOnOpenMPScheduleClause(OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'schedule' clause.
void ActOnOpenMPLoopInitialization(SourceLocation ForLoc, Stmt *Init)
Check if the current region is an OpenMP loop region and if it is, mark loop control variable,...
OMPClause * ActOnOpenMPUnifiedSharedMemoryClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'unified_address' clause.
void DiagnoseUnterminatedOpenMPDeclareTarget()
Report unterminated 'omp declare target' or 'omp begin declare target' at the end of a compilation un...
void finalizeOpenMPDelayedAnalysis(const FunctionDecl *Caller, const FunctionDecl *Callee, SourceLocation Loc)
Finishes analysis of the deferred functions calls that may be declared as host/nohost during device/h...
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
std::optional< std::pair< FunctionDecl *, Expr * > > checkOpenMPDeclareVariantFunction(DeclGroupPtrTy DG, Expr *VariantRef, OMPTraitInfo &TI, unsigned NumAppendArgs, SourceRange SR)
Checks '#pragma omp declare variant' variant function and original functions after parsing of the ass...
StmtResult ActOnOpenMPParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel for simd' after parsing of the associated statement.
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
Definition SemaOpenMP.h:57
OMPClause * ActOnOpenMPReleaseClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'release' clause.
OMPClause * ActOnOpenMPAcquireClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'acquire' clause.
OMPClause * ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'proc_bind' clause.
OMPClause * ActOnOpenMPSIMDClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'simd' clause.
OMPClause * ActOnOpenMPXBareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_bare' clause.
StmtResult ActOnOpenMPInformationalDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Process an OpenMP informational directive.
StmtResult ActOnOpenMPCanonicalLoop(Stmt *AStmt)
Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to an OpenMP loop directive.
OMPClause * ActOnOpenMPTransparentClause(Expr *Transparent, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'transparent' clause.
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
OMPClause * ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
OMPClause * ActOnOpenMPNullaryAssumptionClause(OpenMPClauseKind CK, SourceLocation Loc, SourceLocation RLoc)
StmtResult ActOnOpenMPTargetTeamsDistributeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute' after parsing of the associated statement...
StmtResult ActOnOpenMPParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel for' after parsing of the associated statement.
OMPClause * ActOnOpenMPCaptureClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'capture' clause.
StmtResult ActOnOpenMPForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp for' after parsing of the associated statement.
StmtResult ActOnOpenMPAtomicDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp atomic' after parsing of the associated statement.
StmtResult ActOnOpenMPTargetUpdateDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AStmt)
Called on well-formed '#pragma omp target update'.
StmtResult ActOnOpenMPOrderedDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp ordered' after parsing of the associated statement.
OMPClause * ActOnOpenMPNumTeamsClause(ArrayRef< Expr * > VarList, OpenMPNumTeamsClauseModifier Modifier, Expr *ModifierExpr, SourceLocation ModifierLoc, OpenMPNumTeamsClauseModifier ModifierExtra, Expr *ModifierExtraExpr, SourceLocation ModifierExtraLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
StmtResult ActOnOpenMPReverseDirective(Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'pragma omp reverse'.
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
OMPClause * ActOnOpenMPAtClause(OpenMPAtClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'at' clause.
StmtResult ActOnOpenMPTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp taskloop' after parsing of the associated statement.
OMPClause * ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'init' clause.
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
StmtResult ActOnOpenMPMetaDirective(SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPTraitInfo * > TraitInfos, ArrayRef< Stmt * > Variants)
Called for metadirectives with user conditions that require runtime selection.
void ActOnOpenMPDeclareReductionCombinerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, Expr *Alignment, OpenMPAllocateClauseModifier FirstModifier, SourceLocation FirstModifierLoc, OpenMPAllocateClauseModifier SecondModifier, SourceLocation SecondModifierLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
std::pair< StringRef, QualType > CapturedParamNameType
Definition SemaOpenMP.h:58
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
bool isInOpenMPTargetExecutionDirective() const
Return true inside OpenMP target region.
StmtResult ActOnOpenMPTargetDataDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target data' after parsing of the associated statement.
StmtResult ActOnOpenMPMasterTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp master taskloop' after parsing of the associated statement.
void ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists, SmallVectorImpl< FunctionDecl * > &Bases)
The declarator D defines a function in the scope S which is nested in an omp begin/end declare varian...
friend class Parser
Definition SemaOpenMP.h:54
StmtResult ActOnOpenMPFlushDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp flush'.
StmtResult ActOnOpenMPUnrollDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'pragma omp unroll' after parsing of its clauses and the associated statement.
OMPClause * ActOnOpenMPMapClause(Expr *IteratorModifier, ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, bool NoDiagnose=false, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'map' clause.
OMPClause * ActOnOpenMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier, Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
void ActOnOpenMPDeclareTargetInitializer(Decl *D)
Adds OMPDeclareTargetDeclAttr to referenced variables in declare target directive.
void ActOnOpenMPDeclareVariantDirective(FunctionDecl *FD, Expr *VariantRef, OMPTraitInfo &TI, ArrayRef< OMPAdjustArgsDescriptor * > AdjustArgs, ArrayRef< OMPInteropInfo > AppendArgs, SourceLocation AdjustArgsLoc, SourceLocation AppendArgsLoc, SourceRange SR)
Called on well-formed '#pragma omp declare variant' after parsing of the associated method/function.
bool isInOpenMPDeclareTargetContext() const
Return true inside OpenMP declare target region.
Definition SemaOpenMP.h:387
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'from' clause.
StmtResult ActOnOpenMPCancellationPointDirective(SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind CancelRegion)
Called on well-formed '#pragma omp cancellation point'.
OMPClause * ActOnOpenMPDynGroupprivateClause(OpenMPDynGroupprivateClauseModifier M1, OpenMPDynGroupprivateClauseFallbackModifier M2, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation EndLoc)
Called on a well-formed 'dyn_groupprivate' clause.
OMPClause * ActOnOpenMPVarListClause(OpenMPClauseKind Kind, ArrayRef< Expr * > Vars, const OMPVarListLocTy &Locs, OpenMPVarListDataTy &Data)
void startOpenMPLoop()
If the current region is a loop-based region, mark the start of the loop construct.
StmtResult ActOnOpenMPTargetDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target' after parsing of the associated statement.
void StartOpenMPDSABlock(OpenMPDirectiveKind K, const DeclarationNameInfo &DirName, Scope *CurScope, SourceLocation Loc)
Called on start of new data sharing attribute block.
OMPThreadPrivateDecl * CheckOMPThreadPrivateDecl(SourceLocation Loc, ArrayRef< Expr * > VarList)
Builds a new OpenMPThreadPrivateDecl and checks its correctness.
void handleOMPAssumeAttr(Decl *D, const ParsedAttr &AL)
OMPClause * ActOnOpenMPSeverityClause(OpenMPSeverityClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'severity' clause.
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers={})
Called on well-formed 'to' clause.
void ActOnOpenMPDeclareReductionInitializerEnd(Decl *D, Expr *Initializer, VarDecl *OmpPrivParm)
Finish current declare reduction construct initializer.
OMPClause * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
StmtResult ActOnOpenMPMaskedTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp masked taskloop' after parsing of the associated statement.
StmtResult ActOnOpenMPTaskwaitDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskwait'.
StmtResult ActOnOpenMPForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp for simd' after parsing of the associated statement.
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPVarListDataTy::OpenMPReductionClauseModifiers Modifiers, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions={})
Called on well-formed 'reduction' clause.
OMPClause * ActOnOpenMPRelaxedClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'relaxed' clause.
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
StmtResult ActOnOpenMPInteropDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp interop'.
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
OMPClause * ActOnOpenMPSeqCstClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'seq_cst' clause.
void checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D, SourceLocation IdLoc=SourceLocation())
Check declaration inside target region.
OMPClause * ActOnOpenMPNovariantsClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'novariants' clause.
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
DeclGroupPtrTy ActOnOpenMPDeclareSimdDirective(DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS, Expr *Simdlen, ArrayRef< Expr * > Uniforms, ArrayRef< Expr * > Aligneds, ArrayRef< Expr * > Alignments, ArrayRef< Expr * > Linears, ArrayRef< unsigned > LinModifiers, ArrayRef< Expr * > Steps, SourceRange SR)
Called on well-formed '#pragma omp declare simd' after parsing of the associated method/function.
ExprResult PerformOpenMPImplicitIntegerConversion(SourceLocation OpLoc, Expr *Op)
StmtResult ActOnOpenMPTargetSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target simd' after parsing of the associated statement.
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind M, SourceLocation MLoc, OpenMPDefaultClauseVariableCategory VCKind, SourceLocation VCKindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
OMPClause * ActOnOpenMPAtomicDefaultMemOrderClause(OpenMPAtomicDefaultMemOrderClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'atomic_default_mem_order' clause.
StmtResult ActOnOpenMPTeamsGenericLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams loop' after parsing of the associated statement.
OMPClause * ActOnOpenMPWeakClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'weak' clause.
OMPClause * ActOnOpenMPXAttributeClause(ArrayRef< const Attr * > Attrs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_attribute' clause.
StmtResult ActOnOpenMPTileDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'pragma omp tile' after parsing of its clauses and the associated statement.
StmtResult ActOnOpenMPParallelDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp parallel' after parsing of the associated statement.
StmtResult ActOnOpenMPSingleDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp single' after parsing of the associated statement.
StmtResult ActOnOpenMPTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp taskloop simd' after parsing of the associated statement.
const ValueDecl * getOpenMPDeclareMapperVarName() const
StmtResult ActOnOpenMPParallelMasterTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel master taskloop' after parsing of the associated statemen...
DeclGroupPtrTy ActOnOpenMPThreadprivateDirective(SourceLocation Loc, ArrayRef< Expr * > VarList)
Called on well-formed 'pragma omp threadprivate'.
void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope)
Initialization of captured region for OpenMP region.
NamedDecl * lookupOpenMPDeclareTargetName(Scope *CurScope, CXXScopeSpec &ScopeSpec, const DeclarationNameInfo &Id)
Searches for the provided declaration name for OpenMP declare target directive.
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
OMPClause * ActOnOpenMPWriteClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'write' clause.
StmtResult ActOnOpenMPTargetParallelGenericLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target parallel loop' after parsing of the associated statement.
void ActOnOpenMPAssumesDirective(SourceLocation Loc, OpenMPDirectiveKind DKind, ArrayRef< std::string > Assumptions, bool SkippedClauses)
Called on well-formed 'pragma omp [begin] assume[s]'.
StmtResult ActOnOpenMPTargetParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target parallel for simd' after parsing of the associated statemen...
void ActOnOpenMPBeginDeclareVariant(SourceLocation Loc, OMPTraitInfo &TI)
Handle a omp begin declare variant.
StmtResult ActOnOpenMPLoopnest(Stmt *AStmt)
Process a canonical OpenMP loop nest that can either be a canonical literal loop (ForStmt or CXXForRa...
OMPClause * ActOnOpenMPReverseOffloadClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'reverse_offload' clause.
StmtResult ActOnOpenMPTaskDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp task' after parsing of the associated statement.
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
StmtResult ActOnOpenMPTargetTeamsDistributeSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute simd' after parsing of the associated stat...
const DeclareTargetContextInfo ActOnOpenMPEndDeclareTargetDirective()
Called at the end of target region i.e. 'pragma omp end declare target'.
OMPClause * ActOnOpenMPDepthClause(Expr *DepthExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depth' clause.
void setOpenMPCaptureKind(FieldDecl *FD, const ValueDecl *D, unsigned Level)
Sets OpenMP capture kind (OMPC_private, OMPC_firstprivate, OMPC_map etc.) for FD based on DSA for the...
OMPClause * ActOnOpenMPClause(OpenMPClauseKind Kind, SourceLocation StartLoc, SourceLocation EndLoc)
StmtResult ActOnOpenMPCancelDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind CancelRegion)
Called on well-formed '#pragma omp cancel'.
StmtResult ActOnOpenMPTaskyieldDirective(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskyield'.
StmtResult ActOnOpenMPTeamsDistributeSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute simd' after parsing of the associated statement.
DeclGroupPtrTy ActOnOpenMPDeclareMapperDirective(Scope *S, DeclContext *DC, DeclarationName Name, QualType MapperType, SourceLocation StartLoc, DeclarationName VN, AccessSpecifier AS, Expr *MapperVarRef, ArrayRef< OMPClause * > Clauses, Decl *PrevDeclInScope=nullptr)
Called for 'pragma omp declare mapper'.
Encodes a location in the source.
A trivial tuple used to represent a source range.
Stmt - This represents one statement.
Definition Stmt.h:85
The base class of the type hierarchy.
Definition TypeBase.h:1879
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition Decl.h:714
Represents a variable declaration or definition.
Definition Decl.h:934
Retains information about a function, method, or block that is currently being parsed.
Definition ScopeInfo.h:104
Definition SPIR.cpp:47
Top level wrappers for InstallAPI frontend operations.
bool isa(CodeGen::Address addr)
Definition Address.h:330
MutableArrayRef< TemplateParameterList * > MultiTemplateParamsArg
Definition Ownership.h:263
OpenMPDefaultClauseVariableCategory
OpenMP variable-category for 'default' clause.
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
OpenMPNeedDevicePtrModifier
OpenMP 6.1 need_device modifier.
OpenMPAdjustArgsOpKind
OpenMP adjust-op kinds for 'adjust_args' clause.
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
Definition Specifiers.h:153
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
Definition OpenMPKinds.h:39
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition Specifiers.h:127
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
OpenMPNumTeamsClauseModifier
static constexpr unsigned NumberOfOMPAllocateClauseModifiers
Number of allowed allocate-modifiers.
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
OpenMPDynGroupprivateClauseFallbackModifier
MutableArrayRef< Expr * > MultiExprArg
Definition Ownership.h:259
ActionResult< ParsedType > TypeResult
Definition Ownership.h:251
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
Definition OpenMPKinds.h:55
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
OpenMPUseDevicePtrFallbackModifier
OpenMP 6.1 use_device_ptr fallback modifier.
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
Definition OpenMPKinds.h:63
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
Definition OpenMPKinds.h:25
OpenMPDynGroupprivateClauseModifier
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Definition Specifiers.h:136
OpenMPThreadLimitClauseModifier
OpenMPNumThreadsClauseModifier
OpenMPAtomicDefaultMemOrderClauseKind
OpenMP attributes for 'atomic_default_mem_order' clause.
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
Definition OpenMPKinds.h:48
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
Definition Ownership.h:230
llvm::omp::Clause OpenMPClauseKind
OpenMP clauses.
Definition OpenMPKinds.h:28
ActionResult< Expr * > ExprResult
Definition Ownership.h:249
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
Definition OpenMPKinds.h:31
ActionResult< Stmt * > StmtResult
Definition Ownership.h:250
OpenMPThreadsetKind
OpenMP modifiers for 'threadset' clause.
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
Definition OpenMPKinds.h:71
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
Iterator range representation begin:end[:step].
Definition ExprOpenMP.h:154
This structure contains most locations needed for by an OMPVarListClause.
OMPDeclareTargetDeclAttr::MapTypeTy MT
Definition SemaOpenMP.h:319
DeclareTargetContextInfo(OpenMPDirectiveKind Kind, SourceLocation Loc)
Definition SemaOpenMP.h:337
std::optional< Expr * > Indirect
The directive with indirect clause.
Definition SemaOpenMP.h:332
OpenMPDirectiveKind Kind
The directive kind, begin declare target or declare target.
Definition SemaOpenMP.h:329
OMPDeclareTargetDeclAttr::DevTypeTy DT
The 'device_type' as parsed from the clause.
Definition SemaOpenMP.h:326
SourceLocation Loc
The directive location.
Definition SemaOpenMP.h:335
llvm::DenseMap< NamedDecl *, MapInfo > ExplicitlyMapped
Explicitly listed variables and functions in a 'to' or 'link' clause.
Definition SemaOpenMP.h:323
Data structure for iterator expression.
OMPIteratorExpr::IteratorRange Range
Data used for processing a list of variables in OpenMP clauses.
SmallVector< SourceLocation, NumberOfOMPMotionModifiers > MotionModifiersLoc
int & ExtraModifier
Additional modifier for linear, map, depend, lastprivate, use_device_ptr, or num_teams clause.
SmallVector< OpenMPMotionModifierKind, NumberOfOMPMotionModifiers > MotionModifiers
std::array< int, 2 > ExtraModifierArray
SmallVector< SourceLocation, NumberOfOMPAllocateClauseModifiers > AllocClauseModifiersLoc
SmallVector< OpenMPMapModifierKind, NumberOfOMPMapClauseModifiers > MapTypeModifiers
SmallVector< SourceLocation, NumberOfOMPMapClauseModifiers > MapTypeModifiersLoc
std::array< SourceLocation, 2 > ExtraModifierLocArray
std::array< Expr *, 2 > ExtraModifierExprArray
SmallVector< OpenMPAllocateClauseModifier, NumberOfOMPAllocateClauseModifiers > AllocClauseModifiers
'step' modifier location for linear clause
Data for list of allocators.
Expr * AllocatorTraits
Allocator traits.
SourceLocation LParenLoc
Locations of '(' and ')' symbols.