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 /// Check restrictions on Requires directive
264 ArrayRef<OMPClause *> Clauses);
265 /// Check if the specified type is allowed to be used in 'omp declare
266 /// reduction' construct.
269 /// Called on start of '#pragma omp declare reduction'.
271 Scope *S, DeclContext *DC, DeclarationName Name,
272 ArrayRef<std::pair<QualType, SourceLocation>> ReductionTypes,
273 AccessSpecifier AS, Decl *PrevDeclInScope = nullptr);
274 /// Initialize declare reduction construct initializer.
276 /// Finish current declare reduction construct initializer.
278 /// Initialize declare reduction construct initializer.
279 /// \return omp_priv variable.
281 /// Finish current declare reduction construct initializer.
283 VarDecl *OmpPrivParm);
284 /// Called at the end of '#pragma omp declare reduction'.
286 Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid);
287
288 /// Check variable declaration in 'omp declare mapper' construct.
290 /// Check if the specified type is allowed to be used in 'omp declare
291 /// mapper' construct.
294 /// Called for '#pragma omp declare mapper'.
296 Scope *S, DeclContext *DC, DeclarationName Name, QualType MapperType,
298 Expr *MapperVarRef, ArrayRef<OMPClause *> Clauses,
299 Decl *PrevDeclInScope = nullptr);
300 /// Build the mapper variable of '#pragma omp declare mapper'.
302 QualType MapperType,
303 SourceLocation StartLoc,
304 DeclarationName VN);
306 bool isOpenMPDeclareMapperVarDeclAllowed(const VarDecl *VD) const;
308
310 struct MapInfo {
311 OMPDeclareTargetDeclAttr::MapTypeTy MT;
313 };
314 /// Explicitly listed variables and functions in a 'to' or 'link' clause.
315 llvm::DenseMap<NamedDecl *, MapInfo> ExplicitlyMapped;
316
317 /// The 'device_type' as parsed from the clause.
318 OMPDeclareTargetDeclAttr::DevTypeTy DT = OMPDeclareTargetDeclAttr::DT_Any;
319
320 /// The directive kind, `begin declare target` or `declare target`.
322
323 /// The directive with indirect clause.
324 std::optional<Expr *> Indirect;
325
326 /// The directive location.
328
331 };
332
333 /// Called on the start of target region i.e. '#pragma omp declare target'.
334 bool ActOnStartOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI);
335
336 /// Called at the end of target region i.e. '#pragma omp end declare target'.
337 const DeclareTargetContextInfo ActOnOpenMPEndDeclareTargetDirective();
338
339 /// Called once a target context is completed, that can be when a
340 /// '#pragma omp end declare target' was encountered or when a
341 /// '#pragma omp declare target' without declaration-definition-seq was
342 /// encountered.
343 void ActOnFinishedOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI);
344
345 /// Report unterminated 'omp declare target' or 'omp begin declare target' at
346 /// the end of a compilation unit.
348
349 /// Searches for the provided declaration name for OpenMP declare target
350 /// directive.
352 CXXScopeSpec &ScopeSpec,
353 const DeclarationNameInfo &Id);
354
355 /// Called on correct id-expression from the '#pragma omp declare target'.
357 OMPDeclareTargetDeclAttr::MapTypeTy MT,
358 DeclareTargetContextInfo &DTCI);
359
360 /// Check declaration inside target region.
361 void
364
365 /// Adds OMPDeclareTargetDeclAttr to referenced variables in declare target
366 /// directive.
368
369 /// Finishes analysis of the deferred functions calls that may be declared as
370 /// host/nohost during device/host compilation.
372 const FunctionDecl *Callee,
373 SourceLocation Loc);
374
375 /// Return true if currently in OpenMP task with untied clause context.
376 bool isInOpenMPTaskUntiedContext() const;
377
378 /// Return true inside OpenMP declare target region.
380 return !DeclareTargetNesting.empty();
381 }
382 /// Return true inside OpenMP target region.
384
385 /// Return the number of captured regions created for an OpenMP directive.
387
388 /// Initialization of captured region for OpenMP region.
389 void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope);
390
391 /// Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to
392 /// an OpenMP loop directive.
394
395 /// Process a canonical OpenMP loop nest that can either be a canonical
396 /// literal loop (ForStmt or CXXForRangeStmt), or the generated loop of an
397 /// OpenMP loop transformation construct.
399
400 /// End of OpenMP region.
401 ///
402 /// \param S Statement associated with the current OpenMP region.
403 /// \param Clauses List of clauses for the current OpenMP region.
404 ///
405 /// \returns Statement for finished OpenMP region.
408 OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName,
409 OpenMPDirectiveKind CancelRegion, ArrayRef<OMPClause *> Clauses,
410 Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc);
411 /// Process an OpenMP informational directive.
412 ///
413 /// \param Kind The directive kind.
414 /// \param DirName Declaration name info.
415 /// \param Clauses Array of clauses for directive.
416 /// \param AStmt The associated statement.
417 /// \param StartLoc The start location.
418 /// \param EndLoc The end location.
420 OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName,
421 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
422 SourceLocation EndLoc);
423 /// Process an OpenMP assume directive.
424 ///
425 /// \param Clauses Array of clauses for directive.
426 /// \param AStmt The associated statement.
427 /// \param StartLoc The start location.
428 /// \param EndLoc The end location.
430 Stmt *AStmt, SourceLocation StartLoc,
431 SourceLocation EndLoc);
432
433 /// Called on well-formed '\#pragma omp parallel' after parsing
434 /// of the associated statement.
436 Stmt *AStmt, SourceLocation StartLoc,
437 SourceLocation EndLoc);
439 llvm::SmallDenseMap<const ValueDecl *, const Expr *, 4>;
440 /// Called on well-formed '\#pragma omp simd' after parsing
441 /// of the associated statement.
444 SourceLocation StartLoc, SourceLocation EndLoc,
445 VarsWithInheritedDSAType &VarsWithImplicitDSA);
446 /// Called on well-formed '#pragma omp tile' after parsing of its clauses and
447 /// the associated statement.
449 Stmt *AStmt, SourceLocation StartLoc,
450 SourceLocation EndLoc);
452 Stmt *AStmt, SourceLocation StartLoc,
453 SourceLocation EndLoc);
454 /// Called on well-formed '#pragma omp unroll' after parsing of its clauses
455 /// and the associated statement.
457 Stmt *AStmt, SourceLocation StartLoc,
458 SourceLocation EndLoc);
459 /// Called on well-formed '#pragma omp reverse'.
461 SourceLocation EndLoc);
462 /// Called on well-formed '#pragma omp split' after parsing of its
463 /// associated statement.
465 Stmt *AStmt, SourceLocation StartLoc,
466 SourceLocation EndLoc);
467 /// Called on well-formed '#pragma omp interchange' after parsing of its
468 /// clauses and the associated statement.
470 Stmt *AStmt,
471 SourceLocation StartLoc,
472 SourceLocation EndLoc);
473
474 /// Called on well-formed '#pragma omp fuse' after parsing of its
475 /// clauses and the associated statement.
477 Stmt *AStmt, SourceLocation StartLoc,
478 SourceLocation EndLoc);
479
480 /// Called on well-formed '\#pragma omp for' after parsing
481 /// of the associated statement.
484 SourceLocation StartLoc, SourceLocation EndLoc,
485 VarsWithInheritedDSAType &VarsWithImplicitDSA);
486 /// Called on well-formed '\#pragma omp for simd' after parsing
487 /// of the associated statement.
490 SourceLocation StartLoc, SourceLocation EndLoc,
491 VarsWithInheritedDSAType &VarsWithImplicitDSA);
492 /// Called on well-formed '\#pragma omp sections' after parsing
493 /// of the associated statement.
495 Stmt *AStmt, SourceLocation StartLoc,
496 SourceLocation EndLoc);
497 /// Called on well-formed '\#pragma omp section' after parsing of the
498 /// associated statement.
500 SourceLocation EndLoc);
501 /// Called on well-formed '\#pragma omp scope' after parsing of the
502 /// associated statement.
504 Stmt *AStmt, SourceLocation StartLoc,
505 SourceLocation EndLoc);
506 /// Called on well-formed '\#pragma omp single' after parsing of the
507 /// associated statement.
509 Stmt *AStmt, SourceLocation StartLoc,
510 SourceLocation EndLoc);
511 /// Called on well-formed '\#pragma omp master' after parsing of the
512 /// associated statement.
514 SourceLocation EndLoc);
515 /// Called on well-formed '\#pragma omp critical' after parsing of the
516 /// associated statement.
518 ArrayRef<OMPClause *> Clauses,
519 Stmt *AStmt, SourceLocation StartLoc,
520 SourceLocation EndLoc);
521 /// Called on well-formed '\#pragma omp parallel for' after parsing
522 /// of the associated statement.
524 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
525 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
526 /// Called on well-formed '\#pragma omp parallel for simd' after
527 /// parsing of the associated statement.
529 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
530 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
531 /// Called on well-formed '\#pragma omp parallel master' after
532 /// parsing of the associated statement.
534 Stmt *AStmt,
535 SourceLocation StartLoc,
536 SourceLocation EndLoc);
537 /// Called on well-formed '\#pragma omp parallel masked' after
538 /// parsing of the associated statement.
540 Stmt *AStmt,
541 SourceLocation StartLoc,
542 SourceLocation EndLoc);
543 /// Called on well-formed '\#pragma omp parallel sections' after
544 /// parsing of the associated statement.
546 Stmt *AStmt,
547 SourceLocation StartLoc,
548 SourceLocation EndLoc);
549 /// Called on well-formed '\#pragma omp task' after parsing of the
550 /// associated statement.
552 Stmt *AStmt, SourceLocation StartLoc,
553 SourceLocation EndLoc);
554 /// Called on well-formed '\#pragma omp taskyield'.
556 SourceLocation EndLoc);
557 /// Called on well-formed '\#pragma omp error'.
558 /// Error direcitive is allowed in both declared and excutable contexts.
559 /// Adding InExContext to identify which context is called from.
561 SourceLocation StartLoc,
562 SourceLocation EndLoc,
563 bool InExContext = true);
564 /// Called on well-formed '\#pragma omp barrier'.
566 SourceLocation EndLoc);
567 /// Called on well-formed '\#pragma omp taskwait'.
569 SourceLocation StartLoc,
570 SourceLocation EndLoc);
571 /// Called on well-formed '\#pragma omp taskgroup'.
573 Stmt *AStmt, SourceLocation StartLoc,
574 SourceLocation EndLoc);
575 /// Called on well-formed '\#pragma omp flush'.
577 SourceLocation StartLoc,
578 SourceLocation EndLoc);
579 /// Called on well-formed '\#pragma omp depobj'.
581 SourceLocation StartLoc,
582 SourceLocation EndLoc);
583 /// Called on well-formed '\#pragma omp scan'.
585 SourceLocation StartLoc,
586 SourceLocation EndLoc);
587 /// Called on well-formed '\#pragma omp ordered' after parsing of the
588 /// associated statement.
590 Stmt *AStmt, SourceLocation StartLoc,
591 SourceLocation EndLoc);
592 /// Called on well-formed '\#pragma omp atomic' after parsing of the
593 /// associated statement.
595 Stmt *AStmt, SourceLocation StartLoc,
596 SourceLocation EndLoc);
597 /// Called on well-formed '\#pragma omp target' after parsing of the
598 /// associated statement.
600 Stmt *AStmt, SourceLocation StartLoc,
601 SourceLocation EndLoc);
602 /// Called on well-formed '\#pragma omp target data' after parsing of
603 /// the associated statement.
605 Stmt *AStmt,
606 SourceLocation StartLoc,
607 SourceLocation EndLoc);
608 /// Called on well-formed '\#pragma omp target enter data' after
609 /// parsing of the associated statement.
611 SourceLocation StartLoc,
612 SourceLocation EndLoc,
613 Stmt *AStmt);
614 /// Called on well-formed '\#pragma omp target exit data' after
615 /// parsing of the associated statement.
617 SourceLocation StartLoc,
618 SourceLocation EndLoc,
619 Stmt *AStmt);
620 /// Called on well-formed '\#pragma omp target parallel' after
621 /// parsing of the associated statement.
623 Stmt *AStmt,
624 SourceLocation StartLoc,
625 SourceLocation EndLoc);
626 /// Called on well-formed '\#pragma omp target parallel for' after
627 /// parsing of the associated statement.
629 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
630 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
631 /// Called on well-formed '\#pragma omp teams' after parsing of the
632 /// associated statement.
634 Stmt *AStmt, SourceLocation StartLoc,
635 SourceLocation EndLoc);
636 /// Called on well-formed '\#pragma omp teams loop' after parsing of the
637 /// associated statement.
639 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
640 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
641 /// Called on well-formed '\#pragma omp target teams loop' after parsing of
642 /// the associated statement.
644 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
645 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
646 /// Called on well-formed '\#pragma omp parallel loop' after parsing of the
647 /// associated statement.
649 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
650 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
651 /// Called on well-formed '\#pragma omp target parallel loop' after parsing
652 /// of the associated statement.
654 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
655 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
656 /// Called on well-formed '\#pragma omp cancellation point'.
659 SourceLocation EndLoc,
660 OpenMPDirectiveKind CancelRegion);
661 /// Called on well-formed '\#pragma omp cancel'.
663 SourceLocation StartLoc,
664 SourceLocation EndLoc,
665 OpenMPDirectiveKind CancelRegion);
666 /// Called on well-formed '\#pragma omp taskloop' after parsing of the
667 /// associated statement.
670 SourceLocation StartLoc, SourceLocation EndLoc,
671 VarsWithInheritedDSAType &VarsWithImplicitDSA);
672 /// Called on well-formed '\#pragma omp taskloop simd' after parsing of
673 /// the associated statement.
675 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
676 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
677 /// Called on well-formed '\#pragma omp master taskloop' after parsing of the
678 /// associated statement.
680 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
681 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
682 /// Called on well-formed '\#pragma omp master taskloop simd' after parsing of
683 /// the associated statement.
685 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
686 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
687 /// Called on well-formed '\#pragma omp parallel master taskloop' after
688 /// parsing of the associated statement.
690 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
691 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
692 /// Called on well-formed '\#pragma omp parallel master taskloop simd' after
693 /// parsing of the associated statement.
695 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
696 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
697 /// Called on well-formed '\#pragma omp masked taskloop' after parsing of the
698 /// associated statement.
700 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
701 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
702 /// Called on well-formed '\#pragma omp masked taskloop simd' after parsing of
703 /// the associated statement.
705 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
706 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
707 /// Called on well-formed '\#pragma omp parallel masked taskloop' after
708 /// parsing of the associated statement.
710 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
711 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
712 /// Called on well-formed '\#pragma omp parallel masked taskloop simd' after
713 /// parsing of the associated statement.
715 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
716 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
717 /// Called on well-formed '\#pragma omp distribute' after parsing
718 /// of the associated statement.
721 SourceLocation StartLoc, SourceLocation EndLoc,
722 VarsWithInheritedDSAType &VarsWithImplicitDSA);
723 /// Called on well-formed '\#pragma omp target update'.
725 SourceLocation StartLoc,
726 SourceLocation EndLoc,
727 Stmt *AStmt);
728 /// Called on well-formed '\#pragma omp distribute parallel for' after
729 /// parsing of the associated statement.
731 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
732 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
733 /// Called on well-formed '\#pragma omp distribute parallel for simd'
734 /// after parsing of the associated statement.
736 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
737 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
738 /// Called on well-formed '\#pragma omp distribute simd' after
739 /// parsing of the associated statement.
741 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
742 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
743 /// Called on well-formed '\#pragma omp target parallel for simd' after
744 /// parsing of the associated statement.
746 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
747 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
748 /// Called on well-formed '\#pragma omp target simd' after parsing of
749 /// the associated statement.
752 SourceLocation StartLoc, SourceLocation EndLoc,
753 VarsWithInheritedDSAType &VarsWithImplicitDSA);
754 /// Called on well-formed '\#pragma omp teams distribute' after parsing of
755 /// the associated statement.
757 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
758 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
759 /// Called on well-formed '\#pragma omp teams distribute simd' after parsing
760 /// of the associated statement.
762 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
763 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
764 /// Called on well-formed '\#pragma omp teams distribute parallel for simd'
765 /// after parsing of the associated statement.
767 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
768 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
769 /// Called on well-formed '\#pragma omp teams distribute parallel for'
770 /// after parsing of the associated statement.
772 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
773 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
774 /// Called on well-formed '\#pragma omp target teams' after parsing of the
775 /// associated statement.
777 Stmt *AStmt,
778 SourceLocation StartLoc,
779 SourceLocation EndLoc);
780 /// Called on well-formed '\#pragma omp target teams distribute' after parsing
781 /// of the associated statement.
783 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
784 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
785 /// Called on well-formed '\#pragma omp target teams distribute parallel for'
786 /// after parsing of the associated statement.
788 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
789 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
790 /// Called on well-formed '\#pragma omp target teams distribute parallel for
791 /// simd' after parsing of the associated statement.
793 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
794 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
795 /// Called on well-formed '\#pragma omp target teams distribute simd' after
796 /// parsing of the associated statement.
798 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
799 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
800 /// Called on well-formed '\#pragma omp interop'.
802 SourceLocation StartLoc,
803 SourceLocation EndLoc);
804 /// Called on well-formed '\#pragma omp dispatch' after parsing of the
805 // /associated statement.
807 Stmt *AStmt, SourceLocation StartLoc,
808 SourceLocation EndLoc);
809 /// Called on well-formed '\#pragma omp masked' after parsing of the
810 // /associated statement.
812 Stmt *AStmt, SourceLocation StartLoc,
813 SourceLocation EndLoc);
814
815 /// Called on well-formed '\#pragma omp loop' after parsing of the
816 /// associated statement.
818 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
819 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
820
821 /// Checks correctness of linear modifiers.
823 SourceLocation LinLoc);
824 /// Checks that the specified declaration matches requirements for the linear
825 /// decls.
828 bool IsDeclareSimd = false);
829
830 /// Called on well-formed '\#pragma omp declare simd' after parsing of
831 /// the associated method/function.
833 DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS,
834 Expr *Simdlen, ArrayRef<Expr *> Uniforms, ArrayRef<Expr *> Aligneds,
835 ArrayRef<Expr *> Alignments, ArrayRef<Expr *> Linears,
836 ArrayRef<unsigned> LinModifiers, ArrayRef<Expr *> Steps, SourceRange SR);
837
838 /// Checks '\#pragma omp declare variant' variant function and original
839 /// functions after parsing of the associated method/function.
840 /// \param DG Function declaration to which declare variant directive is
841 /// applied to.
842 /// \param VariantRef Expression that references the variant function, which
843 /// must be used instead of the original one, specified in \p DG.
844 /// \param TI The trait info object representing the match clause.
845 /// \param NumAppendArgs The number of omp_interop_t arguments to account for
846 /// in checking.
847 /// \returns std::nullopt, if the function/variant function are not compatible
848 /// with the pragma, pair of original function/variant ref expression
849 /// otherwise.
850 std::optional<std::pair<FunctionDecl *, Expr *>>
852 OMPTraitInfo &TI, unsigned NumAppendArgs,
853 SourceRange SR);
854
855 /// Called on well-formed '\#pragma omp declare variant' after parsing of
856 /// the associated method/function.
857 /// \param FD Function declaration to which declare variant directive is
858 /// applied to.
859 /// \param VariantRef Expression that references the variant function, which
860 /// must be used instead of the original one, specified in \p DG.
861 /// \param TI The context traits associated with the function variant.
862 /// \param AdjustArgsNothing The list of 'nothing' arguments.
863 /// \param AdjustArgsNeedDevicePtr The list of 'need_device_ptr' arguments.
864 /// \param AppendArgs The list of 'append_args' arguments.
865 /// \param AdjustArgsLoc The Location of an 'adjust_args' clause.
866 /// \param AppendArgsLoc The Location of an 'append_args' clause.
867 /// \param SR The SourceRange of the 'declare variant' directive.
869 FunctionDecl *FD, Expr *VariantRef, OMPTraitInfo &TI,
870 ArrayRef<Expr *> AdjustArgsNothing,
871 ArrayRef<Expr *> AdjustArgsNeedDevicePtr,
872 ArrayRef<Expr *> AdjustArgsNeedDeviceAddr,
873 ArrayRef<OMPInteropInfo> AppendArgs, SourceLocation AdjustArgsLoc,
874 SourceLocation AppendArgsLoc, SourceRange SR);
875
876 /// Called on device_num selector in context selectors.
877 void ActOnOpenMPDeviceNum(Expr *DeviceNumExpr);
878
880 SourceLocation StartLoc,
881 SourceLocation LParenLoc,
882 SourceLocation EndLoc);
883 /// Called on well-formed 'allocator' clause.
885 SourceLocation StartLoc,
886 SourceLocation LParenLoc,
887 SourceLocation EndLoc);
888 /// Called on well-formed 'if' clause.
890 Expr *Condition, SourceLocation StartLoc,
891 SourceLocation LParenLoc,
892 SourceLocation NameModifierLoc,
893 SourceLocation ColonLoc,
894 SourceLocation EndLoc);
895 /// Called on well-formed 'final' clause.
897 SourceLocation LParenLoc,
898 SourceLocation EndLoc);
899 /// Called on well-formed 'num_threads' clause.
901 ArrayRef<Expr *> VarList, OpenMPNumThreadsClauseModifier SimpleModifier,
902 SourceLocation SimpleModifierLoc,
903 OpenMPNumThreadsClauseModifier ComplexModifier, Expr *ComplexModifierExpr,
904 SourceLocation ComplexModifierLoc, SourceLocation StartLoc,
905 SourceLocation LParenLoc, SourceLocation EndLoc);
906 /// Called on well-formed 'align' clause.
908 SourceLocation LParenLoc,
909 SourceLocation EndLoc);
910 /// Called on well-formed 'safelen' clause.
912 SourceLocation LParenLoc,
913 SourceLocation EndLoc);
914 /// Called on well-formed 'simdlen' clause.
916 SourceLocation LParenLoc,
917 SourceLocation EndLoc);
918 /// Called on well-form 'sizes' clause.
920 SourceLocation StartLoc,
921 SourceLocation LParenLoc,
922 SourceLocation EndLoc);
923 /// Called on well-formed 'counts' clause after parsing its arguments.
924 OMPClause *
926 SourceLocation LParenLoc, SourceLocation EndLoc,
927 std::optional<unsigned> FillIdx,
928 SourceLocation FillLoc, unsigned FillCount);
929 /// Called on well-form 'permutation' clause after parsing its arguments.
931 SourceLocation StartLoc,
932 SourceLocation LParenLoc,
933 SourceLocation EndLoc);
934 /// Called on well-form 'full' clauses.
936 SourceLocation EndLoc);
937 /// Called on well-form 'partial' clauses.
939 SourceLocation LParenLoc,
940 SourceLocation EndLoc);
941 /// Called on well-formed 'collapse' clause.
943 SourceLocation StartLoc,
944 SourceLocation LParenLoc,
945 SourceLocation EndLoc);
946
947 /// Called on well-form 'looprange' clause after parsing its arguments.
948 OMPClause *
950 SourceLocation LParenLoc, SourceLocation FirstLoc,
951 SourceLocation CountLoc, SourceLocation EndLoc);
952 /// Called on well-formed 'ordered' clause.
953 OMPClause *
955 SourceLocation LParenLoc = SourceLocation(),
956 Expr *NumForLoops = nullptr);
957 /// Called on well-formed 'grainsize' clause.
959 Expr *Size, SourceLocation StartLoc,
960 SourceLocation LParenLoc,
961 SourceLocation ModifierLoc,
962 SourceLocation EndLoc);
963 /// Called on well-formed 'num_tasks' clause.
965 Expr *NumTasks, SourceLocation StartLoc,
966 SourceLocation LParenLoc,
967 SourceLocation ModifierLoc,
968 SourceLocation EndLoc);
969 /// Called on well-formed 'hint' clause.
971 SourceLocation LParenLoc,
972 SourceLocation EndLoc);
973 /// Called on well-formed 'detach' clause.
975 SourceLocation LParenLoc,
976 SourceLocation EndLoc);
977
978 OMPClause *ActOnOpenMPSimpleClause(OpenMPClauseKind Kind, unsigned Argument,
979 SourceLocation ArgumentLoc,
980 SourceLocation StartLoc,
981 SourceLocation LParenLoc,
982 SourceLocation EndLoc);
983 /// Called on well-formed 'when' clause.
985 SourceLocation LParenLoc,
986 SourceLocation EndLoc);
987 /// Called on well-formed 'default' clause.
988 OMPClause *
989 ActOnOpenMPDefaultClause(llvm::omp::DefaultKind M, SourceLocation MLoc,
991 SourceLocation VCKindLoc, SourceLocation StartLoc,
992 SourceLocation LParenLoc, SourceLocation EndLoc);
993 /// Called on well-formed 'threadset' clause.
995 SourceLocation KindLoc,
996 SourceLocation StartLoc,
997 SourceLocation LParenLoc,
998 SourceLocation EndLoc);
999 /// Called on well-formed 'transparent' clause.
1001 SourceLocation StartLoc,
1002 SourceLocation LParenLoc,
1003 SourceLocation EndLoc);
1004 /// Called on well-formed 'proc_bind' clause.
1005 OMPClause *ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind,
1006 SourceLocation KindLoc,
1007 SourceLocation StartLoc,
1008 SourceLocation LParenLoc,
1009 SourceLocation EndLoc);
1010 /// Called on well-formed 'order' clause.
1013 SourceLocation StartLoc,
1014 SourceLocation LParenLoc,
1015 SourceLocation MLoc, SourceLocation KindLoc,
1016 SourceLocation EndLoc);
1017 /// Called on well-formed 'update_depend_objects' clause.
1019 SourceLocation KindLoc,
1020 SourceLocation StartLoc,
1021 SourceLocation LParenLoc,
1022 SourceLocation EndLoc);
1023 /// Called on well-formed 'holds' clause.
1025 SourceLocation LParenLoc,
1026 SourceLocation EndLoc);
1027 /// Called on well-formed 'absent' or 'contains' clauses.
1032 SourceLocation Loc,
1033 SourceLocation RLoc);
1034
1036 OpenMPClauseKind Kind, ArrayRef<unsigned> Arguments, Expr *Expr,
1037 SourceLocation StartLoc, SourceLocation LParenLoc,
1038 ArrayRef<SourceLocation> ArgumentsLoc, SourceLocation DelimLoc,
1039 SourceLocation EndLoc);
1040 /// Called on well-formed 'schedule' clause.
1043 OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc,
1044 SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc,
1045 SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc);
1046
1048 SourceLocation EndLoc);
1049 /// Called on well-formed 'nowait' clause.
1051 SourceLocation EndLoc,
1052 SourceLocation LParenLoc, Expr *Condition);
1053 /// Called on well-formed 'untied' clause.
1055 SourceLocation EndLoc);
1056 /// Called on well-formed 'mergeable' clause.
1058 SourceLocation EndLoc);
1059 /// Called on well-formed 'read' clause.
1061 SourceLocation EndLoc);
1062 /// Called on well-formed 'write' clause.
1064 SourceLocation EndLoc);
1065 /// Called on well-formed 'update' clause.
1067 SourceLocation EndLoc);
1068 /// Called on well-formed 'capture' clause.
1070 SourceLocation EndLoc);
1071 /// Called on well-formed 'compare' clause.
1073 SourceLocation EndLoc);
1074 /// Called on well-formed 'fail' clause.
1076 SourceLocation EndLoc);
1078 SourceLocation KindLoc,
1079 SourceLocation StartLoc,
1080 SourceLocation LParenLoc,
1081 SourceLocation EndLoc);
1082
1083 /// Called on well-formed 'seq_cst' clause.
1085 SourceLocation EndLoc);
1086 /// Called on well-formed 'acq_rel' clause.
1088 SourceLocation EndLoc);
1089 /// Called on well-formed 'acquire' clause.
1091 SourceLocation EndLoc);
1092 /// Called on well-formed 'release' clause.
1094 SourceLocation EndLoc);
1095 /// Called on well-formed 'relaxed' clause.
1097 SourceLocation EndLoc);
1098 /// Called on well-formed 'weak' clause.
1100 SourceLocation EndLoc);
1101
1102 /// Called on well-formed 'init' clause.
1103 OMPClause *
1104 ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo,
1105 SourceLocation StartLoc, SourceLocation LParenLoc,
1106 SourceLocation VarLoc, SourceLocation EndLoc);
1107
1108 /// Called on well-formed 'use' clause.
1109 OMPClause *ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc,
1110 SourceLocation LParenLoc,
1111 SourceLocation VarLoc, SourceLocation EndLoc);
1112
1113 /// Called on well-formed 'destroy' clause.
1115 SourceLocation LParenLoc,
1116 SourceLocation VarLoc,
1117 SourceLocation EndLoc);
1118 /// Called on well-formed 'novariants' clause.
1120 SourceLocation StartLoc,
1121 SourceLocation LParenLoc,
1122 SourceLocation EndLoc);
1123 /// Called on well-formed 'nocontext' clause.
1125 SourceLocation StartLoc,
1126 SourceLocation LParenLoc,
1127 SourceLocation EndLoc);
1128 /// Called on well-formed 'filter' clause.
1130 SourceLocation LParenLoc,
1131 SourceLocation EndLoc);
1132 /// Called on well-formed 'threads' clause.
1134 SourceLocation EndLoc);
1135 /// Called on well-formed 'simd' clause.
1137 SourceLocation EndLoc);
1138 /// Called on well-formed 'nogroup' clause.
1140 SourceLocation EndLoc);
1141 /// Called on well-formed 'unified_address' clause.
1143 SourceLocation EndLoc);
1144
1145 /// Called on well-formed 'unified_address' clause.
1147 SourceLocation EndLoc);
1148
1149 /// Called on well-formed 'reverse_offload' clause.
1151 SourceLocation EndLoc);
1152
1153 /// Called on well-formed 'dynamic_allocators' clause.
1155 SourceLocation EndLoc);
1156
1157 /// Called on well-formed 'atomic_default_mem_order' clause.
1160 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
1161
1162 /// Called on well-formed 'self_maps' clause.
1164 SourceLocation EndLoc);
1165
1166 /// Called on well-formed 'at' clause.
1168 SourceLocation KindLoc,
1169 SourceLocation StartLoc,
1170 SourceLocation LParenLoc,
1171 SourceLocation EndLoc);
1172
1173 /// Called on well-formed 'severity' clause.
1175 SourceLocation KindLoc,
1176 SourceLocation StartLoc,
1177 SourceLocation LParenLoc,
1178 SourceLocation EndLoc);
1179
1180 /// Called on well-formed 'message' clause.
1181 /// passing string for message.
1183 SourceLocation LParenLoc,
1184 SourceLocation EndLoc);
1185
1186 /// Data used for processing a list of variables in OpenMP clauses.
1187 struct OpenMPVarListDataTy final {
1189 Expr *IteratorExpr = nullptr;
1194 std::array<int, 2> ExtraModifierArray = {-1, -1};
1195 std::array<Expr *, 2> ExtraModifierExprArray = {nullptr, nullptr};
1196 std::array<SourceLocation, 2> ExtraModifierLocArray = {SourceLocation(),
1197 SourceLocation()};
1198 /// Additional modifier for linear, map, depend, lastprivate,
1199 /// use_device_ptr, or num_teams clause.
1203 int OriginalSharingModifier = 0; // Default is shared
1213 bool IsMapTypeImplicit = false;
1217 StepModifierLoc; /// 'step' modifier location for linear clause
1230 };
1231
1233 ArrayRef<Expr *> Vars,
1234 const OMPVarListLocTy &Locs,
1235 OpenMPVarListDataTy &Data);
1236 /// Called on well-formed 'inclusive' clause.
1238 SourceLocation StartLoc,
1239 SourceLocation LParenLoc,
1240 SourceLocation EndLoc);
1241 /// Called on well-formed 'exclusive' clause.
1243 SourceLocation StartLoc,
1244 SourceLocation LParenLoc,
1245 SourceLocation EndLoc);
1246 /// Called on well-formed 'allocate' clause.
1247 OMPClause *
1248 ActOnOpenMPAllocateClause(Expr *Allocator, Expr *Alignment,
1249 OpenMPAllocateClauseModifier FirstModifier,
1250 SourceLocation FirstModifierLoc,
1251 OpenMPAllocateClauseModifier SecondModifier,
1252 SourceLocation SecondModifierLoc,
1253 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1254 SourceLocation ColonLoc, SourceLocation LParenLoc,
1255 SourceLocation EndLoc);
1256 /// Called on well-formed 'private' clause.
1258 SourceLocation StartLoc,
1259 SourceLocation LParenLoc,
1260 SourceLocation EndLoc);
1261 /// Called on well-formed 'firstprivate' clause.
1263 SourceLocation StartLoc,
1264 SourceLocation LParenLoc,
1265 SourceLocation EndLoc);
1266 /// Called on well-formed 'lastprivate' clause.
1269 SourceLocation LPKindLoc, SourceLocation ColonLoc,
1270 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
1271 /// Called on well-formed 'shared' clause.
1273 SourceLocation StartLoc,
1274 SourceLocation LParenLoc,
1275 SourceLocation EndLoc);
1276 /// Called on well-formed 'reduction' clause.
1278 ArrayRef<Expr *> VarList,
1279 OpenMPVarListDataTy::OpenMPReductionClauseModifiers Modifiers,
1280 SourceLocation StartLoc, SourceLocation LParenLoc,
1281 SourceLocation ModifierLoc, SourceLocation ColonLoc,
1282 SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec,
1283 const DeclarationNameInfo &ReductionId,
1284 ArrayRef<Expr *> UnresolvedReductions = {});
1285 /// Called on well-formed 'task_reduction' clause.
1287 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1288 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
1289 CXXScopeSpec &ReductionIdScopeSpec,
1290 const DeclarationNameInfo &ReductionId,
1291 ArrayRef<Expr *> UnresolvedReductions = {});
1292 /// Called on well-formed 'in_reduction' clause.
1294 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1295 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
1296 CXXScopeSpec &ReductionIdScopeSpec,
1297 const DeclarationNameInfo &ReductionId,
1298 ArrayRef<Expr *> UnresolvedReductions = {});
1299 /// Called on well-formed 'linear' clause.
1300 OMPClause *ActOnOpenMPLinearClause(
1301 ArrayRef<Expr *> VarList, Expr *Step, SourceLocation StartLoc,
1302 SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind,
1303 SourceLocation LinLoc, SourceLocation ColonLoc,
1304 SourceLocation StepModifierLoc, SourceLocation EndLoc);
1305 /// Called on well-formed 'aligned' clause.
1306 OMPClause *ActOnOpenMPAlignedClause(ArrayRef<Expr *> VarList, Expr *Alignment,
1307 SourceLocation StartLoc,
1308 SourceLocation LParenLoc,
1309 SourceLocation ColonLoc,
1310 SourceLocation EndLoc);
1311 /// Called on well-formed 'copyin' clause.
1312 OMPClause *ActOnOpenMPCopyinClause(ArrayRef<Expr *> VarList,
1313 SourceLocation StartLoc,
1314 SourceLocation LParenLoc,
1315 SourceLocation EndLoc);
1316 /// Called on well-formed 'copyprivate' clause.
1317 OMPClause *ActOnOpenMPCopyprivateClause(ArrayRef<Expr *> VarList,
1318 SourceLocation StartLoc,
1319 SourceLocation LParenLoc,
1320 SourceLocation EndLoc);
1321 /// Called on well-formed 'flush' pseudo clause.
1322 OMPClause *ActOnOpenMPFlushClause(ArrayRef<Expr *> VarList,
1323 SourceLocation StartLoc,
1324 SourceLocation LParenLoc,
1325 SourceLocation EndLoc);
1326 /// Called on well-formed 'depobj' pseudo clause.
1327 OMPClause *ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc,
1328 SourceLocation LParenLoc,
1329 SourceLocation EndLoc);
1330 /// Called on well-formed 'depend' clause.
1331 OMPClause *ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data,
1332 Expr *DepModifier,
1333 ArrayRef<Expr *> VarList,
1334 SourceLocation StartLoc,
1335 SourceLocation LParenLoc,
1336 SourceLocation EndLoc);
1337 /// Called on well-formed 'device' clause.
1339 Expr *Device, SourceLocation StartLoc,
1340 SourceLocation LParenLoc,
1341 SourceLocation ModifierLoc,
1342 SourceLocation EndLoc);
1343 /// Called on well-formed 'map' clause.
1344 OMPClause *ActOnOpenMPMapClause(
1345 Expr *IteratorModifier, ArrayRef<OpenMPMapModifierKind> MapTypeModifiers,
1346 ArrayRef<SourceLocation> MapTypeModifiersLoc,
1347 CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId,
1348 OpenMPMapClauseKind MapType, bool IsMapTypeImplicit,
1349 SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VarList,
1350 const OMPVarListLocTy &Locs, bool NoDiagnose = false,
1351 ArrayRef<Expr *> UnresolvedMappers = {});
1352 /// Called on well-formed 'num_teams' clause.
1353 OMPClause *ActOnOpenMPNumTeamsClause(
1354 ArrayRef<Expr *> VarList, OpenMPNumTeamsClauseModifier Modifier,
1355 Expr *ModifierExpr, SourceLocation ModifierLoc,
1356 OpenMPNumTeamsClauseModifier ModifierExtra, Expr *ModifierExtraExpr,
1357 SourceLocation ModifierExtraLoc, SourceLocation StartLoc,
1358 SourceLocation LParenLoc, SourceLocation EndLoc);
1359 /// Called on well-formed 'thread_limit' clause.
1361 ArrayRef<Expr *> VarList, OpenMPThreadLimitClauseModifier Modifier,
1362 Expr *ModifierExpr, SourceLocation ModifierLoc, SourceLocation StartLoc,
1363 SourceLocation LParenLoc, SourceLocation EndLoc);
1364 /// Called on well-formed 'priority' clause.
1365 OMPClause *ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc,
1366 SourceLocation LParenLoc,
1367 SourceLocation EndLoc);
1368 /// Called on well-formed 'dist_schedule' clause.
1370 OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize,
1371 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc,
1372 SourceLocation CommaLoc, SourceLocation EndLoc);
1373 /// Called on well-formed 'defaultmap' clause.
1374 OMPClause *ActOnOpenMPDefaultmapClause(
1376 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc,
1377 SourceLocation KindLoc, SourceLocation EndLoc);
1378 /// Called on well-formed 'to' clause.
1379 OMPClause *
1380 ActOnOpenMPToClause(ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
1381 ArrayRef<SourceLocation> MotionModifiersLoc,
1382 Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec,
1383 DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
1384 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
1385 ArrayRef<Expr *> UnresolvedMappers = {});
1386 /// Called on well-formed 'from' clause.
1387 OMPClause *
1388 ActOnOpenMPFromClause(ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
1389 ArrayRef<SourceLocation> MotionModifiersLoc,
1390 Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec,
1391 DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
1392 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
1393 ArrayRef<Expr *> UnresolvedMappers = {});
1394 /// Called on well-formed 'use_device_ptr' clause.
1396 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
1397 OpenMPUseDevicePtrFallbackModifier FallbackModifier,
1398 SourceLocation FallbackModifierLoc);
1399 /// Called on well-formed 'use_device_addr' clause.
1400 OMPClause *ActOnOpenMPUseDeviceAddrClause(ArrayRef<Expr *> VarList,
1401 const OMPVarListLocTy &Locs);
1402 /// Called on well-formed 'is_device_ptr' clause.
1403 OMPClause *ActOnOpenMPIsDevicePtrClause(ArrayRef<Expr *> VarList,
1404 const OMPVarListLocTy &Locs);
1405 /// Called on well-formed 'has_device_addr' clause.
1406 OMPClause *ActOnOpenMPHasDeviceAddrClause(ArrayRef<Expr *> VarList,
1407 const OMPVarListLocTy &Locs);
1408 /// Called on well-formed 'nontemporal' clause.
1409 OMPClause *ActOnOpenMPNontemporalClause(ArrayRef<Expr *> VarList,
1410 SourceLocation StartLoc,
1411 SourceLocation LParenLoc,
1412 SourceLocation EndLoc);
1413
1414 /// Data for list of allocators.
1416 /// Allocator.
1417 Expr *Allocator = nullptr;
1418 /// Allocator traits.
1420 /// Locations of '(' and ')' symbols.
1422 };
1423 /// Called on well-formed 'uses_allocators' clause.
1425 SourceLocation LParenLoc,
1426 SourceLocation EndLoc,
1428 /// Called on well-formed 'affinity' clause.
1430 SourceLocation LParenLoc,
1431 SourceLocation ColonLoc,
1432 SourceLocation EndLoc, Expr *Modifier,
1433 ArrayRef<Expr *> Locators);
1434 /// Called on a well-formed 'bind' clause.
1436 SourceLocation KindLoc,
1437 SourceLocation StartLoc,
1438 SourceLocation LParenLoc,
1439 SourceLocation EndLoc);
1440
1441 /// Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
1443 SourceLocation LParenLoc,
1444 SourceLocation EndLoc);
1445
1446 /// Called on a well-formed 'dyn_groupprivate' clause.
1450 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc,
1451 SourceLocation M2Loc, SourceLocation EndLoc);
1452
1453 /// Called on well-formed 'doacross' clause.
1454 OMPClause *
1456 SourceLocation DepLoc, SourceLocation ColonLoc,
1457 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1458 SourceLocation LParenLoc, SourceLocation EndLoc);
1459
1460 /// Called on a well-formed 'ompx_attribute' clause.
1462 SourceLocation StartLoc,
1463 SourceLocation LParenLoc,
1464 SourceLocation EndLoc);
1465
1466 /// Called on a well-formed 'ompx_bare' clause.
1468 SourceLocation EndLoc);
1469
1471 Expr *LowerBound,
1472 SourceLocation ColonLocFirst,
1473 SourceLocation ColonLocSecond,
1474 Expr *Length, Expr *Stride,
1475 SourceLocation RBLoc);
1477 SourceLocation RParenLoc,
1478 ArrayRef<Expr *> Dims,
1479 ArrayRef<SourceRange> Brackets);
1480
1481 /// Data structure for iterator expression.
1491
1493 SourceLocation LLoc, SourceLocation RLoc,
1495
1497 Expr *ModifierExpr,
1498 SourceLocation ModifierLoc,
1499 ArrayRef<Expr *> VarList,
1500 SourceLocation VarListEndLoc);
1501
1502 void handleOMPAssumeAttr(Decl *D, const ParsedAttr &AL);
1503
1504 /// Setter and getter functions for device_num.
1505 void setOpenMPDeviceNum(int Num);
1506
1507 int getOpenMPDeviceNum() const;
1508
1509 void setOpenMPDeviceNumID(StringRef ID);
1510
1517
1518private:
1519 void *VarDataSharingAttributesStack;
1520
1521 /// Number of nested '#pragma omp declare target' directives.
1522 SmallVector<DeclareTargetContextInfo, 4> DeclareTargetNesting;
1523
1524 /// Initialization of data-sharing attributes stack.
1525 void InitDataSharingAttributesStack();
1526 void DestroyDataSharingAttributesStack();
1527
1528 /// Returns OpenMP nesting level for current directive.
1529 unsigned getOpenMPNestingLevel() const;
1530
1531 /// Adjusts the function scopes index for the target-based regions.
1532 void adjustOpenMPTargetScopeIndex(unsigned &FunctionScopesIndex,
1533 unsigned Level) const;
1534
1535 /// Returns the number of scopes associated with the construct on the given
1536 /// OpenMP level.
1537 int getNumberOfConstructScopes(unsigned Level) const;
1538
1539 /// Push new OpenMP function region for non-capturing function.
1540 void pushOpenMPFunctionRegion();
1541
1542 /// Pop OpenMP function region for non-capturing function.
1543 void popOpenMPFunctionRegion(const sema::FunctionScopeInfo *OldFSI);
1544
1545 /// Analyzes and checks a loop nest for use by a loop transformation.
1546 ///
1547 /// \param Kind The loop transformation directive kind.
1548 /// \param NumLoops How many nested loops the directive is expecting.
1549 /// \param AStmt Associated statement of the transformation directive.
1550 /// \param LoopHelpers [out] The loop analysis result.
1551 /// \param Body [out] The body code nested in \p NumLoops loop.
1552 /// \param OriginalInits [out] Collection of statements and declarations that
1553 /// must have been executed/declared before entering the
1554 /// loop.
1555 ///
1556 /// \return Whether there was any error.
1557 bool checkTransformableLoopNest(
1558 OpenMPDirectiveKind Kind, Stmt *AStmt, int NumLoops,
1560 Stmt *&Body, SmallVectorImpl<SmallVector<Stmt *>> &OriginalInits);
1561
1562 /// Holds the result of the analysis of a (possibly canonical) loop.
1563 struct LoopAnalysis {
1564 /// The analyzed loop or loop transformation.
1565 Stmt *AStmt = nullptr;
1566 /// Loop analyses results.
1567 OMPLoopBasedDirective::HelperExprs HelperExprs;
1568 /// The for-statement of the loop. TheForStmt equals AStmt only when the
1569 /// latter is a canonical loop (i.e. not a loop transformation).
1570 Stmt *TheForStmt = nullptr;
1571 /// Initialization statements before transformations.
1572 SmallVector<Stmt *> OriginalInits;
1573 /// Initialization statements required after transformation of this loop.
1574 SmallVector<Stmt *> TransformsPreInits;
1575
1576 explicit LoopAnalysis(Stmt *S) : AStmt(S) {}
1577
1578 bool isRegularLoop() const { return isRegularLoop(AStmt); }
1579 bool isLoopTransformation() const { return isLoopTransformation(AStmt); }
1580
1581 // Convenience functions used when building LoopSequenceAnalysis.
1582 static bool isRegularLoop(Stmt *S) {
1584 }
1585 static bool isLoopTransformation(Stmt *S) {
1587 }
1588 };
1589
1590 /// Holds the result of the analysis of a (possibly canonical) loop sequence.
1591 struct LoopSequenceAnalysis {
1592 /// Number of top level canonical loops.
1593 unsigned LoopSeqSize = 0;
1594 /// For each loop results of the analysis.
1595 SmallVector<LoopAnalysis, 2> Loops;
1596 /// Additional code required before entering the transformed loop sequence.
1597 SmallVector<Stmt *> LoopSequencePreInits;
1598
1599 // Convenience function used when building the LoopSequenceAnalysis.
1600 static bool isLoopSequenceDerivation(Stmt *S) {
1601 return LoopAnalysis::isRegularLoop(S) ||
1602 LoopAnalysis::isLoopTransformation(S);
1603 }
1604 };
1605
1606 /// The main recursive process of `checkTransformableLoopSequence` that
1607 /// performs grammatical parsing of a canonical loop sequence. It extracts
1608 /// key information, such as the number of top-level loops, loop statements,
1609 /// helper expressions, and other relevant loop-related data, all in a single
1610 /// execution to avoid redundant traversals. This analysis flattens inner
1611 /// Loop Sequences
1612 ///
1613 /// \param LoopSeqStmt The AST of the original statement.
1614 /// \param SeqAnalysis [out] Result of the analysis of \p LoopSeqStmt
1615 /// \param Context
1616 /// \param Kind The loop transformation directive kind.
1617 /// \return Whether the original statement is both syntactically and
1618 /// semantically correct according to OpenMP 6.0 canonical loop
1619 /// sequence definition.
1620 bool analyzeLoopSequence(Stmt *LoopSeqStmt, LoopSequenceAnalysis &SeqAnalysis,
1621 ASTContext &Context, OpenMPDirectiveKind Kind);
1622
1623 /// Validates and checks whether a loop sequence can be transformed according
1624 /// to the given directive, providing necessary setup and initialization
1625 /// (Driver function) before recursion using `analyzeLoopSequence`.
1626 ///
1627 /// \param Kind The loop transformation directive kind.
1628 /// \param AStmt The AST of the original statement
1629 /// \param SeqAnalysis [out] Result of the analysis of \p LoopSeqStmt
1630 /// \param Context
1631 /// \return Whether there was an absence of errors or not
1632 bool checkTransformableLoopSequence(OpenMPDirectiveKind Kind, Stmt *AStmt,
1633 LoopSequenceAnalysis &SeqAnalysis,
1634 ASTContext &Context);
1635
1636 /// Helper to keep information about the current `omp begin/end declare
1637 /// variant` nesting.
1638 struct OMPDeclareVariantScope {
1639 /// The associated OpenMP context selector.
1640 OMPTraitInfo *TI;
1641
1642 /// The associated OpenMP context selector mangling.
1643 std::string NameSuffix;
1644
1645 OMPDeclareVariantScope(OMPTraitInfo &TI);
1646 };
1647
1648 /// Return the OMPTraitInfo for the surrounding scope, if any.
1649 OMPTraitInfo *getOMPTraitInfoForSurroundingScope() {
1650 return OMPDeclareVariantScopes.empty() ? nullptr
1651 : OMPDeclareVariantScopes.back().TI;
1652 }
1653
1654 /// The current `omp begin/end declare variant` scopes.
1655 SmallVector<OMPDeclareVariantScope, 4> OMPDeclareVariantScopes;
1656
1657 /// The current `omp begin/end assumes` scopes.
1658 SmallVector<OMPAssumeAttr *, 4> OMPAssumeScoped;
1659
1660 /// All `omp assumes` we encountered so far.
1661 SmallVector<OMPAssumeAttr *, 4> OMPAssumeGlobal;
1662
1663 /// Device number specified by the context selector.
1664 int DeviceNum = -1;
1665
1666 /// Device number identifier specified by the context selector.
1667 StringRef DeviceNumID;
1668};
1669
1670} // namespace clang
1671
1672#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:1952
An instance of this object exists for each enum constant that is defined.
Definition Decl.h:3558
This represents one expression.
Definition Expr.h:113
Represents a member of a struct/union/class.
Definition Decl.h:3295
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.
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...
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)
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:438
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:379
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'.
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:150
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:124
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:133
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:311
DeclareTargetContextInfo(OpenMPDirectiveKind Kind, SourceLocation Loc)
Definition SemaOpenMP.h:329
std::optional< Expr * > Indirect
The directive with indirect clause.
Definition SemaOpenMP.h:324
OpenMPDirectiveKind Kind
The directive kind, begin declare target or declare target.
Definition SemaOpenMP.h:321
OMPDeclareTargetDeclAttr::DevTypeTy DT
The 'device_type' as parsed from the clause.
Definition SemaOpenMP.h:318
SourceLocation Loc
The directive location.
Definition SemaOpenMP.h:327
llvm::DenseMap< NamedDecl *, MapInfo > ExplicitlyMapped
Explicitly listed variables and functions in a 'to' or 'link' clause.
Definition SemaOpenMP.h:315
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.