File indexing completed on 2026-05-10 08:37:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef LLVM_CLANG_SEMA_SEMAOPENMP_H
0015 #define LLVM_CLANG_SEMA_SEMAOPENMP_H
0016
0017 #include "clang/AST/ASTFwd.h"
0018 #include "clang/AST/Attr.h"
0019 #include "clang/AST/DeclarationName.h"
0020 #include "clang/AST/ExprOpenMP.h"
0021 #include "clang/AST/OpenMPClause.h"
0022 #include "clang/AST/StmtOpenMP.h"
0023 #include "clang/Basic/IdentifierTable.h"
0024 #include "clang/Basic/LLVM.h"
0025 #include "clang/Basic/OpenMPKinds.h"
0026 #include "clang/Basic/SourceLocation.h"
0027 #include "clang/Basic/Specifiers.h"
0028 #include "clang/Sema/DeclSpec.h"
0029 #include "clang/Sema/Ownership.h"
0030 #include "clang/Sema/SemaBase.h"
0031 #include "llvm/ADT/DenseMap.h"
0032 #include "llvm/Frontend/OpenMP/OMP.h.inc"
0033 #include "llvm/Frontend/OpenMP/OMPConstants.h"
0034 #include <optional>
0035 #include <string>
0036 #include <utility>
0037
0038 namespace clang {
0039 namespace sema {
0040 class FunctionScopeInfo;
0041 }
0042
0043 class DeclContext;
0044 class DeclGroupRef;
0045 class ParsedAttr;
0046 class Scope;
0047
0048 class SemaOpenMP : public SemaBase {
0049 public:
0050 SemaOpenMP(Sema &S);
0051
0052 friend class Parser;
0053 friend class Sema;
0054
0055 using DeclGroupPtrTy = OpaquePtr<DeclGroupRef>;
0056 using CapturedParamNameType = std::pair<StringRef, QualType>;
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073 SemaDiagnosticBuilder diagIfOpenMPDeviceCode(SourceLocation Loc,
0074 unsigned DiagID,
0075 const FunctionDecl *FD);
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090 SemaDiagnosticBuilder diagIfOpenMPHostCode(SourceLocation Loc,
0091 unsigned DiagID,
0092 const FunctionDecl *FD);
0093
0094
0095
0096
0097
0098 void ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope(
0099 Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists,
0100 SmallVectorImpl<FunctionDecl *> &Bases);
0101
0102
0103
0104 void ActOnFinishedFunctionDefinitionInOpenMPDeclareVariantScope(
0105 Decl *D, SmallVectorImpl<FunctionDecl *> &Bases);
0106
0107
0108 void ActOnFinishedFunctionDefinitionInOpenMPAssumeScope(Decl *D);
0109
0110
0111 bool isInOpenMPDeclareVariantScope() const {
0112 return !OMPDeclareVariantScopes.empty();
0113 }
0114
0115 ExprResult
0116 VerifyPositiveIntegerConstantInClause(Expr *Op, OpenMPClauseKind CKind,
0117 bool StrictlyPositive = true,
0118 bool SuppressExprDiags = false);
0119
0120
0121
0122
0123
0124 ExprResult ActOnOpenMPCall(ExprResult Call, Scope *Scope,
0125 SourceLocation LParenLoc, MultiExprArg ArgExprs,
0126 SourceLocation RParenLoc, Expr *ExecConfig);
0127
0128
0129 void ActOnOpenMPBeginDeclareVariant(SourceLocation Loc, OMPTraitInfo &TI);
0130
0131
0132 void ActOnOpenMPEndDeclareVariant();
0133
0134
0135
0136 void tryCaptureOpenMPLambdas(ValueDecl *V);
0137
0138
0139
0140
0141
0142
0143 bool isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level,
0144 unsigned OpenMPCaptureLevel) const;
0145
0146
0147
0148
0149 VarDecl *isOpenMPCapturedDecl(ValueDecl *D, bool CheckScopeInfo = false,
0150 unsigned StopAt = 0);
0151
0152
0153
0154
0155
0156 bool isOpenMPRebuildMemberExpr(ValueDecl *D);
0157
0158 ExprResult getOpenMPCapturedExpr(VarDecl *Capture, ExprValueKind VK,
0159 ExprObjectKind OK, SourceLocation Loc);
0160
0161
0162
0163 void startOpenMPLoop();
0164
0165
0166
0167 void startOpenMPCXXRangeFor();
0168
0169
0170
0171
0172 OpenMPClauseKind isOpenMPPrivateDecl(ValueDecl *D, unsigned Level,
0173 unsigned CapLevel) const;
0174
0175
0176
0177
0178 void setOpenMPCaptureKind(FieldDecl *FD, const ValueDecl *D, unsigned Level);
0179
0180
0181
0182
0183 bool isOpenMPTargetCapturedDecl(const ValueDecl *D, unsigned Level,
0184 unsigned CaptureLevel) const;
0185
0186
0187
0188
0189
0190 bool isOpenMPGlobalCapturedDecl(ValueDecl *D, unsigned Level,
0191 unsigned CaptureLevel) const;
0192
0193 ExprResult PerformOpenMPImplicitIntegerConversion(SourceLocation OpLoc,
0194 Expr *Op);
0195
0196 void StartOpenMPDSABlock(OpenMPDirectiveKind K,
0197 const DeclarationNameInfo &DirName, Scope *CurScope,
0198 SourceLocation Loc);
0199
0200 void StartOpenMPClause(OpenMPClauseKind K);
0201
0202 void EndOpenMPClause();
0203
0204 void EndOpenMPDSABlock(Stmt *CurDirective);
0205
0206
0207
0208
0209
0210 void ActOnOpenMPLoopInitialization(SourceLocation ForLoc, Stmt *Init);
0211
0212
0213
0214 StmtResult ActOnOpenMPMetaDirective(ArrayRef<OMPClause *> Clauses,
0215 Stmt *AStmt, SourceLocation StartLoc,
0216 SourceLocation EndLoc);
0217
0218
0219
0220
0221 ExprResult ActOnOpenMPIdExpression(Scope *CurScope, CXXScopeSpec &ScopeSpec,
0222 const DeclarationNameInfo &Id,
0223 OpenMPDirectiveKind Kind);
0224
0225 DeclGroupPtrTy ActOnOpenMPThreadprivateDirective(SourceLocation Loc,
0226 ArrayRef<Expr *> VarList);
0227
0228 OMPThreadPrivateDecl *CheckOMPThreadPrivateDecl(SourceLocation Loc,
0229 ArrayRef<Expr *> VarList);
0230
0231 DeclGroupPtrTy ActOnOpenMPAllocateDirective(SourceLocation Loc,
0232 ArrayRef<Expr *> VarList,
0233 ArrayRef<OMPClause *> Clauses,
0234 DeclContext *Owner = nullptr);
0235
0236
0237 void ActOnOpenMPAssumesDirective(SourceLocation Loc,
0238 OpenMPDirectiveKind DKind,
0239 ArrayRef<std::string> Assumptions,
0240 bool SkippedClauses);
0241
0242
0243 bool isInOpenMPAssumeScope() const { return !OMPAssumeScoped.empty(); }
0244
0245
0246 bool hasGlobalOpenMPAssumes() const { return !OMPAssumeGlobal.empty(); }
0247
0248
0249 void ActOnOpenMPEndAssumesDirective();
0250
0251
0252 DeclGroupPtrTy ActOnOpenMPRequiresDirective(SourceLocation Loc,
0253 ArrayRef<OMPClause *> ClauseList);
0254
0255 OMPRequiresDecl *CheckOMPRequiresDecl(SourceLocation Loc,
0256 ArrayRef<OMPClause *> Clauses);
0257
0258
0259 QualType ActOnOpenMPDeclareReductionType(SourceLocation TyLoc,
0260 TypeResult ParsedType);
0261
0262 DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveStart(
0263 Scope *S, DeclContext *DC, DeclarationName Name,
0264 ArrayRef<std::pair<QualType, SourceLocation>> ReductionTypes,
0265 AccessSpecifier AS, Decl *PrevDeclInScope = nullptr);
0266
0267 void ActOnOpenMPDeclareReductionCombinerStart(Scope *S, Decl *D);
0268
0269 void ActOnOpenMPDeclareReductionCombinerEnd(Decl *D, Expr *Combiner);
0270
0271
0272 VarDecl *ActOnOpenMPDeclareReductionInitializerStart(Scope *S, Decl *D);
0273
0274 void ActOnOpenMPDeclareReductionInitializerEnd(Decl *D, Expr *Initializer,
0275 VarDecl *OmpPrivParm);
0276
0277 DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveEnd(
0278 Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid);
0279
0280
0281 TypeResult ActOnOpenMPDeclareMapperVarDecl(Scope *S, Declarator &D);
0282
0283
0284 QualType ActOnOpenMPDeclareMapperType(SourceLocation TyLoc,
0285 TypeResult ParsedType);
0286
0287 DeclGroupPtrTy ActOnOpenMPDeclareMapperDirective(
0288 Scope *S, DeclContext *DC, DeclarationName Name, QualType MapperType,
0289 SourceLocation StartLoc, DeclarationName VN, AccessSpecifier AS,
0290 Expr *MapperVarRef, ArrayRef<OMPClause *> Clauses,
0291 Decl *PrevDeclInScope = nullptr);
0292
0293 ExprResult ActOnOpenMPDeclareMapperDirectiveVarDecl(Scope *S,
0294 QualType MapperType,
0295 SourceLocation StartLoc,
0296 DeclarationName VN);
0297 void ActOnOpenMPIteratorVarDecl(VarDecl *VD);
0298 bool isOpenMPDeclareMapperVarDeclAllowed(const VarDecl *VD) const;
0299 const ValueDecl *getOpenMPDeclareMapperVarName() const;
0300
0301 struct DeclareTargetContextInfo {
0302 struct MapInfo {
0303 OMPDeclareTargetDeclAttr::MapTypeTy MT;
0304 SourceLocation Loc;
0305 };
0306
0307 llvm::DenseMap<NamedDecl *, MapInfo> ExplicitlyMapped;
0308
0309
0310 OMPDeclareTargetDeclAttr::DevTypeTy DT = OMPDeclareTargetDeclAttr::DT_Any;
0311
0312
0313 OpenMPDirectiveKind Kind;
0314
0315
0316 std::optional<Expr *> Indirect;
0317
0318
0319 SourceLocation Loc;
0320
0321 DeclareTargetContextInfo(OpenMPDirectiveKind Kind, SourceLocation Loc)
0322 : Kind(Kind), Loc(Loc) {}
0323 };
0324
0325
0326 bool ActOnStartOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI);
0327
0328
0329 const DeclareTargetContextInfo ActOnOpenMPEndDeclareTargetDirective();
0330
0331
0332
0333
0334
0335 void ActOnFinishedOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI);
0336
0337
0338
0339 void DiagnoseUnterminatedOpenMPDeclareTarget();
0340
0341
0342
0343 NamedDecl *lookupOpenMPDeclareTargetName(Scope *CurScope,
0344 CXXScopeSpec &ScopeSpec,
0345 const DeclarationNameInfo &Id);
0346
0347
0348 void ActOnOpenMPDeclareTargetName(NamedDecl *ND, SourceLocation Loc,
0349 OMPDeclareTargetDeclAttr::MapTypeTy MT,
0350 DeclareTargetContextInfo &DTCI);
0351
0352
0353 void
0354 checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D,
0355 SourceLocation IdLoc = SourceLocation());
0356
0357
0358
0359 void ActOnOpenMPDeclareTargetInitializer(Decl *D);
0360
0361
0362
0363 void finalizeOpenMPDelayedAnalysis(const FunctionDecl *Caller,
0364 const FunctionDecl *Callee,
0365 SourceLocation Loc);
0366
0367
0368 bool isInOpenMPTaskUntiedContext() const;
0369
0370
0371 bool isInOpenMPDeclareTargetContext() const {
0372 return !DeclareTargetNesting.empty();
0373 }
0374
0375 bool isInOpenMPTargetExecutionDirective() const;
0376
0377
0378 static int getOpenMPCaptureLevels(OpenMPDirectiveKind Kind);
0379
0380
0381 void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope);
0382
0383
0384
0385 StmtResult ActOnOpenMPCanonicalLoop(Stmt *AStmt);
0386
0387
0388
0389
0390 StmtResult ActOnOpenMPLoopnest(Stmt *AStmt);
0391
0392
0393
0394
0395
0396
0397
0398 StmtResult ActOnOpenMPRegionEnd(StmtResult S, ArrayRef<OMPClause *> Clauses);
0399 StmtResult ActOnOpenMPExecutableDirective(
0400 OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName,
0401 OpenMPDirectiveKind CancelRegion, ArrayRef<OMPClause *> Clauses,
0402 Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc);
0403
0404
0405
0406
0407
0408
0409
0410
0411 StmtResult ActOnOpenMPInformationalDirective(
0412 OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName,
0413 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0414 SourceLocation EndLoc);
0415
0416
0417
0418
0419
0420
0421 StmtResult ActOnOpenMPAssumeDirective(ArrayRef<OMPClause *> Clauses,
0422 Stmt *AStmt, SourceLocation StartLoc,
0423 SourceLocation EndLoc);
0424
0425
0426
0427 StmtResult ActOnOpenMPParallelDirective(ArrayRef<OMPClause *> Clauses,
0428 Stmt *AStmt, SourceLocation StartLoc,
0429 SourceLocation EndLoc);
0430 using VarsWithInheritedDSAType =
0431 llvm::SmallDenseMap<const ValueDecl *, const Expr *, 4>;
0432
0433
0434 StmtResult
0435 ActOnOpenMPSimdDirective(ArrayRef<OMPClause *> Clauses, Stmt *AStmt,
0436 SourceLocation StartLoc, SourceLocation EndLoc,
0437 VarsWithInheritedDSAType &VarsWithImplicitDSA);
0438
0439
0440 StmtResult ActOnOpenMPTileDirective(ArrayRef<OMPClause *> Clauses,
0441 Stmt *AStmt, SourceLocation StartLoc,
0442 SourceLocation EndLoc);
0443
0444
0445 StmtResult ActOnOpenMPUnrollDirective(ArrayRef<OMPClause *> Clauses,
0446 Stmt *AStmt, SourceLocation StartLoc,
0447 SourceLocation EndLoc);
0448
0449 StmtResult ActOnOpenMPReverseDirective(Stmt *AStmt, SourceLocation StartLoc,
0450 SourceLocation EndLoc);
0451
0452
0453 StmtResult ActOnOpenMPInterchangeDirective(ArrayRef<OMPClause *> Clauses,
0454 Stmt *AStmt,
0455 SourceLocation StartLoc,
0456 SourceLocation EndLoc);
0457
0458
0459 StmtResult
0460 ActOnOpenMPForDirective(ArrayRef<OMPClause *> Clauses, Stmt *AStmt,
0461 SourceLocation StartLoc, SourceLocation EndLoc,
0462 VarsWithInheritedDSAType &VarsWithImplicitDSA);
0463
0464
0465 StmtResult
0466 ActOnOpenMPForSimdDirective(ArrayRef<OMPClause *> Clauses, Stmt *AStmt,
0467 SourceLocation StartLoc, SourceLocation EndLoc,
0468 VarsWithInheritedDSAType &VarsWithImplicitDSA);
0469
0470
0471 StmtResult ActOnOpenMPSectionsDirective(ArrayRef<OMPClause *> Clauses,
0472 Stmt *AStmt, SourceLocation StartLoc,
0473 SourceLocation EndLoc);
0474
0475
0476 StmtResult ActOnOpenMPSectionDirective(Stmt *AStmt, SourceLocation StartLoc,
0477 SourceLocation EndLoc);
0478
0479
0480 StmtResult ActOnOpenMPScopeDirective(ArrayRef<OMPClause *> Clauses,
0481 Stmt *AStmt, SourceLocation StartLoc,
0482 SourceLocation EndLoc);
0483
0484
0485 StmtResult ActOnOpenMPSingleDirective(ArrayRef<OMPClause *> Clauses,
0486 Stmt *AStmt, SourceLocation StartLoc,
0487 SourceLocation EndLoc);
0488
0489
0490 StmtResult ActOnOpenMPMasterDirective(Stmt *AStmt, SourceLocation StartLoc,
0491 SourceLocation EndLoc);
0492
0493
0494 StmtResult ActOnOpenMPCriticalDirective(const DeclarationNameInfo &DirName,
0495 ArrayRef<OMPClause *> Clauses,
0496 Stmt *AStmt, SourceLocation StartLoc,
0497 SourceLocation EndLoc);
0498
0499
0500 StmtResult ActOnOpenMPParallelForDirective(
0501 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0502 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0503
0504
0505 StmtResult ActOnOpenMPParallelForSimdDirective(
0506 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0507 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0508
0509
0510 StmtResult ActOnOpenMPParallelMasterDirective(ArrayRef<OMPClause *> Clauses,
0511 Stmt *AStmt,
0512 SourceLocation StartLoc,
0513 SourceLocation EndLoc);
0514
0515
0516 StmtResult ActOnOpenMPParallelMaskedDirective(ArrayRef<OMPClause *> Clauses,
0517 Stmt *AStmt,
0518 SourceLocation StartLoc,
0519 SourceLocation EndLoc);
0520
0521
0522 StmtResult ActOnOpenMPParallelSectionsDirective(ArrayRef<OMPClause *> Clauses,
0523 Stmt *AStmt,
0524 SourceLocation StartLoc,
0525 SourceLocation EndLoc);
0526
0527
0528 StmtResult ActOnOpenMPTaskDirective(ArrayRef<OMPClause *> Clauses,
0529 Stmt *AStmt, SourceLocation StartLoc,
0530 SourceLocation EndLoc);
0531
0532 StmtResult ActOnOpenMPTaskyieldDirective(SourceLocation StartLoc,
0533 SourceLocation EndLoc);
0534
0535
0536
0537 StmtResult ActOnOpenMPErrorDirective(ArrayRef<OMPClause *> Clauses,
0538 SourceLocation StartLoc,
0539 SourceLocation EndLoc,
0540 bool InExContext = true);
0541
0542 StmtResult ActOnOpenMPBarrierDirective(SourceLocation StartLoc,
0543 SourceLocation EndLoc);
0544
0545 StmtResult ActOnOpenMPTaskwaitDirective(ArrayRef<OMPClause *> Clauses,
0546 SourceLocation StartLoc,
0547 SourceLocation EndLoc);
0548
0549 StmtResult ActOnOpenMPTaskgroupDirective(ArrayRef<OMPClause *> Clauses,
0550 Stmt *AStmt, SourceLocation StartLoc,
0551 SourceLocation EndLoc);
0552
0553 StmtResult ActOnOpenMPFlushDirective(ArrayRef<OMPClause *> Clauses,
0554 SourceLocation StartLoc,
0555 SourceLocation EndLoc);
0556
0557 StmtResult ActOnOpenMPDepobjDirective(ArrayRef<OMPClause *> Clauses,
0558 SourceLocation StartLoc,
0559 SourceLocation EndLoc);
0560
0561 StmtResult ActOnOpenMPScanDirective(ArrayRef<OMPClause *> Clauses,
0562 SourceLocation StartLoc,
0563 SourceLocation EndLoc);
0564
0565
0566 StmtResult ActOnOpenMPOrderedDirective(ArrayRef<OMPClause *> Clauses,
0567 Stmt *AStmt, SourceLocation StartLoc,
0568 SourceLocation EndLoc);
0569
0570
0571 StmtResult ActOnOpenMPAtomicDirective(ArrayRef<OMPClause *> Clauses,
0572 Stmt *AStmt, SourceLocation StartLoc,
0573 SourceLocation EndLoc);
0574
0575
0576 StmtResult ActOnOpenMPTargetDirective(ArrayRef<OMPClause *> Clauses,
0577 Stmt *AStmt, SourceLocation StartLoc,
0578 SourceLocation EndLoc);
0579
0580
0581 StmtResult ActOnOpenMPTargetDataDirective(ArrayRef<OMPClause *> Clauses,
0582 Stmt *AStmt,
0583 SourceLocation StartLoc,
0584 SourceLocation EndLoc);
0585
0586
0587 StmtResult ActOnOpenMPTargetEnterDataDirective(ArrayRef<OMPClause *> Clauses,
0588 SourceLocation StartLoc,
0589 SourceLocation EndLoc,
0590 Stmt *AStmt);
0591
0592
0593 StmtResult ActOnOpenMPTargetExitDataDirective(ArrayRef<OMPClause *> Clauses,
0594 SourceLocation StartLoc,
0595 SourceLocation EndLoc,
0596 Stmt *AStmt);
0597
0598
0599 StmtResult ActOnOpenMPTargetParallelDirective(ArrayRef<OMPClause *> Clauses,
0600 Stmt *AStmt,
0601 SourceLocation StartLoc,
0602 SourceLocation EndLoc);
0603
0604
0605 StmtResult ActOnOpenMPTargetParallelForDirective(
0606 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0607 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0608
0609
0610 StmtResult ActOnOpenMPTeamsDirective(ArrayRef<OMPClause *> Clauses,
0611 Stmt *AStmt, SourceLocation StartLoc,
0612 SourceLocation EndLoc);
0613
0614
0615 StmtResult ActOnOpenMPTeamsGenericLoopDirective(
0616 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0617 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0618
0619
0620 StmtResult ActOnOpenMPTargetTeamsGenericLoopDirective(
0621 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0622 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0623
0624
0625 StmtResult ActOnOpenMPParallelGenericLoopDirective(
0626 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0627 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0628
0629
0630 StmtResult ActOnOpenMPTargetParallelGenericLoopDirective(
0631 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0632 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0633
0634 StmtResult
0635 ActOnOpenMPCancellationPointDirective(SourceLocation StartLoc,
0636 SourceLocation EndLoc,
0637 OpenMPDirectiveKind CancelRegion);
0638
0639 StmtResult ActOnOpenMPCancelDirective(ArrayRef<OMPClause *> Clauses,
0640 SourceLocation StartLoc,
0641 SourceLocation EndLoc,
0642 OpenMPDirectiveKind CancelRegion);
0643
0644
0645 StmtResult
0646 ActOnOpenMPTaskLoopDirective(ArrayRef<OMPClause *> Clauses, Stmt *AStmt,
0647 SourceLocation StartLoc, SourceLocation EndLoc,
0648 VarsWithInheritedDSAType &VarsWithImplicitDSA);
0649
0650
0651 StmtResult ActOnOpenMPTaskLoopSimdDirective(
0652 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0653 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0654
0655
0656 StmtResult ActOnOpenMPMasterTaskLoopDirective(
0657 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0658 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0659
0660
0661 StmtResult ActOnOpenMPMasterTaskLoopSimdDirective(
0662 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0663 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0664
0665
0666 StmtResult ActOnOpenMPParallelMasterTaskLoopDirective(
0667 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0668 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0669
0670
0671 StmtResult ActOnOpenMPParallelMasterTaskLoopSimdDirective(
0672 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0673 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0674
0675
0676 StmtResult ActOnOpenMPMaskedTaskLoopDirective(
0677 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0678 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0679
0680
0681 StmtResult ActOnOpenMPMaskedTaskLoopSimdDirective(
0682 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0683 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0684
0685
0686 StmtResult ActOnOpenMPParallelMaskedTaskLoopDirective(
0687 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0688 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0689
0690
0691 StmtResult ActOnOpenMPParallelMaskedTaskLoopSimdDirective(
0692 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0693 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0694
0695
0696 StmtResult
0697 ActOnOpenMPDistributeDirective(ArrayRef<OMPClause *> Clauses, Stmt *AStmt,
0698 SourceLocation StartLoc, SourceLocation EndLoc,
0699 VarsWithInheritedDSAType &VarsWithImplicitDSA);
0700
0701 StmtResult ActOnOpenMPTargetUpdateDirective(ArrayRef<OMPClause *> Clauses,
0702 SourceLocation StartLoc,
0703 SourceLocation EndLoc,
0704 Stmt *AStmt);
0705
0706
0707 StmtResult ActOnOpenMPDistributeParallelForDirective(
0708 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0709 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0710
0711
0712 StmtResult ActOnOpenMPDistributeParallelForSimdDirective(
0713 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0714 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0715
0716
0717 StmtResult ActOnOpenMPDistributeSimdDirective(
0718 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0719 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0720
0721
0722 StmtResult ActOnOpenMPTargetParallelForSimdDirective(
0723 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0724 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0725
0726
0727 StmtResult
0728 ActOnOpenMPTargetSimdDirective(ArrayRef<OMPClause *> Clauses, Stmt *AStmt,
0729 SourceLocation StartLoc, SourceLocation EndLoc,
0730 VarsWithInheritedDSAType &VarsWithImplicitDSA);
0731
0732
0733 StmtResult ActOnOpenMPTeamsDistributeDirective(
0734 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0735 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0736
0737
0738 StmtResult ActOnOpenMPTeamsDistributeSimdDirective(
0739 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0740 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0741
0742
0743 StmtResult ActOnOpenMPTeamsDistributeParallelForSimdDirective(
0744 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0745 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0746
0747
0748 StmtResult ActOnOpenMPTeamsDistributeParallelForDirective(
0749 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0750 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0751
0752
0753 StmtResult ActOnOpenMPTargetTeamsDirective(ArrayRef<OMPClause *> Clauses,
0754 Stmt *AStmt,
0755 SourceLocation StartLoc,
0756 SourceLocation EndLoc);
0757
0758
0759 StmtResult ActOnOpenMPTargetTeamsDistributeDirective(
0760 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0761 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0762
0763
0764 StmtResult ActOnOpenMPTargetTeamsDistributeParallelForDirective(
0765 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0766 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0767
0768
0769 StmtResult ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective(
0770 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0771 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0772
0773
0774 StmtResult ActOnOpenMPTargetTeamsDistributeSimdDirective(
0775 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0776 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0777
0778 StmtResult ActOnOpenMPInteropDirective(ArrayRef<OMPClause *> Clauses,
0779 SourceLocation StartLoc,
0780 SourceLocation EndLoc);
0781
0782
0783 StmtResult ActOnOpenMPDispatchDirective(ArrayRef<OMPClause *> Clauses,
0784 Stmt *AStmt, SourceLocation StartLoc,
0785 SourceLocation EndLoc);
0786
0787
0788 StmtResult ActOnOpenMPMaskedDirective(ArrayRef<OMPClause *> Clauses,
0789 Stmt *AStmt, SourceLocation StartLoc,
0790 SourceLocation EndLoc);
0791
0792
0793
0794 StmtResult ActOnOpenMPGenericLoopDirective(
0795 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
0796 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
0797
0798
0799 bool CheckOpenMPLinearModifier(OpenMPLinearClauseKind LinKind,
0800 SourceLocation LinLoc);
0801
0802
0803 bool CheckOpenMPLinearDecl(const ValueDecl *D, SourceLocation ELoc,
0804 OpenMPLinearClauseKind LinKind, QualType Type,
0805 bool IsDeclareSimd = false);
0806
0807
0808
0809 DeclGroupPtrTy ActOnOpenMPDeclareSimdDirective(
0810 DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS,
0811 Expr *Simdlen, ArrayRef<Expr *> Uniforms, ArrayRef<Expr *> Aligneds,
0812 ArrayRef<Expr *> Alignments, ArrayRef<Expr *> Linears,
0813 ArrayRef<unsigned> LinModifiers, ArrayRef<Expr *> Steps, SourceRange SR);
0814
0815
0816
0817
0818
0819
0820
0821
0822
0823
0824
0825
0826
0827 std::optional<std::pair<FunctionDecl *, Expr *>>
0828 checkOpenMPDeclareVariantFunction(DeclGroupPtrTy DG, Expr *VariantRef,
0829 OMPTraitInfo &TI, unsigned NumAppendArgs,
0830 SourceRange SR);
0831
0832
0833
0834
0835
0836
0837
0838
0839
0840
0841
0842
0843
0844
0845 void ActOnOpenMPDeclareVariantDirective(
0846 FunctionDecl *FD, Expr *VariantRef, OMPTraitInfo &TI,
0847 ArrayRef<Expr *> AdjustArgsNothing,
0848 ArrayRef<Expr *> AdjustArgsNeedDevicePtr,
0849 ArrayRef<OMPInteropInfo> AppendArgs, SourceLocation AdjustArgsLoc,
0850 SourceLocation AppendArgsLoc, SourceRange SR);
0851
0852 OMPClause *ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr,
0853 SourceLocation StartLoc,
0854 SourceLocation LParenLoc,
0855 SourceLocation EndLoc);
0856
0857 OMPClause *ActOnOpenMPAllocatorClause(Expr *Allocator,
0858 SourceLocation StartLoc,
0859 SourceLocation LParenLoc,
0860 SourceLocation EndLoc);
0861
0862 OMPClause *ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier,
0863 Expr *Condition, SourceLocation StartLoc,
0864 SourceLocation LParenLoc,
0865 SourceLocation NameModifierLoc,
0866 SourceLocation ColonLoc,
0867 SourceLocation EndLoc);
0868
0869 OMPClause *ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc,
0870 SourceLocation LParenLoc,
0871 SourceLocation EndLoc);
0872
0873 OMPClause *ActOnOpenMPNumThreadsClause(Expr *NumThreads,
0874 SourceLocation StartLoc,
0875 SourceLocation LParenLoc,
0876 SourceLocation EndLoc);
0877
0878 OMPClause *ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc,
0879 SourceLocation LParenLoc,
0880 SourceLocation EndLoc);
0881
0882 OMPClause *ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc,
0883 SourceLocation LParenLoc,
0884 SourceLocation EndLoc);
0885
0886 OMPClause *ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc,
0887 SourceLocation LParenLoc,
0888 SourceLocation EndLoc);
0889
0890 OMPClause *ActOnOpenMPSizesClause(ArrayRef<Expr *> SizeExprs,
0891 SourceLocation StartLoc,
0892 SourceLocation LParenLoc,
0893 SourceLocation EndLoc);
0894
0895 OMPClause *ActOnOpenMPPermutationClause(ArrayRef<Expr *> PermExprs,
0896 SourceLocation StartLoc,
0897 SourceLocation LParenLoc,
0898 SourceLocation EndLoc);
0899
0900 OMPClause *ActOnOpenMPFullClause(SourceLocation StartLoc,
0901 SourceLocation EndLoc);
0902
0903 OMPClause *ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc,
0904 SourceLocation LParenLoc,
0905 SourceLocation EndLoc);
0906
0907 OMPClause *ActOnOpenMPCollapseClause(Expr *NumForLoops,
0908 SourceLocation StartLoc,
0909 SourceLocation LParenLoc,
0910 SourceLocation EndLoc);
0911
0912 OMPClause *
0913 ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc,
0914 SourceLocation LParenLoc = SourceLocation(),
0915 Expr *NumForLoops = nullptr);
0916
0917 OMPClause *ActOnOpenMPGrainsizeClause(OpenMPGrainsizeClauseModifier Modifier,
0918 Expr *Size, SourceLocation StartLoc,
0919 SourceLocation LParenLoc,
0920 SourceLocation ModifierLoc,
0921 SourceLocation EndLoc);
0922
0923 OMPClause *ActOnOpenMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier,
0924 Expr *NumTasks, SourceLocation StartLoc,
0925 SourceLocation LParenLoc,
0926 SourceLocation ModifierLoc,
0927 SourceLocation EndLoc);
0928
0929 OMPClause *ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc,
0930 SourceLocation LParenLoc,
0931 SourceLocation EndLoc);
0932
0933 OMPClause *ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc,
0934 SourceLocation LParenLoc,
0935 SourceLocation EndLoc);
0936
0937 OMPClause *ActOnOpenMPSimpleClause(OpenMPClauseKind Kind, unsigned Argument,
0938 SourceLocation ArgumentLoc,
0939 SourceLocation StartLoc,
0940 SourceLocation LParenLoc,
0941 SourceLocation EndLoc);
0942
0943 OMPClause *ActOnOpenMPWhenClause(OMPTraitInfo &TI, SourceLocation StartLoc,
0944 SourceLocation LParenLoc,
0945 SourceLocation EndLoc);
0946
0947 OMPClause *ActOnOpenMPDefaultClause(llvm::omp::DefaultKind Kind,
0948 SourceLocation KindLoc,
0949 SourceLocation StartLoc,
0950 SourceLocation LParenLoc,
0951 SourceLocation EndLoc);
0952
0953 OMPClause *ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind,
0954 SourceLocation KindLoc,
0955 SourceLocation StartLoc,
0956 SourceLocation LParenLoc,
0957 SourceLocation EndLoc);
0958
0959 OMPClause *ActOnOpenMPOrderClause(OpenMPOrderClauseModifier Modifier,
0960 OpenMPOrderClauseKind Kind,
0961 SourceLocation StartLoc,
0962 SourceLocation LParenLoc,
0963 SourceLocation MLoc, SourceLocation KindLoc,
0964 SourceLocation EndLoc);
0965
0966 OMPClause *ActOnOpenMPUpdateClause(OpenMPDependClauseKind Kind,
0967 SourceLocation KindLoc,
0968 SourceLocation StartLoc,
0969 SourceLocation LParenLoc,
0970 SourceLocation EndLoc);
0971
0972 OMPClause *ActOnOpenMPHoldsClause(Expr *E, SourceLocation StartLoc,
0973 SourceLocation LParenLoc,
0974 SourceLocation EndLoc);
0975
0976 OMPClause *ActOnOpenMPDirectivePresenceClause(
0977 OpenMPClauseKind CK, llvm::ArrayRef<OpenMPDirectiveKind> DKVec,
0978 SourceLocation Loc, SourceLocation LLoc, SourceLocation RLoc);
0979 OMPClause *ActOnOpenMPNullaryAssumptionClause(OpenMPClauseKind CK,
0980 SourceLocation Loc,
0981 SourceLocation RLoc);
0982
0983 OMPClause *ActOnOpenMPSingleExprWithArgClause(
0984 OpenMPClauseKind Kind, ArrayRef<unsigned> Arguments, Expr *Expr,
0985 SourceLocation StartLoc, SourceLocation LParenLoc,
0986 ArrayRef<SourceLocation> ArgumentsLoc, SourceLocation DelimLoc,
0987 SourceLocation EndLoc);
0988
0989 OMPClause *ActOnOpenMPScheduleClause(
0990 OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2,
0991 OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc,
0992 SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc,
0993 SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc);
0994
0995 OMPClause *ActOnOpenMPClause(OpenMPClauseKind Kind, SourceLocation StartLoc,
0996 SourceLocation EndLoc);
0997
0998 OMPClause *ActOnOpenMPNowaitClause(SourceLocation StartLoc,
0999 SourceLocation EndLoc);
1000
1001 OMPClause *ActOnOpenMPUntiedClause(SourceLocation StartLoc,
1002 SourceLocation EndLoc);
1003
1004 OMPClause *ActOnOpenMPMergeableClause(SourceLocation StartLoc,
1005 SourceLocation EndLoc);
1006
1007 OMPClause *ActOnOpenMPReadClause(SourceLocation StartLoc,
1008 SourceLocation EndLoc);
1009
1010 OMPClause *ActOnOpenMPWriteClause(SourceLocation StartLoc,
1011 SourceLocation EndLoc);
1012
1013 OMPClause *ActOnOpenMPUpdateClause(SourceLocation StartLoc,
1014 SourceLocation EndLoc);
1015
1016 OMPClause *ActOnOpenMPCaptureClause(SourceLocation StartLoc,
1017 SourceLocation EndLoc);
1018
1019 OMPClause *ActOnOpenMPCompareClause(SourceLocation StartLoc,
1020 SourceLocation EndLoc);
1021
1022 OMPClause *ActOnOpenMPFailClause(SourceLocation StartLoc,
1023 SourceLocation EndLoc);
1024 OMPClause *ActOnOpenMPFailClause(OpenMPClauseKind Kind,
1025 SourceLocation KindLoc,
1026 SourceLocation StartLoc,
1027 SourceLocation LParenLoc,
1028 SourceLocation EndLoc);
1029
1030
1031 OMPClause *ActOnOpenMPSeqCstClause(SourceLocation StartLoc,
1032 SourceLocation EndLoc);
1033
1034 OMPClause *ActOnOpenMPAcqRelClause(SourceLocation StartLoc,
1035 SourceLocation EndLoc);
1036
1037 OMPClause *ActOnOpenMPAcquireClause(SourceLocation StartLoc,
1038 SourceLocation EndLoc);
1039
1040 OMPClause *ActOnOpenMPReleaseClause(SourceLocation StartLoc,
1041 SourceLocation EndLoc);
1042
1043 OMPClause *ActOnOpenMPRelaxedClause(SourceLocation StartLoc,
1044 SourceLocation EndLoc);
1045
1046 OMPClause *ActOnOpenMPWeakClause(SourceLocation StartLoc,
1047 SourceLocation EndLoc);
1048
1049
1050 OMPClause *
1051 ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo,
1052 SourceLocation StartLoc, SourceLocation LParenLoc,
1053 SourceLocation VarLoc, SourceLocation EndLoc);
1054
1055
1056 OMPClause *ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc,
1057 SourceLocation LParenLoc,
1058 SourceLocation VarLoc, SourceLocation EndLoc);
1059
1060
1061 OMPClause *ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc,
1062 SourceLocation LParenLoc,
1063 SourceLocation VarLoc,
1064 SourceLocation EndLoc);
1065
1066 OMPClause *ActOnOpenMPNovariantsClause(Expr *Condition,
1067 SourceLocation StartLoc,
1068 SourceLocation LParenLoc,
1069 SourceLocation EndLoc);
1070
1071 OMPClause *ActOnOpenMPNocontextClause(Expr *Condition,
1072 SourceLocation StartLoc,
1073 SourceLocation LParenLoc,
1074 SourceLocation EndLoc);
1075
1076 OMPClause *ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc,
1077 SourceLocation LParenLoc,
1078 SourceLocation EndLoc);
1079
1080 OMPClause *ActOnOpenMPThreadsClause(SourceLocation StartLoc,
1081 SourceLocation EndLoc);
1082
1083 OMPClause *ActOnOpenMPSIMDClause(SourceLocation StartLoc,
1084 SourceLocation EndLoc);
1085
1086 OMPClause *ActOnOpenMPNogroupClause(SourceLocation StartLoc,
1087 SourceLocation EndLoc);
1088
1089 OMPClause *ActOnOpenMPUnifiedAddressClause(SourceLocation StartLoc,
1090 SourceLocation EndLoc);
1091
1092
1093 OMPClause *ActOnOpenMPUnifiedSharedMemoryClause(SourceLocation StartLoc,
1094 SourceLocation EndLoc);
1095
1096
1097 OMPClause *ActOnOpenMPReverseOffloadClause(SourceLocation StartLoc,
1098 SourceLocation EndLoc);
1099
1100
1101 OMPClause *ActOnOpenMPDynamicAllocatorsClause(SourceLocation StartLoc,
1102 SourceLocation EndLoc);
1103
1104
1105 OMPClause *ActOnOpenMPAtomicDefaultMemOrderClause(
1106 OpenMPAtomicDefaultMemOrderClauseKind Kind, SourceLocation KindLoc,
1107 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
1108
1109
1110 OMPClause *ActOnOpenMPAtClause(OpenMPAtClauseKind Kind,
1111 SourceLocation KindLoc,
1112 SourceLocation StartLoc,
1113 SourceLocation LParenLoc,
1114 SourceLocation EndLoc);
1115
1116
1117 OMPClause *ActOnOpenMPSeverityClause(OpenMPSeverityClauseKind Kind,
1118 SourceLocation KindLoc,
1119 SourceLocation StartLoc,
1120 SourceLocation LParenLoc,
1121 SourceLocation EndLoc);
1122
1123
1124
1125 OMPClause *ActOnOpenMPMessageClause(Expr *MS, SourceLocation StartLoc,
1126 SourceLocation LParenLoc,
1127 SourceLocation EndLoc);
1128
1129
1130 struct OpenMPVarListDataTy final {
1131 Expr *DepModOrTailExpr = nullptr;
1132 Expr *IteratorExpr = nullptr;
1133 SourceLocation ColonLoc;
1134 SourceLocation RLoc;
1135 CXXScopeSpec ReductionOrMapperIdScopeSpec;
1136 DeclarationNameInfo ReductionOrMapperId;
1137 int ExtraModifier = -1;
1138
1139 SmallVector<OpenMPMapModifierKind, NumberOfOMPMapClauseModifiers>
1140 MapTypeModifiers;
1141 SmallVector<SourceLocation, NumberOfOMPMapClauseModifiers>
1142 MapTypeModifiersLoc;
1143 SmallVector<OpenMPMotionModifierKind, NumberOfOMPMotionModifiers>
1144 MotionModifiers;
1145 SmallVector<SourceLocation, NumberOfOMPMotionModifiers> MotionModifiersLoc;
1146 bool IsMapTypeImplicit = false;
1147 SourceLocation ExtraModifierLoc;
1148 SourceLocation OmpAllMemoryLoc;
1149 SourceLocation
1150 StepModifierLoc;
1151 SmallVector<OpenMPAllocateClauseModifier,
1152 NumberOfOMPAllocateClauseModifiers>
1153 AllocClauseModifiers;
1154 SmallVector<SourceLocation, NumberOfOMPAllocateClauseModifiers>
1155 AllocClauseModifiersLoc;
1156 Expr *AllocateAlignment = nullptr;
1157 };
1158
1159 OMPClause *ActOnOpenMPVarListClause(OpenMPClauseKind Kind,
1160 ArrayRef<Expr *> Vars,
1161 const OMPVarListLocTy &Locs,
1162 OpenMPVarListDataTy &Data);
1163
1164 OMPClause *ActOnOpenMPInclusiveClause(ArrayRef<Expr *> VarList,
1165 SourceLocation StartLoc,
1166 SourceLocation LParenLoc,
1167 SourceLocation EndLoc);
1168
1169 OMPClause *ActOnOpenMPExclusiveClause(ArrayRef<Expr *> VarList,
1170 SourceLocation StartLoc,
1171 SourceLocation LParenLoc,
1172 SourceLocation EndLoc);
1173
1174 OMPClause *
1175 ActOnOpenMPAllocateClause(Expr *Allocator, Expr *Alignment,
1176 OpenMPAllocateClauseModifier FirstModifier,
1177 SourceLocation FirstModifierLoc,
1178 OpenMPAllocateClauseModifier SecondModifier,
1179 SourceLocation SecondModifierLoc,
1180 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1181 SourceLocation ColonLoc, SourceLocation LParenLoc,
1182 SourceLocation EndLoc);
1183
1184 OMPClause *ActOnOpenMPPrivateClause(ArrayRef<Expr *> VarList,
1185 SourceLocation StartLoc,
1186 SourceLocation LParenLoc,
1187 SourceLocation EndLoc);
1188
1189 OMPClause *ActOnOpenMPFirstprivateClause(ArrayRef<Expr *> VarList,
1190 SourceLocation StartLoc,
1191 SourceLocation LParenLoc,
1192 SourceLocation EndLoc);
1193
1194 OMPClause *ActOnOpenMPLastprivateClause(
1195 ArrayRef<Expr *> VarList, OpenMPLastprivateModifier LPKind,
1196 SourceLocation LPKindLoc, SourceLocation ColonLoc,
1197 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
1198
1199 OMPClause *ActOnOpenMPSharedClause(ArrayRef<Expr *> VarList,
1200 SourceLocation StartLoc,
1201 SourceLocation LParenLoc,
1202 SourceLocation EndLoc);
1203
1204 OMPClause *ActOnOpenMPReductionClause(
1205 ArrayRef<Expr *> VarList, OpenMPReductionClauseModifier Modifier,
1206 SourceLocation StartLoc, SourceLocation LParenLoc,
1207 SourceLocation ModifierLoc, SourceLocation ColonLoc,
1208 SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec,
1209 const DeclarationNameInfo &ReductionId,
1210 ArrayRef<Expr *> UnresolvedReductions = {});
1211
1212 OMPClause *ActOnOpenMPTaskReductionClause(
1213 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1214 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
1215 CXXScopeSpec &ReductionIdScopeSpec,
1216 const DeclarationNameInfo &ReductionId,
1217 ArrayRef<Expr *> UnresolvedReductions = {});
1218
1219 OMPClause *ActOnOpenMPInReductionClause(
1220 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1221 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
1222 CXXScopeSpec &ReductionIdScopeSpec,
1223 const DeclarationNameInfo &ReductionId,
1224 ArrayRef<Expr *> UnresolvedReductions = {});
1225
1226 OMPClause *ActOnOpenMPLinearClause(
1227 ArrayRef<Expr *> VarList, Expr *Step, SourceLocation StartLoc,
1228 SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind,
1229 SourceLocation LinLoc, SourceLocation ColonLoc,
1230 SourceLocation StepModifierLoc, SourceLocation EndLoc);
1231
1232 OMPClause *ActOnOpenMPAlignedClause(ArrayRef<Expr *> VarList, Expr *Alignment,
1233 SourceLocation StartLoc,
1234 SourceLocation LParenLoc,
1235 SourceLocation ColonLoc,
1236 SourceLocation EndLoc);
1237
1238 OMPClause *ActOnOpenMPCopyinClause(ArrayRef<Expr *> VarList,
1239 SourceLocation StartLoc,
1240 SourceLocation LParenLoc,
1241 SourceLocation EndLoc);
1242
1243 OMPClause *ActOnOpenMPCopyprivateClause(ArrayRef<Expr *> VarList,
1244 SourceLocation StartLoc,
1245 SourceLocation LParenLoc,
1246 SourceLocation EndLoc);
1247
1248 OMPClause *ActOnOpenMPFlushClause(ArrayRef<Expr *> VarList,
1249 SourceLocation StartLoc,
1250 SourceLocation LParenLoc,
1251 SourceLocation EndLoc);
1252
1253 OMPClause *ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc,
1254 SourceLocation LParenLoc,
1255 SourceLocation EndLoc);
1256
1257 OMPClause *ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data,
1258 Expr *DepModifier,
1259 ArrayRef<Expr *> VarList,
1260 SourceLocation StartLoc,
1261 SourceLocation LParenLoc,
1262 SourceLocation EndLoc);
1263
1264 OMPClause *ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier,
1265 Expr *Device, SourceLocation StartLoc,
1266 SourceLocation LParenLoc,
1267 SourceLocation ModifierLoc,
1268 SourceLocation EndLoc);
1269
1270 OMPClause *ActOnOpenMPMapClause(
1271 Expr *IteratorModifier, ArrayRef<OpenMPMapModifierKind> MapTypeModifiers,
1272 ArrayRef<SourceLocation> MapTypeModifiersLoc,
1273 CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId,
1274 OpenMPMapClauseKind MapType, bool IsMapTypeImplicit,
1275 SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VarList,
1276 const OMPVarListLocTy &Locs, bool NoDiagnose = false,
1277 ArrayRef<Expr *> UnresolvedMappers = {});
1278
1279 OMPClause *ActOnOpenMPNumTeamsClause(ArrayRef<Expr *> VarList,
1280 SourceLocation StartLoc,
1281 SourceLocation LParenLoc,
1282 SourceLocation EndLoc);
1283
1284 OMPClause *ActOnOpenMPThreadLimitClause(ArrayRef<Expr *> VarList,
1285 SourceLocation StartLoc,
1286 SourceLocation LParenLoc,
1287 SourceLocation EndLoc);
1288
1289 OMPClause *ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc,
1290 SourceLocation LParenLoc,
1291 SourceLocation EndLoc);
1292
1293 OMPClause *ActOnOpenMPDistScheduleClause(
1294 OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize,
1295 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc,
1296 SourceLocation CommaLoc, SourceLocation EndLoc);
1297
1298 OMPClause *ActOnOpenMPDefaultmapClause(
1299 OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind,
1300 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc,
1301 SourceLocation KindLoc, SourceLocation EndLoc);
1302
1303 OMPClause *
1304 ActOnOpenMPToClause(ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
1305 ArrayRef<SourceLocation> MotionModifiersLoc,
1306 CXXScopeSpec &MapperIdScopeSpec,
1307 DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
1308 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
1309 ArrayRef<Expr *> UnresolvedMappers = {});
1310
1311 OMPClause *
1312 ActOnOpenMPFromClause(ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
1313 ArrayRef<SourceLocation> MotionModifiersLoc,
1314 CXXScopeSpec &MapperIdScopeSpec,
1315 DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
1316 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
1317 ArrayRef<Expr *> UnresolvedMappers = {});
1318
1319 OMPClause *ActOnOpenMPUseDevicePtrClause(ArrayRef<Expr *> VarList,
1320 const OMPVarListLocTy &Locs);
1321
1322 OMPClause *ActOnOpenMPUseDeviceAddrClause(ArrayRef<Expr *> VarList,
1323 const OMPVarListLocTy &Locs);
1324
1325 OMPClause *ActOnOpenMPIsDevicePtrClause(ArrayRef<Expr *> VarList,
1326 const OMPVarListLocTy &Locs);
1327
1328 OMPClause *ActOnOpenMPHasDeviceAddrClause(ArrayRef<Expr *> VarList,
1329 const OMPVarListLocTy &Locs);
1330
1331 OMPClause *ActOnOpenMPNontemporalClause(ArrayRef<Expr *> VarList,
1332 SourceLocation StartLoc,
1333 SourceLocation LParenLoc,
1334 SourceLocation EndLoc);
1335
1336
1337 struct UsesAllocatorsData {
1338
1339 Expr *Allocator = nullptr;
1340
1341 Expr *AllocatorTraits = nullptr;
1342
1343 SourceLocation LParenLoc, RParenLoc;
1344 };
1345
1346 OMPClause *ActOnOpenMPUsesAllocatorClause(SourceLocation StartLoc,
1347 SourceLocation LParenLoc,
1348 SourceLocation EndLoc,
1349 ArrayRef<UsesAllocatorsData> Data);
1350
1351 OMPClause *ActOnOpenMPAffinityClause(SourceLocation StartLoc,
1352 SourceLocation LParenLoc,
1353 SourceLocation ColonLoc,
1354 SourceLocation EndLoc, Expr *Modifier,
1355 ArrayRef<Expr *> Locators);
1356
1357 OMPClause *ActOnOpenMPBindClause(OpenMPBindClauseKind Kind,
1358 SourceLocation KindLoc,
1359 SourceLocation StartLoc,
1360 SourceLocation LParenLoc,
1361 SourceLocation EndLoc);
1362
1363
1364 OMPClause *ActOnOpenMPXDynCGroupMemClause(Expr *Size, SourceLocation StartLoc,
1365 SourceLocation LParenLoc,
1366 SourceLocation EndLoc);
1367
1368
1369 OMPClause *
1370 ActOnOpenMPDoacrossClause(OpenMPDoacrossClauseModifier DepType,
1371 SourceLocation DepLoc, SourceLocation ColonLoc,
1372 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
1373 SourceLocation LParenLoc, SourceLocation EndLoc);
1374
1375
1376 OMPClause *ActOnOpenMPXAttributeClause(ArrayRef<const Attr *> Attrs,
1377 SourceLocation StartLoc,
1378 SourceLocation LParenLoc,
1379 SourceLocation EndLoc);
1380
1381
1382 OMPClause *ActOnOpenMPXBareClause(SourceLocation StartLoc,
1383 SourceLocation EndLoc);
1384
1385 ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc,
1386 Expr *LowerBound,
1387 SourceLocation ColonLocFirst,
1388 SourceLocation ColonLocSecond,
1389 Expr *Length, Expr *Stride,
1390 SourceLocation RBLoc);
1391 ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc,
1392 SourceLocation RParenLoc,
1393 ArrayRef<Expr *> Dims,
1394 ArrayRef<SourceRange> Brackets);
1395
1396
1397 struct OMPIteratorData {
1398 IdentifierInfo *DeclIdent = nullptr;
1399 SourceLocation DeclIdentLoc;
1400 ParsedType Type;
1401 OMPIteratorExpr::IteratorRange Range;
1402 SourceLocation AssignLoc;
1403 SourceLocation ColonLoc;
1404 SourceLocation SecColonLoc;
1405 };
1406
1407 ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc,
1408 SourceLocation LLoc, SourceLocation RLoc,
1409 ArrayRef<OMPIteratorData> Data);
1410
1411 void handleOMPAssumeAttr(Decl *D, const ParsedAttr &AL);
1412
1413 private:
1414 void *VarDataSharingAttributesStack;
1415
1416
1417 SmallVector<DeclareTargetContextInfo, 4> DeclareTargetNesting;
1418
1419
1420 void InitDataSharingAttributesStack();
1421 void DestroyDataSharingAttributesStack();
1422
1423
1424 unsigned getOpenMPNestingLevel() const;
1425
1426
1427 void adjustOpenMPTargetScopeIndex(unsigned &FunctionScopesIndex,
1428 unsigned Level) const;
1429
1430
1431
1432 int getNumberOfConstructScopes(unsigned Level) const;
1433
1434
1435 void pushOpenMPFunctionRegion();
1436
1437
1438 void popOpenMPFunctionRegion(const sema::FunctionScopeInfo *OldFSI);
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452 bool checkTransformableLoopNest(
1453 OpenMPDirectiveKind Kind, Stmt *AStmt, int NumLoops,
1454 SmallVectorImpl<OMPLoopBasedDirective::HelperExprs> &LoopHelpers,
1455 Stmt *&Body, SmallVectorImpl<SmallVector<Stmt *, 0>> &OriginalInits);
1456
1457
1458
1459 struct OMPDeclareVariantScope {
1460
1461 OMPTraitInfo *TI;
1462
1463
1464 std::string NameSuffix;
1465
1466 OMPDeclareVariantScope(OMPTraitInfo &TI);
1467 };
1468
1469
1470 OMPTraitInfo *getOMPTraitInfoForSurroundingScope() {
1471 return OMPDeclareVariantScopes.empty() ? nullptr
1472 : OMPDeclareVariantScopes.back().TI;
1473 }
1474
1475
1476 SmallVector<OMPDeclareVariantScope, 4> OMPDeclareVariantScopes;
1477
1478
1479 SmallVector<OMPAssumeAttr *, 4> OMPAssumeScoped;
1480
1481
1482 SmallVector<OMPAssumeAttr *, 4> OMPAssumeGlobal;
1483 };
1484
1485 }
1486
1487 #endif