clang 20.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/Attr.h"
18#include "clang/AST/Decl.h"
19#include "clang/AST/DeclBase.h"
22#include "clang/AST/Expr.h"
25#include "clang/AST/Stmt.h"
27#include "clang/AST/Type.h"
29#include "clang/Basic/LLVM.h"
33#include "clang/Sema/DeclSpec.h"
35#include "clang/Sema/Scope.h"
37#include "clang/Sema/SemaBase.h"
38#include "llvm/ADT/DenseMap.h"
39#include "llvm/ADT/PointerUnion.h"
40#include <optional>
41#include <string>
42#include <utility>
43
44namespace clang {
45class ParsedAttr;
46
47class SemaOpenMP : public SemaBase {
48public:
49 SemaOpenMP(Sema &S);
50
51 friend class Parser;
52 friend class Sema;
53
55 using CapturedParamNameType = std::pair<StringRef, QualType>;
56
57 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
58 /// context is "used as device code".
59 ///
60 /// - If CurContext is a `declare target` function or it is known that the
61 /// function is emitted for the device, emits the diagnostics immediately.
62 /// - If CurContext is a non-`declare target` function and we are compiling
63 /// for the device, creates a diagnostic which is emitted if and when we
64 /// realize that the function will be codegen'ed.
65 ///
66 /// Example usage:
67 ///
68 /// // Variable-length arrays are not allowed in NVPTX device code.
69 /// if (diagIfOpenMPDeviceCode(Loc, diag::err_vla_unsupported))
70 /// return ExprError();
71 /// // Otherwise, continue parsing as normal.
73 unsigned DiagID,
74 const FunctionDecl *FD);
75
76 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
77 /// context is "used as host code".
78 ///
79 /// - If CurContext is a `declare target` function or it is known that the
80 /// function is emitted for the host, emits the diagnostics immediately.
81 /// - If CurContext is a non-host function, just ignore it.
82 ///
83 /// Example usage:
84 ///
85 /// // Variable-length arrays are not allowed in NVPTX device code.
86 /// if (diagIfOpenMPHostode(Loc, diag::err_vla_unsupported))
87 /// return ExprError();
88 /// // Otherwise, continue parsing as normal.
90 unsigned DiagID,
91 const FunctionDecl *FD);
92
93 /// The declarator \p D defines a function in the scope \p S which is nested
94 /// in an `omp begin/end declare variant` scope. In this method we create a
95 /// declaration for \p D and rename \p D according to the OpenMP context
96 /// selector of the surrounding scope. Return all base functions in \p Bases.
98 Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists,
100
101 /// Register \p D as specialization of all base functions in \p Bases in the
102 /// current `omp begin/end declare variant` scope.
105
106 /// Act on \p D, a function definition inside of an `omp [begin/end] assumes`.
108
109 /// Can we exit an OpenMP declare variant scope at the moment.
111 return !OMPDeclareVariantScopes.empty();
112 }
113
116 bool StrictlyPositive = true,
117 bool SuppressExprDiags = false);
118
119 /// Given the potential call expression \p Call, determine if there is a
120 /// specialization via the OpenMP declare variant mechanism available. If
121 /// there is, return the specialized call expression, otherwise return the
122 /// original \p Call.
124 SourceLocation LParenLoc, MultiExprArg ArgExprs,
125 SourceLocation RParenLoc, Expr *ExecConfig);
126
127 /// Handle a `omp begin declare variant`.
129
130 /// Handle a `omp end declare variant`.
132
133 /// Function tries to capture lambda's captured variables in the OpenMP region
134 /// before the original lambda is captured.
136
137 /// Return true if the provided declaration \a VD should be captured by
138 /// reference.
139 /// \param Level Relative level of nested OpenMP construct for that the check
140 /// is performed.
141 /// \param OpenMPCaptureLevel Capture level within an OpenMP construct.
142 bool isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level,
143 unsigned OpenMPCaptureLevel) const;
144
145 /// Check if the specified variable is used in one of the private
146 /// clauses (private, firstprivate, lastprivate, reduction etc.) in OpenMP
147 /// constructs.
148 VarDecl *isOpenMPCapturedDecl(ValueDecl *D, bool CheckScopeInfo = false,
149 unsigned StopAt = 0);
150
151 /// The member expression(this->fd) needs to be rebuilt in the template
152 /// instantiation to generate private copy for OpenMP when default
153 /// clause is used. The function will return true if default
154 /// cluse is used.
156
159
160 /// If the current region is a loop-based region, mark the start of the loop
161 /// construct.
162 void startOpenMPLoop();
163
164 /// If the current region is a range loop-based region, mark the start of the
165 /// loop construct.
167
168 /// Check if the specified variable is used in 'private' clause.
169 /// \param Level Relative level of nested OpenMP construct for that the check
170 /// is performed.
172 unsigned CapLevel) const;
173
174 /// Sets OpenMP capture kind (OMPC_private, OMPC_firstprivate, OMPC_map etc.)
175 /// for \p FD based on DSA for the provided corresponding captured declaration
176 /// \p D.
177 void setOpenMPCaptureKind(FieldDecl *FD, const ValueDecl *D, unsigned Level);
178
179 /// Check if the specified variable is captured by 'target' directive.
180 /// \param Level Relative level of nested OpenMP construct for that the check
181 /// is performed.
182 bool isOpenMPTargetCapturedDecl(const ValueDecl *D, unsigned Level,
183 unsigned CaptureLevel) const;
184
185 /// Check if the specified global variable must be captured by outer capture
186 /// regions.
187 /// \param Level Relative level of nested OpenMP construct for that
188 /// the check is performed.
189 bool isOpenMPGlobalCapturedDecl(ValueDecl *D, unsigned Level,
190 unsigned CaptureLevel) const;
191
193 Expr *Op);
194 /// Called on start of new data sharing attribute block.
196 const DeclarationNameInfo &DirName, Scope *CurScope,
198 /// Start analysis of clauses.
200 /// End analysis of clauses.
201 void EndOpenMPClause();
202 /// Called on end of data sharing attribute block.
203 void EndOpenMPDSABlock(Stmt *CurDirective);
204
205 /// Check if the current region is an OpenMP loop region and if it is,
206 /// mark loop control variable, used in \p Init for loop initialization, as
207 /// private by default.
208 /// \param Init First part of the for loop.
210
211 /// Called on well-formed '\#pragma omp metadirective' after parsing
212 /// of the associated statement.
214 Stmt *AStmt, SourceLocation StartLoc,
215 SourceLocation EndLoc);
216
217 // OpenMP directives and clauses.
218 /// Called on correct id-expression from the '#pragma omp
219 /// threadprivate'.
221 const DeclarationNameInfo &Id,
223 /// Called on well-formed '#pragma omp threadprivate'.
225 ArrayRef<Expr *> VarList);
226 /// Builds a new OpenMPThreadPrivateDecl and checks its correctness.
228 ArrayRef<Expr *> VarList);
229 /// Called on well-formed '#pragma omp allocate'.
231 ArrayRef<Expr *> VarList,
232 ArrayRef<OMPClause *> Clauses,
233 DeclContext *Owner = nullptr);
234
235 /// Called on well-formed '#pragma omp [begin] assume[s]'.
238 ArrayRef<std::string> Assumptions,
239 bool SkippedClauses);
240
241 /// Check if there is an active global `omp begin assumes` directive.
242 bool isInOpenMPAssumeScope() const { return !OMPAssumeScoped.empty(); }
243
244 /// Check if there is an active global `omp assumes` directive.
245 bool hasGlobalOpenMPAssumes() const { return !OMPAssumeGlobal.empty(); }
246
247 /// Called on well-formed '#pragma omp end assumes'.
249
250 /// Called on well-formed '#pragma omp requires'.
252 ArrayRef<OMPClause *> ClauseList);
253 /// Check restrictions on Requires directive
255 ArrayRef<OMPClause *> Clauses);
256 /// Check if the specified type is allowed to be used in 'omp declare
257 /// reduction' construct.
260 /// Called on start of '#pragma omp declare reduction'.
262 Scope *S, DeclContext *DC, DeclarationName Name,
263 ArrayRef<std::pair<QualType, SourceLocation>> ReductionTypes,
264 AccessSpecifier AS, Decl *PrevDeclInScope = nullptr);
265 /// Initialize declare reduction construct initializer.
267 /// Finish current declare reduction construct initializer.
269 /// Initialize declare reduction construct initializer.
270 /// \return omp_priv variable.
272 /// Finish current declare reduction construct initializer.
274 VarDecl *OmpPrivParm);
275 /// Called at the end of '#pragma omp declare reduction'.
277 Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid);
278
279 /// Check variable declaration in 'omp declare mapper' construct.
281 /// Check if the specified type is allowed to be used in 'omp declare
282 /// mapper' construct.
285 /// Called on start of '#pragma omp declare mapper'.
287 Scope *S, DeclContext *DC, DeclarationName Name, QualType MapperType,
289 Expr *MapperVarRef, ArrayRef<OMPClause *> Clauses,
290 Decl *PrevDeclInScope = nullptr);
291 /// Build the mapper variable of '#pragma omp declare mapper'.
293 QualType MapperType,
294 SourceLocation StartLoc,
295 DeclarationName VN);
297 bool isOpenMPDeclareMapperVarDeclAllowed(const VarDecl *VD) const;
299
301 struct MapInfo {
302 OMPDeclareTargetDeclAttr::MapTypeTy MT;
304 };
305 /// Explicitly listed variables and functions in a 'to' or 'link' clause.
306 llvm::DenseMap<NamedDecl *, MapInfo> ExplicitlyMapped;
307
308 /// The 'device_type' as parsed from the clause.
309 OMPDeclareTargetDeclAttr::DevTypeTy DT = OMPDeclareTargetDeclAttr::DT_Any;
310
311 /// The directive kind, `begin declare target` or `declare target`.
313
314 /// The directive with indirect clause.
315 std::optional<Expr *> Indirect;
316
317 /// The directive location.
319
321 : Kind(Kind), Loc(Loc) {}
322 };
323
324 /// Called on the start of target region i.e. '#pragma omp declare target'.
325 bool ActOnStartOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI);
326
327 /// Called at the end of target region i.e. '#pragma omp end declare target'.
328 const DeclareTargetContextInfo ActOnOpenMPEndDeclareTargetDirective();
329
330 /// Called once a target context is completed, that can be when a
331 /// '#pragma omp end declare target' was encountered or when a
332 /// '#pragma omp declare target' without declaration-definition-seq was
333 /// encountered.
334 void ActOnFinishedOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI);
335
336 /// Report unterminated 'omp declare target' or 'omp begin declare target' at
337 /// the end of a compilation unit.
339
340 /// Searches for the provided declaration name for OpenMP declare target
341 /// directive.
343 CXXScopeSpec &ScopeSpec,
344 const DeclarationNameInfo &Id);
345
346 /// Called on correct id-expression from the '#pragma omp declare target'.
348 OMPDeclareTargetDeclAttr::MapTypeTy MT,
349 DeclareTargetContextInfo &DTCI);
350
351 /// Check declaration inside target region.
352 void
355
356 /// Adds OMPDeclareTargetDeclAttr to referenced variables in declare target
357 /// directive.
359
360 /// Finishes analysis of the deferred functions calls that may be declared as
361 /// host/nohost during device/host compilation.
363 const FunctionDecl *Callee,
365
366 /// Return true if currently in OpenMP task with untied clause context.
367 bool isInOpenMPTaskUntiedContext() const;
368
369 /// Return true inside OpenMP declare target region.
371 return !DeclareTargetNesting.empty();
372 }
373 /// Return true inside OpenMP target region.
375
376 /// Return the number of captured regions created for an OpenMP directive.
378
379 /// Initialization of captured region for OpenMP region.
380 void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope);
381
382 /// Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to
383 /// an OpenMP loop directive.
385
386 /// Process a canonical OpenMP loop nest that can either be a canonical
387 /// literal loop (ForStmt or CXXForRangeStmt), or the generated loop of an
388 /// OpenMP loop transformation construct.
390
391 /// End of OpenMP region.
392 ///
393 /// \param S Statement associated with the current OpenMP region.
394 /// \param Clauses List of clauses for the current OpenMP region.
395 ///
396 /// \returns Statement for finished OpenMP region.
400 OpenMPDirectiveKind CancelRegion, ArrayRef<OMPClause *> Clauses,
401 Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc);
402 /// Called on well-formed '\#pragma omp parallel' after parsing
403 /// of the associated statement.
405 Stmt *AStmt, SourceLocation StartLoc,
406 SourceLocation EndLoc);
408 llvm::SmallDenseMap<const ValueDecl *, const Expr *, 4>;
409 /// Called on well-formed '\#pragma omp simd' after parsing
410 /// of the associated statement.
413 SourceLocation StartLoc, SourceLocation EndLoc,
414 VarsWithInheritedDSAType &VarsWithImplicitDSA);
415 /// Called on well-formed '#pragma omp tile' after parsing of its clauses and
416 /// the associated statement.
418 Stmt *AStmt, SourceLocation StartLoc,
419 SourceLocation EndLoc);
420 /// Called on well-formed '#pragma omp unroll' after parsing of its clauses
421 /// and the associated statement.
423 Stmt *AStmt, SourceLocation StartLoc,
424 SourceLocation EndLoc);
425 /// Called on well-formed '#pragma omp reverse'.
427 SourceLocation EndLoc);
428 /// Called on well-formed '#pragma omp interchange' after parsing of its
429 /// clauses and the associated statement.
431 Stmt *AStmt,
432 SourceLocation StartLoc,
433 SourceLocation EndLoc);
434 /// Called on well-formed '\#pragma omp for' after parsing
435 /// of the associated statement.
438 SourceLocation StartLoc, SourceLocation EndLoc,
439 VarsWithInheritedDSAType &VarsWithImplicitDSA);
440 /// Called on well-formed '\#pragma omp for simd' after parsing
441 /// of the associated statement.
444 SourceLocation StartLoc, SourceLocation EndLoc,
445 VarsWithInheritedDSAType &VarsWithImplicitDSA);
446 /// Called on well-formed '\#pragma omp sections' after parsing
447 /// of the associated statement.
449 Stmt *AStmt, SourceLocation StartLoc,
450 SourceLocation EndLoc);
451 /// Called on well-formed '\#pragma omp section' after parsing of the
452 /// associated statement.
454 SourceLocation EndLoc);
455 /// Called on well-formed '\#pragma omp scope' after parsing of the
456 /// associated statement.
458 Stmt *AStmt, SourceLocation StartLoc,
459 SourceLocation EndLoc);
460 /// Called on well-formed '\#pragma omp single' after parsing of the
461 /// associated statement.
463 Stmt *AStmt, SourceLocation StartLoc,
464 SourceLocation EndLoc);
465 /// Called on well-formed '\#pragma omp master' after parsing of the
466 /// associated statement.
468 SourceLocation EndLoc);
469 /// Called on well-formed '\#pragma omp critical' after parsing of the
470 /// associated statement.
472 ArrayRef<OMPClause *> Clauses,
473 Stmt *AStmt, SourceLocation StartLoc,
474 SourceLocation EndLoc);
475 /// Called on well-formed '\#pragma omp parallel for' after parsing
476 /// of the associated statement.
478 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
479 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
480 /// Called on well-formed '\#pragma omp parallel for simd' after
481 /// parsing of the associated statement.
483 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
484 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
485 /// Called on well-formed '\#pragma omp parallel master' after
486 /// parsing of the associated statement.
488 Stmt *AStmt,
489 SourceLocation StartLoc,
490 SourceLocation EndLoc);
491 /// Called on well-formed '\#pragma omp parallel masked' after
492 /// parsing of the associated statement.
494 Stmt *AStmt,
495 SourceLocation StartLoc,
496 SourceLocation EndLoc);
497 /// Called on well-formed '\#pragma omp parallel sections' after
498 /// parsing of the associated statement.
500 Stmt *AStmt,
501 SourceLocation StartLoc,
502 SourceLocation EndLoc);
503 /// Called on well-formed '\#pragma omp task' after parsing of the
504 /// associated statement.
506 Stmt *AStmt, SourceLocation StartLoc,
507 SourceLocation EndLoc);
508 /// Called on well-formed '\#pragma omp taskyield'.
510 SourceLocation EndLoc);
511 /// Called on well-formed '\#pragma omp error'.
512 /// Error direcitive is allowed in both declared and excutable contexts.
513 /// Adding InExContext to identify which context is called from.
515 SourceLocation StartLoc,
516 SourceLocation EndLoc,
517 bool InExContext = true);
518 /// Called on well-formed '\#pragma omp barrier'.
520 SourceLocation EndLoc);
521 /// Called on well-formed '\#pragma omp taskwait'.
523 SourceLocation StartLoc,
524 SourceLocation EndLoc);
525 /// Called on well-formed '\#pragma omp taskgroup'.
527 Stmt *AStmt, SourceLocation StartLoc,
528 SourceLocation EndLoc);
529 /// Called on well-formed '\#pragma omp flush'.
531 SourceLocation StartLoc,
532 SourceLocation EndLoc);
533 /// Called on well-formed '\#pragma omp depobj'.
535 SourceLocation StartLoc,
536 SourceLocation EndLoc);
537 /// Called on well-formed '\#pragma omp scan'.
539 SourceLocation StartLoc,
540 SourceLocation EndLoc);
541 /// Called on well-formed '\#pragma omp ordered' after parsing of the
542 /// associated statement.
544 Stmt *AStmt, SourceLocation StartLoc,
545 SourceLocation EndLoc);
546 /// Called on well-formed '\#pragma omp atomic' after parsing of the
547 /// associated statement.
549 Stmt *AStmt, SourceLocation StartLoc,
550 SourceLocation EndLoc);
551 /// Called on well-formed '\#pragma omp target' after parsing of the
552 /// associated statement.
554 Stmt *AStmt, SourceLocation StartLoc,
555 SourceLocation EndLoc);
556 /// Called on well-formed '\#pragma omp target data' after parsing of
557 /// the associated statement.
559 Stmt *AStmt,
560 SourceLocation StartLoc,
561 SourceLocation EndLoc);
562 /// Called on well-formed '\#pragma omp target enter data' after
563 /// parsing of the associated statement.
565 SourceLocation StartLoc,
566 SourceLocation EndLoc,
567 Stmt *AStmt);
568 /// Called on well-formed '\#pragma omp target exit data' after
569 /// parsing of the associated statement.
571 SourceLocation StartLoc,
572 SourceLocation EndLoc,
573 Stmt *AStmt);
574 /// Called on well-formed '\#pragma omp target parallel' after
575 /// parsing of the associated statement.
577 Stmt *AStmt,
578 SourceLocation StartLoc,
579 SourceLocation EndLoc);
580 /// Called on well-formed '\#pragma omp target parallel for' after
581 /// parsing of the associated statement.
583 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
584 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
585 /// Called on well-formed '\#pragma omp teams' after parsing of the
586 /// associated statement.
588 Stmt *AStmt, SourceLocation StartLoc,
589 SourceLocation EndLoc);
590 /// Called on well-formed '\#pragma omp teams loop' after parsing of the
591 /// associated statement.
593 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
594 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
595 /// Called on well-formed '\#pragma omp target teams loop' after parsing of
596 /// the associated statement.
598 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
599 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
600 /// Called on well-formed '\#pragma omp parallel loop' after parsing of the
601 /// associated statement.
603 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
604 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
605 /// Called on well-formed '\#pragma omp target parallel loop' after parsing
606 /// of the associated statement.
608 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
609 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
610 /// Called on well-formed '\#pragma omp cancellation point'.
613 SourceLocation EndLoc,
614 OpenMPDirectiveKind CancelRegion);
615 /// Called on well-formed '\#pragma omp cancel'.
617 SourceLocation StartLoc,
618 SourceLocation EndLoc,
619 OpenMPDirectiveKind CancelRegion);
620 /// Called on well-formed '\#pragma omp taskloop' after parsing of the
621 /// associated statement.
624 SourceLocation StartLoc, SourceLocation EndLoc,
625 VarsWithInheritedDSAType &VarsWithImplicitDSA);
626 /// Called on well-formed '\#pragma omp taskloop simd' after parsing of
627 /// the associated statement.
629 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
630 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
631 /// Called on well-formed '\#pragma omp master taskloop' after parsing of the
632 /// associated statement.
634 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
635 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
636 /// Called on well-formed '\#pragma omp master taskloop simd' after parsing of
637 /// the associated statement.
639 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
640 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
641 /// Called on well-formed '\#pragma omp parallel master taskloop' after
642 /// parsing of the associated statement.
644 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
645 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
646 /// Called on well-formed '\#pragma omp parallel master taskloop simd' after
647 /// parsing of the associated statement.
649 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
650 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
651 /// Called on well-formed '\#pragma omp masked taskloop' after parsing of the
652 /// associated statement.
654 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
655 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
656 /// Called on well-formed '\#pragma omp masked taskloop simd' after parsing of
657 /// the associated statement.
659 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
660 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
661 /// Called on well-formed '\#pragma omp parallel masked taskloop' after
662 /// parsing of the associated statement.
664 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
665 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
666 /// Called on well-formed '\#pragma omp parallel masked taskloop simd' after
667 /// parsing of the associated statement.
669 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
670 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
671 /// Called on well-formed '\#pragma omp distribute' after parsing
672 /// of the associated statement.
675 SourceLocation StartLoc, SourceLocation EndLoc,
676 VarsWithInheritedDSAType &VarsWithImplicitDSA);
677 /// Called on well-formed '\#pragma omp target update'.
679 SourceLocation StartLoc,
680 SourceLocation EndLoc,
681 Stmt *AStmt);
682 /// Called on well-formed '\#pragma omp distribute parallel for' after
683 /// parsing of the associated statement.
685 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
686 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
687 /// Called on well-formed '\#pragma omp distribute parallel for simd'
688 /// after 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 distribute 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 target parallel for simd' after
698 /// parsing of the associated statement.
700 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
701 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
702 /// Called on well-formed '\#pragma omp target simd' after parsing of
703 /// the associated statement.
706 SourceLocation StartLoc, SourceLocation EndLoc,
707 VarsWithInheritedDSAType &VarsWithImplicitDSA);
708 /// Called on well-formed '\#pragma omp teams distribute' after parsing of
709 /// the associated statement.
711 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
712 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
713 /// Called on well-formed '\#pragma omp teams distribute simd' after parsing
714 /// of the associated statement.
716 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
717 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
718 /// Called on well-formed '\#pragma omp teams distribute parallel for simd'
719 /// after parsing of the associated statement.
721 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
722 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
723 /// Called on well-formed '\#pragma omp teams distribute parallel for'
724 /// after parsing of the associated statement.
726 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
727 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
728 /// Called on well-formed '\#pragma omp target teams' after parsing of the
729 /// associated statement.
731 Stmt *AStmt,
732 SourceLocation StartLoc,
733 SourceLocation EndLoc);
734 /// Called on well-formed '\#pragma omp target teams distribute' after parsing
735 /// of the associated statement.
737 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
738 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
739 /// Called on well-formed '\#pragma omp target teams distribute parallel for'
740 /// after parsing of the associated statement.
742 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
743 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
744 /// Called on well-formed '\#pragma omp target teams distribute parallel for
745 /// simd' after parsing of the associated statement.
747 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
748 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
749 /// Called on well-formed '\#pragma omp target teams distribute simd' after
750 /// parsing of the associated statement.
752 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
753 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
754 /// Called on well-formed '\#pragma omp interop'.
756 SourceLocation StartLoc,
757 SourceLocation EndLoc);
758 /// Called on well-formed '\#pragma omp dispatch' after parsing of the
759 // /associated statement.
761 Stmt *AStmt, SourceLocation StartLoc,
762 SourceLocation EndLoc);
763 /// Called on well-formed '\#pragma omp masked' after parsing of the
764 // /associated statement.
766 Stmt *AStmt, SourceLocation StartLoc,
767 SourceLocation EndLoc);
768
769 /// Called on well-formed '\#pragma omp loop' after parsing of the
770 /// associated statement.
772 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
773 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
774
775 /// Checks correctness of linear modifiers.
777 SourceLocation LinLoc);
778 /// Checks that the specified declaration matches requirements for the linear
779 /// decls.
782 bool IsDeclareSimd = false);
783
784 /// Called on well-formed '\#pragma omp declare simd' after parsing of
785 /// the associated method/function.
787 DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS,
788 Expr *Simdlen, ArrayRef<Expr *> Uniforms, ArrayRef<Expr *> Aligneds,
789 ArrayRef<Expr *> Alignments, ArrayRef<Expr *> Linears,
790 ArrayRef<unsigned> LinModifiers, ArrayRef<Expr *> Steps, SourceRange SR);
791
792 /// Checks '\#pragma omp declare variant' variant function and original
793 /// functions after parsing of the associated method/function.
794 /// \param DG Function declaration to which declare variant directive is
795 /// applied to.
796 /// \param VariantRef Expression that references the variant function, which
797 /// must be used instead of the original one, specified in \p DG.
798 /// \param TI The trait info object representing the match clause.
799 /// \param NumAppendArgs The number of omp_interop_t arguments to account for
800 /// in checking.
801 /// \returns std::nullopt, if the function/variant function are not compatible
802 /// with the pragma, pair of original function/variant ref expression
803 /// otherwise.
804 std::optional<std::pair<FunctionDecl *, Expr *>>
806 OMPTraitInfo &TI, unsigned NumAppendArgs,
807 SourceRange SR);
808
809 /// Called on well-formed '\#pragma omp declare variant' after parsing of
810 /// the associated method/function.
811 /// \param FD Function declaration to which declare variant directive is
812 /// applied to.
813 /// \param VariantRef Expression that references the variant function, which
814 /// must be used instead of the original one, specified in \p DG.
815 /// \param TI The context traits associated with the function variant.
816 /// \param AdjustArgsNothing The list of 'nothing' arguments.
817 /// \param AdjustArgsNeedDevicePtr The list of 'need_device_ptr' arguments.
818 /// \param AppendArgs The list of 'append_args' arguments.
819 /// \param AdjustArgsLoc The Location of an 'adjust_args' clause.
820 /// \param AppendArgsLoc The Location of an 'append_args' clause.
821 /// \param SR The SourceRange of the 'declare variant' directive.
823 FunctionDecl *FD, Expr *VariantRef, OMPTraitInfo &TI,
824 ArrayRef<Expr *> AdjustArgsNothing,
825 ArrayRef<Expr *> AdjustArgsNeedDevicePtr,
826 ArrayRef<OMPInteropInfo> AppendArgs, SourceLocation AdjustArgsLoc,
827 SourceLocation AppendArgsLoc, SourceRange SR);
828
830 SourceLocation StartLoc,
831 SourceLocation LParenLoc,
832 SourceLocation EndLoc);
833 /// Called on well-formed 'allocator' clause.
835 SourceLocation StartLoc,
836 SourceLocation LParenLoc,
837 SourceLocation EndLoc);
838 /// Called on well-formed 'if' clause.
840 Expr *Condition, SourceLocation StartLoc,
841 SourceLocation LParenLoc,
842 SourceLocation NameModifierLoc,
843 SourceLocation ColonLoc,
844 SourceLocation EndLoc);
845 /// Called on well-formed 'final' clause.
847 SourceLocation LParenLoc,
848 SourceLocation EndLoc);
849 /// Called on well-formed 'num_threads' clause.
851 SourceLocation StartLoc,
852 SourceLocation LParenLoc,
853 SourceLocation EndLoc);
854 /// Called on well-formed 'align' clause.
856 SourceLocation LParenLoc,
857 SourceLocation EndLoc);
858 /// Called on well-formed 'safelen' clause.
860 SourceLocation LParenLoc,
861 SourceLocation EndLoc);
862 /// Called on well-formed 'simdlen' clause.
864 SourceLocation LParenLoc,
865 SourceLocation EndLoc);
866 /// Called on well-form 'sizes' clause.
868 SourceLocation StartLoc,
869 SourceLocation LParenLoc,
870 SourceLocation EndLoc);
871 /// Called on well-form 'full' clauses.
873 SourceLocation EndLoc);
874 /// Called on well-form 'partial' clauses.
876 SourceLocation LParenLoc,
877 SourceLocation EndLoc);
878 /// Called on well-formed 'collapse' clause.
880 SourceLocation StartLoc,
881 SourceLocation LParenLoc,
882 SourceLocation EndLoc);
883 /// Called on well-formed 'ordered' clause.
884 OMPClause *
886 SourceLocation LParenLoc = SourceLocation(),
887 Expr *NumForLoops = nullptr);
888 /// Called on well-formed 'grainsize' clause.
890 Expr *Size, SourceLocation StartLoc,
891 SourceLocation LParenLoc,
892 SourceLocation ModifierLoc,
893 SourceLocation EndLoc);
894 /// Called on well-formed 'num_tasks' clause.
896 Expr *NumTasks, SourceLocation StartLoc,
897 SourceLocation LParenLoc,
898 SourceLocation ModifierLoc,
899 SourceLocation EndLoc);
900 /// Called on well-formed 'hint' clause.
902 SourceLocation LParenLoc,
903 SourceLocation EndLoc);
904 /// Called on well-formed 'detach' clause.
906 SourceLocation LParenLoc,
907 SourceLocation EndLoc);
908
910 SourceLocation ArgumentLoc,
911 SourceLocation StartLoc,
912 SourceLocation LParenLoc,
913 SourceLocation EndLoc);
914 /// Called on well-formed 'when' clause.
916 SourceLocation LParenLoc,
917 SourceLocation EndLoc);
918 /// Called on well-formed 'default' clause.
919 OMPClause *ActOnOpenMPDefaultClause(llvm::omp::DefaultKind Kind,
920 SourceLocation KindLoc,
921 SourceLocation StartLoc,
922 SourceLocation LParenLoc,
923 SourceLocation EndLoc);
924 /// Called on well-formed 'proc_bind' clause.
925 OMPClause *ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind,
926 SourceLocation KindLoc,
927 SourceLocation StartLoc,
928 SourceLocation LParenLoc,
929 SourceLocation EndLoc);
930 /// Called on well-formed 'order' clause.
933 SourceLocation StartLoc,
934 SourceLocation LParenLoc,
935 SourceLocation MLoc, SourceLocation KindLoc,
936 SourceLocation EndLoc);
937 /// Called on well-formed 'update' clause.
939 SourceLocation KindLoc,
940 SourceLocation StartLoc,
941 SourceLocation LParenLoc,
942 SourceLocation EndLoc);
943
946 SourceLocation StartLoc, SourceLocation LParenLoc,
947 ArrayRef<SourceLocation> ArgumentsLoc, SourceLocation DelimLoc,
948 SourceLocation EndLoc);
949 /// Called on well-formed 'schedule' clause.
952 OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc,
953 SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc,
954 SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc);
955
957 SourceLocation EndLoc);
958 /// Called on well-formed 'nowait' clause.
960 SourceLocation EndLoc);
961 /// Called on well-formed 'untied' clause.
963 SourceLocation EndLoc);
964 /// Called on well-formed 'mergeable' clause.
966 SourceLocation EndLoc);
967 /// Called on well-formed 'read' clause.
969 SourceLocation EndLoc);
970 /// Called on well-formed 'write' clause.
972 SourceLocation EndLoc);
973 /// Called on well-formed 'update' clause.
975 SourceLocation EndLoc);
976 /// Called on well-formed 'capture' clause.
978 SourceLocation EndLoc);
979 /// Called on well-formed 'compare' clause.
981 SourceLocation EndLoc);
982 /// Called on well-formed 'fail' clause.
984 SourceLocation EndLoc);
986 SourceLocation KindLoc,
987 SourceLocation StartLoc,
988 SourceLocation LParenLoc,
989 SourceLocation EndLoc);
990
991 /// Called on well-formed 'seq_cst' clause.
993 SourceLocation EndLoc);
994 /// Called on well-formed 'acq_rel' clause.
996 SourceLocation EndLoc);
997 /// Called on well-formed 'acquire' clause.
999 SourceLocation EndLoc);
1000 /// Called on well-formed 'release' clause.
1002 SourceLocation EndLoc);
1003 /// Called on well-formed 'relaxed' clause.
1005 SourceLocation EndLoc);
1006 /// Called on well-formed 'weak' clause.
1008 SourceLocation EndLoc);
1009
1010 /// Called on well-formed 'init' clause.
1011 OMPClause *
1012 ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo,
1013 SourceLocation StartLoc, SourceLocation LParenLoc,
1014 SourceLocation VarLoc, SourceLocation EndLoc);
1015
1016 /// Called on well-formed 'use' clause.
1017 OMPClause *ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc,
1018 SourceLocation LParenLoc,
1019 SourceLocation VarLoc, SourceLocation EndLoc);
1020
1021 /// Called on well-formed 'destroy' clause.
1023 SourceLocation LParenLoc,
1024 SourceLocation VarLoc,
1025 SourceLocation EndLoc);
1026 /// Called on well-formed 'novariants' clause.
1028 SourceLocation StartLoc,
1029 SourceLocation LParenLoc,
1030 SourceLocation EndLoc);
1031 /// Called on well-formed 'nocontext' clause.
1033 SourceLocation StartLoc,
1034 SourceLocation LParenLoc,
1035 SourceLocation EndLoc);
1036 /// Called on well-formed 'filter' clause.
1038 SourceLocation LParenLoc,
1039 SourceLocation EndLoc);
1040 /// Called on well-formed 'threads' clause.
1042 SourceLocation EndLoc);
1043 /// Called on well-formed 'simd' clause.
1045 SourceLocation EndLoc);
1046 /// Called on well-formed 'nogroup' clause.
1048 SourceLocation EndLoc);
1049 /// Called on well-formed 'unified_address' clause.
1051 SourceLocation EndLoc);
1052
1053 /// Called on well-formed 'unified_address' clause.
1055 SourceLocation EndLoc);
1056
1057 /// Called on well-formed 'reverse_offload' clause.
1059 SourceLocation EndLoc);
1060
1061 /// Called on well-formed 'dynamic_allocators' clause.
1063 SourceLocation EndLoc);
1064
1065 /// Called on well-formed 'atomic_default_mem_order' clause.
1068 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
1069
1070 /// Called on well-formed 'at' clause.
1072 SourceLocation KindLoc,
1073 SourceLocation StartLoc,
1074 SourceLocation LParenLoc,
1075 SourceLocation EndLoc);
1076
1077 /// Called on well-formed 'severity' clause.
1079 SourceLocation KindLoc,
1080 SourceLocation StartLoc,
1081 SourceLocation LParenLoc,
1082 SourceLocation EndLoc);
1083
1084 /// Called on well-formed 'message' clause.
1085 /// passing string for message.
1087 SourceLocation LParenLoc,
1088 SourceLocation EndLoc);
1089
1090 /// Data used for processing a list of variables in OpenMP clauses.
1091 struct OpenMPVarListDataTy final {
1093 Expr *IteratorExpr = nullptr;
1098 int ExtraModifier = -1; ///< Additional modifier for linear, map, depend or
1099 ///< lastprivate clause.
1107 bool IsMapTypeImplicit = false;
1111 StepModifierLoc; /// 'step' modifier location for linear clause
1112 };
1113
1115 ArrayRef<Expr *> Vars,
1116 const OMPVarListLocTy &Locs,
1118 /// Called on well-formed 'inclusive' clause.
1120 SourceLocation StartLoc,
1121 SourceLocation LParenLoc,
1122 SourceLocation EndLoc);
1123 /// Called on well-formed 'exclusive' clause.
1125 SourceLocation StartLoc,
1126 SourceLocation LParenLoc,
1127 SourceLocation EndLoc);
1128 /// Called on well-formed 'allocate' clause.
1129 OMPClause *
1131 SourceLocation StartLoc, SourceLocation ColonLoc,
1132 SourceLocation LParenLoc, SourceLocation EndLoc);
1133 /// Called on well-formed 'private' clause.
1135 SourceLocation StartLoc,
1136 SourceLocation LParenLoc,
1137 SourceLocation EndLoc);
1138 /// Called on well-formed 'firstprivate' clause.
1140 SourceLocation StartLoc,
1141 SourceLocation LParenLoc,
1142 SourceLocation EndLoc);
1143 /// Called on well-formed 'lastprivate' clause.
1146 SourceLocation LPKindLoc, SourceLocation ColonLoc,
1147 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
1148 /// Called on well-formed 'shared' clause.
1150 SourceLocation StartLoc,
1151 SourceLocation LParenLoc,
1152 SourceLocation EndLoc);
1153 /// Called on well-formed 'reduction' clause.
1156 SourceLocation StartLoc, SourceLocation LParenLoc,
1157 SourceLocation ModifierLoc, SourceLocation ColonLoc,
1158 SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec,
1159 const DeclarationNameInfo &ReductionId,
1160 ArrayRef<Expr *> UnresolvedReductions = std::nullopt);
1161 /// Called on well-formed 'task_reduction' clause.
1163 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1164 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
1165 CXXScopeSpec &ReductionIdScopeSpec,
1166 const DeclarationNameInfo &ReductionId,
1167 ArrayRef<Expr *> UnresolvedReductions = std::nullopt);
1168 /// Called on well-formed 'in_reduction' clause.
1170 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1171 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
1172 CXXScopeSpec &ReductionIdScopeSpec,
1173 const DeclarationNameInfo &ReductionId,
1174 ArrayRef<Expr *> UnresolvedReductions = std::nullopt);
1175 /// Called on well-formed 'linear' clause.
1177 ArrayRef<Expr *> VarList, Expr *Step, SourceLocation StartLoc,
1178 SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind,
1179 SourceLocation LinLoc, SourceLocation ColonLoc,
1180 SourceLocation StepModifierLoc, SourceLocation EndLoc);
1181 /// Called on well-formed 'aligned' clause.
1183 SourceLocation StartLoc,
1184 SourceLocation LParenLoc,
1185 SourceLocation ColonLoc,
1186 SourceLocation EndLoc);
1187 /// Called on well-formed 'copyin' clause.
1189 SourceLocation StartLoc,
1190 SourceLocation LParenLoc,
1191 SourceLocation EndLoc);
1192 /// Called on well-formed 'copyprivate' clause.
1194 SourceLocation StartLoc,
1195 SourceLocation LParenLoc,
1196 SourceLocation EndLoc);
1197 /// Called on well-formed 'flush' pseudo clause.
1199 SourceLocation StartLoc,
1200 SourceLocation LParenLoc,
1201 SourceLocation EndLoc);
1202 /// Called on well-formed 'depobj' pseudo clause.
1204 SourceLocation LParenLoc,
1205 SourceLocation EndLoc);
1206 /// Called on well-formed 'depend' clause.
1208 Expr *DepModifier,
1209 ArrayRef<Expr *> VarList,
1210 SourceLocation StartLoc,
1211 SourceLocation LParenLoc,
1212 SourceLocation EndLoc);
1213 /// Called on well-formed 'device' clause.
1215 Expr *Device, SourceLocation StartLoc,
1216 SourceLocation LParenLoc,
1217 SourceLocation ModifierLoc,
1218 SourceLocation EndLoc);
1219 /// Called on well-formed 'map' clause.
1221 Expr *IteratorModifier, ArrayRef<OpenMPMapModifierKind> MapTypeModifiers,
1222 ArrayRef<SourceLocation> MapTypeModifiersLoc,
1223 CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId,
1224 OpenMPMapClauseKind MapType, bool IsMapTypeImplicit,
1225 SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VarList,
1226 const OMPVarListLocTy &Locs, bool NoDiagnose = false,
1227 ArrayRef<Expr *> UnresolvedMappers = std::nullopt);
1228 /// Called on well-formed 'num_teams' clause.
1230 SourceLocation LParenLoc,
1231 SourceLocation EndLoc);
1232 /// Called on well-formed 'thread_limit' clause.
1234 SourceLocation StartLoc,
1235 SourceLocation LParenLoc,
1236 SourceLocation EndLoc);
1237 /// Called on well-formed 'priority' clause.
1239 SourceLocation LParenLoc,
1240 SourceLocation EndLoc);
1241 /// Called on well-formed 'dist_schedule' clause.
1244 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc,
1245 SourceLocation CommaLoc, SourceLocation EndLoc);
1246 /// Called on well-formed 'defaultmap' clause.
1249 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc,
1250 SourceLocation KindLoc, SourceLocation EndLoc);
1251 /// Called on well-formed 'to' clause.
1252 OMPClause *
1254 ArrayRef<SourceLocation> MotionModifiersLoc,
1255 CXXScopeSpec &MapperIdScopeSpec,
1256 DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
1257 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
1258 ArrayRef<Expr *> UnresolvedMappers = std::nullopt);
1259 /// Called on well-formed 'from' clause.
1260 OMPClause *
1262 ArrayRef<SourceLocation> MotionModifiersLoc,
1263 CXXScopeSpec &MapperIdScopeSpec,
1264 DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
1265 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
1266 ArrayRef<Expr *> UnresolvedMappers = std::nullopt);
1267 /// Called on well-formed 'use_device_ptr' clause.
1269 const OMPVarListLocTy &Locs);
1270 /// Called on well-formed 'use_device_addr' clause.
1272 const OMPVarListLocTy &Locs);
1273 /// Called on well-formed 'is_device_ptr' clause.
1275 const OMPVarListLocTy &Locs);
1276 /// Called on well-formed 'has_device_addr' clause.
1278 const OMPVarListLocTy &Locs);
1279 /// Called on well-formed 'nontemporal' clause.
1281 SourceLocation StartLoc,
1282 SourceLocation LParenLoc,
1283 SourceLocation EndLoc);
1284
1285 /// Data for list of allocators.
1287 /// Allocator.
1288 Expr *Allocator = nullptr;
1289 /// Allocator traits.
1291 /// Locations of '(' and ')' symbols.
1293 };
1294 /// Called on well-formed 'uses_allocators' clause.
1296 SourceLocation LParenLoc,
1297 SourceLocation EndLoc,
1299 /// Called on well-formed 'affinity' clause.
1301 SourceLocation LParenLoc,
1302 SourceLocation ColonLoc,
1303 SourceLocation EndLoc, Expr *Modifier,
1304 ArrayRef<Expr *> Locators);
1305 /// Called on a well-formed 'bind' clause.
1307 SourceLocation KindLoc,
1308 SourceLocation StartLoc,
1309 SourceLocation LParenLoc,
1310 SourceLocation EndLoc);
1311
1312 /// Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
1314 SourceLocation LParenLoc,
1315 SourceLocation EndLoc);
1316
1317 /// Called on well-formed 'doacross' clause.
1318 OMPClause *
1320 SourceLocation DepLoc, SourceLocation ColonLoc,
1321 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1322 SourceLocation LParenLoc, SourceLocation EndLoc);
1323
1324 /// Called on a well-formed 'ompx_attribute' clause.
1326 SourceLocation StartLoc,
1327 SourceLocation LParenLoc,
1328 SourceLocation EndLoc);
1329
1330 /// Called on a well-formed 'ompx_bare' clause.
1332 SourceLocation EndLoc);
1333
1335 Expr *LowerBound,
1336 SourceLocation ColonLocFirst,
1337 SourceLocation ColonLocSecond,
1338 Expr *Length, Expr *Stride,
1339 SourceLocation RBLoc);
1341 SourceLocation RParenLoc,
1342 ArrayRef<Expr *> Dims,
1343 ArrayRef<SourceRange> Brackets);
1344
1345 /// Data structure for iterator expression.
1354 };
1355
1357 SourceLocation LLoc, SourceLocation RLoc,
1359
1360 void handleOMPAssumeAttr(Decl *D, const ParsedAttr &AL);
1361
1362private:
1363 void *VarDataSharingAttributesStack;
1364
1365 /// Number of nested '#pragma omp declare target' directives.
1366 SmallVector<DeclareTargetContextInfo, 4> DeclareTargetNesting;
1367
1368 /// Initialization of data-sharing attributes stack.
1369 void InitDataSharingAttributesStack();
1370 void DestroyDataSharingAttributesStack();
1371
1372 /// Returns OpenMP nesting level for current directive.
1373 unsigned getOpenMPNestingLevel() const;
1374
1375 /// Adjusts the function scopes index for the target-based regions.
1376 void adjustOpenMPTargetScopeIndex(unsigned &FunctionScopesIndex,
1377 unsigned Level) const;
1378
1379 /// Returns the number of scopes associated with the construct on the given
1380 /// OpenMP level.
1381 int getNumberOfConstructScopes(unsigned Level) const;
1382
1383 /// Push new OpenMP function region for non-capturing function.
1384 void pushOpenMPFunctionRegion();
1385
1386 /// Pop OpenMP function region for non-capturing function.
1387 void popOpenMPFunctionRegion(const sema::FunctionScopeInfo *OldFSI);
1388
1389 /// Analyzes and checks a loop nest for use by a loop transformation.
1390 ///
1391 /// \param Kind The loop transformation directive kind.
1392 /// \param NumLoops How many nested loops the directive is expecting.
1393 /// \param AStmt Associated statement of the transformation directive.
1394 /// \param LoopHelpers [out] The loop analysis result.
1395 /// \param Body [out] The body code nested in \p NumLoops loop.
1396 /// \param OriginalInits [out] Collection of statements and declarations that
1397 /// must have been executed/declared before entering the
1398 /// loop.
1399 ///
1400 /// \return Whether there was any error.
1401 bool checkTransformableLoopNest(
1402 OpenMPDirectiveKind Kind, Stmt *AStmt, int NumLoops,
1404 Stmt *&Body, SmallVectorImpl<SmallVector<Stmt *, 0>> &OriginalInits);
1405
1406 /// Helper to keep information about the current `omp begin/end declare
1407 /// variant` nesting.
1408 struct OMPDeclareVariantScope {
1409 /// The associated OpenMP context selector.
1410 OMPTraitInfo *TI;
1411
1412 /// The associated OpenMP context selector mangling.
1413 std::string NameSuffix;
1414
1415 OMPDeclareVariantScope(OMPTraitInfo &TI);
1416 };
1417
1418 /// Return the OMPTraitInfo for the surrounding scope, if any.
1419 OMPTraitInfo *getOMPTraitInfoForSurroundingScope() {
1420 return OMPDeclareVariantScopes.empty() ? nullptr
1421 : OMPDeclareVariantScopes.back().TI;
1422 }
1423
1424 /// The current `omp begin/end declare variant` scopes.
1425 SmallVector<OMPDeclareVariantScope, 4> OMPDeclareVariantScopes;
1426
1427 /// The current `omp begin/end assumes` scopes.
1428 SmallVector<OMPAssumeAttr *, 4> OMPAssumeScoped;
1429
1430 /// All `omp assumes` we encountered so far.
1431 SmallVector<OMPAssumeAttr *, 4> OMPAssumeGlobal;
1432};
1433
1434} // namespace clang
1435
1436#endif // LLVM_CLANG_SEMA_SEMAOPENMP_H
#define V(N, I)
Definition: ASTContext.h:3338
const Decl * D
Expr * E
enum clang::sema::@1651::IndirectLocalPathEntry::EntryKind Kind
This file defines OpenMP nodes for declarative directives.
int Priority
Definition: Format.cpp:2993
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.
uint32_t Id
Definition: SemaARM.cpp:1143
SourceLocation Loc
Definition: SemaObjC.cpp:758
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.
C Language Family Type Representation.
Represents a C++ nested-name-specifier or a global scope specifier.
Definition: DeclSpec.h:74
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1425
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:1900
This represents one expression.
Definition: Expr.h:110
Represents a member of a struct/union/class.
Definition: Decl.h:3030
Represents a function declaration or definition.
Definition: Decl.h:1932
One of these records is kept for each identifier that is lexed.
This represents a decl that may have a name.
Definition: Decl.h:249
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:55
This represents '#pragma omp requires...' directive.
Definition: DeclOpenMP.h:417
This represents '#pragma omp threadprivate ...' directive.
Definition: DeclOpenMP.h:110
Helper data structure representing the traits in a match clause of an declare variant or metadirectiv...
Wrapper for void* pointer.
Definition: Ownership.h:50
ParsedAttr - Represents a syntactic attribute.
Definition: ParsedAttr.h:129
Parser - This implements a parser for the C family of languages.
Definition: Parser.h:58
A (possibly-)qualified type.
Definition: Type.h:941
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:110
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.
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...
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
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...
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
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...
void ActOnFinishedOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI)
Called once a target context is completed, that can be when a '#pragma omp end declare target' was en...
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 * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPReductionClauseModifier Modifier, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=std::nullopt)
Called on well-formed 'reduction' 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 * 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'.
StmtResult ActOnOpenMPDistributeSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute simd' after parsing of the associated statement.
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
StmtResult ActOnOpenMPDepobjDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp depobj'.
ExprResult getOpenMPCapturedExpr(VarDecl *Capture, ExprValueKind VK, ExprObjectKind OK, SourceLocation Loc)
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
OMPClause * ActOnOpenMPSingleExprWithArgClause(OpenMPClauseKind Kind, ArrayRef< unsigned > Arguments, Expr *Expr, SourceLocation StartLoc, SourceLocation LParenLoc, ArrayRef< SourceLocation > ArgumentsLoc, SourceLocation DelimLoc, SourceLocation EndLoc)
StmtResult ActOnOpenMPTargetParallelDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target parallel' after parsing of the associated statement.
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
OpenMPClauseKind isOpenMPPrivateDecl(ValueDecl *D, unsigned Level, unsigned CapLevel) const
Check if the specified variable is used in 'private' clause.
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
OMPClause * ActOnOpenMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'nowait' clause.
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 * 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 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,...
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.
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)
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers=std::nullopt)
Called on well-formed 'from' clause.
bool isOpenMPRebuildMemberExpr(ValueDecl *D)
The member expression(this->fd) needs to be rebuilt in the template instantiation to generate private...
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)
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers=std::nullopt)
Called on well-formed 'to' clause.
bool isInOpenMPDeclareVariantScope() const
Can we exit an OpenMP declare variant scope at the moment.
Definition: SemaOpenMP.h:110
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)
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.
bool hasGlobalOpenMPAssumes() const
Check if there is an active global omp assumes directive.
Definition: SemaOpenMP.h:245
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.
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.
OMPClause * ActOnOpenMPSizesClause(ArrayRef< Expr * > SizeExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'sizes' clause.
bool ActOnStartOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI)
Called on the start of target region i.e. '#pragma omp declare target'.
StmtResult ActOnOpenMPTeamsDistributeParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute parallel for simd' after parsing of the associate...
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
OMPClause * ActOnOpenMPNumThreadsClause(Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
StmtResult ActOnOpenMPDistributeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute' after parsing of the associated statement.
StmtResult ActOnOpenMPSectionDirective(Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp section' after parsing of the associated statement.
StmtResult ActOnOpenMPInterchangeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp interchange' after parsing of its clauses and the associated state...
bool isOpenMPGlobalCapturedDecl(ValueDecl *D, unsigned Level, unsigned CaptureLevel) const
Check if the specified global variable must be captured by outer capture regions.
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:242
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...
OMPClause * ActOnOpenMPNumTeamsClause(Expr *NumTeams, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
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 * 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=std::nullopt)
Called on well-formed 'map' clause.
OMPClause * ActOnOpenMPTaskReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=std::nullopt)
Called on well-formed 'task_reduction' clause.
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...
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_ptr' clause.
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:54
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 ActOnOpenMPCanonicalLoop(Stmt *AStmt)
Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to an OpenMP loop directive.
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)
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.
StmtResult ActOnOpenMPReverseDirective(Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp reverse'.
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
OMPClause * ActOnOpenMPAtClause(OpenMPAtClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'at' clause.
StmtResult ActOnOpenMPTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp taskloop' after parsing of the associated statement.
OMPClause * ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'init' clause.
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
void ActOnOpenMPDeclareReductionCombinerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
std::pair< StringRef, QualType > CapturedParamNameType
Definition: SemaOpenMP.h:55
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...
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 * 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:370
StmtResult ActOnOpenMPCancellationPointDirective(SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind CancelRegion)
Called on well-formed '#pragma omp cancellation point'.
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.
void ActOnOpenMPDeclareVariantDirective(FunctionDecl *FD, Expr *VariantRef, OMPTraitInfo &TI, ArrayRef< Expr * > AdjustArgsNothing, ArrayRef< Expr * > AdjustArgsNeedDevicePtr, ArrayRef< OMPInteropInfo > AppendArgs, SourceLocation AdjustArgsLoc, SourceLocation AppendArgsLoc, SourceRange SR)
Called on well-formed '#pragma omp declare variant' after parsing of the associated method/function.
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 * 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 * 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.
OMPClause * ActOnOpenMPInReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=std::nullopt)
Called on well-formed 'in_reduction' clause.
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.
OMPClause * ActOnOpenMPThreadLimitClause(Expr *ThreadLimit, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' 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.
llvm::SmallDenseMap< const ValueDecl *, const Expr *, 4 > VarsWithInheritedDSAType
Definition: SemaOpenMP.h:408
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 on start of '#pragma omp declare mapper'.
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:535
Encodes a location in the source.
A trivial tuple used to represent a source range.
Stmt - This represents one statement.
Definition: Stmt.h:84
The base class of the type hierarchy.
Definition: Type.h:1829
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:667
Represents a variable declaration or definition.
Definition: Decl.h:879
Retains information about a function, method, or block that is currently being parsed.
Definition: ScopeInfo.h:104
The JSON file list parser is used to communicate input to InstallAPI.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
Definition: OpenMPKinds.h:24
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
Definition: OpenMPKinds.h:118
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
Definition: OpenMPKinds.h:171
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
Definition: Specifiers.h:146
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
Definition: OpenMPKinds.h:135
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
Definition: OpenMPKinds.h:186
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
Definition: OpenMPKinds.h:38
llvm::omp::Clause OpenMPClauseKind
OpenMP clauses.
Definition: OpenMPKinds.h:27
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
Definition: OpenMPKinds.h:103
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
Definition: OpenMPKinds.h:219
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
Definition: OpenMPKinds.h:200
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
Definition: OpenMPKinds.h:157
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
Definition: OpenMPKinds.h:54
OpenMPGrainsizeClauseModifier
Definition: OpenMPKinds.h:206
OpenMPNumTasksClauseModifier
Definition: OpenMPKinds.h:212
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
Definition: OpenMPKinds.h:142
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
Definition: OpenMPKinds.h:110
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
Definition: OpenMPKinds.h:62
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Definition: Specifiers.h:129
OpenMPAtomicDefaultMemOrderClauseKind
OpenMP attributes for 'atomic_default_mem_order' clause.
Definition: OpenMPKinds.h:127
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
Definition: OpenMPKinds.h:47
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
Definition: OpenMPKinds.h:164
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
Definition: OpenMPKinds.h:30
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition: Specifiers.h:120
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
Definition: OpenMPKinds.h:70
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.
Definition: OpenMPClause.h:259
OMPDeclareTargetDeclAttr::MapTypeTy MT
Definition: SemaOpenMP.h:302
DeclareTargetContextInfo(OpenMPDirectiveKind Kind, SourceLocation Loc)
Definition: SemaOpenMP.h:320
std::optional< Expr * > Indirect
The directive with indirect clause.
Definition: SemaOpenMP.h:315
OpenMPDirectiveKind Kind
The directive kind, begin declare target or declare target.
Definition: SemaOpenMP.h:312
OMPDeclareTargetDeclAttr::DevTypeTy DT
The 'device_type' as parsed from the clause.
Definition: SemaOpenMP.h:309
SourceLocation Loc
The directive location.
Definition: SemaOpenMP.h:318
llvm::DenseMap< NamedDecl *, MapInfo > ExplicitlyMapped
Explicitly listed variables and functions in a 'to' or 'link' clause.
Definition: SemaOpenMP.h:306
Data structure for iterator expression.
Definition: SemaOpenMP.h:1346
OMPIteratorExpr::IteratorRange Range
Definition: SemaOpenMP.h:1350
Data used for processing a list of variables in OpenMP clauses.
Definition: SemaOpenMP.h:1091
SmallVector< SourceLocation, NumberOfOMPMotionModifiers > MotionModifiersLoc
Definition: SemaOpenMP.h:1106
SmallVector< OpenMPMotionModifierKind, NumberOfOMPMotionModifiers > MotionModifiers
Definition: SemaOpenMP.h:1105
SmallVector< OpenMPMapModifierKind, NumberOfOMPMapClauseModifiers > MapTypeModifiers
Definition: SemaOpenMP.h:1101
SmallVector< SourceLocation, NumberOfOMPMapClauseModifiers > MapTypeModifiersLoc
Definition: SemaOpenMP.h:1103
DeclarationNameInfo ReductionOrMapperId
Definition: SemaOpenMP.h:1097
int ExtraModifier
Additional modifier for linear, map, depend or lastprivate clause.
Definition: SemaOpenMP.h:1098
Data for list of allocators.
Definition: SemaOpenMP.h:1286
Expr * AllocatorTraits
Allocator traits.
Definition: SemaOpenMP.h:1290
SourceLocation LParenLoc
Locations of '(' and ')' symbols.
Definition: SemaOpenMP.h:1292