Lines Matching defs:SemaRef

60     Sema &SemaRef, Expr *E,
245 Sema &SemaRef;
350 explicit DSAStackTy(Sema &S) : SemaRef(S) {}
478 const FunctionScopeInfo *CurFnScope = SemaRef.getCurFunction();
491 for (const FunctionScopeInfo *FSI : llvm::reverse(SemaRef.FunctionScopes)) {
704 SemaRef.Diag(CNew->getBeginLoc(),
707 SemaRef.Diag(CPrev->getBeginLoc(),
1553 static VarDecl *buildVarDecl(Sema &SemaRef, SourceLocation Loc, QualType Type,
1556 DeclContext *DC = SemaRef.CurContext;
1557 IdentifierInfo *II = &SemaRef.PP.getIdentifierTable().get(Name);
1558 TypeSourceInfo *TInfo = SemaRef.Context.getTrivialTypeSourceInfo(Type, Loc);
1560 VarDecl::Create(SemaRef.Context, DC, Loc, Loc, II, Type, TInfo, SC_None);
1569 OMPReferencedVarAttr::CreateImplicit(SemaRef.Context, OrigRef));
1602 VarDecl *VD = buildVarDecl(SemaRef, SR.getBegin(),
1603 SemaRef.Context.VoidPtrTy, ".task_red.");
1605 buildDeclRefExpr(SemaRef, VD, SemaRef.Context.VoidPtrTy, SR.getBegin());
1627 VarDecl *VD = buildVarDecl(SemaRef, SR.getBegin(),
1628 SemaRef.Context.VoidPtrTy, ".task_red.");
1630 buildDeclRefExpr(SemaRef, VD, SemaRef.Context.VoidPtrTy, SR.getBegin());
1709 static bool isConstNotMutableType(Sema &SemaRef, QualType Type,
1712 ASTContext &Context = SemaRef.getASTContext();
1716 const CXXRecordDecl *RD = AcceptIfMutable && SemaRef.getLangOpts().CPlusPlus
1724 return IsConstant && !(SemaRef.getLangOpts().CPlusPlus && RD &&
1728 static bool rejectConstNotMutableType(Sema &SemaRef, const ValueDecl *D,
1733 ASTContext &Context = SemaRef.getASTContext();
1735 if (isConstNotMutableType(SemaRef, Type, AcceptIfMutable, &IsClassType)) {
1739 SemaRef.Diag(ELoc, Diag) << getOpenMPClauseName(CKind);
1744 SemaRef.Diag(D->getLocation(),
1768 SemaRef, VD, D->getType().getNonReferenceType(),
1779 SemaRef.getLangOpts().OpenMPUseTLS &&
1780 SemaRef.getASTContext().getTargetInfo().isTLSSupported())) ||
1784 SemaRef, VD, D->getType().getNonReferenceType(), D->getLocation());
1789 if (SemaRef.getLangOpts().OpenMPCUDAMode && VD &&
1801 buildDeclRefExpr(SemaRef, VD, D->getType().getNonReferenceType(),
1816 if (!SemaRef.OpenMP().isOpenMPCapturedByRef(
1820 buildDeclRefExpr(SemaRef, VD, D->getType().getNonReferenceType(),
1868 if (SemaRef.LangOpts.OpenMP <= 31) {
1873 if (isConstNotMutableType(SemaRef, D->getType())) {
2027 VarDataSharingAttributesStack = new DSAStackTy(SemaRef);
2061 Sema::FunctionEmissionStatus FES = SemaRef.getEmissionStatus(FD);
2074 Kind = isOpenMPDeviceDelayedContext(SemaRef)
2088 return SemaDiagnosticBuilder(Kind, Loc, DiagID, FD, SemaRef);
2099 Sema::FunctionEmissionStatus FES = SemaRef.getEmissionStatus(FD);
2115 return SemaDiagnosticBuilder(Kind, Loc, DiagID, FD, SemaRef);
2376 (SemaRef.getCurCapturedRegion() || SemaRef.getCurBlock() ||
2377 SemaRef.getCurLambda())) {
2390 llvm::reverse(SemaRef.FunctionScopes),
2391 CheckScopeInfo ? (SemaRef.FunctionScopes.size() - (StopAt + 1))
2421 FunctionScopeInfo *FSI = SemaRef.FunctionScopes[I - 1];
2486 if (SemaRef.getCurrentThisType().isNull())
2488 Expr *ThisExpr = SemaRef.BuildCXXThisExpr(SourceLocation(),
2489 SemaRef.getCurrentThisType(),
2492 Expr *ME = SemaRef.BuildMemberExpr(
2499 SemaRef, FD->getIdentifier(), ME, DVarPrivate.CKind != OMPC_private,
2500 SemaRef.CurContext->getParent(), /*AsExpression=*/false);
2502 SemaRef, CD, CD->getType().getNonReferenceType(), SourceLocation());
2791 SemaRef.PushExpressionEvaluationContext(
2801 SemaRef.CleanupVarDeclMarking();
2880 static void reportOriginalDsa(Sema &SemaRef, const DSAStackTy *Stack,
2912 SemaRef, DE->getExprLoc(), Type.getUnqualifiedType(),
2914 SemaRef.ActOnUninitializedDecl(VDPrivate);
2920 SemaRef, VDPrivate, DE->getType(), DE->getExprLoc()));
2938 auto Res = getPrivateItem(SemaRef, SimpleRefExpr, ELoc, ERange);
2991 reportOriginalDsa(SemaRef, DSAStack, VD, DVar);
3001 if (!SemaRef.CurContext->isDependentContext())
3002 checkAllocateClauses(SemaRef, DSAStack, D->clauses());
3003 checkReductionClauses(SemaRef, DSAStack, D->clauses());
3007 SemaRef.DiscardCleanupsInEvaluationContext();
3008 SemaRef.PopExpressionEvaluationContext();
3012 Expr *NumIterations, Sema &SemaRef,
3015 static bool finishLinearClauses(Sema &SemaRef, ArrayRef<OMPClause *> Clauses,
3018 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) &&
3021 if (SemaRef.CurContext->isDependentContext())
3030 B.NumIterations, SemaRef,
3031 SemaRef.getCurScope(), Stack))
3042 Sema &SemaRef;
3045 explicit VarDeclFilterCCC(Sema &S) : SemaRef(S) {}
3050 SemaRef.isDeclInScope(ND, SemaRef.getCurLexicalContext(),
3051 SemaRef.getCurScope());
3063 Sema &SemaRef;
3066 explicit VarOrFuncDeclFilterCCC(Sema &S) : SemaRef(S) {}
3071 return SemaRef.isDeclInScope(ND, SemaRef.getCurLexicalContext(),
3072 SemaRef.getCurScope());
3089 LookupResult Lookup(SemaRef, Id, Sema::LookupOrdinaryName);
3090 SemaRef.LookupParsedName(Lookup, CurScope, &ScopeSpec,
3099 VarDeclFilterCCC CCC(SemaRef);
3101 SemaRef.CorrectTypo(Id, Sema::LookupOrdinaryName, CurScope, nullptr,
3103 SemaRef.diagnoseTypo(Corrected,
3141 !SemaRef.getCurLexicalContext()->isTranslationUnit()) {
3156 !CanonicalVD->getDeclContext()->Equals(SemaRef.getCurLexicalContext())) {
3171 (!SemaRef.getCurLexicalContext()->isFileContext() ||
3172 !SemaRef.getCurLexicalContext()->Encloses(
3187 !SemaRef.isDeclInScope(ND, SemaRef.getCurLexicalContext(), CurScope)) {
3219 SemaRef.CurContext->addDecl(D);
3228 Sema &SemaRef;
3234 SemaRef.Diag(E->getBeginLoc(),
3237 SemaRef.Diag(VD->getLocation(), diag::note_defined_here)
3251 explicit LocalVarRefChecker(Sema &SemaRef) : SemaRef(SemaRef) {}
3278 if (SemaRef.RequireCompleteType(
3317 LocalVarRefChecker Checker(SemaRef);
3331 D = OMPThreadPrivateDecl::Create(Context, SemaRef.getCurLexicalContext(),
3451 SemaRef.targetDiag(Loc, diag::err_expected_allocator_clause);
3462 getAllocatorKind(SemaRef, DSAStack, Allocator);
3477 if (checkPreviousOMPAllocateAttribute(SemaRef, DSAStack, RefExpr, VD,
3500 applyOMPAllocateAttribute(SemaRef, VD, AllocatorKind, Allocator, Alignment,
3506 Owner = SemaRef.getCurLexicalContext();
3517 if (!SemaRef.CurContext->isFileContext()) {
3522 SemaRef.CurContext->addDecl(D);
3558 auto *Ctx = SemaRef.CurContext;
3621 getASTContext(), SemaRef.getCurLexicalContext(), Loc, ClauseList);
3625 static void reportOriginalDsa(Sema &SemaRef, const DSAStackTy *Stack,
3630 SemaRef.Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
3666 else if (D->getType().isConstant(SemaRef.getASTContext()))
3673 SemaRef.Diag(ReportLoc, diag::note_omp_predetermined_dsa)
3677 SemaRef.Diag(DVar.ImplicitDSALoc, diag::note_omp_implicit_dsa)
3729 Sema &SemaRef;
3863 getVariableCategoryFromDecl(SemaRef.getLangOpts(), VD);
3864 if (SemaRef.getLangOpts().OpenMP >= 50) {
3886 if (SemaRef.getLangOpts().OpenMP > 50) {
3905 if (SemaRef.LangOpts.OpenMP >= 50)
3960 SemaRef.Diag(ELoc, diag::err_omp_reduction_in_task);
3961 reportOriginalDsa(SemaRef, Stack, VD, DVar);
4032 getVariableCategoryFromDecl(SemaRef.getLangOpts(), FD);
4056 SemaRef.Diag(ELoc, diag::err_omp_reduction_in_task);
4057 reportOriginalDsa(SemaRef, Stack, FD, DVar);
4076 if (!checkMapClauseExpressionBase(SemaRef, E, CurComponents, OMPC_map,
4188 SemaRef, VD, VD->getType().getNonLValueExprType(SemaRef.Context),
4210 DSAAttrChecker(DSAStackTy *S, Sema &SemaRef, CapturedStmt *CS)
4211 : Stack(S), SemaRef(SemaRef), ErrorFound(false), CS(CS) {
4239 getParallelRegionParams(Sema &SemaRef, bool LoopBoundSharing) {
4240 ASTContext &Context = SemaRef.getASTContext();
4261 getTeamsRegionParams(Sema &SemaRef) {
4262 return getParallelRegionParams(SemaRef, /*LoopBoundSharing=*/false);
4266 getTaskRegionParams(Sema &SemaRef) {
4267 ASTContext &Context = SemaRef.getASTContext();
4290 getTargetRegionParams(Sema &SemaRef) {
4291 ASTContext &Context = SemaRef.getASTContext();
4293 if (SemaRef.getLangOpts().OpenMPIsTargetDevice) {
4303 getUnknownRegionParams(Sema &SemaRef) {
4311 getTaskloopRegionParams(Sema &SemaRef) {
4312 ASTContext &Context = SemaRef.getASTContext();
4344 static void processCapturedRegions(Sema &SemaRef, OpenMPDirectiveKind DKind,
4353 SemaRef.getASTContext(), {}, AlwaysInlineAttr::Keyword_forceinline));
4361 SemaRef.ActOnCapturedRegionStart(
4363 getParallelRegionParams(SemaRef, LoopBoundSharing), Level);
4366 SemaRef.ActOnCapturedRegionStart(Loc, CurScope, CR_OpenMP,
4367 getTeamsRegionParams(SemaRef), Level);
4370 SemaRef.ActOnCapturedRegionStart(Loc, CurScope, CR_OpenMP,
4371 getTaskRegionParams(SemaRef), Level);
4374 MarkAsInlined(SemaRef.getCurCapturedRegion());
4377 SemaRef.ActOnCapturedRegionStart(Loc, CurScope, CR_OpenMP,
4378 getTaskloopRegionParams(SemaRef), Level);
4381 MarkAsInlined(SemaRef.getCurCapturedRegion());
4384 SemaRef.ActOnCapturedRegionStart(Loc, CurScope, CR_OpenMP,
4385 getTargetRegionParams(SemaRef), Level);
4388 SemaRef.ActOnCapturedRegionStart(Loc, CurScope, CR_OpenMP,
4389 getUnknownRegionParams(SemaRef));
4413 processCapturedRegions(SemaRef, DKind, CurScope,
4418 DSAStack->setContext(SemaRef.CurContext);
4529 if (!SemaRef.CurContext->isDependentContext() &&
4549 if (!VDC->Encloses(SemaRef.CurContext))
4551 SemaRef.MarkVariableReferenced(LC.getLocation(), VD);
4553 QualType ThisTy = SemaRef.getCurrentThisType();
4556 SemaRef.CheckCXXThisCapture(LC.getLocation());
4605 SemaRef, ErrorFound, DSAStack->getCurrentDirective());
4628 SemaRef.MarkDeclarationsReferencedInExpr(E);
4639 SemaRef.MarkDeclarationsReferencedInExpr(E);
4649 SemaRef.MarkDeclarationsReferencedInExpr(E);
4661 SemaRef.MarkDeclarationsReferencedInExpr(E);
4683 if (checkOrderedOrderSpecified(SemaRef, Clauses))
4720 SemaRef.MarkVariableReferenced(D->getLocation(),
4735 SemaRef.MarkDeclarationsReferencedInExpr(E);
4750 SemaRef.MarkDeclarationsReferencedInExpr(E);
4754 SemaRef.MarkDeclarationsReferencedInExpr(E);
4760 SR = SemaRef.ActOnCapturedRegionEnd(SR.get());
4765 static bool checkCancelRegion(Sema &SemaRef, OpenMPDirectiveKind CurrentRegion,
4776 SemaRef.Diag(StartLoc, diag::err_omp_wrong_cancel_region)
4781 static bool checkNestingOfRegions(Sema &SemaRef, const DSAStackTy *Stack,
4809 if (SemaRef.LangOpts.OpenMP >= 51 && Stack->isParentOrderConcurrent() &&
4813 SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region_order)
4818 ((SemaRef.LangOpts.OpenMP <= 45 && CurrentRegion != OMPD_ordered) ||
4819 (SemaRef.LangOpts.OpenMP >= 50 && CurrentRegion != OMPD_ordered &&
4834 SemaRef.Diag(StartLoc, (CurrentRegion != OMPD_simd)
4837 << (SemaRef.LangOpts.OpenMP >= 50 ? 1 : 0);
4843 SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region_atomic);
4852 SemaRef.Diag(StartLoc, diag::err_omp_orphaned_section_directive)
4869 if (SemaRef.LangOpts.OpenMP >= 50 && CurrentRegion == OMPD_loop &&
4874 SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region)
4895 (SemaRef.getLangOpts().OpenMP < 50 ||
4929 SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region_critical_same_name)
4932 SemaRef.Diag(PreviousCriticalLoc,
4982 (SemaRef.LangOpts.OpenMP <= 45 && EnclosingConstruct != OMPD_target) ||
4983 (SemaRef.LangOpts.OpenMP >= 50 && EnclosingConstruct != OMPD_unknown &&
4988 if (SemaRef.LangOpts.OpenMP >= 50) {
5016 !(SemaRef.getLangOpts().OpenMPExtensions &&
5057 SemaRef.Diag(StartLoc, diag::err_omp_orphaned_device_directive)
5060 SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region)
5721 SemaRef.BuildUnaryOp(nullptr, {}, UO_Minus, IncBin->getRHS()));
5739 SemaRef.BuildUnaryOp(nullptr, {}, UO_Minus, CondCXXOp->getArg(1)));
5748 buildDistanceFunc(SemaRef, LogicalTy, CondRel, LHS, RHS, Step);
5750 SemaRef, LVTy, LogicalTy, CounterRef, Step, isa<CXXForRangeStmt>(AStmt));
5752 SemaRef.BuildDeclRefExpr(LUVDecl, LUVDecl->getType(), VK_LValue, {},
5771 static ExprResult buildUserDefinedMapperRef(Sema &SemaRef, Scope *S,
5916 Sema &SemaRef;
5948 IsOpenMPAPI || SemaRef.getLangOpts().OpenMPNoNestedParallelism;
5970 explicit TeamsLoopChecker(Sema &SemaRef)
5971 : SemaRef(SemaRef), TeamsLoopCanBeParallelFor(true) {}
5978 static bool teamsLoopCanBeParallelFor(Stmt *AStmt, Sema &SemaRef) {
5979 TeamsLoopChecker Checker(SemaRef);
6103 if (checkCancelRegion(SemaRef, Kind, CancelRegion, StartLoc) ||
6104 checkNestingOfRegions(SemaRef, DSAStack, DK, DirName, CancelRegion,
6123 if (AStmt && !SemaRef.CurContext->isDependentContext() &&
6128 DSAAttrChecker DSAChecker(DSAStack, SemaRef, cast<CapturedStmt>(AStmt));
6269 processImplicitMapsWithDefaultMappers(SemaRef, DSAStack,
6610 DSAAttrChecker DSAChecker(DSAStack, SemaRef, nullptr);
6752 ErrorFound = checkIfClauses(SemaRef, Kind, Clauses, AllowedNameModifiers) ||
6758 if (!SemaRef.CurContext->isDependentContext() &&
7006 NewStep = SemaRef
7060 if (!SemaRef.inTemplateInstantiation()) {
7087 LookupResult Lookup(SemaRef, DeclarationName(BaseII), D.getIdentifierLoc(),
7089 SemaRef.LookupParsedName(Lookup, S, &D.getCXXScopeSpec(),
7092 TypeSourceInfo *TInfo = SemaRef.GetTypeForDeclarator(D);
7137 Decl *BaseD = SemaRef.HandleDeclarator(S, D, TemplateParamLists);
7160 SemaRef, Sema::ExpressionEvaluationContext::Unevaluated);
7217 SemaRef.getCurFunctionDecl(),
7263 Sema::TentativeAnalysisScope Trap(SemaRef);
7272 NewCall = SemaRef.BuildCallExpr(Scope, BestExpr, LParenLoc, ArgExprs,
7402 LookupResult Result(SemaRef, &Context.Idents.get("omp_interop_t"),
7404 if (SemaRef.LookupName(Result, SemaRef.getCurScope())) {
7438 Sema::TentativeAnalysisScope Trap(SemaRef);
7439 ER = SemaRef.CreateBuiltinUnaryOp(VariantRef->getBeginLoc(), UO_AddrOf,
7453 ImplicitConversionSequence ICS = SemaRef.TryImplicitConversion(
7467 VariantRefCast = SemaRef.PerformImplicitConversion(
7481 ExprResult ER = SemaRef.CheckPlaceholderExpr(VariantRefCast.get());
7523 setPrototype(SemaRef, FD, NewFD, NewType);
7525 setPrototype(SemaRef, NewFD, FD, NewType);
7588 if (SemaRef.areMultiversionVariantFunctionsCompatible(
7674 setBranchProtectedScope(Sema &SemaRef, OpenMPDirectiveKind DKind, Stmt *AStmt) {
7684 for (int ThisCaptureLevel = SemaRef.OpenMP().getOpenMPCaptureLevels(DKind);
7694 SemaRef.setFunctionHasBranchProtectedScope();
7705 setBranchProtectedScope(SemaRef, OMPD_parallel, AStmt);
7766 Sema &SemaRef;
7818 OpenMPIterationSpaceChecker(Sema &SemaRef, bool SupportsNonRectangular,
7820 : SemaRef(SemaRef), SupportsNonRectangular(SupportsNonRectangular),
7959 ExprResult Val = SemaRef.OpenMP().PerformOpenMPImplicitIntegerConversion(
7977 NewStep->getIntegerConstantExpr(SemaRef.Context);
7991 SemaRef.Diag(NewStep->getExprLoc(),
7994 SemaRef.Diag(ConditionLoc,
8001 SemaRef.CreateBuiltinUnaryOp(NewStep->getExprLoc(), UO_Minus, NewStep)
8017 Sema &SemaRef;
8027 SemaRef.Diag(E->getExprLoc(), diag::err_omp_stmt_depends_on_loop_counter)
8038 VD->getNameForDiagnostic(OS, SemaRef.getPrintingPolicy(),
8040 SemaRef.Diag(E->getExprLoc(),
8043 SemaRef.Diag(VD->getLocation(), diag::note_previous_decl) << VD;
8047 SemaRef.Diag(E->getExprLoc(), diag::err_omp_invariant_dependency);
8057 DepDecl->getNameForDiagnostic(OS, SemaRef.getPrintingPolicy(),
8059 SemaRef.Diag(E->getExprLoc(),
8092 explicit LoopCounterRefChecker(Sema &SemaRef, DSAStackTy &Stack,
8096 : SemaRef(SemaRef), Stack(Stack), CurLCDecl(CurLCDecl),
8114 LoopCounterRefChecker LoopStmtChecker(SemaRef, Stack, LCDecl, IsInitializer,
8134 SemaRef.Diag(DefaultLoc, diag::err_omp_loop_not_canonical_init);
8168 SemaRef.Diag(S->getBeginLoc(),
8173 buildDeclRefExpr(SemaRef, Var,
8199 if (dependent() || SemaRef.CurContext->isDependentContext())
8202 SemaRef.Diag(S->getBeginLoc(), diag::err_omp_loop_not_canonical_init)
8237 bool IneqCondIsCanonical = SemaRef.getLangOpts().OpenMP >= 50;
8239 SemaRef.Diag(DefaultLoc, diag::err_omp_loop_not_canonical_cond)
8283 if (dependent() || SemaRef.CurContext->isDependentContext())
8285 SemaRef.Diag(CondLoc, diag::err_omp_loop_not_canonical_cond)
8314 if (dependent() || SemaRef.CurContext->isDependentContext())
8316 SemaRef.Diag(RHS->getBeginLoc(), diag::err_omp_loop_not_canonical_incr)
8336 SemaRef.Diag(DefaultLoc, diag::err_omp_loop_not_canonical_incr) << LCDecl;
8348 return setStep(SemaRef
8372 return setStep(SemaRef
8392 if (dependent() || SemaRef.CurContext->isDependentContext())
8394 SemaRef.Diag(S->getBeginLoc(), diag::err_omp_loop_not_canonical_incr)
8400 tryBuildCapture(Sema &SemaRef, Expr *Capture,
8403 if (SemaRef.CurContext->isDependentContext() || Capture->containsErrors())
8405 if (Capture->isEvaluatable(SemaRef.Context, Expr::SE_AllowSideEffects))
8406 return SemaRef.PerformImplicitConversion(
8411 return buildCapture(SemaRef, Capture, I->second, Name);
8413 ExprResult Res = buildCapture(SemaRef, Capture, Ref, Name);
8421 calculateNumIters(Sema &SemaRef, Scope *S, SourceLocation DefaultLoc,
8425 ExprResult NewStep = tryBuildCapture(SemaRef, Step, Captures, ".new_step");
8431 Lower->getIntegerConstantExpr(SemaRef.Context)) {
8436 Step->getIntegerConstantExpr(SemaRef.Context)) {
8475 Upper->getIntegerConstantExpr(SemaRef.Context)) {
8498 uint64_t LowerSize = SemaRef.Context.getTypeSize(LowerTy);
8499 uint64_t UpperSize = SemaRef.Context.getTypeSize(UpperTy);
8502 QualType CastType = SemaRef.Context.getIntTypeForBitwidth(
8505 SemaRef
8507 SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, Upper).get(),
8510 Lower = SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, Lower).get();
8511 NewStep = SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, NewStep.get());
8526 SemaRef.BuildBinOp(S, DefaultLoc, BO_Sub, Diff.get(), NewStep.get());
8533 Diff = SemaRef.BuildBinOp(
8535 SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get());
8539 Diff = SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, Diff.get());
8544 Diff = SemaRef.BuildBinOp(S, DefaultLoc, BO_Sub, Upper, Diff.get());
8548 Diff = SemaRef.BuildBinOp(S, DefaultLoc, BO_Sub, Upper, Lower);
8553 SemaRef.Diag(Upper->getBeginLoc(), diag::err_omp_loop_diff_cxx)
8563 Diff = SemaRef.BuildBinOp(
8565 SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get());
8572 SemaRef.BuildBinOp(S, DefaultLoc, BO_Add, Diff.get(), NewStep.get());
8579 Diff = SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, Diff.get());
8584 Diff = SemaRef.BuildBinOp(S, DefaultLoc, BO_Div, Diff.get(), NewStep.get());
8597 !SemaRef.getLangOpts().CPlusPlus)
8609 SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, IS.MinValue);
8613 ExprResult LBMinVal = SemaRef.BuildBinOp(S, DefaultLoc, BO_Assign,
8619 SemaRef.BuildBinOp(S, DefaultLoc, BO_Comma, LBMinVal.get(), LBVal);
8623 LBMinVal = SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, LBMinVal.get());
8629 SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, IS.MaxValue);
8633 ExprResult LBMaxVal = SemaRef.BuildBinOp(S, DefaultLoc, BO_Assign,
8639 SemaRef.BuildBinOp(S, DefaultLoc, BO_Comma, LBMaxVal.get(), LBVal);
8643 LBMaxVal = SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, LBMaxVal.get());
8648 tryBuildCapture(SemaRef, LBMinVal.get(), Captures, ".lb_min").get();
8650 tryBuildCapture(SemaRef, LBMaxVal.get(), Captures, ".lb_max").get();
8655 SemaRef.BuildBinOp(S, DefaultLoc, BO_LT, LBMin, LBMax);
8659 tryBuildCapture(SemaRef, MinLessMaxRes.get(), Captures, ".min_less_max")
8666 ExprResult MinLB = SemaRef.ActOnConditionalOp(DefaultLoc, DefaultLoc,
8674 ExprResult MaxLB = SemaRef.ActOnConditionalOp(DefaultLoc, DefaultLoc,
8682 SemaRef.BuildBinOp(S, DefaultLoc, BO_Assign, IS.CounterVar, LBVal);
8695 SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, IS.MinValue);
8699 ExprResult UBMinVal = SemaRef.BuildBinOp(S, DefaultLoc, BO_Assign,
8705 SemaRef.BuildBinOp(S, DefaultLoc, BO_Comma, UBMinVal.get(), UBVal);
8709 UBMinVal = SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, UBMinVal.get());
8715 SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, IS.MaxValue);
8719 ExprResult UBMaxVal = SemaRef.BuildBinOp(S, DefaultLoc, BO_Assign,
8725 SemaRef.BuildBinOp(S, DefaultLoc, BO_Comma, UBMaxVal.get(), UBVal);
8729 UBMaxVal = SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, UBMaxVal.get());
8734 tryBuildCapture(SemaRef, UBMinVal.get(), Captures, ".ub_min").get();
8736 tryBuildCapture(SemaRef, UBMaxVal.get(), Captures, ".ub_max").get();
8741 SemaRef.BuildBinOp(S, DefaultLoc, BO_GT, UBMin, UBMax);
8744 Expr *MinGreaterMax = tryBuildCapture(SemaRef, MinGreaterMaxRes.get(),
8752 ExprResult MaxUB = SemaRef.ActOnConditionalOp(
8760 ExprResult MinUB = SemaRef.ActOnConditionalOp(
8769 Expr *Upper = tryBuildCapture(SemaRef, UBExpr, Captures, ".upper").get();
8770 Expr *Lower = tryBuildCapture(SemaRef, LBExpr, Captures, ".lower").get();
8774 ExprResult Diff = calculateNumIters(SemaRef, S, DefaultLoc, Lower, Upper,
8782 ASTContext &C = SemaRef.Context;
8791 if (!SemaRef.Context.hasSameType(Diff.get()->getType(), Type)) {
8792 Diff = SemaRef.PerformImplicitConversion(
8803 SemaRef.Diag(DefaultLoc, diag::warn_omp_loop_64_bit_var)
8809 if (!SemaRef.Context.hasSameType(Diff.get()->getType(), NewType)) {
8810 Diff = SemaRef.PerformImplicitConversion(Diff.get(), NewType,
8838 LBNonRect ? LBExpr : tryBuildCapture(SemaRef, LBExpr, Captures).get();
8840 UBNonRect ? UBExpr : tryBuildCapture(SemaRef, UBExpr, Captures).get();
8852 ExprResult Diff = calculateNumIters(SemaRef, S, DefaultLoc, Lower, Upper,
8860 Diff = SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, Diff.get());
8864 ExprResult NewStep = tryBuildCapture(SemaRef, Step, Captures, ".new_step");
8867 Diff = SemaRef.BuildBinOp(S, DefaultLoc, BO_Mul, Diff.get(), NewStep.get());
8872 Diff = SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, Diff.get());
8878 !SemaRef.Context.hasSameType(
8880 SemaRef.Context.getUnsignedPointerDiffType())) {
8881 Diff = SemaRef.PerformImplicitConversion(
8882 Diff.get(), SemaRef.Context.getUnsignedPointerDiffType(),
8891 Diff = SemaRef.BuildBinOp(
8893 SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, Lower).get(),
8900 Diff = SemaRef.BuildBinOp(
8902 SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, Upper).get(),
8909 if (SemaRef.Context.hasSameType(Diff.get()->getType(), VarType))
8910 Diff = SemaRef.PerformImplicitConversion(Diff.get(), VarType,
8916 Sema::TentativeAnalysisScope Trap(SemaRef);
8917 Diff = SemaRef.ActOnFinishFullExpr(Diff.get(), /*DiscardedValue=*/false);
8943 return SemaRef
8945 SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get(),
8946 SemaRef.Context.BoolTy, /*Action=*/Sema::AA_Casting,
8951 Sema::TentativeAnalysisScope Trap(SemaRef);
8953 ExprResult NewLB = tryBuildCapture(SemaRef, LB, Captures);
8954 ExprResult NewUB = tryBuildCapture(SemaRef, UB, Captures);
8959 SemaRef.BuildBinOp(S, DefaultLoc,
8964 if (!SemaRef.Context.hasSameUnqualifiedType(CondExpr.get()->getType(),
8965 SemaRef.Context.BoolTy))
8966 CondExpr = SemaRef.PerformImplicitConversion(
8967 CondExpr.get(), SemaRef.Context.BoolTy, /*Action=*/Sema::AA_Casting,
8981 VD = SemaRef.OpenMP().isOpenMPCapturedDecl(LCDecl);
8983 SemaRef, VD, VD->getType().getNonReferenceType(), DefaultLoc);
8999 SemaRef, DefaultLoc, Type, LCDecl->getName(),
9002 ? buildDeclRefExpr(SemaRef, cast<VarDecl>(LCDecl), Type, DefaultLoc)
9006 return buildDeclRefExpr(SemaRef, PrivateVar, Type, DefaultLoc);
9021 Expr *Cnt = SemaRef.DefaultLvalueConversion(Counter).get();
9028 Cnt = SemaRef.BuildBinOp(S, Loc, BOK, Cnt, Inc).get();
9034 !SemaRef.getLangOpts().CPlusPlus)
9038 *TestIsLessOp ? Cnt : tryBuildCapture(SemaRef, LB, Captures).get();
9040 *TestIsLessOp ? tryBuildCapture(SemaRef, LB, Captures).get() : Cnt;
9045 SemaRef, S, DefaultLoc, Lower, Upper, Step, VarType,
9064 OpenMPIterationSpaceChecker ISC(SemaRef, /*SupportsNonRectangular=*/true,
9074 PrivateRef = buildCapture(SemaRef, D, ISC.getLoopDeclRefExpr(),
9084 SemaRef.MarkDeclarationsReferencedInExpr(buildDeclRefExpr(
9085 SemaRef, const_cast<VarDecl *>(Var),
9123 reportOriginalDsa(SemaRef, DSAStack, D, DVar, /*IsLoopIterVar=*/true);
9156 OpenMPDirectiveKind DKind, Stmt *S, Sema &SemaRef, DSAStackTy &DSA,
9172 if (!For && (SemaRef.LangOpts.OpenMP <= 45 || !CXXFor)) {
9173 OpenMPDirectiveKind DK = (SemaRef.getLangOpts().OpenMP < 50 ||
9177 SemaRef.Diag(S->getBeginLoc(), diag::err_omp_not_for)
9183 SemaRef.Diag(DSA.getConstructLoc(),
9188 SemaRef.Diag(CollapseLoopCountExpr->getExprLoc(),
9192 SemaRef.Diag(OrderedLoopCountExpr->getExprLoc(),
9201 if (CXXFor && SemaRef.CurContext->isDependentContext())
9204 OpenMPIterationSpaceChecker ISC(SemaRef, SupportsNonRectangular, DSA,
9224 !(SemaRef.getLangOpts().CPlusPlus && VarType->isOverloadableType())) {
9225 SemaRef.Diag(Init->getBeginLoc(), diag::err_omp_loop_variable_type)
9226 << SemaRef.getLangOpts().CPlusPlus;
9250 if (ISC.dependent() || SemaRef.CurContext->isDependentContext() || HasErrors)
9341 Expr *Cnt = SemaRef
9349 SemaRef.ActOnIntegerConstant(DoacrossC->getColonLoc(), /*Val=*/1)
9373 buildCounterInit(Sema &SemaRef, Scope *S, SourceLocation Loc, ExprResult VarRef,
9379 : tryBuildCapture(SemaRef, Start.get(), Captures);
9382 if (!SemaRef.Context.hasSameType(NewStart.get()->getType(),
9384 NewStart = SemaRef.PerformImplicitConversion(
9392 SemaRef.BuildBinOp(S, Loc, BO_Assign, VarRef.get(), NewStart.get());
9398 Sema &SemaRef, Scope *S, SourceLocation Loc, ExprResult VarRef,
9403 Iter = SemaRef.ActOnParenExpr(Loc, Loc, Iter.get());
9410 NewStep = tryBuildCapture(SemaRef, Step.get(), *Captures);
9414 SemaRef.BuildBinOp(S, Loc, BO_Mul, Iter.get(), NewStep.get());
9422 ExprResult NewStart = SemaRef.ActOnParenExpr(Loc, Loc, Start.get());
9426 NewStart = tryBuildCapture(SemaRef, Start.get(), *Captures);
9436 Sema::TentativeAnalysisScope Trap(SemaRef);
9439 SemaRef.BuildBinOp(S, Loc, BO_Assign, VarRef.get(), NewStart.get());
9442 SemaRef.BuildBinOp(S, Loc, Subtract ? BO_SubAssign : BO_AddAssign,
9445 Update = SemaRef.CreateBuiltinBinOp(Loc, BO_Comma, Update.get(),
9453 Update = SemaRef.BuildBinOp(S, Loc, Subtract ? BO_Sub : BO_Add,
9458 if (!SemaRef.Context.hasSameType(Update.get()->getType(),
9460 Update = SemaRef.PerformImplicitConversion(
9466 Update = SemaRef.BuildBinOp(S, Loc, BO_Assign, VarRef.get(), Update.get());
9473 static ExprResult widenIterationCount(unsigned Bits, Expr *E, Sema &SemaRef) {
9476 ASTContext &C = SemaRef.Context;
9483 return SemaRef.PerformImplicitConversion(E, NewType, Sema::AA_Converting,
9489 static bool fitsInto(unsigned Bits, bool Signed, const Expr *E, Sema &SemaRef) {
9493 E->getIntegerConstantExpr(SemaRef.Context))
9577 Expr *OrderedLoopCountExpr, Stmt *AStmt, Sema &SemaRef,
9582 bool SupportsNonPerfectlyNested = (SemaRef.LangOpts.OpenMP >= 50) &&
9589 CollapseLoopCountExpr->EvaluateAsInt(Result, SemaRef.getASTContext())) {
9602 SemaRef.getASTContext())) {
9605 SemaRef.Diag(OrderedLoopCountExpr->getExprLoc(),
9608 SemaRef.Diag(CollapseLoopCountExpr->getExprLoc(),
9626 [DKind, &SemaRef, &DSA, NumLoops, NestedLoopCount,
9630 DKind, CurStmt, SemaRef, DSA, Cnt, NestedLoopCount,
9644 [&SemaRef, &Captures](OMPLoopTransformationDirective *Transform) {
9658 SemaRef, D, D->getType().getNonReferenceType(),
9669 if (SemaRef.CurContext->isDependentContext())
9707 SemaRef
9712 SemaRef);
9715 SemaRef
9720 SemaRef);
9725 ASTContext &C = SemaRef.Context;
9732 SemaRef.BuildBinOp(CurScope, PreCond.get()->getExprLoc(), BO_LAnd,
9739 LastIteration32 = SemaRef.BuildBinOp(
9741 SemaRef
9747 LastIteration64 = SemaRef.BuildBinOp(
9749 SemaRef
9758 if (SemaRef.getLangOpts().OpenMPOptimisticCollapse ||
9765 LastIteration64.get(), SemaRef))))
9772 SemaRef.Context.getIntTypeForBitwidth(/*DestWidth=*/64, /*Signed=*/0);
9774 SemaRef.Context.getIntTypeForBitwidth(/*DestWidth=*/64, /*Signed=*/1);
9783 LastIteration = SemaRef.BuildBinOp(
9786 SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get());
9793 bool IsConstant = LastIteration.get()->isIntegerConstantExpr(SemaRef.Context);
9797 tryBuildCapture(SemaRef, LastIteration.get(), Captures);
9801 NumIterations = SemaRef.BuildBinOp(
9803 SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get());
9817 VarDecl *LBDecl = buildVarDecl(SemaRef, InitLoc, VType, ".omp.lb");
9818 LB = buildDeclRefExpr(SemaRef, LBDecl, VType, InitLoc);
9819 SemaRef.AddInitializerToDecl(LBDecl,
9820 SemaRef.ActOnIntegerConstant(InitLoc, 0).get(),
9824 VarDecl *UBDecl = buildVarDecl(SemaRef, InitLoc, VType, ".omp.ub");
9825 UB = buildDeclRefExpr(SemaRef, UBDecl, VType, InitLoc);
9826 SemaRef.AddInitializerToDecl(UBDecl, LastIteration.get(),
9831 QualType Int32Ty = SemaRef.Context.getIntTypeForBitwidth(32, true);
9832 VarDecl *ILDecl = buildVarDecl(SemaRef, InitLoc, Int32Ty, ".omp.is_last");
9833 IL = buildDeclRefExpr(SemaRef, ILDecl, Int32Ty, InitLoc);
9834 SemaRef.AddInitializerToDecl(ILDecl,
9835 SemaRef.ActOnIntegerConstant(InitLoc, 0).get(),
9840 buildVarDecl(SemaRef, InitLoc, StrideVType, ".omp.stride");
9841 ST = buildDeclRefExpr(SemaRef, STDecl, StrideVType, InitLoc);
9842 SemaRef.AddInitializerToDecl(STDecl,
9843 SemaRef.ActOnIntegerConstant(InitLoc, 1).get(),
9848 ExprResult IsUBGreater = SemaRef.BuildBinOp(CurScope, InitLoc, BO_GT,
9850 ExprResult CondOp = SemaRef.ActOnConditionalOp(
9853 EUB = SemaRef.BuildBinOp(CurScope, InitLoc, BO_Assign, UB.get(),
9855 EUB = SemaRef.ActOnFinishFullExpr(EUB.get(), /*DiscardedValue*/ false);
9864 buildVarDecl(SemaRef, InitLoc, VType, ".omp.comb.lb");
9865 CombLB = buildDeclRefExpr(SemaRef, CombLBDecl, VType, InitLoc);
9866 SemaRef.AddInitializerToDecl(
9867 CombLBDecl, SemaRef.ActOnIntegerConstant(InitLoc, 0).get(),
9872 buildVarDecl(SemaRef, InitLoc, VType, ".omp.comb.ub");
9873 CombUB = buildDeclRefExpr(SemaRef, CombUBDecl, VType, InitLoc);
9874 SemaRef.AddInitializerToDecl(CombUBDecl, LastIteration.get(),
9877 ExprResult CombIsUBGreater = SemaRef.BuildBinOp(
9880 SemaRef.ActOnConditionalOp(InitLoc, InitLoc, CombIsUBGreater.get(),
9882 CombEUB = SemaRef.BuildBinOp(CurScope, InitLoc, BO_Assign, CombUB.get(),
9885 SemaRef.ActOnFinishFullExpr(CombEUB.get(), /*DiscardedValue*/ false);
9901 buildDeclRefExpr(SemaRef, PrevLBDecl, PrevLBDecl->getType(), InitLoc);
9903 buildDeclRefExpr(SemaRef, PrevUBDecl, PrevUBDecl->getType(), InitLoc);
9911 VarDecl *IVDecl = buildVarDecl(SemaRef, InitLoc, RealVType, ".omp.iv");
9912 IV = buildDeclRefExpr(SemaRef, IVDecl, RealVType, InitLoc);
9919 : SemaRef.ActOnIntegerConstant(SourceLocation(), 0).get();
9920 Init = SemaRef.BuildBinOp(CurScope, InitLoc, BO_Assign, IV.get(), RHS);
9921 Init = SemaRef.ActOnFinishFullExpr(Init.get(), /*DiscardedValue*/ false);
9930 : SemaRef.ActOnIntegerConstant(SourceLocation(), 0).get();
9932 SemaRef.BuildBinOp(CurScope, InitLoc, BO_Assign, IV.get(), CombRHS);
9934 SemaRef.ActOnFinishFullExpr(CombInit.get(), /*DiscardedValue*/ false);
9949 SemaRef
9951 SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get())
9954 SemaRef.ActOnFinishFullExpr(BoundUB, /*DiscardedValue*/ false).get();
9961 ? SemaRef.BuildBinOp(CurScope, CondLoc,
9964 : SemaRef.BuildBinOp(CurScope, CondLoc, BO_LT, IV.get(),
9968 CombDistCond = SemaRef.BuildBinOp(CurScope, CondLoc, BO_LT, IV.get(),
9977 SemaRef
9980 SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get())
9983 SemaRef.ActOnFinishFullExpr(BoundCombUB, /*DiscardedValue*/ false)
9987 SemaRef.BuildBinOp(CurScope, CondLoc, UseStrictCompare ? BO_LT : BO_LE,
9993 SemaRef.BuildBinOp(CurScope, IncLoc, BO_Add, IV.get(),
9994 SemaRef.ActOnIntegerConstant(IncLoc, 1).get());
9997 Inc = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Assign, IV.get(), Inc.get());
9998 Inc = SemaRef.ActOnFinishFullExpr(Inc.get(), /*DiscardedValue*/ false);
10012 NextLB = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Add, LB.get(), ST.get());
10017 SemaRef.BuildBinOp(CurScope, IncLoc, BO_Assign, LB.get(), NextLB.get());
10019 SemaRef.ActOnFinishFullExpr(NextLB.get(), /*DiscardedValue*/ false);
10023 NextUB = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Add, UB.get(), ST.get());
10028 SemaRef.BuildBinOp(CurScope, IncLoc, BO_Assign, UB.get(), NextUB.get());
10030 SemaRef.ActOnFinishFullExpr(NextUB.get(), /*DiscardedValue*/ false);
10035 SemaRef.BuildBinOp(CurScope, IncLoc, BO_Add, CombLB.get(), ST.get());
10039 CombNextLB = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Assign, CombLB.get(),
10041 CombNextLB = SemaRef.ActOnFinishFullExpr(CombNextLB.get(),
10047 SemaRef.BuildBinOp(CurScope, IncLoc, BO_Add, CombUB.get(), ST.get());
10051 CombNextUB = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Assign, CombUB.get(),
10053 CombNextUB = SemaRef.ActOnFinishFullExpr(CombNextUB.get(),
10067 DistCond = SemaRef.BuildBinOp(
10072 SemaRef.BuildBinOp(CurScope, DistIncLoc, BO_Add, IV.get(), ST.get());
10074 DistInc = SemaRef.BuildBinOp(CurScope, DistIncLoc, BO_Assign, IV.get(),
10077 SemaRef.ActOnFinishFullExpr(DistInc.get(), /*DiscardedValue*/ false);
10084 if (!SemaRef.Context.hasSameType(UB.get()->getType(),
10086 NewPrevUB = SemaRef.BuildCStyleCastExpr(
10088 SemaRef.Context.getTrivialTypeSourceInfo(UB.get()->getType()),
10093 ExprResult IsUBGreater = SemaRef.BuildBinOp(CurScope, DistEUBLoc, BO_GT,
10095 ExprResult CondOp = SemaRef.ActOnConditionalOp(
10097 PrevEUB = SemaRef.BuildBinOp(CurScope, DistIncLoc, BO_Assign, UB.get(),
10100 SemaRef.ActOnFinishFullExpr(PrevEUB.get(), /*DiscardedValue*/ false);
10108 SemaRef
10111 SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get())
10114 SemaRef.ActOnFinishFullExpr(BoundPrevUB, /*DiscardedValue*/ false)
10118 SemaRef.BuildBinOp(CurScope, CondLoc, UseStrictCompare ? BO_LT : BO_LE,
10154 ExprResult Prod = SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get();
10156 Prod = SemaRef.BuildBinOp(CurScope, UpdLoc, BO_Mul, Prod.get(),
10164 SemaRef.BuildBinOp(CurScope, UpdLoc, BO_Div, Acc.get(), Prod.get());
10177 Prod = SemaRef.BuildBinOp(CurScope, UpdLoc, BO_Mul, Iter.get(),
10181 Acc = SemaRef.BuildBinOp(CurScope, UpdLoc, BO_Sub, Acc.get(), Prod.get());
10186 SemaRef, VD, IS.CounterVar->getType(), IS.CounterVar->getExprLoc(),
10189 buildCounterInit(SemaRef, CurScope, UpdLoc, CounterVar,
10196 SemaRef, CurScope, UpdLoc, CounterVar, IS.CounterInit, Iter,
10205 buildCounterUpdate(SemaRef, CurScope, UpdLoc, CounterVar,
10241 Built.CalcLastIteration = SemaRef
10347 checkGenericLoopLastprivate(SemaRef, Clauses, OMPD_loop, DSAStack)) {
10368 AStmt, SemaRef, *DSAStack, VarsWithImplicitDSA, B);
10372 if (finishLinearClauses(SemaRef, Clauses, B, DSAStack))
10375 if (checkSimdlenSafelenSpecified(SemaRef, Clauses))
10378 SemaRef.setFunctionHasBranchProtectedScope();
10400 AStmt, SemaRef, *DSAStack, VarsWithImplicitDSA, B);
10404 if (finishLinearClauses(SemaRef, Clauses, B, DSAStack))
10426 getOrderedNumberExpr(Clauses), AStmt, SemaRef, *DSAStack,
10431 if (finishLinearClauses(SemaRef, Clauses, B, DSAStack))
10434 if (checkSimdlenSafelenSpecified(SemaRef, Clauses))
10437 SemaRef.setFunctionHasBranchProtectedScope();
10442 static bool checkSectionsDirective(Sema &SemaRef, OpenMPDirectiveKind DKind,
10460 SemaRef.Diag(SectionStmt->getBeginLoc(),
10469 SemaRef.Diag(AStmt->getBeginLoc(), diag::err_omp_sections_not_compound_stmt)
10480 if (checkSectionsDirective(SemaRef, OMPD_sections, AStmt, DSAStack))
10483 SemaRef.setFunctionHasBranchProtectedScope();
10496 SemaRef.setFunctionHasBranchProtectedScope();
10527 if (!SemaRef.CurContext->isDependentContext()) {
10555 SemaRef.setFunctionHasBranchProtectedScope();
10595 if (checkGenericLoopLastprivate(SemaRef, Clauses, OMPD_loop, DSAStack))
10598 setBranchProtectedScope(SemaRef, OMPD_loop, AStmt);
10604 AStmt, SemaRef, *DSAStack, VarsWithImplicitDSA, B);
10608 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) &&
10624 if (checkGenericLoopLastprivate(SemaRef, Clauses, OMPD_teams_loop, DSAStack))
10627 CapturedStmt *CS = setBranchProtectedScope(SemaRef, OMPD_teams_loop, AStmt);
10633 /*OrderedLoopCountExpr=*/nullptr, CS, SemaRef, *DSAStack,
10638 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) &&
10656 if (checkGenericLoopLastprivate(SemaRef, Clauses, OMPD_target_teams_loop,
10661 setBranchProtectedScope(SemaRef, OMPD_target_teams_loop, AStmt);
10667 /*OrderedLoopCountExpr=*/nullptr, CS, SemaRef, *DSAStack,
10672 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) &&
10677 teamsLoopCanBeParallelFor(AStmt, SemaRef));
10689 if (checkGenericLoopLastprivate(SemaRef, Clauses, OMPD_parallel_loop,
10694 setBranchProtectedScope(SemaRef, OMPD_parallel_loop, AStmt);
10700 /*OrderedLoopCountExpr=*/nullptr, CS, SemaRef, *DSAStack,
10705 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) &&
10721 if (checkGenericLoopLastprivate(SemaRef, Clauses, OMPD_target_parallel_loop,
10726 setBranchProtectedScope(SemaRef, OMPD_target_parallel_loop, AStmt);
10732 /*OrderedLoopCountExpr=*/nullptr, CS, SemaRef, *DSAStack,
10737 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) &&
10753 SemaRef.setFunctionHasBranchProtectedScope();
10782 SemaRef.setFunctionHasBranchProtectedScope();
10794 SemaRef.setFunctionHasBranchProtectedScope();
10848 SemaRef.setFunctionHasBranchProtectedScope();
10863 setBranchProtectedScope(SemaRef, OMPD_parallel_for, AStmt);
10870 getOrderedNumberExpr(Clauses), AStmt, SemaRef, *DSAStack,
10875 if (finishLinearClauses(SemaRef, Clauses, B, DSAStack))
10889 setBranchProtectedScope(SemaRef, OMPD_parallel_for_simd, AStmt);
10896 getOrderedNumberExpr(Clauses), AStmt, SemaRef, *DSAStack,
10901 if (finishLinearClauses(SemaRef, Clauses, B, DSAStack))
10904 if (checkSimdlenSafelenSpecified(SemaRef, Clauses))
10917 setBranchProtectedScope(SemaRef, OMPD_parallel_master, AStmt);
10930 setBranchProtectedScope(SemaRef, OMPD_parallel_masked, AStmt);
10940 if (checkSectionsDirective(SemaRef, OMPD_parallel_sections, AStmt, DSAStack))
10943 SemaRef.setFunctionHasBranchProtectedScope();
10983 if (checkMutuallyExclusiveClauses(SemaRef, Clauses,
10987 setBranchProtectedScope(SemaRef, OMPD_task, AStmt);
11061 SemaRef.setFunctionHasBranchProtectedScope();
11268 SemaRef.setFunctionHasBranchProtectedScope();
11306 Sema &SemaRef;
11327 OpenMPAtomicUpdateChecker(Sema &SemaRef)
11328 : SemaRef(SemaRef), X(nullptr), E(nullptr), UpdateExpr(nullptr),
11379 X->IgnoreParenImpCasts()->Profile(XId, SemaRef.getASTContext(),
11381 LHS->IgnoreParenImpCasts()->Profile(LHSId, SemaRef.getASTContext(),
11383 RHS->IgnoreParenImpCasts()->Profile(RHSId, SemaRef.getASTContext(),
11418 SemaRef.Diag(ErrorLoc, DiagId) << ErrorRange;
11419 SemaRef.Diag(NoteLoc, NoteId) << ErrorFound << NoteRange;
11422 if (SemaRef.CurContext->isDependentContext())
11466 E = SemaRef.ActOnIntegerConstant(OpLoc, /*uint64_t Val=*/1).get();
11495 SemaRef.Diag(ErrorLoc, DiagId) << ErrorRange;
11496 SemaRef.Diag(NoteLoc, NoteId) << ErrorFound << NoteRange;
11499 if (SemaRef.CurContext->isDependentContext())
11505 auto *OVEX = new (SemaRef.getASTContext())
11507 auto *OVEExpr = new (SemaRef.getASTContext())
11510 SemaRef.CreateBuiltinBinOp(OpLoc, Op, IsXLHSInRHSPart ? OVEX : OVEExpr,
11514 Update = SemaRef.PerformImplicitConversion(Update.get(), X->getType(),
12537 if (SemaRef.CurContext->isDependentContext())
12599 if (SemaRef.CurContext->isDependentContext())
12610 OpenMPAtomicUpdateChecker Checker(SemaRef);
12618 if (!SemaRef.CurContext->isDependentContext()) {
12648 OpenMPAtomicUpdateChecker Checker(SemaRef);
12673 if (SemaRef.CurContext->isDependentContext())
12702 OpenMPAtomicUpdateChecker Checker(SemaRef);
12709 if (IsUpdateExprFound && !SemaRef.CurContext->isDependentContext()) {
12740 !SemaRef.CurContext->isDependentContext()) {
12837 if (SemaRef.CurContext->isDependentContext())
12842 OpenMPAtomicCompareCaptureChecker Checker(SemaRef);
12862 OpenMPAtomicCompareChecker Checker(SemaRef);
12900 SemaRef.setFunctionHasBranchProtectedScope();
12914 CapturedStmt *CS = setBranchProtectedScope(SemaRef, OMPD_target, AStmt);
12965 setBranchProtectedScope(SemaRef, OMPD_target_parallel, AStmt);
12979 setBranchProtectedScope(SemaRef, OMPD_target_parallel_for, AStmt);
12986 getOrderedNumberExpr(Clauses), CS, SemaRef, *DSAStack,
12991 if (finishLinearClauses(SemaRef, Clauses, B, DSAStack))
13057 SemaRef.setFunctionHasBranchProtectedScope();
13069 setBranchProtectedScope(SemaRef, OMPD_target_enter_data, AStmt);
13089 setBranchProtectedScope(SemaRef, OMPD_target_exit_data, AStmt);
13109 setBranchProtectedScope(SemaRef, OMPD_target_update, AStmt);
13136 setBranchProtectedScope(SemaRef, OMPD_teams, AStmt);
13214 /*OrderedLoopCountExpr=*/nullptr, AStmt, SemaRef,
13219 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) &&
13225 if (checkMutuallyExclusiveClauses(SemaRef, Clauses,
13231 if (checkReductionClauseWithNogroup(SemaRef, Clauses))
13234 SemaRef.setFunctionHasBranchProtectedScope();
13252 /*OrderedLoopCountExpr=*/nullptr, AStmt, SemaRef,
13257 if (finishLinearClauses(SemaRef, Clauses, B, DSAStack))
13263 if (checkMutuallyExclusiveClauses(SemaRef, Clauses,
13269 if (checkReductionClauseWithNogroup(SemaRef, Clauses))
13271 if (checkSimdlenSafelenSpecified(SemaRef, Clauses))
13274 SemaRef.setFunctionHasBranchProtectedScope();
13291 /*OrderedLoopCountExpr=*/nullptr, AStmt, SemaRef,
13296 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) &&
13302 if (checkMutuallyExclusiveClauses(SemaRef, Clauses,
13308 if (checkReductionClauseWithNogroup(SemaRef, Clauses))
13311 SemaRef.setFunctionHasBranchProtectedScope();
13329 /*OrderedLoopCountExpr=*/nullptr, AStmt, SemaRef,
13334 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) &&
13340 if (checkMutuallyExclusiveClauses(SemaRef, Clauses,
13346 if (checkReductionClauseWithNogroup(SemaRef, Clauses))
13349 SemaRef.setFunctionHasBranchProtectedScope();
13367 /*OrderedLoopCountExpr=*/nullptr, AStmt, SemaRef,
13372 if (finishLinearClauses(SemaRef, Clauses, B, DSAStack))
13378 if (checkMutuallyExclusiveClauses(SemaRef, Clauses,
13384 if (checkReductionClauseWithNogroup(SemaRef, Clauses))
13386 if (checkSimdlenSafelenSpecified(SemaRef, Clauses))
13389 SemaRef.setFunctionHasBranchProtectedScope();
13406 /*OrderedLoopCountExpr=*/nullptr, AStmt, SemaRef,
13411 if (finishLinearClauses(SemaRef, Clauses, B, DSAStack))
13417 if (checkMutuallyExclusiveClauses(SemaRef, Clauses,
13423 if (checkReductionClauseWithNogroup(SemaRef, Clauses))
13425 if (checkSimdlenSafelenSpecified(SemaRef, Clauses))
13428 SemaRef.setFunctionHasBranchProtectedScope();
13440 setBranchProtectedScope(SemaRef, OMPD_parallel_master_taskloop, AStmt);
13447 /*OrderedLoopCountExpr=*/nullptr, CS, SemaRef, *DSAStack,
13452 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) &&
13458 if (checkMutuallyExclusiveClauses(SemaRef, Clauses,
13464 if (checkReductionClauseWithNogroup(SemaRef, Clauses))
13479 setBranchProtectedScope(SemaRef, OMPD_parallel_masked_taskloop, AStmt);
13486 /*OrderedLoopCountExpr=*/nullptr, CS, SemaRef, *DSAStack,
13491 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) &&
13497 if (checkMutuallyExclusiveClauses(SemaRef, Clauses,
13503 if (checkReductionClauseWithNogroup(SemaRef, Clauses))
13518 SemaRef, OMPD_parallel_master_taskloop_simd, AStmt);
13525 /*OrderedLoopCountExpr=*/nullptr, CS, SemaRef, *DSAStack,
13530 if (finishLinearClauses(SemaRef, Clauses, B, DSAStack))
13536 if (checkMutuallyExclusiveClauses(SemaRef, Clauses,
13542 if (checkReductionClauseWithNogroup(SemaRef, Clauses))
13544 if (checkSimdlenSafelenSpecified(SemaRef, Clauses))
13558 SemaRef, OMPD_parallel_masked_taskloop_simd, AStmt);
13565 /*OrderedLoopCountExpr=*/nullptr, CS, SemaRef, *DSAStack,
13570 if (finishLinearClauses(SemaRef, Clauses, B, DSAStack))
13576 if (checkMutuallyExclusiveClauses(SemaRef, Clauses,
13582 if (checkReductionClauseWithNogroup(SemaRef, Clauses))
13584 if (checkSimdlenSafelenSpecified(SemaRef, Clauses))
13607 SemaRef, *DSAStack, VarsWithImplicitDSA, B);
13611 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) &&
13614 SemaRef.setFunctionHasBranchProtectedScope();
13628 setBranchProtectedScope(SemaRef, OMPD_distribute_parallel_for, AStmt);
13635 nullptr /*ordered not a clause on distribute*/, CS, SemaRef, *DSAStack,
13640 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) &&
13655 SemaRef, OMPD_distribute_parallel_for_simd, AStmt);
13662 nullptr /*ordered not a clause on distribute*/, CS, SemaRef, *DSAStack,
13667 if (finishLinearClauses(SemaRef, Clauses, B, DSAStack))
13670 if (checkSimdlenSafelenSpecified(SemaRef, Clauses))
13684 setBranchProtectedScope(SemaRef, OMPD_distribute_simd, AStmt);
13692 SemaRef, *DSAStack, VarsWithImplicitDSA, B);
13696 if (finishLinearClauses(SemaRef, Clauses, B, DSAStack))
13699 if (checkSimdlenSafelenSpecified(SemaRef, Clauses))
13713 setBranchProtectedScope(SemaRef, OMPD_target_parallel_for_simd, AStmt);
13720 getOrderedNumberExpr(Clauses), CS, SemaRef, *DSAStack,
13725 if (finishLinearClauses(SemaRef, Clauses, B, DSAStack))
13728 if (checkSimdlenSafelenSpecified(SemaRef, Clauses))
13741 CapturedStmt *CS = setBranchProtectedScope(SemaRef, OMPD_target_simd, AStmt);
13748 getOrderedNumberExpr(Clauses), CS, SemaRef, *DSAStack,
13753 if (finishLinearClauses(SemaRef, Clauses, B, DSAStack))
13756 if (checkSimdlenSafelenSpecified(SemaRef, Clauses))
13770 setBranchProtectedScope(SemaRef, OMPD_teams_distribute, AStmt);
13778 SemaRef, *DSAStack, VarsWithImplicitDSA, B);
13782 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) &&
13798 setBranchProtectedScope(SemaRef, OMPD_teams_distribute_simd, AStmt);
13805 nullptr /*ordered not a clause on distribute*/, CS, SemaRef, *DSAStack,
13810 if (finishLinearClauses(SemaRef, Clauses, B, DSAStack))
13813 if (checkSimdlenSafelenSpecified(SemaRef, Clauses))
13829 SemaRef, OMPD_teams_distribute_parallel_for_simd, AStmt);
13836 nullptr /*ordered not a clause on distribute*/, CS, SemaRef, *DSAStack,
13841 if (finishLinearClauses(SemaRef, Clauses, B, DSAStack))
13844 if (checkSimdlenSafelenSpecified(SemaRef, Clauses))
13860 SemaRef, OMPD_teams_distribute_parallel_for, AStmt);
13867 nullptr /*ordered not a clause on distribute*/, CS, SemaRef, *DSAStack,
13873 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) &&
13889 setBranchProtectedScope(SemaRef, OMPD_target_teams, AStmt);
13915 setBranchProtectedScope(SemaRef, OMPD_target_teams_distribute, AStmt);
13922 nullptr /*ordered not a clause on distribute*/, CS, SemaRef, *DSAStack,
13927 assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) &&
13941 SemaRef, OMPD_target_teams_distribute_parallel_for, AStmt);
13948 nullptr /*ordered not a clause on distribute*/, CS, SemaRef, *DSAStack,
13953 if (finishLinearClauses(SemaRef, Clauses, B, DSAStack))
13968 SemaRef, OMPD_target_teams_distribute_parallel_for_simd, AStmt);
13977 SemaRef, *DSAStack, VarsWithImplicitDSA, B);
13981 if (finishLinearClauses(SemaRef, Clauses, B, DSAStack))
13984 if (checkSimdlenSafelenSpecified(SemaRef, Clauses))
13998 SemaRef, OMPD_target_teams_distribute_simd, AStmt);
14005 nullptr /*ordered not a clause on distribute*/, CS, SemaRef, *DSAStack,
14010 if (finishLinearClauses(SemaRef, Clauses, B, DSAStack))
14013 if (checkSimdlenSafelenSpecified(SemaRef, Clauses))
14031 checkOpenMPLoop(Kind, nullptr, nullptr, CurStmt, SemaRef, *DSAStack,
14130 Scope *CurScope = SemaRef.getCurScope();
14152 if (SemaRef.CurContext->isDependentContext())
14168 CaptureVars CopyTransformer(SemaRef);
14190 buildVarDecl(SemaRef, {}, CntTy, FloorCntName, nullptr, OrigCntVar);
14204 &SemaRef.PP.getIdentifierTable().get(TileCntName));
14215 auto MakeDimTileSize = [&SemaRef = this->SemaRef, &CopyTransformer, &Context,
14243 Expr *Cond = AssertSuccess(SemaRef.BuildBinOp(
14264 auto MakeTileIVRef = [&SemaRef = this->SemaRef, &TileIndVars, I, IVTy,
14266 return buildDeclRefExpr(SemaRef, TileIndVars[I], IVTy,
14269 auto MakeFloorIVRef = [&SemaRef = this->SemaRef, &FloorIndVars, I, IVTy,
14271 return buildDeclRefExpr(SemaRef, FloorIndVars[I], IVTy,
14276 SemaRef.AddInitializerToDecl(
14277 TileIndVars[I], SemaRef.DefaultLvalueConversion(MakeFloorIVRef()).get(),
14289 SemaRef.BuildBinOp(CurScope, LoopHelper.Cond->getExprLoc(), BO_Add,
14294 SemaRef.BuildBinOp(CurScope, LoopHelper.Cond->getExprLoc(), BO_LT,
14298 ExprResult MinTileAndIterSpace = SemaRef.ActOnConditionalOp(
14304 SemaRef.BuildBinOp(CurScope, LoopHelper.Cond->getExprLoc(), BO_LT,
14310 ExprResult IncrStmt = SemaRef.BuildUnaryOp(
14354 auto MakeFloorIVRef = [&SemaRef = this->SemaRef, &FloorIndVars, I, IVTy,
14356 return buildDeclRefExpr(SemaRef, FloorIndVars[I], IVTy,
14361 SemaRef.AddInitializerToDecl(
14363 SemaRef.ActOnIntegerConstant(LoopHelper.Init->getExprLoc(), 0).get(),
14374 SemaRef.BuildBinOp(CurScope, LoopHelper.Cond->getExprLoc(), BO_LT,
14381 SemaRef.BuildBinOp(CurScope, LoopHelper.Inc->getExprLoc(), BO_AddAssign,
14402 Scope *CurScope = SemaRef.getCurScope();
14407 if (checkMutuallyExclusiveClauses(SemaRef, Clauses,
14430 if (SemaRef.CurContext->isDependentContext())
14546 buildVarDecl(SemaRef, {}, IVTy, OuterIVName, nullptr, OrigVar);
14548 return buildDeclRefExpr(SemaRef, OuterIVDecl, IVTy, OrigVarLoc);
14554 InnerIVDecl->setDeclName(&SemaRef.PP.getIdentifierTable().get(InnerIVName));
14556 return buildDeclRefExpr(SemaRef, InnerIVDecl, IVTy, OrigVarLoc);
14561 CaptureVars CopyTransformer(SemaRef);
14568 ExprResult LValueConv = SemaRef.DefaultLvalueConversion(MakeOuterRef());
14569 SemaRef.AddInitializerToDecl(InnerIVDecl, LValueConv.get(),
14584 SemaRef.BuildBinOp(CurScope, LoopHelper.Cond->getExprLoc(), BO_Add,
14589 SemaRef.BuildBinOp(CurScope, LoopHelper.Cond->getExprLoc(), BO_LT,
14594 SemaRef.BuildBinOp(CurScope, LoopHelper.Cond->getExprLoc(), BO_LT,
14599 SemaRef.BuildBinOp(CurScope, LoopHelper.Cond->getExprLoc(), BO_LAnd,
14605 ExprResult InnerIncr = SemaRef.BuildUnaryOp(
14643 SemaRef.AddInitializerToDecl(
14645 SemaRef.ActOnIntegerConstant(LoopHelper.Init->getExprLoc(), 0).get(),
14654 SemaRef.BuildBinOp(CurScope, LoopHelper.Cond->getExprLoc(), BO_LT,
14661 SemaRef.BuildBinOp(CurScope, LoopHelper.Inc->getExprLoc(), BO_AddAssign,
14681 Scope *CurScope = SemaRef.getCurScope();
14698 if (SemaRef.CurContext->isDependentContext())
14769 CaptureVars CopyTransformer(SemaRef);
14777 buildVarDecl(SemaRef, {}, IVTy, ForwardIVName, nullptr, OrigVar);
14778 auto MakeForwardRef = [&SemaRef = this->SemaRef, ForwardIVDecl, IVTy,
14780 return buildDeclRefExpr(SemaRef, ForwardIVDecl, IVTy, OrigVarLoc);
14787 &SemaRef.PP.getIdentifierTable().get(ReversedIVName));
14795 SemaRef.AddInitializerToDecl(ForwardIVDecl, Zero, /*DirectInit=*/false);
14806 SemaRef.BuildBinOp(CurScope, LoopHelper.Cond->getExprLoc(), BO_LT,
14815 ExprResult Incr = SemaRef.BuildUnaryOp(CurScope, LoopHelper.Inc->getExprLoc(),
14826 ExprResult Minus = SemaRef.BuildBinOp(CurScope, TransformLoc, BO_Sub,
14830 Minus = SemaRef.BuildBinOp(CurScope, TransformLoc, BO_Sub, Minus.get(),
14838 SemaRef.AddInitializerToDecl(ReversedIVDecl, Minus.get(),
14868 DeclContext *CurContext = SemaRef.CurContext;
14869 Scope *CurScope = SemaRef.getCurScope();
14920 CaptureVars CopyTransformer(SemaRef);
14958 &SemaRef.PP.getIdentifierTable().get(PermutedCntName));
14961 return buildDeclRefExpr(SemaRef, PermutedCntDecl, IVTy, OrigVarLoc);
14968 ExprResult Zero = SemaRef.ActOnIntegerConstant(OrigVarLoc, 0);
14971 SemaRef.AddInitializerToDecl(PermutedCntDecl, Zero.get(),
14984 SemaRef.BuildBinOp(CurScope, SourceHelper.Cond->getExprLoc(), BO_LT,
14993 ExprResult IncrStmt = SemaRef.BuildUnaryOp(
15286 ExprResult Val = SemaRef.CheckBooleanCondition(StartLoc, Condition);
15296 !SemaRef.CurContext->isDependentContext()) {
15297 ValExpr = SemaRef.MakeFullExpr(ValExpr).get();
15299 ValExpr = tryBuildCapture(SemaRef, ValExpr, Captures).get();
15319 ExprResult Val = SemaRef.CheckBooleanCondition(StartLoc, Condition);
15323 ValExpr = SemaRef.MakeFullExpr(Val.get()).get();
15329 !SemaRef.CurContext->isDependentContext()) {
15330 ValExpr = SemaRef.MakeFullExpr(ValExpr).get();
15332 ValExpr = tryBuildCapture(SemaRef, ValExpr, Captures).get();
15383 return SemaRef.PerformContextualImplicitConversion(Loc, Op, ConvertDiagnoser);
15387 isNonNegativeIntegerValue(Expr *&ValExpr, Sema &SemaRef, OpenMPClauseKind CKind,
15396 SemaRef.OpenMP().PerformOpenMPImplicitIntegerConversion(Loc, ValExpr);
15403 ValExpr->getIntegerConstantExpr(SemaRef.Context)) {
15407 SemaRef.Diag(Loc, diag::err_omp_negative_expression_in_clause)
15416 getOpenMPCaptureRegionForClause(DKind, CKind, SemaRef.LangOpts.OpenMP);
15418 !SemaRef.CurContext->isDependentContext()) {
15419 ValExpr = SemaRef.MakeFullExpr(ValExpr).get();
15421 ValExpr = tryBuildCapture(SemaRef, ValExpr, Captures).get();
15422 *HelperValStmt = buildPreInits(SemaRef.Context, Captures);
15437 if (!isNonNegativeIntegerValue(ValExpr, SemaRef, OMPC_num_threads,
15445 !SemaRef.CurContext->isDependentContext()) {
15446 ValExpr = SemaRef.MakeFullExpr(ValExpr).get();
15448 ValExpr = tryBuildCapture(SemaRef, ValExpr, Captures).get();
15477 ICE = SemaRef.VerifyIntegerConstantExpression(E, &Result, Diagnoser,
15480 ICE = SemaRef.VerifyIntegerConstantExpression(E, &Result,
15595 if (!findOMPAllocatorHandleT(SemaRef, A->getExprLoc(), DSAStack))
15598 ExprResult Allocator = SemaRef.DefaultLvalueConversion(A);
15601 Allocator = SemaRef.PerformImplicitConversion(
15990 bool IsValid = isNonNegativeIntegerValue(SizeExpr, SemaRef, OMPC_sizes,
16239 if (checkScheduleModifiers(SemaRef, M1, M2, M1Loc, M2Loc) ||
16240 checkScheduleModifiers(SemaRef, M2, M1, M2Loc, M1Loc))
16309 !SemaRef.CurContext->isDependentContext()) {
16310 ValExpr = SemaRef.MakeFullExpr(ValExpr).get();
16312 ValExpr = tryBuildCapture(SemaRef, ValExpr, Captures).get();
16660 DeclResult = getPrivateItem(SemaRef, E, ELoc, ERange);
16663 DeclResult = getPrivateItem(SemaRef, E, ELoc, ERange);
16666 DeclResult = getPrivateItem(SemaRef, E, ELoc, ERange);
16682 static bool isValidInteropVariable(Sema &SemaRef, Expr *InteropVarExpr,
16689 getPrivateItem(SemaRef, RefExpr, ELoc, ERange,
16703 LookupResult Result(SemaRef, &SemaRef.Context.Idents.get("omp_interop_t"),
16705 if (SemaRef.LookupName(Result, SemaRef.getCurScope())) {
16717 SemaRef.Diag(VarLoc, diag::err_omp_implied_type_not_found)
16723 if (!SemaRef.Context.hasSameType(InteropType, VarType)) {
16724 SemaRef.Diag(VarLoc, diag::err_omp_interop_variable_wrong_type);
16731 isConstNotMutableType(SemaRef, InteropVarExpr->getType())) {
16732 SemaRef.Diag(VarLoc, diag::err_omp_interop_variable_expected)
16743 if (!isValidInteropVariable(SemaRef, InteropVar, VarLoc, OMPC_init))
16770 if (!isValidInteropVariable(SemaRef, InteropVar, VarLoc, OMPC_use))
16790 !isValidInteropVariable(SemaRef, InteropVar, VarLoc, OMPC_destroy))
16807 ExprResult Val = SemaRef.CheckBooleanCondition(StartLoc, Condition);
16811 ValExpr = SemaRef.MakeFullExpr(Val.get()).get();
16817 !SemaRef.CurContext->isDependentContext()) {
16818 ValExpr = SemaRef.MakeFullExpr(ValExpr).get();
16820 ValExpr = tryBuildCapture(SemaRef, ValExpr, Captures).get();
16839 ExprResult Val = SemaRef.CheckBooleanCondition(StartLoc, Condition);
16843 ValExpr = SemaRef.MakeFullExpr(Val.get()).get();
16849 !SemaRef.CurContext->isDependentContext()) {
16850 ValExpr = SemaRef.MakeFullExpr(ValExpr).get();
16852 ValExpr = tryBuildCapture(SemaRef, ValExpr, Captures).get();
16872 !SemaRef.CurContext->isDependentContext()) {
16873 ValExpr = SemaRef.MakeFullExpr(ValExpr).get();
16875 ValExpr = tryBuildCapture(SemaRef, ValExpr, Captures).get();
17081 ExprResult Res = SemaRef.BuildDeclRefExpr(
17086 Res = SemaRef.CreateBuiltinUnaryOp(Loc, UO_Deref, Res.get());
17091 Res = SemaRef.DefaultLvalueConversion(Res.get());
17111 auto Res = getPrivateItem(SemaRef, SimpleRefExpr, ELoc, ERange);
17127 if (SemaRef.RequireCompleteType(ELoc, Type,
17140 if (rejectConstNotMutableType(SemaRef, D, Type, OMPC_private, ELoc))
17154 reportOriginalDsa(SemaRef, DSAStack, D, DVar);
17196 reportOriginalDsa(SemaRef, DSAStack, D, DVar);
17212 buildVarDecl(SemaRef, ELoc, Type, D->getName(),
17215 SemaRef.ActOnUninitializedDecl(VDPrivate);
17219 SemaRef, VDPrivate, RefExpr->getType().getUnqualifiedType(), ELoc);
17222 if (!VD && !SemaRef.CurContext->isDependentContext()) {
17226 Ref = buildDeclRefExpr(SemaRef, VD, VD->getType().getNonReferenceType(),
17229 Ref = buildCapture(SemaRef, D, SimpleRefExpr, /*WithInit=*/false);
17233 Vars.push_back((VD || SemaRef.CurContext->isDependentContext())
17263 auto Res = getPrivateItem(SemaRef, SimpleRefExpr, ELoc, ERange);
17281 if (SemaRef.RequireCompleteType(ELoc, Type,
17315 reportOriginalDsa(SemaRef, DSAStack, D, DVar);
17335 reportOriginalDsa(SemaRef, DSAStack, D, DVar);
17366 reportOriginalDsa(SemaRef, DSAStack, D, DVar);
17399 reportOriginalDsa(SemaRef, DSAStack, D, DVar);
17428 reportOriginalDsa(SemaRef, DSAStack, D, DVar);
17450 buildVarDecl(SemaRef, ELoc, Type, D->getName(),
17463 buildVarDecl(SemaRef, RefExpr->getExprLoc(), ElemType, D->getName());
17464 VDInitRefExpr = buildDeclRefExpr(SemaRef, VDInit, ElemType, ELoc);
17465 Expr *Init = SemaRef.DefaultLvalueConversion(VDInitRefExpr).get();
17467 VarDecl *VDInitTemp = buildVarDecl(SemaRef, RefExpr->getExprLoc(),
17473 InitializationSequence InitSeq(SemaRef, Entity, Kind, Init);
17474 ExprResult Result = InitSeq.Perform(SemaRef, Entity, Kind, Init);
17482 VarDecl *VDInit = buildVarDecl(SemaRef, RefExpr->getExprLoc(), Type,
17484 VDInitRefExpr = buildDeclRefExpr(SemaRef, VDInit, RefExpr->getType(),
17486 SemaRef.AddInitializerToDecl(
17487 VDPrivate, SemaRef.DefaultLvalueConversion(VDInitRefExpr).get(),
17497 SemaRef.CurContext->addDecl(VDPrivate);
17499 SemaRef, VDPrivate, RefExpr->getType().getUnqualifiedType(),
17502 if (!VD && !SemaRef.CurContext->isDependentContext()) {
17510 buildDeclRefExpr(SemaRef, VD, VD->getType().getNonReferenceType(),
17513 Ref = buildCapture(SemaRef, D, SimpleRefExpr, /*WithInit=*/true);
17520 Vars.push_back((VD || SemaRef.CurContext->isDependentContext())
17559 auto Res = getPrivateItem(SemaRef, SimpleRefExpr, ELoc, ERange);
17577 if (SemaRef.RequireCompleteType(ELoc, Type,
17590 if (rejectConstNotMutableType(SemaRef, D, Type, OMPC_lastprivate, ELoc))
17623 reportOriginalDsa(SemaRef, DSAStack, D, DVar);
17642 reportOriginalDsa(SemaRef, DSAStack, D, DVar);
17656 VarDecl *SrcVD = buildVarDecl(SemaRef, ERange.getBegin(),
17660 buildDeclRefExpr(SemaRef, SrcVD, Type.getUnqualifiedType(), ELoc);
17662 buildVarDecl(SemaRef, ERange.getBegin(), Type, ".lastprivate.dst",
17664 DeclRefExpr *PseudoDstExpr = buildDeclRefExpr(SemaRef, DstVD, Type, ELoc);
17667 ExprResult AssignmentOp = SemaRef.BuildBinOp(/*S=*/nullptr, ELoc, BO_Assign,
17671 AssignmentOp = SemaRef.ActOnFinishFullExpr(AssignmentOp.get(), ELoc,
17677 if (!VD && !SemaRef.CurContext->isDependentContext()) {
17681 Ref = buildCapture(SemaRef, D, SimpleRefExpr, /*WithInit=*/false);
17688 ExprResult RefRes = SemaRef.DefaultLvalueConversion(Ref);
17692 SemaRef.BuildBinOp(DSAStack->getCurScope(), ELoc, BO_Assign,
17697 SemaRef.IgnoredValueConversions(PostUpdateRes.get()).get());
17701 Vars.push_back((VD || SemaRef.CurContext->isDependentContext())
17716 buildPostUpdate(SemaRef, ExprPostUpdates));
17729 auto Res = getPrivateItem(SemaRef, SimpleRefExpr, ELoc, ERange);
17751 reportOriginalDsa(SemaRef, DSAStack, D, DVar);
17757 !SemaRef.CurContext->isDependentContext())
17758 Ref = buildCapture(SemaRef, D, SimpleRefExpr, /*WithInit=*/true);
17760 Vars.push_back((VD || !Ref || SemaRef.CurContext->isDependentContext())
17815 TransformExprToCaptures(Sema &SemaRef, ValueDecl *FieldDecl)
17816 : BaseTransform(SemaRef), Field(FieldDecl), CapturedExpr(nullptr) {}
17821 CapturedExpr = buildCapture(SemaRef, Field, E, /*WithInit=*/false);
17842 static NamedDecl *findAcceptableDecl(Sema &SemaRef, NamedDecl *D) {
17843 assert(!LookupResult::isVisible(SemaRef, D) && "not in slow case");
17851 if (LookupResult::isVisible(SemaRef, ND))
17859 argumentDependentLookup(Sema &SemaRef, const DeclarationNameInfo &Id,
17867 SemaRef.FindAssociatedClassesAndNamespaces(Loc, &OVE, AssociatedNamespaces,
17903 if (!SemaRef.isVisible(D)) {
17904 D = findAcceptableDecl(SemaRef, D);
17917 buildDeclareReductionRef(Sema &SemaRef, SourceLocation Loc, SourceRange Range,
17925 LookupResult Lookup(SemaRef, ReductionId, Sema::LookupOMPReductionName);
17927 while (S && SemaRef.LookupParsedName(Lookup, S, &ReductionIdScopeSpec,
17951 if (SemaRef.CurContext->isDependentContext() || Ty->isDependentType() ||
17969 SemaRef.Context, /*NamingClass=*/nullptr,
17970 ReductionIdScopeSpec.getWithLocInContext(SemaRef.Context), ReductionId,
17987 LookupResult Lookup(SemaRef, ReductionId, Sema::LookupOMPReductionName);
17992 if (SemaRef.isCompleteType(Loc, Ty) || TyRec->isBeingDefined() ||
17995 SemaRef.LookupQualifiedName(Lookup, TyRec->getDecl());
18003 if (SemaRef.getLangOpts().CPlusPlus)
18004 argumentDependentLookup(SemaRef, ReductionId, Loc, Ty, Lookups);
18006 Lookups, [&SemaRef, Ty](ValueDecl *D) -> ValueDecl * {
18008 SemaRef.Context.hasSameType(D->getType(), Ty))
18012 return SemaRef.BuildDeclRefExpr(VD, VD->getType().getNonReferenceType(),
18014 if (SemaRef.getLangOpts().CPlusPlus) {
18016 Lookups, [&SemaRef, Ty, Loc](ValueDecl *D) -> ValueDecl * {
18018 SemaRef.IsDerivedFrom(Loc, Ty, D->getType()) &&
18025 if (SemaRef.IsDerivedFrom(Loc, Ty, VD->getType(), Paths)) {
18026 if (!Paths.isAmbiguous(SemaRef.Context.getCanonicalType(
18028 if (SemaRef.CheckBaseClassAccess(
18031 SemaRef.BuildBasePathArray(Paths, BasePath);
18032 return SemaRef.BuildDeclRefExpr(
18040 SemaRef.Diag(Loc, diag::err_omp_not_resolved_reduction_identifier)
18971 if (actOnOMPReductionKindClause(SemaRef, DSAStack, OMPC_reduction, VarList,
18984 buildPostUpdate(SemaRef, RD.ExprPostUpdates));
18993 if (actOnOMPReductionKindClause(SemaRef, DSAStack, OMPC_task_reduction,
19004 buildPostUpdate(SemaRef, RD.ExprPostUpdates));
19013 if (actOnOMPReductionKindClause(SemaRef, DSAStack, OMPC_in_reduction, VarList,
19024 buildPostUpdate(SemaRef, RD.ExprPostUpdates));
19043 if (SemaRef.RequireCompleteType(ELoc, Type,
19060 rejectConstNotMutableType(SemaRef, D, Type, OMPC_linear, ELoc))
19104 auto Res = getPrivateItem(SemaRef, SimpleRefExpr, ELoc, ERange);
19126 reportOriginalDsa(SemaRef, DSAStack, D, DVar);
19136 buildVarDecl(SemaRef, ELoc, Type, D->getName(),
19139 DeclRefExpr *PrivateRef = buildDeclRefExpr(SemaRef, Private, Type, ELoc);
19141 VarDecl *Init = buildVarDecl(SemaRef, ELoc, Type, ".linear.start");
19144 if (!VD && !SemaRef.CurContext->isDependentContext()) {
19145 Ref = buildCapture(SemaRef, D, SimpleRefExpr, /*WithInit=*/false);
19149 ExprResult RefRes = SemaRef.DefaultLvalueConversion(Ref);
19153 SemaRef.BuildBinOp(DSAStack->getCurScope(), ELoc, BO_Assign,
19158 SemaRef.IgnoredValueConversions(PostUpdateRes.get()).get());
19166 SemaRef.AddInitializerToDecl(
19167 Init, SemaRef.DefaultLvalueConversion(InitExpr).get(),
19169 DeclRefExpr *InitRef = buildDeclRefExpr(SemaRef, Init, Type, ELoc);
19172 Vars.push_back((VD || SemaRef.CurContext->isDependentContext())
19195 buildVarDecl(SemaRef, StepLoc, StepExpr->getType(), ".linear.step");
19197 buildDeclRefExpr(SemaRef, SaveVar, StepExpr->getType(), StepLoc);
19198 ExprResult CalcStep = SemaRef.BuildBinOp(
19199 SemaRef.getCurScope(), StepLoc, BO_Assign, SaveRef.get(), StepExpr);
19201 SemaRef.ActOnFinishFullExpr(CalcStep.get(), /*DiscardedValue*/ false);
19221 buildPostUpdate(SemaRef, ExprPostUpdates));
19225 Expr *NumIterations, Sema &SemaRef,
19236 Step = SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get();
19247 auto Res = getPrivateItem(SemaRef, SimpleRefExpr, ELoc, ERange);
19261 SemaRef.Diag(ELoc,
19277 buildDeclRefExpr(SemaRef, cast<VarDecl>(DE->getDecl()),
19285 SemaRef, S, RefExpr->getExprLoc(), *CurPrivate, InitExpr, IV, Step,
19289 Update = SemaRef.ActOnFinishFullExpr(Update.get(), DE->getBeginLoc(),
19295 Final = SemaRef.BuildBinOp(
19297 SemaRef.DefaultLvalueConversion(*CurPrivate).get());
19300 Final = SemaRef.ActOnFinishFullExpr(Final.get(), DE->getBeginLoc(),
19336 auto Res = getPrivateItem(SemaRef, SimpleRefExpr, ELoc, ERange);
19376 Ref = buildCapture(SemaRef, D, SimpleRefExpr, /*WithInit=*/true);
19377 Vars.push_back(SemaRef
19462 buildVarDecl(SemaRef, DE->getBeginLoc(), ElemType.getUnqualifiedType(),
19465 SemaRef, SrcVD, ElemType.getUnqualifiedType(), DE->getExprLoc());
19467 buildVarDecl(SemaRef, DE->getBeginLoc(), ElemType, ".copyin.dst",
19470 buildDeclRefExpr(SemaRef, DstVD, ElemType, DE->getExprLoc());
19474 SemaRef.BuildBinOp(/*S=*/nullptr, DE->getExprLoc(), BO_Assign,
19479 SemaRef.ActOnFinishFullExpr(AssignmentOp.get(), DE->getExprLoc(),
19511 auto Res = getPrivateItem(SemaRef, SimpleRefExpr, ELoc, ERange);
19537 reportOriginalDsa(SemaRef, DSAStack, D, DVar);
19550 reportOriginalDsa(SemaRef, DSAStack, D, DVar);
19577 buildVarDecl(SemaRef, RefExpr->getBeginLoc(), Type, ".copyprivate.src",
19579 DeclRefExpr *PseudoSrcExpr = buildDeclRefExpr(SemaRef, SrcVD, Type, ELoc);
19581 buildVarDecl(SemaRef, RefExpr->getBeginLoc(), Type, ".copyprivate.dst",
19583 DeclRefExpr *PseudoDstExpr = buildDeclRefExpr(SemaRef, DstVD, Type, ELoc);
19584 ExprResult AssignmentOp = SemaRef.BuildBinOp(
19588 AssignmentOp = SemaRef.ActOnFinishFullExpr(AssignmentOp.get(), ELoc,
19598 : buildCapture(SemaRef, D, SimpleRefExpr, /*WithInit=*/false));
19647 bool OMPDependTFound = findOMPDependT(SemaRef, StartLoc, DSAStack);
19682 ProcessOpenMPDoacrossClauseCommon(Sema &SemaRef, bool IsSource,
19693 TotalDepCount = OrderedCountExpr->EvaluateKnownConstInt(SemaRef.Context);
19710 SemaRef.Diag(ELoc, diag::err_omp_depend_sink_unexpected_expr);
19722 if (SemaRef.CurContext->isDependentContext()) {
19753 auto Res = getPrivateItem(SemaRef, LHS, ELoc, ERange);
19763 SemaRef.Diag(OOLoc, diag::err_omp_depend_sink_expected_plus_minus);
19768 SemaRef.OpenMP().VerifyPositiveIntegerConstantInClause(
19773 if (!SemaRef.CurContext->isDependentContext() &&
19779 SemaRef.Diag(ELoc, diag::err_omp_depend_sink_expected_loop_iteration)
19782 SemaRef.Diag(ELoc, diag::err_omp_depend_sink_expected_loop_iteration)
19790 if (!SemaRef.CurContext->isDependentContext() && !IsSource &&
19794 SemaRef.Diag(EndLoc, diag::err_omp_depend_sink_expected_loop_iteration)
19858 SemaRef, DepKind == OMPC_DEPEND_source, VarList, DSAStack, EndLoc);
19876 OMPDependTFound = findOMPDependT(SemaRef, StartLoc, DSAStack,
19960 Sema::TentativeAnalysisScope Trap(SemaRef);
19961 Res = SemaRef.CreateBuiltinUnaryOp(ELoc, UO_AddrOf,
20014 ErrorFound = !isNonNegativeIntegerValue(ValExpr, SemaRef, OMPC_device,
20025 SemaRef.targetDiag(
20036 !SemaRef.CurContext->isDependentContext()) {
20037 ValExpr = SemaRef.MakeFullExpr(ValExpr).get();
20039 ValExpr = tryBuildCapture(SemaRef, ValExpr, Captures).get();
20048 static bool checkTypeMappable(SourceLocation SL, SourceRange SR, Sema &SemaRef,
20051 if (SemaRef.RequireCompleteType(SL, QTy, diag::err_incomplete_type))
20053 if (FullCheck && !SemaRef.CurContext->isDependentContext() &&
20054 !QTy.isTriviallyCopyableType(SemaRef.Context))
20055 SemaRef.Diag(SL, diag::warn_omp_non_trivial_type_mapped) << QTy << SR;
20062 static bool checkArrayExpressionDoesNotReferToWholeSize(Sema &SemaRef,
20086 if (!LowerBound->EvaluateAsInt(Result, SemaRef.getASTContext()))
20110 if (!Length->EvaluateAsInt(Result, SemaRef.getASTContext()))
20120 static bool checkArrayExpressionDoesNotReferToUnitySize(Sema &SemaRef,
20146 if (!Length->EvaluateAsInt(Result, SemaRef.getASTContext()))
20190 Sema &SemaRef;
20205 if (SemaRef.getLangOpts().OpenMP < 50) {
20206 SemaRef.Diag(ELoc,
20210 SemaRef.Diag(ELoc, diag::err_omp_non_lvalue_in_map_or_motion_clauses)
20242 SemaRef.Diag(ELoc, diag::err_omp_expected_access_to_data_field)
20258 SemaRef.Diag(ELoc, diag::err_omp_bit_fields_forbidden_in_clause)
20278 SemaRef.Diag(ELoc, diag::err_omp_union_type_not_allowed)
20305 SemaRef.Diag(ELoc, diag::err_omp_expected_base_var_name)
20315 if (checkArrayExpressionDoesNotReferToWholeSize(SemaRef, AE, E->getType()))
20321 AE->getIdx()->EvaluateAsInt(Result, SemaRef.getASTContext()) &&
20323 SemaRef.Diag(AE->getIdx()->getExprLoc(),
20325 SemaRef.Diag(AE->getIdx()->getExprLoc(),
20341 assert(!(SemaRef.getLangOpts().OpenMP < 50 && NoDiagnose) &&
20356 SemaRef.Diag(ELoc, diag::err_omp_expected_base_var_name)
20362 checkArrayExpressionDoesNotReferToWholeSize(SemaRef, OASE, CurType);
20364 checkArrayExpressionDoesNotReferToUnitySize(SemaRef, OASE, CurType);
20376 SemaRef.getLangOpts().OpenMP >= 50) {
20378 SemaRef.Diag(ELoc, diag::err_omp_section_length_undefined)
20387 SemaRef.Diag(ELoc,
20400 OASE->getLength()->EvaluateAsInt(ResultR, SemaRef.getASTContext()) &&
20402 SemaRef.Diag(OASE->getLength()->getExprLoc(),
20404 SemaRef.Diag(OASE->getLength()->getExprLoc(),
20409 SemaRef.getASTContext()) &&
20411 SemaRef.Diag(OASE->getLowerBound()->getExprLoc(),
20413 SemaRef.Diag(OASE->getLowerBound()->getExprLoc(),
20434 if (SemaRef.getLangOpts().OpenMP < 50 || !UO->isLValue() ||
20446 if (SemaRef.getLangOpts().OpenMP < 50 || !BO->getType()->isPointerType()) {
20490 Sema &SemaRef, OpenMPClauseKind CKind, OpenMPDirectiveKind DKind,
20493 : SemaRef(SemaRef), CKind(CKind), DKind(DKind), Components(Components),
20503 Sema &SemaRef, Expr *E,
20508 MapBaseChecker Checker(SemaRef, CKind, DKind, CurComponents, NoDiagnose, ELoc,
20512 if (SemaRef.getLangOpts().OpenMP >= 50 && !CurComponents.empty() &&
20523 SemaRef.Diag(ELoc, diag::err_array_section_does_not_specify_length)
20535 Sema &SemaRef, DSAStackTy *DSAS, const ValueDecl *VD, const Expr *E,
20557 [&IsEnclosedByDataEnvironmentExpr, &SemaRef, VD, CurrentRegionOnly, ELoc,
20562 if (CKind == Kind && SemaRef.LangOpts.OpenMP >= 50)
20593 SemaRef.Diag(CI->getAssociatedExpression()->getExprLoc(),
20596 SemaRef.Diag(SI->getAssociatedExpression()->getExprLoc(),
20629 SemaRef, SI->getAssociatedExpression(), Type))
20642 SemaRef.Diag(ELoc, diag::err_omp_map_shared_storage) << ERange;
20645 SemaRef.Diag(ELoc, diag::err_omp_once_referenced_in_target_update)
20648 SemaRef.Diag(RE->getExprLoc(), diag::note_used_here)
20681 SemaRef.Diag(
20685 SemaRef.Diag(RE->getExprLoc(), diag::note_used_here)
20694 SemaRef.Diag(DerivedLoc, diag::err_omp_same_pointer_dereferenced)
20696 SemaRef.Diag(RE->getExprLoc(), diag::note_used_here)
20729 SemaRef.Diag(ELoc, diag::err_omp_map_shared_storage) << ERange;
20732 SemaRef.Diag(ELoc, diag::err_omp_once_referenced_in_target_update)
20735 SemaRef.Diag(RE->getExprLoc(), diag::note_used_here)
20768 SemaRef.Diag(ELoc,
20771 SemaRef.Diag(EnclosingExpr->getExprLoc(), diag::note_used_here)
20781 static ExprResult buildUserDefinedMapperRef(Sema &SemaRef, Scope *S,
20795 LookupResult Lookup(SemaRef, MapperId, Sema::LookupOMPMapperName);
20798 while (S && SemaRef.LookupParsedName(Lookup, S, &MapperIdScopeSpec,
20820 if (SemaRef.CurContext->isDependentContext() || Type->isDependentType() ||
20836 SemaRef.Context, /*NamingClass=*/nullptr,
20837 MapperIdScopeSpec.getWithLocInContext(SemaRef.Context), MapperId,
20846 SemaRef.Diag(Loc, diag::err_omp_mapper_wrong_type);
20850 if (SemaRef.getLangOpts().CPlusPlus && !MapperIdScopeSpec.isSet())
20851 argumentDependentLookup(SemaRef, MapperId, Loc, Type, Lookups);
20854 Lookups, [&SemaRef, Type](ValueDecl *D) -> ValueDecl * {
20856 SemaRef.Context.hasSameType(D->getType(), Type))
20860 return SemaRef.BuildDeclRefExpr(VD, Type, VK_LValue, Loc);
20864 Lookups, [&SemaRef, Type, Loc](ValueDecl *D) -> ValueDecl * {
20866 SemaRef.IsDerivedFrom(Loc, Type, D->getType()) &&
20873 if (SemaRef.IsDerivedFrom(Loc, Type, VD->getType(), Paths)) {
20874 if (!Paths.isAmbiguous(SemaRef.Context.getCanonicalType(
20876 if (SemaRef.CheckBaseClassAccess(
20879 return SemaRef.BuildDeclRefExpr(VD, Type, VK_LValue, Loc);
20886 SemaRef.Diag(Loc, diag::err_omp_invalid_mapper)
20924 Sema &SemaRef, DSAStackTy *DSAS, OpenMPClauseKind CKind,
20940 auto &DeclNames = SemaRef.getASTContext().DeclarationNames;
20942 &SemaRef.getASTContext().Idents.get("default")));
20982 SemaRef, DSAS->getCurScope(), MapperIdScopeSpec, MapperId,
20996 if (SemaRef.getLangOpts().OpenMP < 50) {
20997 SemaRef.Diag(
21001 SemaRef.Diag(ELoc, diag::err_omp_non_lvalue_in_map_or_motion_clauses)
21013 checkMapClauseExpressionBase(SemaRef, SimpleExpr, CurComponents, CKind,
21026 SemaRef, DSAS->getCurScope(), MapperIdScopeSpec, MapperId,
21063 SemaRef.Diag(ELoc, diag::err_omp_threadprivate_in_clause)
21065 reportOriginalDsa(SemaRef, DSAS, VD, DVar);
21077 if (checkMapConflicts(SemaRef, DSAS, CurDeclaration, SimpleExpr,
21081 (SemaRef.getLangOpts().OpenMP <= 45 || StartLoc.isValid()) &&
21082 checkMapConflicts(SemaRef, DSAS, CurDeclaration, SimpleExpr,
21121 if (!checkTypeMappable(VE->getExprLoc(), VE->getSourceRange(), SemaRef,
21134 SemaRef.getLangOpts().OpenMP >= 52)) {
21135 SemaRef.Diag(StartLoc, diag::err_omp_invalid_map_type_for_directive)
21149 MapType == OMPC_MAP_delete || SemaRef.getLangOpts().OpenMP >= 52)) {
21150 SemaRef.Diag(StartLoc, diag::err_omp_invalid_map_type_for_directive)
21164 SemaRef.Diag(StartLoc,
21180 SemaRef.Diag(StartLoc, diag::err_omp_invalid_map_type_for_directive)
21195 if (VD && ((SemaRef.LangOpts.OpenMP <= 45 &&
21200 SemaRef.Diag(ELoc, diag::err_omp_variable_in_given_clause_and_dsa)
21204 reportOriginalDsa(SemaRef, DSAS, CurDeclaration, DVar);
21212 SemaRef, DSAS->getCurScope(), MapperIdScopeSpec, MapperId,
21272 checkMappableExpressionList(SemaRef, DSAStack, OMPC_map, MVLI, Locs.StartLoc,
21290 QualType ReductionType = SemaRef.GetTypeFromParser(ParsedType.get());
21326 LookupResult Lookup(SemaRef, Name, SourceLocation(),
21328 SemaRef.forRedeclarationInCurContext());
21339 FunctionScopeInfo *ParentFn = SemaRef.getEnclosingFunction();
21342 SemaRef.LookupName(Lookup, S);
21343 SemaRef.FilterLookupForScope(Lookup, DC, S, /*ConsiderLinkage=*/false,
21406 SemaRef.PushFunctionScope();
21407 SemaRef.setFunctionHasBranchProtectedScope();
21408 SemaRef.getCurFunction()->setHasOMPDeclareReductionCombiner();
21411 SemaRef.PushDeclContext(S, DRD);
21413 SemaRef.CurContext = DRD;
21415 SemaRef.PushExpressionEvaluationContext(
21426 buildVarDecl(SemaRef, D->getLocation(), ReductionType, "omp_in");
21434 buildVarDecl(SemaRef, D->getLocation(), ReductionType, "omp_out");
21436 SemaRef.PushOnScopeChains(OmpInParm, S);
21437 SemaRef.PushOnScopeChains(OmpOutParm, S);
21443 ::buildDeclRefExpr(SemaRef, OmpInParm, ReductionType, D->getLocation());
21445 ::buildDeclRefExpr(SemaRef, OmpOutParm, ReductionType, D->getLocation());
21452 SemaRef.DiscardCleanupsInEvaluationContext();
21453 SemaRef.PopExpressionEvaluationContext();
21455 SemaRef.PopDeclContext();
21456 SemaRef.PopFunctionScopeInfo();
21469 SemaRef.PushFunctionScope();
21470 SemaRef.setFunctionHasBranchProtectedScope();
21473 SemaRef.PushDeclContext(S, DRD);
21475 SemaRef.CurContext = DRD;
21477 SemaRef.PushExpressionEvaluationContext(
21488 buildVarDecl(SemaRef, D->getLocation(), ReductionType, "omp_priv");
21496 buildVarDecl(SemaRef, D->getLocation(), ReductionType, "omp_orig");
21498 SemaRef.PushOnScopeChains(OmpPrivParm, S);
21499 SemaRef.PushOnScopeChains(OmpOrigParm, S);
21505 ::buildDeclRefExpr(SemaRef, OmpOrigParm, ReductionType, D->getLocation());
21507 ::buildDeclRefExpr(SemaRef, OmpPrivParm, ReductionType, D->getLocation());
21515 SemaRef.DiscardCleanupsInEvaluationContext();
21516 SemaRef.PopExpressionEvaluationContext();
21518 SemaRef.PopDeclContext();
21519 SemaRef.PopFunctionScopeInfo();
21538 SemaRef.PushOnScopeChains(cast<OMPDeclareReductionDecl>(D), S,
21549 TypeSourceInfo *TInfo = SemaRef.GetTypeForDeclarator(D);
21556 SemaRef.CheckExtraCXXDefaultArguments(D);
21559 return SemaRef.CreateParsedType(T, TInfo);
21566 QualType MapperType = SemaRef.GetTypeFromParser(ParsedType.get());
21582 LookupResult Lookup(SemaRef, Name, SourceLocation(),
21584 SemaRef.forRedeclarationInCurContext());
21595 FunctionScopeInfo *ParentFn = SemaRef.getEnclosingFunction();
21598 SemaRef.LookupName(Lookup, S);
21599 SemaRef.FilterLookupForScope(Lookup, DC, S, /*ConsiderLinkage=*/false,
21646 processImplicitMapsWithDefaultMappers(SemaRef, DSAStack,
21652 SemaRef.PushOnScopeChains(DMD, S);
21677 SemaRef.PushOnScopeChains(VD, S, /*AddToContext=*/false);
21678 Expr *E = buildDeclRefExpr(SemaRef, VD, MapperType, StartLoc);
21717 if (!isNonNegativeIntegerValue(ValExpr, SemaRef, OMPC_num_teams,
21725 !SemaRef.CurContext->isDependentContext()) {
21726 ValExpr = SemaRef.MakeFullExpr(ValExpr).get();
21728 ValExpr = tryBuildCapture(SemaRef, ValExpr, Captures).get();
21745 if (!isNonNegativeIntegerValue(ValExpr, SemaRef, OMPC_thread_limit,
21753 !SemaRef.CurContext->isDependentContext()) {
21754 ValExpr = SemaRef.MakeFullExpr(ValExpr).get();
21756 ValExpr = tryBuildCapture(SemaRef, ValExpr, Captures).get();
21775 ValExpr, SemaRef, OMPC_priority,
21806 if (!isNonNegativeIntegerValue(ValExpr, SemaRef, OMPC_grainsize,
21841 ValExpr, SemaRef, OMPC_num_tasks,
21889 if (!findOMPEventHandleT(SemaRef, Evt->getExprLoc(), DSAStack))
21922 reportOriginalDsa(SemaRef, DSAStack, VD, DVar);
21971 !SemaRef.CurContext->isDependentContext()) {
21972 ValExpr = SemaRef.MakeFullExpr(ValExpr).get();
21974 ValExpr = tryBuildCapture(SemaRef, ValExpr, Captures).get();
22073 DeclContext *CurLexicalContext = SemaRef.getCurLexicalContext();
22116 LookupResult Lookup(SemaRef, Id, Sema::LookupOrdinaryName);
22117 SemaRef.LookupParsedName(Lookup, CurScope, &ScopeSpec,
22126 VarOrFuncDeclFilterCCC CCC(SemaRef);
22128 SemaRef.CorrectTypo(Id, Sema::LookupOrdinaryName, CurScope, nullptr,
22130 SemaRef.diagnoseTypo(Corrected,
22220 Sema &SemaRef, Decl *D) {
22226 if (SemaRef.LangOpts.OpenMP >= 50 &&
22227 (SemaRef.getCurLambda(/*IgnoreNonLambdaCapturingScope=*/true) ||
22228 SemaRef.getCurBlock() || SemaRef.getCurCapturedRegion()) &&
22237 SemaRef.Diag(VD->getLocation(),
22239 SemaRef.Diag(SL, diag::note_var_explicitly_captured_here)
22246 SemaRef.Diag(VD->getLocation(), diag::warn_omp_not_in_target_context);
22247 SemaRef.Diag(SL, diag::note_used_here) << SR;
22251 Sema &SemaRef, DSAStackTy *Stack,
22254 checkTypeMappable(SL, SR, SemaRef, Stack, VD->getType(),
22273 reportOriginalDsa(SemaRef, DSAStack, VD, DSAStack->getTopDSA(VD, false));
22292 !checkValueDeclInTarget(SL, SR, SemaRef, DSAStack, VD))
22326 checkDeclInTargetContext(E->getExprLoc(), E->getSourceRange(), SemaRef, D);
22403 checkMappableExpressionList(SemaRef, DSAStack, OMPC_to, MVLI, Locs.StartLoc,
22440 checkMappableExpressionList(SemaRef, DSAStack, OMPC_from, MVLI, Locs.StartLoc,
22463 auto Res = getPrivateItem(SemaRef, SimpleRefExpr, ELoc, ERange);
22488 buildVarDecl(SemaRef, ELoc, Type, D->getName(),
22494 SemaRef.CurContext->addDecl(VDPrivate);
22496 SemaRef, VDPrivate, RefExpr->getType().getUnqualifiedType(), ELoc);
22500 buildVarDecl(SemaRef, RefExpr->getExprLoc(), Type, ".devptr.temp");
22502 SemaRef, VDInit, RefExpr->getType(), RefExpr->getExprLoc());
22503 SemaRef.AddInitializerToDecl(
22504 VDPrivate, SemaRef.DefaultLvalueConversion(VDInitRefExpr).get(),
22511 Ref = buildCapture(SemaRef, D, SimpleRefExpr, /*WithInit=*/true);
22547 auto Res = getPrivateItem(SemaRef, SimpleRefExpr, ELoc, ERange,
22562 Ref = buildCapture(SemaRef, D, SimpleRefExpr, /*WithInit=*/true);
22578 SemaRef.DefaultFunctionArrayLvalueConversion(SimpleRefExpr).get();
22600 auto Res = getPrivateItem(SemaRef, SimpleRefExpr, ELoc, ERange);
22626 reportOriginalDsa(SemaRef, DSAStack, D, DVar);
22684 auto Res = getPrivateItem(SemaRef, SimpleRefExpr, ELoc, ERange,
22702 reportOriginalDsa(SemaRef, DSAStack, D, DVar);
22728 SemaRef.DefaultFunctionArrayLvalueConversion(SimpleRefExpr).get();
22735 if (!VD && !SemaRef.CurContext->isDependentContext()) {
22737 buildCapture(SemaRef, D, SimpleRefExpr, /*WithInit=*/true);
22769 if (!findOMPAllocatorHandleT(SemaRef, Allocator->getExprLoc(), DSAStack))
22772 ExprResult AllocatorRes = SemaRef.DefaultLvalueConversion(Allocator);
22775 AllocatorRes = SemaRef.PerformImplicitConversion(
22790 SemaRef.targetDiag(StartLoc, diag::err_expected_allocator_expression);
22799 auto Res = getPrivateItem(SemaRef, SimpleRefExpr, ELoc, ERange);
22810 if (!VD && !SemaRef.CurContext->isDependentContext())
22811 Ref = buildCapture(SemaRef, D, SimpleRefExpr, /*WithInit=*/false);
22812 Vars.push_back((VD || SemaRef.CurContext->isDependentContext())
22836 auto Res = getPrivateItem(SemaRef, SimpleRefExpr, ELoc, ERange);
22872 SemaRef.setFunctionHasBranchProtectedScope();
22888 auto Res = getPrivateItem(SemaRef, SimpleRefExpr, ELoc, ERange,
22929 auto Res = getPrivateItem(SemaRef, SimpleRefExpr, ELoc, ERange,
22984 if (!findOMPAllocatorHandleT(SemaRef, StartLoc, DSAStack))
22991 !findOMPAlloctraitT(SemaRef, StartLoc, DSAStack))
22999 PredefinedAllocators.insert(SemaRef.LookupSingleName(
23000 SemaRef.TUScope, AllocatorName, StartLoc, Sema::LookupAnyName));
23017 getAllocatorKind(SemaRef, DSAStack, AllocatorExpr);
23062 AllocatorExpr = SemaRef.DefaultLvalueConversion(AllocatorExpr).get();
23136 Sema::TentativeAnalysisScope Trap(SemaRef);
23137 Res = SemaRef.CreateBuiltinUnaryOp(ELoc, UO_AddrOf, SimpleExpr);
23179 if (!isNonNegativeIntegerValue(ValExpr, SemaRef, OMPC_ompx_dyn_cgroup_mem,
23187 !SemaRef.CurContext->isDependentContext()) {
23188 ValExpr = SemaRef.MakeFullExpr(ValExpr).get();
23190 ValExpr = tryBuildCapture(SemaRef, ValExpr, Captures).get();
23217 SemaRef,
23253 ExprResult Result = SemaRef.CheckPlaceholderExpr(Base);
23259 ExprResult Result = SemaRef.CheckPlaceholderExpr(LowerBound);
23262 Result = SemaRef.DefaultLvalueConversion(Result.get());
23268 ExprResult Result = SemaRef.CheckPlaceholderExpr(Length);
23271 Result = SemaRef.DefaultLvalueConversion(Result.get());
23277 ExprResult Result = SemaRef.CheckPlaceholderExpr(Stride);
23280 Result = SemaRef.DefaultLvalueConversion(Result.get());
23363 if (SemaRef.RequireCompleteType(Base->getExprLoc(), ResultTy,
23422 ExprResult Result = SemaRef.DefaultFunctionArrayLvalueConversion(Base);
23437 ExprResult Result = SemaRef.CheckPlaceholderExpr(Base);
23440 Result = SemaRef.DefaultLvalueConversion(Result.get());
23462 ExprResult Result = SemaRef.CheckPlaceholderExpr(Dim);
23467 Result = SemaRef.DefaultLvalueConversion(Result.get());
23557 VarDecl::Create(Context, SemaRef.CurContext, StartLoc, D.DeclIdentLoc,
23563 LookupResult Previous(SemaRef, NameInfo, Sema::LookupOrdinaryName,
23566 SemaRef.LookupName(Previous, S);
23568 SemaRef.FilterLookupForScope(Previous, SemaRef.CurContext, S,
23576 SemaRef.PushOnScopeChains(VD, S);
23579 SemaRef.CurContext->addDecl(VD);
23588 SemaRef.PerformImplicitConversion(Begin, DeclTy, Sema::AA_Converting);
23594 SemaRef.PerformImplicitConversion(End, DeclTy, Sema::AA_Converting);
23639 if (!SemaRef.CurContext->isDependentContext()) {
23645 ExprResult Res = SemaRef.CreateBuiltinBinOp(D.AssignmentLoc, BO_Sub,
23655 Res = SemaRef.CreateBuiltinBinOp(D.AssignmentLoc, BO_Add, Res.get(),
23662 Res = SemaRef.CreateBuiltinBinOp(
23664 SemaRef.ActOnIntegerConstant(D.AssignmentLoc, 1).get());
23670 Res = SemaRef.CreateBuiltinBinOp(D.AssignmentLoc, BO_Div, Res.get(),
23676 St1 = SemaRef.CreateBuiltinUnaryOp(D.AssignmentLoc, UO_Minus,
23679 ExprResult Res1 = SemaRef.CreateBuiltinBinOp(
23686 Res1 = SemaRef.CreateBuiltinBinOp(D.AssignmentLoc, BO_Add, Res1.get(),
23693 Res1 = SemaRef.CreateBuiltinBinOp(
23695 SemaRef.ActOnIntegerConstant(D.AssignmentLoc, 1).get());
23701 Res1 = SemaRef.CreateBuiltinBinOp(D.AssignmentLoc, BO_Div, Res1.get(),
23708 ExprResult CmpRes = SemaRef.CreateBuiltinBinOp(
23710 SemaRef.ActOnIntegerConstant(D.AssignmentLoc, 0).get());
23715 Res = SemaRef.ActOnConditionalOp(D.AssignmentLoc, D.AssignmentLoc,
23722 Res = SemaRef.ActOnFinishFullExpr(Res.get(), /*DiscardedValue=*/false);
23730 auto *CounterVD = VarDecl::Create(Context, SemaRef.CurContext,
23736 SemaRef.BuildDeclRefExpr(CounterVD, CounterVD->getType(), VK_LValue,
23742 UpdateRes = SemaRef.CreateBuiltinBinOp(
23744 SemaRef.DefaultLvalueConversion(RefRes.get()).get(), St.get());
23746 UpdateRes = SemaRef.DefaultLvalueConversion(RefRes.get());
23752 UpdateRes = SemaRef.CreateBuiltinBinOp(D.AssignmentLoc, BO_Add,
23759 SemaRef.BuildDeclRefExpr(cast<VarDecl>(D.IteratorDecl),
23762 UpdateRes = SemaRef.CreateBuiltinBinOp(D.AssignmentLoc, BO_Assign,
23769 SemaRef.ActOnFinishFullExpr(UpdateRes.get(), /*DiscardedValue=*/true);
23774 ExprResult CounterUpdateRes = SemaRef.CreateBuiltinUnaryOp(
23780 CounterUpdateRes = SemaRef.ActOnFinishFullExpr(CounterUpdateRes.get(),
23836 if (!SemaRef.checkStringLiteralArgumentAttr(AL, 0, Str, &AttrStrLoc))
23839 checkOMPAssumeAttr(SemaRef, AttrStrLoc, Str);