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 OpenMPNumThreadsClauseModifier Modifier, Expr *NumThreads,
902 SourceLocation StartLoc, SourceLocation LParenLoc,
903 SourceLocation ModifierLoc, SourceLocation EndLoc);
904 /// Called on well-formed 'align' clause.
906 SourceLocation LParenLoc,
907 SourceLocation EndLoc);
908 /// Called on well-formed 'safelen' clause.
910 SourceLocation LParenLoc,
911 SourceLocation EndLoc);
912 /// Called on well-formed 'simdlen' clause.
914 SourceLocation LParenLoc,
915 SourceLocation EndLoc);
916 /// Called on well-form 'sizes' clause.
918 SourceLocation StartLoc,
919 SourceLocation LParenLoc,
920 SourceLocation EndLoc);
921 /// Called on well-formed 'counts' clause after parsing its arguments.
922 OMPClause *
924 SourceLocation LParenLoc, SourceLocation EndLoc,
925 std::optional<unsigned> FillIdx,
926 SourceLocation FillLoc, unsigned FillCount);
927 /// Called on well-form 'permutation' clause after parsing its arguments.
929 SourceLocation StartLoc,
930 SourceLocation LParenLoc,
931 SourceLocation EndLoc);
932 /// Called on well-form 'full' clauses.
934 SourceLocation EndLoc);
935 /// Called on well-form 'partial' clauses.
937 SourceLocation LParenLoc,
938 SourceLocation EndLoc);
939 /// Called on well-formed 'collapse' clause.
941 SourceLocation StartLoc,
942 SourceLocation LParenLoc,
943 SourceLocation EndLoc);
944
945 /// Called on well-form 'looprange' clause after parsing its arguments.
946 OMPClause *
948 SourceLocation LParenLoc, SourceLocation FirstLoc,
949 SourceLocation CountLoc, SourceLocation EndLoc);
950 /// Called on well-formed 'ordered' clause.
951 OMPClause *
953 SourceLocation LParenLoc = SourceLocation(),
954 Expr *NumForLoops = nullptr);
955 /// Called on well-formed 'grainsize' clause.
957 Expr *Size, SourceLocation StartLoc,
958 SourceLocation LParenLoc,
959 SourceLocation ModifierLoc,
960 SourceLocation EndLoc);
961 /// Called on well-formed 'num_tasks' clause.
963 Expr *NumTasks, SourceLocation StartLoc,
964 SourceLocation LParenLoc,
965 SourceLocation ModifierLoc,
966 SourceLocation EndLoc);
967 /// Called on well-formed 'hint' clause.
969 SourceLocation LParenLoc,
970 SourceLocation EndLoc);
971 /// Called on well-formed 'detach' clause.
973 SourceLocation LParenLoc,
974 SourceLocation EndLoc);
975
976 OMPClause *ActOnOpenMPSimpleClause(OpenMPClauseKind Kind, unsigned Argument,
977 SourceLocation ArgumentLoc,
978 SourceLocation StartLoc,
979 SourceLocation LParenLoc,
980 SourceLocation EndLoc);
981 /// Called on well-formed 'when' clause.
983 SourceLocation LParenLoc,
984 SourceLocation EndLoc);
985 /// Called on well-formed 'default' clause.
986 OMPClause *
987 ActOnOpenMPDefaultClause(llvm::omp::DefaultKind M, SourceLocation MLoc,
989 SourceLocation VCKindLoc, SourceLocation StartLoc,
990 SourceLocation LParenLoc, SourceLocation EndLoc);
991 /// Called on well-formed 'threadset' clause.
993 SourceLocation KindLoc,
994 SourceLocation StartLoc,
995 SourceLocation LParenLoc,
996 SourceLocation EndLoc);
997 /// Called on well-formed 'transparent' clause.
999 SourceLocation StartLoc,
1000 SourceLocation LParenLoc,
1001 SourceLocation EndLoc);
1002 /// Called on well-formed 'proc_bind' clause.
1003 OMPClause *ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind,
1004 SourceLocation KindLoc,
1005 SourceLocation StartLoc,
1006 SourceLocation LParenLoc,
1007 SourceLocation EndLoc);
1008 /// Called on well-formed 'order' clause.
1011 SourceLocation StartLoc,
1012 SourceLocation LParenLoc,
1013 SourceLocation MLoc, SourceLocation KindLoc,
1014 SourceLocation EndLoc);
1015 /// Called on well-formed 'update' clause.
1017 SourceLocation KindLoc,
1018 SourceLocation StartLoc,
1019 SourceLocation LParenLoc,
1020 SourceLocation EndLoc);
1021 /// Called on well-formed 'holds' clause.
1023 SourceLocation LParenLoc,
1024 SourceLocation EndLoc);
1025 /// Called on well-formed 'absent' or 'contains' clauses.
1030 SourceLocation Loc,
1031 SourceLocation RLoc);
1032
1034 OpenMPClauseKind Kind, ArrayRef<unsigned> Arguments, Expr *Expr,
1035 SourceLocation StartLoc, SourceLocation LParenLoc,
1036 ArrayRef<SourceLocation> ArgumentsLoc, SourceLocation DelimLoc,
1037 SourceLocation EndLoc);
1038 /// Called on well-formed 'schedule' clause.
1041 OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc,
1042 SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc,
1043 SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc);
1044
1046 SourceLocation EndLoc);
1047 /// Called on well-formed 'nowait' clause.
1049 SourceLocation EndLoc,
1050 SourceLocation LParenLoc, Expr *Condition);
1051 /// Called on well-formed 'untied' clause.
1053 SourceLocation EndLoc);
1054 /// Called on well-formed 'mergeable' clause.
1056 SourceLocation EndLoc);
1057 /// Called on well-formed 'read' clause.
1059 SourceLocation EndLoc);
1060 /// Called on well-formed 'write' clause.
1062 SourceLocation EndLoc);
1063 /// Called on well-formed 'update' clause.
1065 SourceLocation EndLoc);
1066 /// Called on well-formed 'capture' clause.
1068 SourceLocation EndLoc);
1069 /// Called on well-formed 'compare' clause.
1071 SourceLocation EndLoc);
1072 /// Called on well-formed 'fail' clause.
1074 SourceLocation EndLoc);
1076 SourceLocation KindLoc,
1077 SourceLocation StartLoc,
1078 SourceLocation LParenLoc,
1079 SourceLocation EndLoc);
1080
1081 /// Called on well-formed 'seq_cst' clause.
1083 SourceLocation EndLoc);
1084 /// Called on well-formed 'acq_rel' clause.
1086 SourceLocation EndLoc);
1087 /// Called on well-formed 'acquire' clause.
1089 SourceLocation EndLoc);
1090 /// Called on well-formed 'release' clause.
1092 SourceLocation EndLoc);
1093 /// Called on well-formed 'relaxed' clause.
1095 SourceLocation EndLoc);
1096 /// Called on well-formed 'weak' clause.
1098 SourceLocation EndLoc);
1099
1100 /// Called on well-formed 'init' clause.
1101 OMPClause *
1102 ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo,
1103 SourceLocation StartLoc, SourceLocation LParenLoc,
1104 SourceLocation VarLoc, SourceLocation EndLoc);
1105
1106 /// Called on well-formed 'use' clause.
1107 OMPClause *ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc,
1108 SourceLocation LParenLoc,
1109 SourceLocation VarLoc, SourceLocation EndLoc);
1110
1111 /// Called on well-formed 'destroy' clause.
1113 SourceLocation LParenLoc,
1114 SourceLocation VarLoc,
1115 SourceLocation EndLoc);
1116 /// Called on well-formed 'novariants' clause.
1118 SourceLocation StartLoc,
1119 SourceLocation LParenLoc,
1120 SourceLocation EndLoc);
1121 /// Called on well-formed 'nocontext' clause.
1123 SourceLocation StartLoc,
1124 SourceLocation LParenLoc,
1125 SourceLocation EndLoc);
1126 /// Called on well-formed 'filter' clause.
1128 SourceLocation LParenLoc,
1129 SourceLocation EndLoc);
1130 /// Called on well-formed 'threads' clause.
1132 SourceLocation EndLoc);
1133 /// Called on well-formed 'simd' clause.
1135 SourceLocation EndLoc);
1136 /// Called on well-formed 'nogroup' clause.
1138 SourceLocation EndLoc);
1139 /// Called on well-formed 'unified_address' clause.
1141 SourceLocation EndLoc);
1142
1143 /// Called on well-formed 'unified_address' clause.
1145 SourceLocation EndLoc);
1146
1147 /// Called on well-formed 'reverse_offload' clause.
1149 SourceLocation EndLoc);
1150
1151 /// Called on well-formed 'dynamic_allocators' clause.
1153 SourceLocation EndLoc);
1154
1155 /// Called on well-formed 'atomic_default_mem_order' clause.
1158 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
1159
1160 /// Called on well-formed 'self_maps' clause.
1162 SourceLocation EndLoc);
1163
1164 /// Called on well-formed 'at' clause.
1166 SourceLocation KindLoc,
1167 SourceLocation StartLoc,
1168 SourceLocation LParenLoc,
1169 SourceLocation EndLoc);
1170
1171 /// Called on well-formed 'severity' clause.
1173 SourceLocation KindLoc,
1174 SourceLocation StartLoc,
1175 SourceLocation LParenLoc,
1176 SourceLocation EndLoc);
1177
1178 /// Called on well-formed 'message' clause.
1179 /// passing string for message.
1181 SourceLocation LParenLoc,
1182 SourceLocation EndLoc);
1183
1184 /// Data used for processing a list of variables in OpenMP clauses.
1185 struct OpenMPVarListDataTy final {
1187 Expr *IteratorExpr = nullptr;
1192 std::array<int, 2> ExtraModifierArray = {-1, -1};
1193 std::array<Expr *, 2> ExtraModifierExprArray = {nullptr, nullptr};
1194 std::array<SourceLocation, 2> ExtraModifierLocArray = {SourceLocation(),
1195 SourceLocation()};
1196 /// Additional modifier for linear, map, depend, lastprivate,
1197 /// use_device_ptr, or num_teams clause.
1201 int OriginalSharingModifier = 0; // Default is shared
1211 bool IsMapTypeImplicit = false;
1215 StepModifierLoc; /// 'step' modifier location for linear clause
1228 };
1229
1231 ArrayRef<Expr *> Vars,
1232 const OMPVarListLocTy &Locs,
1233 OpenMPVarListDataTy &Data);
1234 /// Called on well-formed 'inclusive' clause.
1236 SourceLocation StartLoc,
1237 SourceLocation LParenLoc,
1238 SourceLocation EndLoc);
1239 /// Called on well-formed 'exclusive' clause.
1241 SourceLocation StartLoc,
1242 SourceLocation LParenLoc,
1243 SourceLocation EndLoc);
1244 /// Called on well-formed 'allocate' clause.
1245 OMPClause *
1246 ActOnOpenMPAllocateClause(Expr *Allocator, Expr *Alignment,
1247 OpenMPAllocateClauseModifier FirstModifier,
1248 SourceLocation FirstModifierLoc,
1249 OpenMPAllocateClauseModifier SecondModifier,
1250 SourceLocation SecondModifierLoc,
1251 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1252 SourceLocation ColonLoc, SourceLocation LParenLoc,
1253 SourceLocation EndLoc);
1254 /// Called on well-formed 'private' clause.
1256 SourceLocation StartLoc,
1257 SourceLocation LParenLoc,
1258 SourceLocation EndLoc);
1259 /// Called on well-formed 'firstprivate' clause.
1261 SourceLocation StartLoc,
1262 SourceLocation LParenLoc,
1263 SourceLocation EndLoc);
1264 /// Called on well-formed 'lastprivate' clause.
1267 SourceLocation LPKindLoc, SourceLocation ColonLoc,
1268 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
1269 /// Called on well-formed 'shared' clause.
1271 SourceLocation StartLoc,
1272 SourceLocation LParenLoc,
1273 SourceLocation EndLoc);
1274 /// Called on well-formed 'reduction' clause.
1276 ArrayRef<Expr *> VarList,
1277 OpenMPVarListDataTy::OpenMPReductionClauseModifiers Modifiers,
1278 SourceLocation StartLoc, SourceLocation LParenLoc,
1279 SourceLocation ModifierLoc, SourceLocation ColonLoc,
1280 SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec,
1281 const DeclarationNameInfo &ReductionId,
1282 ArrayRef<Expr *> UnresolvedReductions = {});
1283 /// Called on well-formed 'task_reduction' clause.
1285 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1286 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
1287 CXXScopeSpec &ReductionIdScopeSpec,
1288 const DeclarationNameInfo &ReductionId,
1289 ArrayRef<Expr *> UnresolvedReductions = {});
1290 /// Called on well-formed 'in_reduction' clause.
1292 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1293 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
1294 CXXScopeSpec &ReductionIdScopeSpec,
1295 const DeclarationNameInfo &ReductionId,
1296 ArrayRef<Expr *> UnresolvedReductions = {});
1297 /// Called on well-formed 'linear' clause.
1298 OMPClause *ActOnOpenMPLinearClause(
1299 ArrayRef<Expr *> VarList, Expr *Step, SourceLocation StartLoc,
1300 SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind,
1301 SourceLocation LinLoc, SourceLocation ColonLoc,
1302 SourceLocation StepModifierLoc, SourceLocation EndLoc);
1303 /// Called on well-formed 'aligned' clause.
1304 OMPClause *ActOnOpenMPAlignedClause(ArrayRef<Expr *> VarList, Expr *Alignment,
1305 SourceLocation StartLoc,
1306 SourceLocation LParenLoc,
1307 SourceLocation ColonLoc,
1308 SourceLocation EndLoc);
1309 /// Called on well-formed 'copyin' clause.
1310 OMPClause *ActOnOpenMPCopyinClause(ArrayRef<Expr *> VarList,
1311 SourceLocation StartLoc,
1312 SourceLocation LParenLoc,
1313 SourceLocation EndLoc);
1314 /// Called on well-formed 'copyprivate' clause.
1315 OMPClause *ActOnOpenMPCopyprivateClause(ArrayRef<Expr *> VarList,
1316 SourceLocation StartLoc,
1317 SourceLocation LParenLoc,
1318 SourceLocation EndLoc);
1319 /// Called on well-formed 'flush' pseudo clause.
1320 OMPClause *ActOnOpenMPFlushClause(ArrayRef<Expr *> VarList,
1321 SourceLocation StartLoc,
1322 SourceLocation LParenLoc,
1323 SourceLocation EndLoc);
1324 /// Called on well-formed 'depobj' pseudo clause.
1325 OMPClause *ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc,
1326 SourceLocation LParenLoc,
1327 SourceLocation EndLoc);
1328 /// Called on well-formed 'depend' clause.
1329 OMPClause *ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data,
1330 Expr *DepModifier,
1331 ArrayRef<Expr *> VarList,
1332 SourceLocation StartLoc,
1333 SourceLocation LParenLoc,
1334 SourceLocation EndLoc);
1335 /// Called on well-formed 'device' clause.
1337 Expr *Device, SourceLocation StartLoc,
1338 SourceLocation LParenLoc,
1339 SourceLocation ModifierLoc,
1340 SourceLocation EndLoc);
1341 /// Called on well-formed 'map' clause.
1342 OMPClause *ActOnOpenMPMapClause(
1343 Expr *IteratorModifier, ArrayRef<OpenMPMapModifierKind> MapTypeModifiers,
1344 ArrayRef<SourceLocation> MapTypeModifiersLoc,
1345 CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId,
1346 OpenMPMapClauseKind MapType, bool IsMapTypeImplicit,
1347 SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VarList,
1348 const OMPVarListLocTy &Locs, bool NoDiagnose = false,
1349 ArrayRef<Expr *> UnresolvedMappers = {});
1350 /// Called on well-formed 'num_teams' clause.
1351 OMPClause *ActOnOpenMPNumTeamsClause(
1352 ArrayRef<Expr *> VarList, OpenMPNumTeamsClauseModifier Modifier,
1353 Expr *ModifierExpr, SourceLocation ModifierLoc,
1354 OpenMPNumTeamsClauseModifier ModifierExtra, Expr *ModifierExtraExpr,
1355 SourceLocation ModifierExtraLoc, SourceLocation StartLoc,
1356 SourceLocation LParenLoc, SourceLocation EndLoc);
1357 /// Called on well-formed 'thread_limit' clause.
1359 ArrayRef<Expr *> VarList, OpenMPThreadLimitClauseModifier Modifier,
1360 Expr *ModifierExpr, SourceLocation ModifierLoc, SourceLocation StartLoc,
1361 SourceLocation LParenLoc, SourceLocation EndLoc);
1362 /// Called on well-formed 'priority' clause.
1363 OMPClause *ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc,
1364 SourceLocation LParenLoc,
1365 SourceLocation EndLoc);
1366 /// Called on well-formed 'dist_schedule' clause.
1368 OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize,
1369 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc,
1370 SourceLocation CommaLoc, SourceLocation EndLoc);
1371 /// Called on well-formed 'defaultmap' clause.
1372 OMPClause *ActOnOpenMPDefaultmapClause(
1374 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc,
1375 SourceLocation KindLoc, SourceLocation EndLoc);
1376 /// Called on well-formed 'to' clause.
1377 OMPClause *
1378 ActOnOpenMPToClause(ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
1379 ArrayRef<SourceLocation> MotionModifiersLoc,
1380 Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec,
1381 DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
1382 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
1383 ArrayRef<Expr *> UnresolvedMappers = {});
1384 /// Called on well-formed 'from' clause.
1385 OMPClause *
1386 ActOnOpenMPFromClause(ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
1387 ArrayRef<SourceLocation> MotionModifiersLoc,
1388 Expr *IteratorModifier, CXXScopeSpec &MapperIdScopeSpec,
1389 DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
1390 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
1391 ArrayRef<Expr *> UnresolvedMappers = {});
1392 /// Called on well-formed 'use_device_ptr' clause.
1394 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
1395 OpenMPUseDevicePtrFallbackModifier FallbackModifier,
1396 SourceLocation FallbackModifierLoc);
1397 /// Called on well-formed 'use_device_addr' clause.
1398 OMPClause *ActOnOpenMPUseDeviceAddrClause(ArrayRef<Expr *> VarList,
1399 const OMPVarListLocTy &Locs);
1400 /// Called on well-formed 'is_device_ptr' clause.
1401 OMPClause *ActOnOpenMPIsDevicePtrClause(ArrayRef<Expr *> VarList,
1402 const OMPVarListLocTy &Locs);
1403 /// Called on well-formed 'has_device_addr' clause.
1404 OMPClause *ActOnOpenMPHasDeviceAddrClause(ArrayRef<Expr *> VarList,
1405 const OMPVarListLocTy &Locs);
1406 /// Called on well-formed 'nontemporal' clause.
1407 OMPClause *ActOnOpenMPNontemporalClause(ArrayRef<Expr *> VarList,
1408 SourceLocation StartLoc,
1409 SourceLocation LParenLoc,
1410 SourceLocation EndLoc);
1411
1412 /// Data for list of allocators.
1414 /// Allocator.
1415 Expr *Allocator = nullptr;
1416 /// Allocator traits.
1418 /// Locations of '(' and ')' symbols.
1420 };
1421 /// Called on well-formed 'uses_allocators' clause.
1423 SourceLocation LParenLoc,
1424 SourceLocation EndLoc,
1426 /// Called on well-formed 'affinity' clause.
1428 SourceLocation LParenLoc,
1429 SourceLocation ColonLoc,
1430 SourceLocation EndLoc, Expr *Modifier,
1431 ArrayRef<Expr *> Locators);
1432 /// Called on a well-formed 'bind' clause.
1434 SourceLocation KindLoc,
1435 SourceLocation StartLoc,
1436 SourceLocation LParenLoc,
1437 SourceLocation EndLoc);
1438
1439 /// Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
1441 SourceLocation LParenLoc,
1442 SourceLocation EndLoc);
1443
1444 /// Called on a well-formed 'dyn_groupprivate' clause.
1448 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc,
1449 SourceLocation M2Loc, SourceLocation EndLoc);
1450
1451 /// Called on well-formed 'doacross' clause.
1452 OMPClause *
1454 SourceLocation DepLoc, SourceLocation ColonLoc,
1455 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1456 SourceLocation LParenLoc, SourceLocation EndLoc);
1457
1458 /// Called on a well-formed 'ompx_attribute' clause.
1460 SourceLocation StartLoc,
1461 SourceLocation LParenLoc,
1462 SourceLocation EndLoc);
1463
1464 /// Called on a well-formed 'ompx_bare' clause.
1466 SourceLocation EndLoc);
1467
1469 Expr *LowerBound,
1470 SourceLocation ColonLocFirst,
1471 SourceLocation ColonLocSecond,
1472 Expr *Length, Expr *Stride,
1473 SourceLocation RBLoc);
1475 SourceLocation RParenLoc,
1476 ArrayRef<Expr *> Dims,
1477 ArrayRef<SourceRange> Brackets);
1478
1479 /// Data structure for iterator expression.
1489
1491 SourceLocation LLoc, SourceLocation RLoc,
1493
1495 Expr *ModifierExpr,
1496 SourceLocation ModifierLoc,
1497 ArrayRef<Expr *> VarList,
1498 SourceLocation VarListEndLoc);
1499
1500 void handleOMPAssumeAttr(Decl *D, const ParsedAttr &AL);
1501
1502 /// Setter and getter functions for device_num.
1503 void setOpenMPDeviceNum(int Num);
1504
1505 int getOpenMPDeviceNum() const;
1506
1507 void setOpenMPDeviceNumID(StringRef ID);
1508
1515
1516private:
1517 void *VarDataSharingAttributesStack;
1518
1519 /// Number of nested '#pragma omp declare target' directives.
1520 SmallVector<DeclareTargetContextInfo, 4> DeclareTargetNesting;
1521
1522 /// Initialization of data-sharing attributes stack.
1523 void InitDataSharingAttributesStack();
1524 void DestroyDataSharingAttributesStack();
1525
1526 /// Returns OpenMP nesting level for current directive.
1527 unsigned getOpenMPNestingLevel() const;
1528
1529 /// Adjusts the function scopes index for the target-based regions.
1530 void adjustOpenMPTargetScopeIndex(unsigned &FunctionScopesIndex,
1531 unsigned Level) const;
1532
1533 /// Returns the number of scopes associated with the construct on the given
1534 /// OpenMP level.
1535 int getNumberOfConstructScopes(unsigned Level) const;
1536
1537 /// Push new OpenMP function region for non-capturing function.
1538 void pushOpenMPFunctionRegion();
1539
1540 /// Pop OpenMP function region for non-capturing function.
1541 void popOpenMPFunctionRegion(const sema::FunctionScopeInfo *OldFSI);
1542
1543 /// Analyzes and checks a loop nest for use by a loop transformation.
1544 ///
1545 /// \param Kind The loop transformation directive kind.
1546 /// \param NumLoops How many nested loops the directive is expecting.
1547 /// \param AStmt Associated statement of the transformation directive.
1548 /// \param LoopHelpers [out] The loop analysis result.
1549 /// \param Body [out] The body code nested in \p NumLoops loop.
1550 /// \param OriginalInits [out] Collection of statements and declarations that
1551 /// must have been executed/declared before entering the
1552 /// loop.
1553 ///
1554 /// \return Whether there was any error.
1555 bool checkTransformableLoopNest(
1556 OpenMPDirectiveKind Kind, Stmt *AStmt, int NumLoops,
1558 Stmt *&Body, SmallVectorImpl<SmallVector<Stmt *>> &OriginalInits);
1559
1560 /// Holds the result of the analysis of a (possibly canonical) loop.
1561 struct LoopAnalysis {
1562 /// The analyzed loop or loop transformation.
1563 Stmt *AStmt = nullptr;
1564 /// Loop analyses results.
1565 OMPLoopBasedDirective::HelperExprs HelperExprs;
1566 /// The for-statement of the loop. TheForStmt equals AStmt only when the
1567 /// latter is a canonical loop (i.e. not a loop transformation).
1568 Stmt *TheForStmt = nullptr;
1569 /// Initialization statements before transformations.
1570 SmallVector<Stmt *> OriginalInits;
1571 /// Initialization statements required after transformation of this loop.
1572 SmallVector<Stmt *> TransformsPreInits;
1573
1574 explicit LoopAnalysis(Stmt *S) : AStmt(S) {}
1575
1576 bool isRegularLoop() const { return isRegularLoop(AStmt); }
1577 bool isLoopTransformation() const { return isLoopTransformation(AStmt); }
1578
1579 // Convenience functions used when building LoopSequenceAnalysis.
1580 static bool isRegularLoop(Stmt *S) {
1582 }
1583 static bool isLoopTransformation(Stmt *S) {
1585 }
1586 };
1587
1588 /// Holds the result of the analysis of a (possibly canonical) loop sequence.
1589 struct LoopSequenceAnalysis {
1590 /// Number of top level canonical loops.
1591 unsigned LoopSeqSize = 0;
1592 /// For each loop results of the analysis.
1593 SmallVector<LoopAnalysis, 2> Loops;
1594 /// Additional code required before entering the transformed loop sequence.
1595 SmallVector<Stmt *> LoopSequencePreInits;
1596
1597 // Convenience function used when building the LoopSequenceAnalysis.
1598 static bool isLoopSequenceDerivation(Stmt *S) {
1599 return LoopAnalysis::isRegularLoop(S) ||
1600 LoopAnalysis::isLoopTransformation(S);
1601 }
1602 };
1603
1604 /// The main recursive process of `checkTransformableLoopSequence` that
1605 /// performs grammatical parsing of a canonical loop sequence. It extracts
1606 /// key information, such as the number of top-level loops, loop statements,
1607 /// helper expressions, and other relevant loop-related data, all in a single
1608 /// execution to avoid redundant traversals. This analysis flattens inner
1609 /// Loop Sequences
1610 ///
1611 /// \param LoopSeqStmt The AST of the original statement.
1612 /// \param SeqAnalysis [out] Result of the analysis of \p LoopSeqStmt
1613 /// \param Context
1614 /// \param Kind The loop transformation directive kind.
1615 /// \return Whether the original statement is both syntactically and
1616 /// semantically correct according to OpenMP 6.0 canonical loop
1617 /// sequence definition.
1618 bool analyzeLoopSequence(Stmt *LoopSeqStmt, LoopSequenceAnalysis &SeqAnalysis,
1619 ASTContext &Context, OpenMPDirectiveKind Kind);
1620
1621 /// Validates and checks whether a loop sequence can be transformed according
1622 /// to the given directive, providing necessary setup and initialization
1623 /// (Driver function) before recursion using `analyzeLoopSequence`.
1624 ///
1625 /// \param Kind The loop transformation directive kind.
1626 /// \param AStmt The AST of the original statement
1627 /// \param SeqAnalysis [out] Result of the analysis of \p LoopSeqStmt
1628 /// \param Context
1629 /// \return Whether there was an absence of errors or not
1630 bool checkTransformableLoopSequence(OpenMPDirectiveKind Kind, Stmt *AStmt,
1631 LoopSequenceAnalysis &SeqAnalysis,
1632 ASTContext &Context);
1633
1634 /// Helper to keep information about the current `omp begin/end declare
1635 /// variant` nesting.
1636 struct OMPDeclareVariantScope {
1637 /// The associated OpenMP context selector.
1638 OMPTraitInfo *TI;
1639
1640 /// The associated OpenMP context selector mangling.
1641 std::string NameSuffix;
1642
1643 OMPDeclareVariantScope(OMPTraitInfo &TI);
1644 };
1645
1646 /// Return the OMPTraitInfo for the surrounding scope, if any.
1647 OMPTraitInfo *getOMPTraitInfoForSurroundingScope() {
1648 return OMPDeclareVariantScopes.empty() ? nullptr
1649 : OMPDeclareVariantScopes.back().TI;
1650 }
1651
1652 /// The current `omp begin/end declare variant` scopes.
1653 SmallVector<OMPDeclareVariantScope, 4> OMPDeclareVariantScopes;
1654
1655 /// The current `omp begin/end assumes` scopes.
1656 SmallVector<OMPAssumeAttr *, 4> OMPAssumeScoped;
1657
1658 /// All `omp assumes` we encountered so far.
1659 SmallVector<OMPAssumeAttr *, 4> OMPAssumeGlobal;
1660
1661 /// Device number specified by the context selector.
1662 int DeviceNum = -1;
1663
1664 /// Device number identifier specified by the context selector.
1665 StringRef DeviceNumID;
1666};
1667
1668} // namespace clang
1669
1670#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:2001
An instance of this object exists for each enum constant that is defined.
Definition Decl.h:3467
This represents one expression.
Definition Expr.h:112
Represents a member of a struct/union/class.
Definition Decl.h:3204
Represents a function declaration or definition.
Definition Decl.h:2029
One of these records is kept for each identifier that is lexed.
This represents a decl that may have a name.
Definition Decl.h:274
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.
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 * ActOnOpenMPUpdateClause(OpenMPDependClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'update' clause.
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 * 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.
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 * ActOnOpenMPNumThreadsClause(OpenMPNumThreadsClauseModifier Modifier, Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
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:1876
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition Decl.h:712
Represents a variable declaration or definition.
Definition Decl.h:932
Retains information about a function, method, or block that is currently being parsed.
Definition ScopeInfo.h:104
Definition SPIR.cpp:47
The JSON file list parser is used to communicate input to InstallAPI.
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.