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 on well-formed '\#pragma omp metadirective' after parsing
215 /// of the associated statement.
217 Stmt *AStmt, SourceLocation StartLoc,
218 SourceLocation EndLoc);
219
220 // OpenMP directives and clauses.
221 /// Called on correct id-expression from the '#pragma omp
222 /// threadprivate'.
224 const DeclarationNameInfo &Id,
226 /// Called on well-formed '#pragma omp threadprivate'.
228 ArrayRef<Expr *> VarList);
229 /// Builds a new OpenMPThreadPrivateDecl and checks its correctness.
231 ArrayRef<Expr *> VarList);
232 /// Called on well-formed '#pragma omp groupprivate'.
234 ArrayRef<Expr *> VarList);
235 /// Builds a new OpenMPGroupPrivateDecl and checks its correctness.
237 ArrayRef<Expr *> VarList);
238 /// Called on well-formed '#pragma omp allocate'.
240 ArrayRef<Expr *> VarList,
241 ArrayRef<OMPClause *> Clauses,
242 DeclContext *Owner = nullptr);
243
244 /// Called on well-formed '#pragma omp [begin] assume[s]'.
247 ArrayRef<std::string> Assumptions,
248 bool SkippedClauses);
249
250 /// Check if there is an active global `omp begin assumes` directive.
251 bool isInOpenMPAssumeScope() const { return !OMPAssumeScoped.empty(); }
252
253 /// Check if there is an active global `omp assumes` directive.
254 bool hasGlobalOpenMPAssumes() const { return !OMPAssumeGlobal.empty(); }
255
256 /// Called on well-formed '#pragma omp end assumes'.
258
259 /// Called on well-formed '#pragma omp requires'.
261 ArrayRef<OMPClause *> ClauseList);
262
263 /// Registers a 'requires' directive deserialized from an AST file.
265
266 /// The 'requires' directives seen so far in this translation unit.
268 /// Check restrictions on Requires directive
270 ArrayRef<OMPClause *> Clauses);
271 /// Check if the specified type is allowed to be used in 'omp declare
272 /// reduction' construct.
275 /// Called on start of '#pragma omp declare reduction'.
277 Scope *S, DeclContext *DC, DeclarationName Name,
278 ArrayRef<std::pair<QualType, SourceLocation>> ReductionTypes,
279 AccessSpecifier AS, Decl *PrevDeclInScope = nullptr);
280 /// Initialize declare reduction construct initializer.
282 /// Finish current declare reduction construct initializer.
284 /// Initialize declare reduction construct initializer.
285 /// \return omp_priv variable.
287 /// Finish current declare reduction construct initializer.
289 VarDecl *OmpPrivParm);
290 /// Called at the end of '#pragma omp declare reduction'.
292 Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid);
293
294 /// Check variable declaration in 'omp declare mapper' construct.
296 /// Check if the specified type is allowed to be used in 'omp declare
297 /// mapper' construct.
300 /// Called for '#pragma omp declare mapper'.
302 Scope *S, DeclContext *DC, DeclarationName Name, QualType MapperType,
304 Expr *MapperVarRef, ArrayRef<OMPClause *> Clauses,
305 Decl *PrevDeclInScope = nullptr);
306 /// Build the mapper variable of '#pragma omp declare mapper'.
308 QualType MapperType,
309 SourceLocation StartLoc,
310 DeclarationName VN);
312 bool isOpenMPDeclareMapperVarDeclAllowed(const VarDecl *VD) const;
314
316 struct MapInfo {
317 OMPDeclareTargetDeclAttr::MapTypeTy MT;
319 };
320 /// Explicitly listed variables and functions in a 'to' or 'link' clause.
321 llvm::DenseMap<NamedDecl *, MapInfo> ExplicitlyMapped;
322
323 /// The 'device_type' as parsed from the clause.
324 OMPDeclareTargetDeclAttr::DevTypeTy DT = OMPDeclareTargetDeclAttr::DT_Any;
325
326 /// The directive kind, `begin declare target` or `declare target`.
328
329 /// The directive with indirect clause.
330 std::optional<Expr *> Indirect;
331
332 /// The directive location.
334
337 };
338
339 /// Called on the start of target region i.e. '#pragma omp declare target'.
340 bool ActOnStartOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI);
341
342 /// Called at the end of target region i.e. '#pragma omp end declare target'.
343 const DeclareTargetContextInfo ActOnOpenMPEndDeclareTargetDirective();
344
345 /// Called once a target context is completed, that can be when a
346 /// '#pragma omp end declare target' was encountered or when a
347 /// '#pragma omp declare target' without declaration-definition-seq was
348 /// encountered.
349 void ActOnFinishedOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI);
350
351 /// Report unterminated 'omp declare target' or 'omp begin declare target' at
352 /// the end of a compilation unit.
354
355 /// Searches for the provided declaration name for OpenMP declare target
356 /// directive.
358 CXXScopeSpec &ScopeSpec,
359 const DeclarationNameInfo &Id);
360
361 /// Called on correct id-expression from the '#pragma omp declare target'.
363 OMPDeclareTargetDeclAttr::MapTypeTy MT,
364 DeclareTargetContextInfo &DTCI);
365
366 /// Check declaration inside target region.
367 void
370
371 /// Adds OMPDeclareTargetDeclAttr to referenced variables in declare target
372 /// directive.
374
375 /// Finishes analysis of the deferred functions calls that may be declared as
376 /// host/nohost during device/host compilation.
378 const FunctionDecl *Callee,
379 SourceLocation Loc);
380
381 /// Return true if currently in OpenMP task with untied clause context.
382 bool isInOpenMPTaskUntiedContext() const;
383
384 /// Return true inside OpenMP declare target region.
386 return !DeclareTargetNesting.empty();
387 }
388 /// Return true inside OpenMP target region.
390
391 /// Return the number of captured regions created for an OpenMP directive.
393
394 /// Initialization of captured region for OpenMP region.
395 void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope);
396
397 /// Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to
398 /// an OpenMP loop directive.
400
401 /// Process a canonical OpenMP loop nest that can either be a canonical
402 /// literal loop (ForStmt or CXXForRangeStmt), or the generated loop of an
403 /// OpenMP loop transformation construct.
405
406 /// End of OpenMP region.
407 ///
408 /// \param S Statement associated with the current OpenMP region.
409 /// \param Clauses List of clauses for the current OpenMP region.
410 ///
411 /// \returns Statement for finished OpenMP region.
414 OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName,
415 OpenMPDirectiveKind CancelRegion, ArrayRef<OMPClause *> Clauses,
416 Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc);
417 /// Process an OpenMP informational directive.
418 ///
419 /// \param Kind The directive kind.
420 /// \param DirName Declaration name info.
421 /// \param Clauses Array of clauses for directive.
422 /// \param AStmt The associated statement.
423 /// \param StartLoc The start location.
424 /// \param EndLoc The end location.
426 OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName,
427 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
428 SourceLocation EndLoc);
429 /// Process an OpenMP assume directive.
430 ///
431 /// \param Clauses Array of clauses for directive.
432 /// \param AStmt The associated statement.
433 /// \param StartLoc The start location.
434 /// \param EndLoc The end location.
436 Stmt *AStmt, SourceLocation StartLoc,
437 SourceLocation EndLoc);
438
439 /// Called on well-formed '\#pragma omp parallel' after parsing
440 /// of the associated statement.
442 Stmt *AStmt, SourceLocation StartLoc,
443 SourceLocation EndLoc);
445 llvm::SmallDenseMap<const ValueDecl *, const Expr *, 4>;
446 /// Called on well-formed '\#pragma omp simd' after parsing
447 /// of the associated statement.
450 SourceLocation StartLoc, SourceLocation EndLoc,
451 VarsWithInheritedDSAType &VarsWithImplicitDSA);
452 /// Called on well-formed '#pragma omp tile' after parsing of its clauses and
453 /// the associated statement.
455 Stmt *AStmt, SourceLocation StartLoc,
456 SourceLocation EndLoc);
458 Stmt *AStmt, SourceLocation StartLoc,
459 SourceLocation EndLoc);
460 /// Called on well-formed '#pragma omp unroll' after parsing of its clauses
461 /// and the associated statement.
463 Stmt *AStmt, SourceLocation StartLoc,
464 SourceLocation EndLoc);
465 /// Called on well-formed '#pragma omp reverse'.
467 SourceLocation EndLoc);
468 /// Called on well-formed '#pragma omp split' after parsing of its
469 /// associated statement.
471 Stmt *AStmt, SourceLocation StartLoc,
472 SourceLocation EndLoc);
473 /// Called on well-formed '#pragma omp interchange' after parsing of its
474 /// clauses and the associated statement.
476 Stmt *AStmt,
477 SourceLocation StartLoc,
478 SourceLocation EndLoc);
479
480 /// Called on well-formed '#pragma omp flatten' after parsing of its
481 /// clauses and the associated statement.
483 Stmt *AStmt, SourceLocation StartLoc,
484 SourceLocation EndLoc);
485
486 /// Called on well-formed '#pragma omp fuse' after parsing of its
487 /// clauses and the associated statement.
489 Stmt *AStmt, SourceLocation StartLoc,
490 SourceLocation EndLoc);
491
492 /// Called on well-formed '\#pragma omp for' after parsing
493 /// of the associated statement.
496 SourceLocation StartLoc, SourceLocation EndLoc,
497 VarsWithInheritedDSAType &VarsWithImplicitDSA);
498 /// Called on well-formed '\#pragma omp for simd' after parsing
499 /// of the associated statement.
502 SourceLocation StartLoc, SourceLocation EndLoc,
503 VarsWithInheritedDSAType &VarsWithImplicitDSA);
504 /// Called on well-formed '\#pragma omp sections' after parsing
505 /// of the associated statement.
507 Stmt *AStmt, SourceLocation StartLoc,
508 SourceLocation EndLoc);
509 /// Called on well-formed '\#pragma omp section' after parsing of the
510 /// associated statement.
512 SourceLocation EndLoc);
513 /// Called on well-formed '\#pragma omp scope' after parsing of the
514 /// associated statement.
516 Stmt *AStmt, SourceLocation StartLoc,
517 SourceLocation EndLoc);
518 /// Called on well-formed '\#pragma omp single' after parsing of the
519 /// associated statement.
521 Stmt *AStmt, SourceLocation StartLoc,
522 SourceLocation EndLoc);
523 /// Called on well-formed '\#pragma omp master' after parsing of the
524 /// associated statement.
526 SourceLocation EndLoc);
527 /// Called on well-formed '\#pragma omp critical' after parsing of the
528 /// associated statement.
530 ArrayRef<OMPClause *> Clauses,
531 Stmt *AStmt, SourceLocation StartLoc,
532 SourceLocation EndLoc);
533 /// Called on well-formed '\#pragma omp parallel for' after parsing
534 /// of the associated statement.
536 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
537 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
538 /// Called on well-formed '\#pragma omp parallel for simd' after
539 /// parsing of the associated statement.
541 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
542 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
543 /// Called on well-formed '\#pragma omp parallel master' after
544 /// parsing of the associated statement.
546 Stmt *AStmt,
547 SourceLocation StartLoc,
548 SourceLocation EndLoc);
549 /// Called on well-formed '\#pragma omp parallel masked' after
550 /// parsing of the associated statement.
552 Stmt *AStmt,
553 SourceLocation StartLoc,
554 SourceLocation EndLoc);
555 /// Called on well-formed '\#pragma omp parallel sections' after
556 /// parsing of the associated statement.
558 Stmt *AStmt,
559 SourceLocation StartLoc,
560 SourceLocation EndLoc);
561 /// Called on well-formed '\#pragma omp task' after parsing of the
562 /// associated statement.
564 Stmt *AStmt, SourceLocation StartLoc,
565 SourceLocation EndLoc);
566 /// Called on well-formed '\#pragma omp taskyield'.
568 SourceLocation EndLoc);
569 /// Called on well-formed '\#pragma omp error'.
570 /// Error direcitive is allowed in both declared and excutable contexts.
571 /// Adding InExContext to identify which context is called from.
573 SourceLocation StartLoc,
574 SourceLocation EndLoc,
575 bool InExContext = true);
576 /// Called on well-formed '\#pragma omp barrier'.
578 SourceLocation EndLoc);
579 /// Called on well-formed '\#pragma omp taskwait'.
581 SourceLocation StartLoc,
582 SourceLocation EndLoc);
583 /// Called on well-formed '\#pragma omp taskgroup'.
585 Stmt *AStmt, SourceLocation StartLoc,
586 SourceLocation EndLoc);
587 /// Called on well-formed '\#pragma omp flush'.
589 SourceLocation StartLoc,
590 SourceLocation EndLoc);
591 /// Called on well-formed '\#pragma omp depobj'.
593 SourceLocation StartLoc,
594 SourceLocation EndLoc);
595 /// Called on well-formed '\#pragma omp scan'.
597 SourceLocation StartLoc,
598 SourceLocation EndLoc);
599 /// Called on well-formed '\#pragma omp ordered' after parsing of the
600 /// associated statement.
602 Stmt *AStmt, SourceLocation StartLoc,
603 SourceLocation EndLoc);
604 /// Called on well-formed '\#pragma omp atomic' after parsing of the
605 /// associated statement.
607 Stmt *AStmt, SourceLocation StartLoc,
608 SourceLocation EndLoc);
609 /// Called on well-formed '\#pragma omp target' after parsing of the
610 /// associated statement.
612 Stmt *AStmt, SourceLocation StartLoc,
613 SourceLocation EndLoc);
614 /// Called on well-formed '\#pragma omp target data' after parsing of
615 /// the associated statement.
617 Stmt *AStmt,
618 SourceLocation StartLoc,
619 SourceLocation EndLoc);
620 /// Called on well-formed '\#pragma omp target enter data' after
621 /// parsing of the associated statement.
623 SourceLocation StartLoc,
624 SourceLocation EndLoc,
625 Stmt *AStmt);
626 /// Called on well-formed '\#pragma omp target exit data' after
627 /// parsing of the associated statement.
629 SourceLocation StartLoc,
630 SourceLocation EndLoc,
631 Stmt *AStmt);
632 /// Called on well-formed '\#pragma omp target parallel' after
633 /// parsing of the associated statement.
635 Stmt *AStmt,
636 SourceLocation StartLoc,
637 SourceLocation EndLoc);
638 /// Called on well-formed '\#pragma omp target parallel for' after
639 /// parsing of the associated statement.
641 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
642 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
643 /// Called on well-formed '\#pragma omp teams' after parsing of the
644 /// associated statement.
646 Stmt *AStmt, SourceLocation StartLoc,
647 SourceLocation EndLoc);
648 /// Called on well-formed '\#pragma omp teams loop' after parsing of the
649 /// associated statement.
651 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
652 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
653 /// Called on well-formed '\#pragma omp target teams loop' after parsing of
654 /// the associated statement.
656 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
657 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
658 /// Called on well-formed '\#pragma omp parallel loop' after parsing of the
659 /// associated statement.
661 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
662 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
663 /// Called on well-formed '\#pragma omp target parallel loop' after parsing
664 /// of the associated statement.
666 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
667 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
668 /// Called on well-formed '\#pragma omp cancellation point'.
671 SourceLocation EndLoc,
672 OpenMPDirectiveKind CancelRegion);
673 /// Called on well-formed '\#pragma omp cancel'.
675 SourceLocation StartLoc,
676 SourceLocation EndLoc,
677 OpenMPDirectiveKind CancelRegion);
678 /// Called on well-formed '\#pragma omp taskloop' after parsing of the
679 /// associated statement.
682 SourceLocation StartLoc, SourceLocation EndLoc,
683 VarsWithInheritedDSAType &VarsWithImplicitDSA);
684 /// Called on well-formed '\#pragma omp taskloop simd' after parsing of
685 /// the associated statement.
687 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
688 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
689 /// Called on well-formed '\#pragma omp master taskloop' after parsing of the
690 /// associated statement.
692 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
693 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
694 /// Called on well-formed '\#pragma omp master taskloop simd' after parsing of
695 /// the associated statement.
697 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
698 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
699 /// Called on well-formed '\#pragma omp parallel master taskloop' after
700 /// parsing of the associated statement.
702 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
703 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
704 /// Called on well-formed '\#pragma omp parallel master taskloop simd' after
705 /// parsing of the associated statement.
707 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
708 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
709 /// Called on well-formed '\#pragma omp masked taskloop' after parsing of the
710 /// associated statement.
712 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
713 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
714 /// Called on well-formed '\#pragma omp masked taskloop simd' after parsing of
715 /// the associated statement.
717 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
718 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
719 /// Called on well-formed '\#pragma omp parallel masked taskloop' after
720 /// parsing of the associated statement.
722 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
723 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
724 /// Called on well-formed '\#pragma omp parallel masked taskloop simd' after
725 /// parsing of the associated statement.
727 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
728 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
729 /// Called on well-formed '\#pragma omp distribute' after parsing
730 /// of the associated statement.
733 SourceLocation StartLoc, SourceLocation EndLoc,
734 VarsWithInheritedDSAType &VarsWithImplicitDSA);
735 /// Called on well-formed '\#pragma omp target update'.
737 SourceLocation StartLoc,
738 SourceLocation EndLoc,
739 Stmt *AStmt);
740 /// Called on well-formed '\#pragma omp distribute parallel for' after
741 /// parsing of the associated statement.
743 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
744 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
745 /// Called on well-formed '\#pragma omp distribute parallel for simd'
746 /// after parsing of the associated statement.
748 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
749 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
750 /// Called on well-formed '\#pragma omp distribute simd' after
751 /// parsing of the associated statement.
753 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
754 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
755 /// Called on well-formed '\#pragma omp target parallel for simd' after
756 /// parsing of the associated statement.
758 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
759 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
760 /// Called on well-formed '\#pragma omp target simd' after parsing of
761 /// the associated statement.
764 SourceLocation StartLoc, SourceLocation EndLoc,
765 VarsWithInheritedDSAType &VarsWithImplicitDSA);
766 /// Called on well-formed '\#pragma omp teams distribute' after parsing of
767 /// the associated statement.
769 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
770 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
771 /// Called on well-formed '\#pragma omp teams distribute simd' after parsing
772 /// of the associated statement.
774 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
775 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
776 /// Called on well-formed '\#pragma omp teams distribute parallel for simd'
777 /// after parsing of the associated statement.
779 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
780 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
781 /// Called on well-formed '\#pragma omp teams distribute parallel for'
782 /// after parsing of the associated statement.
784 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
785 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
786 /// Called on well-formed '\#pragma omp target teams' after parsing of the
787 /// associated statement.
789 Stmt *AStmt,
790 SourceLocation StartLoc,
791 SourceLocation EndLoc);
792 /// Called on well-formed '\#pragma omp target teams distribute' after parsing
793 /// of the associated statement.
795 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
796 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
797 /// Called on well-formed '\#pragma omp target teams distribute parallel for'
798 /// after parsing of the associated statement.
800 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
801 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
802 /// Called on well-formed '\#pragma omp target teams distribute parallel for
803 /// simd' after parsing of the associated statement.
805 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
806 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
807 /// Called on well-formed '\#pragma omp target teams distribute simd' after
808 /// parsing of the associated statement.
810 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
811 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
812 /// Called on well-formed '\#pragma omp interop'.
814 SourceLocation StartLoc,
815 SourceLocation EndLoc);
816 /// Called on well-formed '\#pragma omp dispatch' after parsing of the
817 // /associated statement.
819 Stmt *AStmt, SourceLocation StartLoc,
820 SourceLocation EndLoc);
821 /// Called on well-formed '\#pragma omp masked' after parsing of the
822 // /associated statement.
824 Stmt *AStmt, SourceLocation StartLoc,
825 SourceLocation EndLoc);
826
827 /// Called on well-formed '\#pragma omp loop' after parsing of the
828 /// associated statement.
830 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
831 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
832
833 /// Checks correctness of linear modifiers.
835 SourceLocation LinLoc);
836 /// Checks that the specified declaration matches requirements for the linear
837 /// decls.
840 bool IsDeclareSimd = false);
841
842 /// Called on well-formed '\#pragma omp declare simd' after parsing of
843 /// the associated method/function.
845 DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS,
846 Expr *Simdlen, ArrayRef<Expr *> Uniforms, ArrayRef<Expr *> Aligneds,
847 ArrayRef<Expr *> Alignments, ArrayRef<Expr *> Linears,
848 ArrayRef<unsigned> LinModifiers, ArrayRef<Expr *> Steps, SourceRange SR);
849
850 /// Checks '\#pragma omp declare variant' variant function and original
851 /// functions after parsing of the associated method/function.
852 /// \param DG Function declaration to which declare variant directive is
853 /// applied to.
854 /// \param VariantRef Expression that references the variant function, which
855 /// must be used instead of the original one, specified in \p DG.
856 /// \param TI The trait info object representing the match clause.
857 /// \param NumAppendArgs The number of omp_interop_t arguments to account for
858 /// in checking.
859 /// \returns std::nullopt, if the function/variant function are not compatible
860 /// with the pragma, pair of original function/variant ref expression
861 /// otherwise.
862 std::optional<std::pair<FunctionDecl *, Expr *>>
864 OMPTraitInfo &TI, unsigned NumAppendArgs,
865 SourceRange SR);
866
867 /// Called on well-formed '\#pragma omp declare variant' after parsing of
868 /// the associated method/function.
869 /// \param FD Function declaration to which declare variant directive is
870 /// applied to.
871 /// \param VariantRef Expression that references the variant function, which
872 /// must be used instead of the original one, specified in \p DG.
873 /// \param TI The context traits associated with the function variant.
874 /// \param AdjustArgsNothing The list of 'nothing' arguments.
875 /// \param AdjustArgsNeedDevicePtr The list of 'need_device_ptr' arguments.
876 /// \param AppendArgs The list of 'append_args' arguments.
877 /// \param AdjustArgsLoc The Location of an 'adjust_args' clause.
878 /// \param AppendArgsLoc The Location of an 'append_args' clause.
879 /// \param SR The SourceRange of the 'declare variant' directive.
881 FunctionDecl *FD, Expr *VariantRef, OMPTraitInfo &TI,
882 ArrayRef<Expr *> AdjustArgsNothing,
883 ArrayRef<Expr *> AdjustArgsNeedDevicePtr,
884 ArrayRef<Expr *> AdjustArgsNeedDeviceAddr,
885 ArrayRef<OMPInteropInfo> AppendArgs, SourceLocation AdjustArgsLoc,
886 SourceLocation AppendArgsLoc, SourceRange SR);
887
888 /// Called on device_num selector in context selectors.
889 void ActOnOpenMPDeviceNum(Expr *DeviceNumExpr);
890
892 SourceLocation StartLoc,
893 SourceLocation LParenLoc,
894 SourceLocation EndLoc);
895 /// Called on well-formed 'allocator' clause.
897 SourceLocation StartLoc,
898 SourceLocation LParenLoc,
899 SourceLocation EndLoc);
900 /// Called on well-formed 'if' clause.
902 Expr *Condition, SourceLocation StartLoc,
903 SourceLocation LParenLoc,
904 SourceLocation NameModifierLoc,
905 SourceLocation ColonLoc,
906 SourceLocation EndLoc);
907 /// Called on well-formed 'final' clause.
909 SourceLocation LParenLoc,
910 SourceLocation EndLoc);
911 /// Called on well-formed 'num_threads' clause.
913 ArrayRef<Expr *> VarList, OpenMPNumThreadsClauseModifier SimpleModifier,
914 SourceLocation SimpleModifierLoc,
915 OpenMPNumThreadsClauseModifier ComplexModifier, Expr *ComplexModifierExpr,
916 SourceLocation ComplexModifierLoc, SourceLocation StartLoc,
917 SourceLocation LParenLoc, SourceLocation EndLoc);
918 /// Called on well-formed 'align' clause.
920 SourceLocation LParenLoc,
921 SourceLocation EndLoc);
922 /// Called on well-formed 'safelen' clause.
924 SourceLocation LParenLoc,
925 SourceLocation EndLoc);
926 /// Called on well-formed 'simdlen' clause.
928 SourceLocation LParenLoc,
929 SourceLocation EndLoc);
930 /// Called on well-form 'sizes' clause.
932 SourceLocation StartLoc,
933 SourceLocation LParenLoc,
934 SourceLocation EndLoc);
935 /// Called on well-formed 'counts' clause after parsing its arguments.
936 OMPClause *
938 SourceLocation LParenLoc, SourceLocation EndLoc,
939 std::optional<unsigned> FillIdx,
940 SourceLocation FillLoc, unsigned FillCount);
941 /// Called on well-form 'permutation' clause after parsing its arguments.
943 SourceLocation StartLoc,
944 SourceLocation LParenLoc,
945 SourceLocation EndLoc);
946 /// Called on well-form 'full' clauses.
948 SourceLocation EndLoc);
949 /// Called on well-form 'partial' clauses.
951 SourceLocation LParenLoc,
952 SourceLocation EndLoc);
953 /// Called on well-formed 'depth' clause.
955 SourceLocation LParenLoc,
956 SourceLocation EndLoc);
957 /// Called on well-formed 'collapse' clause.
959 SourceLocation StartLoc,
960 SourceLocation LParenLoc,
961 SourceLocation EndLoc);
962
963 /// Called on well-form 'looprange' clause after parsing its arguments.
964 OMPClause *
966 SourceLocation LParenLoc, SourceLocation FirstLoc,
967 SourceLocation CountLoc, SourceLocation EndLoc);
968 /// Called on well-formed 'ordered' clause.
969 OMPClause *
971 SourceLocation LParenLoc = SourceLocation(),
972 Expr *NumForLoops = nullptr);
973 /// Called on well-formed 'grainsize' clause.
975 Expr *Size, SourceLocation StartLoc,
976 SourceLocation LParenLoc,
977 SourceLocation ModifierLoc,
978 SourceLocation EndLoc);
979 /// Called on well-formed 'num_tasks' clause.
981 Expr *NumTasks, SourceLocation StartLoc,
982 SourceLocation LParenLoc,
983 SourceLocation ModifierLoc,
984 SourceLocation EndLoc);
985 /// Called on well-formed 'hint' clause.
987 SourceLocation LParenLoc,
988 SourceLocation EndLoc);
989 /// Called on well-formed 'detach' clause.
991 SourceLocation LParenLoc,
992 SourceLocation EndLoc);
993
994 OMPClause *ActOnOpenMPSimpleClause(OpenMPClauseKind Kind, unsigned Argument,
995 SourceLocation ArgumentLoc,
996 SourceLocation StartLoc,
997 SourceLocation LParenLoc,
998 SourceLocation EndLoc);
999 /// Called on well-formed 'when' clause.
1001 SourceLocation LParenLoc,
1002 SourceLocation EndLoc);
1003 /// Called on well-formed 'default' clause.
1004 OMPClause *
1005 ActOnOpenMPDefaultClause(llvm::omp::DefaultKind M, SourceLocation MLoc,
1007 SourceLocation VCKindLoc, SourceLocation StartLoc,
1008 SourceLocation LParenLoc, SourceLocation EndLoc);
1009 /// Called on well-formed 'threadset' clause.
1011 SourceLocation KindLoc,
1012 SourceLocation StartLoc,
1013 SourceLocation LParenLoc,
1014 SourceLocation EndLoc);
1015 /// Called on well-formed 'transparent' clause.
1017 SourceLocation StartLoc,
1018 SourceLocation LParenLoc,
1019 SourceLocation EndLoc);
1020 /// Called on well-formed 'proc_bind' clause.
1021 OMPClause *ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind,
1022 SourceLocation KindLoc,
1023 SourceLocation StartLoc,
1024 SourceLocation LParenLoc,
1025 SourceLocation EndLoc);
1026 /// Called on well-formed 'order' clause.
1029 SourceLocation StartLoc,
1030 SourceLocation LParenLoc,
1031 SourceLocation MLoc, SourceLocation KindLoc,
1032 SourceLocation EndLoc);
1033 /// Called on well-formed 'update_depend_objects' clause.
1035 SourceLocation KindLoc,
1036 SourceLocation StartLoc,
1037 SourceLocation LParenLoc,
1038 SourceLocation EndLoc);
1039 /// Called on well-formed 'holds' clause.
1041 SourceLocation LParenLoc,
1042 SourceLocation EndLoc);
1043 /// Called on well-formed 'absent' or 'contains' clauses.
1048 SourceLocation Loc,
1049 SourceLocation RLoc);
1050
1052 OpenMPClauseKind Kind, ArrayRef<unsigned> Arguments, Expr *Expr,
1053 SourceLocation StartLoc, SourceLocation LParenLoc,
1054 ArrayRef<SourceLocation> ArgumentsLoc, SourceLocation DelimLoc,
1055 SourceLocation EndLoc);
1056 /// Called on well-formed 'schedule' clause.
1059 OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc,
1060 SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc,
1061 SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc);
1062
1064 SourceLocation EndLoc);
1065 /// Called on well-formed 'nowait' clause.
1067 SourceLocation EndLoc,
1068 SourceLocation LParenLoc, Expr *Condition);
1069 /// Called on well-formed 'untied' clause.
1071 SourceLocation EndLoc);
1072 /// Called on well-formed 'mergeable' clause.
1074 SourceLocation EndLoc);
1075 /// Called on well-formed 'read' clause.
1077 SourceLocation EndLoc);
1078 /// Called on well-formed 'write' clause.
1080 SourceLocation EndLoc);
1081 /// Called on well-formed 'update' clause.
1083 SourceLocation EndLoc);
1084 /// Called on well-formed 'capture' clause.
1086 SourceLocation EndLoc);
1087 /// Called on well-formed 'compare' clause.
1089 SourceLocation EndLoc);
1090 /// Called on well-formed 'fail' clause.
1092 SourceLocation EndLoc);
1094 SourceLocation KindLoc,
1095 SourceLocation StartLoc,
1096 SourceLocation LParenLoc,
1097 SourceLocation EndLoc);
1098
1099 /// Called on well-formed 'seq_cst' clause.
1101 SourceLocation EndLoc);
1102 /// Called on well-formed 'acq_rel' clause.
1104 SourceLocation EndLoc);
1105 /// Called on well-formed 'acquire' clause.
1107 SourceLocation EndLoc);
1108 /// Called on well-formed 'release' clause.
1110 SourceLocation EndLoc);
1111 /// Called on well-formed 'relaxed' clause.
1113 SourceLocation EndLoc);
1114 /// Called on well-formed 'weak' clause.
1116 SourceLocation EndLoc);
1117
1118 /// Called on well-formed 'init' clause.
1119 OMPClause *
1120 ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo,
1121 SourceLocation StartLoc, SourceLocation LParenLoc,
1122 SourceLocation VarLoc, SourceLocation EndLoc);
1123
1124 /// Called on well-formed 'use' clause.
1125 OMPClause *ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc,
1126 SourceLocation LParenLoc,
1127 SourceLocation VarLoc, SourceLocation EndLoc);
1128
1129 /// Called on well-formed 'destroy' clause.
1131 SourceLocation LParenLoc,
1132 SourceLocation VarLoc,
1133 SourceLocation EndLoc);
1134 /// Called on well-formed 'novariants' clause.
1136 SourceLocation StartLoc,
1137 SourceLocation LParenLoc,
1138 SourceLocation EndLoc);
1139 /// Called on well-formed 'nocontext' clause.
1141 SourceLocation StartLoc,
1142 SourceLocation LParenLoc,
1143 SourceLocation EndLoc);
1144 /// Called on well-formed 'filter' clause.
1146 SourceLocation LParenLoc,
1147 SourceLocation EndLoc);
1148 /// Called on well-formed 'threads' clause.
1150 SourceLocation EndLoc);
1151 /// Called on well-formed 'simd' clause.
1153 SourceLocation EndLoc);
1154 /// Called on well-formed 'nogroup' clause.
1156 SourceLocation EndLoc);
1157 /// Called on well-formed 'unified_address' clause.
1159 SourceLocation EndLoc);
1160
1161 /// Called on well-formed 'unified_address' clause.
1163 SourceLocation EndLoc);
1164
1165 /// Called on well-formed 'reverse_offload' clause.
1167 SourceLocation EndLoc);
1168
1169 /// Called on well-formed 'dynamic_allocators' clause.
1171 SourceLocation EndLoc);
1172
1173 /// Called on well-formed 'atomic_default_mem_order' clause.
1176 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
1177
1178 /// Called on well-formed 'self_maps' clause.
1180 SourceLocation EndLoc);
1181
1182 /// Called on well-formed 'at' clause.
1184 SourceLocation KindLoc,
1185 SourceLocation StartLoc,
1186 SourceLocation LParenLoc,
1187 SourceLocation EndLoc);
1188
1189 /// Called on well-formed 'severity' clause.
1191 SourceLocation KindLoc,
1192 SourceLocation StartLoc,
1193 SourceLocation LParenLoc,
1194 SourceLocation EndLoc);
1195
1196 /// Called on well-formed 'message' clause.
1197 /// passing string for message.
1199 SourceLocation LParenLoc,
1200 SourceLocation EndLoc);
1201
1202 /// Data used for processing a list of variables in OpenMP clauses.
1203 struct OpenMPVarListDataTy final {
1205 Expr *IteratorExpr = nullptr;
1210 std::array<int, 2> ExtraModifierArray = {-1, -1};
1211 std::array<Expr *, 2> ExtraModifierExprArray = {nullptr, nullptr};
1212 std::array<SourceLocation, 2> ExtraModifierLocArray = {SourceLocation(),
1213 SourceLocation()};
1214 /// Additional modifier for linear, map, depend, lastprivate,
1215 /// use_device_ptr, or num_teams clause.
1219 int OriginalSharingModifier = 0; // Default is shared
1229 bool IsMapTypeImplicit = false;
1233 StepModifierLoc; /// 'step' modifier location for linear clause
1246 };
1247
1249 ArrayRef<Expr *> Vars,
1250 const OMPVarListLocTy &Locs,
1251 OpenMPVarListDataTy &Data);
1252 /// Called on well-formed 'inclusive' clause.
1254 SourceLocation StartLoc,
1255 SourceLocation LParenLoc,
1256 SourceLocation EndLoc);
1257 /// Called on well-formed 'exclusive' clause.
1259 SourceLocation StartLoc,
1260 SourceLocation LParenLoc,
1261 SourceLocation EndLoc);
1262 /// Called on well-formed 'allocate' clause.
1263 OMPClause *
1264 ActOnOpenMPAllocateClause(Expr *Allocator, Expr *Alignment,
1265 OpenMPAllocateClauseModifier FirstModifier,
1266 SourceLocation FirstModifierLoc,
1267 OpenMPAllocateClauseModifier SecondModifier,
1268 SourceLocation SecondModifierLoc,
1269 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1270 SourceLocation ColonLoc, SourceLocation LParenLoc,
1271 SourceLocation EndLoc);
1272 /// Called on well-formed 'private' clause.
1274 SourceLocation StartLoc,
1275 SourceLocation LParenLoc,
1276 SourceLocation EndLoc);
1277 /// Called on well-formed 'firstprivate' clause.
1279 SourceLocation StartLoc,
1280 SourceLocation LParenLoc,
1281 SourceLocation EndLoc);
1282 /// Called on well-formed 'lastprivate' clause.
1285 SourceLocation LPKindLoc, SourceLocation ColonLoc,
1286 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
1287 /// Called on well-formed 'shared' clause.
1289 SourceLocation StartLoc,
1290 SourceLocation LParenLoc,
1291 SourceLocation EndLoc);
1292 /// Called on well-formed 'reduction' clause.
1294 ArrayRef<Expr *> VarList,
1295 OpenMPVarListDataTy::OpenMPReductionClauseModifiers Modifiers,
1296 SourceLocation StartLoc, SourceLocation LParenLoc,
1297 SourceLocation ModifierLoc, SourceLocation ColonLoc,
1298 SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec,
1299 const DeclarationNameInfo &ReductionId,
1300 ArrayRef<Expr *> UnresolvedReductions = {});
1301 /// Called on well-formed 'task_reduction' clause.
1303 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1304 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
1305 CXXScopeSpec &ReductionIdScopeSpec,
1306 const DeclarationNameInfo &ReductionId,
1307 ArrayRef<Expr *> UnresolvedReductions = {});
1308 /// Called on well-formed 'in_reduction' clause.
1310 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1311 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
1312 CXXScopeSpec &ReductionIdScopeSpec,
1313 const DeclarationNameInfo &ReductionId,
1314 ArrayRef<Expr *> UnresolvedReductions = {});
1315 /// Called on well-formed 'linear' clause.
1316 OMPClause *ActOnOpenMPLinearClause(
1317 ArrayRef<Expr *> VarList, Expr *Step, SourceLocation StartLoc,
1318 SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind,
1319 SourceLocation LinLoc, SourceLocation ColonLoc,
1320 SourceLocation StepModifierLoc, SourceLocation EndLoc);
1321 /// Called on well-formed 'aligned' clause.
1322 OMPClause *ActOnOpenMPAlignedClause(ArrayRef<Expr *> VarList, Expr *Alignment,
1323 SourceLocation StartLoc,
1324 SourceLocation LParenLoc,
1325 SourceLocation ColonLoc,
1326 SourceLocation EndLoc);
1327 /// Called on well-formed 'copyin' clause.
1328 OMPClause *ActOnOpenMPCopyinClause(ArrayRef<Expr *> VarList,
1329 SourceLocation StartLoc,
1330 SourceLocation LParenLoc,
1331 SourceLocation EndLoc);
1332 /// Called on well-formed 'copyprivate' clause.
1333 OMPClause *ActOnOpenMPCopyprivateClause(ArrayRef<Expr *> VarList,
1334 SourceLocation StartLoc,
1335 SourceLocation LParenLoc,
1336 SourceLocation EndLoc);
1337 /// Called on well-formed 'flush' pseudo clause.
1338 OMPClause *ActOnOpenMPFlushClause(ArrayRef<Expr *> VarList,
1339 SourceLocation StartLoc,
1340 SourceLocation LParenLoc,
1341 SourceLocation EndLoc);
1342 /// Called on well-formed 'depobj' pseudo clause.
1343 OMPClause *ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc,
1344 SourceLocation LParenLoc,
1345 SourceLocation EndLoc);
1346 /// Called on well-formed 'depend' clause.
1347 OMPClause *ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data,
1348 Expr *DepModifier,
1349 ArrayRef<Expr *> VarList,
1350 SourceLocation StartLoc,
1351 SourceLocation LParenLoc,
1352 SourceLocation EndLoc);
1353 /// Called on well-formed 'device' clause.
1355 Expr *Device, SourceLocation StartLoc,
1356 SourceLocation LParenLoc,
1357 SourceLocation ModifierLoc,
1358 SourceLocation EndLoc);
1359 /// Called on well-formed 'map' clause.
1360 OMPClause *ActOnOpenMPMapClause(
1361 Expr *IteratorModifier, ArrayRef<OpenMPMapModifierKind> MapTypeModifiers,
1362 ArrayRef<SourceLocation> MapTypeModifiersLoc,
1363 CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId,
1364 OpenMPMapClauseKind MapType, bool IsMapTypeImplicit,
1365 SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VarList,
1366 const OMPVarListLocTy &Locs, bool NoDiagnose = false,
1367 ArrayRef<Expr *> UnresolvedMappers = {});
1368 /// Called on well-formed 'num_teams' clause.
1369 OMPClause *ActOnOpenMPNumTeamsClause(
1370 ArrayRef<Expr *> VarList, OpenMPNumTeamsClauseModifier Modifier,
1371 Expr *ModifierExpr, SourceLocation ModifierLoc,
1372 OpenMPNumTeamsClauseModifier ModifierExtra, Expr *ModifierExtraExpr,
1373 SourceLocation ModifierExtraLoc, SourceLocation StartLoc,
1374 SourceLocation LParenLoc, SourceLocation EndLoc);
1375 /// Called on well-formed 'thread_limit' clause.
1377 ArrayRef<Expr *> VarList, OpenMPThreadLimitClauseModifier Modifier,
1378 Expr *ModifierExpr, SourceLocation ModifierLoc, SourceLocation StartLoc,
1379 SourceLocation LParenLoc, SourceLocation EndLoc);
1380 /// Called on well-formed 'priority' clause.
1381 OMPClause *ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc,
1382 SourceLocation LParenLoc,
1383 SourceLocation EndLoc);
1384 /// Called on well-formed 'dist_schedule' clause.
1386 OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize,
1387 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc,
1388 SourceLocation CommaLoc, SourceLocation EndLoc);
1389 /// Called on well-formed 'defaultmap' clause.
1390 OMPClause *ActOnOpenMPDefaultmapClause(
1392 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc,
1393 SourceLocation KindLoc, SourceLocation EndLoc);
1394 /// Called on well-formed 'to' clause.
1395 OMPClause *
1396 ActOnOpenMPToClause(ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
1397 ArrayRef<SourceLocation> MotionModifiersLoc,
1398 Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec,
1399 DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
1400 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
1401 ArrayRef<Expr *> UnresolvedMappers = {});
1402 /// Called on well-formed 'from' clause.
1403 OMPClause *
1404 ActOnOpenMPFromClause(ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
1405 ArrayRef<SourceLocation> MotionModifiersLoc,
1406 Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec,
1407 DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
1408 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
1409 ArrayRef<Expr *> UnresolvedMappers = {});
1410 /// Called on well-formed 'use_device_ptr' clause.
1412 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
1413 OpenMPUseDevicePtrFallbackModifier FallbackModifier,
1414 SourceLocation FallbackModifierLoc);
1415 /// Called on well-formed 'use_device_addr' clause.
1416 OMPClause *ActOnOpenMPUseDeviceAddrClause(ArrayRef<Expr *> VarList,
1417 const OMPVarListLocTy &Locs);
1418 /// Called on well-formed 'is_device_ptr' clause.
1419 OMPClause *ActOnOpenMPIsDevicePtrClause(ArrayRef<Expr *> VarList,
1420 const OMPVarListLocTy &Locs);
1421 /// Called on well-formed 'has_device_addr' clause.
1422 OMPClause *ActOnOpenMPHasDeviceAddrClause(ArrayRef<Expr *> VarList,
1423 const OMPVarListLocTy &Locs);
1424 /// Called on well-formed 'nontemporal' clause.
1425 OMPClause *ActOnOpenMPNontemporalClause(ArrayRef<Expr *> VarList,
1426 SourceLocation StartLoc,
1427 SourceLocation LParenLoc,
1428 SourceLocation EndLoc);
1429
1430 /// Data for list of allocators.
1432 /// Allocator.
1433 Expr *Allocator = nullptr;
1434 /// Allocator traits.
1436 /// Locations of '(' and ')' symbols.
1438 };
1439 /// Called on well-formed 'uses_allocators' clause.
1441 SourceLocation LParenLoc,
1442 SourceLocation EndLoc,
1444 /// Called on well-formed 'affinity' clause.
1446 SourceLocation LParenLoc,
1447 SourceLocation ColonLoc,
1448 SourceLocation EndLoc, Expr *Modifier,
1449 ArrayRef<Expr *> Locators);
1450 /// Called on a well-formed 'bind' clause.
1452 SourceLocation KindLoc,
1453 SourceLocation StartLoc,
1454 SourceLocation LParenLoc,
1455 SourceLocation EndLoc);
1456
1457 /// Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
1459 SourceLocation LParenLoc,
1460 SourceLocation EndLoc);
1461
1462 /// Called on a well-formed 'dyn_groupprivate' clause.
1466 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc,
1467 SourceLocation M2Loc, SourceLocation EndLoc);
1468
1469 /// Called on well-formed 'doacross' clause.
1470 OMPClause *
1472 SourceLocation DepLoc, SourceLocation ColonLoc,
1473 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1474 SourceLocation LParenLoc, SourceLocation EndLoc);
1475
1476 /// Called on a well-formed 'ompx_attribute' clause.
1478 SourceLocation StartLoc,
1479 SourceLocation LParenLoc,
1480 SourceLocation EndLoc);
1481
1482 /// Called on a well-formed 'ompx_bare' clause.
1484 SourceLocation EndLoc);
1485
1487 Expr *LowerBound,
1488 SourceLocation ColonLocFirst,
1489 SourceLocation ColonLocSecond,
1490 Expr *Length, Expr *Stride,
1491 SourceLocation RBLoc);
1493 SourceLocation RParenLoc,
1494 ArrayRef<Expr *> Dims,
1495 ArrayRef<SourceRange> Brackets);
1496
1497 /// Data structure for iterator expression.
1507
1509 SourceLocation LLoc, SourceLocation RLoc,
1511
1513 Expr *ModifierExpr,
1514 SourceLocation ModifierLoc,
1515 ArrayRef<Expr *> VarList,
1516 SourceLocation VarListEndLoc);
1517
1518 void handleOMPAssumeAttr(Decl *D, const ParsedAttr &AL);
1519
1520 /// Setter and getter functions for device_num.
1521 void setOpenMPDeviceNum(int Num);
1522
1523 int getOpenMPDeviceNum() const;
1524
1525 void setOpenMPDeviceNumID(StringRef ID);
1526
1533
1534private:
1535 void *VarDataSharingAttributesStack;
1536
1537 /// Number of nested '#pragma omp declare target' directives.
1538 SmallVector<DeclareTargetContextInfo, 4> DeclareTargetNesting;
1539
1540 /// Initialization of data-sharing attributes stack.
1541 void InitDataSharingAttributesStack();
1542 void DestroyDataSharingAttributesStack();
1543
1544 /// Returns OpenMP nesting level for current directive.
1545 unsigned getOpenMPNestingLevel() const;
1546
1547 /// Adjusts the function scopes index for the target-based regions.
1548 void adjustOpenMPTargetScopeIndex(unsigned &FunctionScopesIndex,
1549 unsigned Level) const;
1550
1551 /// Returns the number of scopes associated with the construct on the given
1552 /// OpenMP level.
1553 int getNumberOfConstructScopes(unsigned Level) const;
1554
1555 /// Push new OpenMP function region for non-capturing function.
1556 void pushOpenMPFunctionRegion();
1557
1558 /// Pop OpenMP function region for non-capturing function.
1559 void popOpenMPFunctionRegion(const sema::FunctionScopeInfo *OldFSI);
1560
1561 /// Analyzes and checks a loop nest for use by a loop transformation.
1562 ///
1563 /// \param Kind The loop transformation directive kind.
1564 /// \param NumLoops How many nested loops the directive is expecting.
1565 /// \param AStmt Associated statement of the transformation directive.
1566 /// \param LoopHelpers [out] The loop analysis result.
1567 /// \param Body [out] The body code nested in \p NumLoops loop.
1568 /// \param OriginalInits [out] Collection of statements and declarations that
1569 /// must have been executed/declared before entering the
1570 /// loop.
1571 ///
1572 /// \return Whether there was any error.
1573 bool checkTransformableLoopNest(
1574 OpenMPDirectiveKind Kind, Stmt *AStmt, int NumLoops,
1576 Stmt *&Body, SmallVectorImpl<SmallVector<Stmt *>> &OriginalInits);
1577
1578 /// Holds the result of the analysis of a (possibly canonical) loop.
1579 struct LoopAnalysis {
1580 /// The analyzed loop or loop transformation.
1581 Stmt *AStmt = nullptr;
1582 /// Loop analyses results.
1583 OMPLoopBasedDirective::HelperExprs HelperExprs;
1584 /// The for-statement of the loop. TheForStmt equals AStmt only when the
1585 /// latter is a canonical loop (i.e. not a loop transformation).
1586 Stmt *TheForStmt = nullptr;
1587 /// Initialization statements before transformations.
1588 SmallVector<Stmt *> OriginalInits;
1589 /// Initialization statements required after transformation of this loop.
1590 SmallVector<Stmt *> TransformsPreInits;
1591
1592 explicit LoopAnalysis(Stmt *S) : AStmt(S) {}
1593
1594 bool isRegularLoop() const { return isRegularLoop(AStmt); }
1595 bool isLoopTransformation() const { return isLoopTransformation(AStmt); }
1596
1597 // Convenience functions used when building LoopSequenceAnalysis.
1598 static bool isRegularLoop(Stmt *S) {
1600 }
1601 static bool isLoopTransformation(Stmt *S) {
1603 }
1604 };
1605
1606 /// Holds the result of the analysis of a (possibly canonical) loop sequence.
1607 struct LoopSequenceAnalysis {
1608 /// Number of top level canonical loops.
1609 unsigned LoopSeqSize = 0;
1610 /// For each loop results of the analysis.
1611 SmallVector<LoopAnalysis, 2> Loops;
1612 /// Additional code required before entering the transformed loop sequence.
1613 SmallVector<Stmt *> LoopSequencePreInits;
1614
1615 // Convenience function used when building the LoopSequenceAnalysis.
1616 static bool isLoopSequenceDerivation(Stmt *S) {
1617 return LoopAnalysis::isRegularLoop(S) ||
1618 LoopAnalysis::isLoopTransformation(S);
1619 }
1620 };
1621
1622 /// The main recursive process of `checkTransformableLoopSequence` that
1623 /// performs grammatical parsing of a canonical loop sequence. It extracts
1624 /// key information, such as the number of top-level loops, loop statements,
1625 /// helper expressions, and other relevant loop-related data, all in a single
1626 /// execution to avoid redundant traversals. This analysis flattens inner
1627 /// Loop Sequences
1628 ///
1629 /// \param LoopSeqStmt The AST of the original statement.
1630 /// \param SeqAnalysis [out] Result of the analysis of \p LoopSeqStmt
1631 /// \param Context
1632 /// \param Kind The loop transformation directive kind.
1633 /// \return Whether the original statement is both syntactically and
1634 /// semantically correct according to OpenMP 6.0 canonical loop
1635 /// sequence definition.
1636 bool analyzeLoopSequence(Stmt *LoopSeqStmt, LoopSequenceAnalysis &SeqAnalysis,
1637 ASTContext &Context, OpenMPDirectiveKind Kind);
1638
1639 /// Validates and checks whether a loop sequence can be transformed according
1640 /// to the given directive, providing necessary setup and initialization
1641 /// (Driver function) before recursion using `analyzeLoopSequence`.
1642 ///
1643 /// \param Kind The loop transformation directive kind.
1644 /// \param AStmt The AST of the original statement
1645 /// \param SeqAnalysis [out] Result of the analysis of \p LoopSeqStmt
1646 /// \param Context
1647 /// \return Whether there was an absence of errors or not
1648 bool checkTransformableLoopSequence(OpenMPDirectiveKind Kind, Stmt *AStmt,
1649 LoopSequenceAnalysis &SeqAnalysis,
1650 ASTContext &Context);
1651
1652 /// Helper to keep information about the current `omp begin/end declare
1653 /// variant` nesting.
1654 struct OMPDeclareVariantScope {
1655 /// The associated OpenMP context selector.
1656 OMPTraitInfo *TI;
1657
1658 /// The associated OpenMP context selector mangling.
1659 std::string NameSuffix;
1660
1661 OMPDeclareVariantScope(OMPTraitInfo &TI);
1662 };
1663
1664 /// Return the OMPTraitInfo for the surrounding scope, if any.
1665 OMPTraitInfo *getOMPTraitInfoForSurroundingScope() {
1666 return OMPDeclareVariantScopes.empty() ? nullptr
1667 : OMPDeclareVariantScopes.back().TI;
1668 }
1669
1670 /// The current `omp begin/end declare variant` scopes.
1671 SmallVector<OMPDeclareVariantScope, 4> OMPDeclareVariantScopes;
1672
1673 /// The current `omp begin/end assumes` scopes.
1674 SmallVector<OMPAssumeAttr *, 4> OMPAssumeScoped;
1675
1676 /// All `omp assumes` we encountered so far.
1677 SmallVector<OMPAssumeAttr *, 4> OMPAssumeGlobal;
1678
1679 /// Device number specified by the context selector.
1680 int DeviceNum = -1;
1681
1682 /// Device number identifier specified by the context selector.
1683 StringRef DeviceNumID;
1684};
1685
1686} // namespace clang
1687
1688#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:76
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition DeclBase.h:1466
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:1955
An instance of this object exists for each enum constant that is defined.
Definition Decl.h:3562
This represents one expression.
Definition Expr.h:113
Represents a member of a struct/union/class.
Definition Decl.h:3299
Represents a function declaration or definition.
Definition Decl.h:2059
One of these records is kept for each identifier that is lexed.
This represents a decl that may have a name.
Definition Decl.h:275
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)
void ActOnOpenMPDeclareVariantDirective(FunctionDecl *FD, Expr *VariantRef, OMPTraitInfo &TI, ArrayRef< Expr * > AdjustArgsNothing, ArrayRef< Expr * > AdjustArgsNeedDevicePtr, ArrayRef< Expr * > AdjustArgsNeedDeviceAddr, ArrayRef< OMPInteropInfo > AppendArgs, SourceLocation AdjustArgsLoc, SourceLocation AppendArgsLoc, SourceRange SR)
Called on well-formed '#pragma omp declare variant' after parsing of the associated method/function.
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.
StmtResult ActOnOpenMPMetaDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp metadirective' after parsing of the associated statement.
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.
OMPClause * ActOnOpenMPWhenClause(OMPTraitInfo &TI, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'when' clause.
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
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:254
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:444
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:251
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.
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.
bool isInOpenMPDeclareTargetContext() const
Return true inside OpenMP declare target region.
Definition SemaOpenMP.h:385
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:713
Represents a variable declaration or definition.
Definition Decl.h:933
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.
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:317
DeclareTargetContextInfo(OpenMPDirectiveKind Kind, SourceLocation Loc)
Definition SemaOpenMP.h:335
std::optional< Expr * > Indirect
The directive with indirect clause.
Definition SemaOpenMP.h:330
OpenMPDirectiveKind Kind
The directive kind, begin declare target or declare target.
Definition SemaOpenMP.h:327
OMPDeclareTargetDeclAttr::DevTypeTy DT
The 'device_type' as parsed from the clause.
Definition SemaOpenMP.h:324
SourceLocation Loc
The directive location.
Definition SemaOpenMP.h:333
llvm::DenseMap< NamedDecl *, MapInfo > ExplicitlyMapped
Explicitly listed variables and functions in a 'to' or 'link' clause.
Definition SemaOpenMP.h:321
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.