Lines Matching refs:SemaRef
136 Sema &SemaRef;
149 : Stack(1), ClauseKindMode(OMPC_unknown), SemaRef(S),
531 static VarDecl *buildVarDecl(Sema &SemaRef, SourceLocation Loc, QualType Type,
533 DeclContext *DC = SemaRef.CurContext;
534 IdentifierInfo *II = &SemaRef.PP.getIdentifierTable().get(Name);
535 TypeSourceInfo *TInfo = SemaRef.Context.getTrivialTypeSourceInfo(Type, Loc);
537 VarDecl::Create(SemaRef.Context, DC, Loc, Loc, II, Type, TInfo, SC_None);
566 SemaRef.getLangOpts().OpenMPUseTLS &&
567 SemaRef.getASTContext().getTargetInfo().isTLSSupported())) ||
570 addDSA(D, buildDeclRefExpr(SemaRef, D, D->getType().getNonReferenceType(),
598 bool IsConstant = Type.isConstant(SemaRef.getASTContext());
599 Type = SemaRef.getASTContext().getBaseElementType(Type);
605 SemaRef.getLangOpts().CPlusPlus ? Type->getAsCXXRecordDecl() : nullptr;
610 !(SemaRef.getLangOpts().CPlusPlus && RD && RD->hasMutableFields())) {
963 Expr *NumIterations, Sema &SemaRef,
970 Sema &SemaRef;
973 explicit VarDeclFilterCCC(Sema &S) : SemaRef(S) {}
978 SemaRef.isDeclInScope(ND, SemaRef.getCurLexicalContext(),
979 SemaRef.getCurScope());
1122 Sema &SemaRef;
1128 SemaRef.Diag(E->getLocStart(),
1131 SemaRef.Diag(VD->getLocation(), diag::note_defined_here)
1145 explicit LocalVarRefChecker(Sema &SemaRef) : SemaRef(SemaRef) {}
1226 static void ReportOriginalDSA(Sema &SemaRef, DSAStackTy *Stack,
1230 SemaRef.Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
1264 else if (VD->getType().isConstant(SemaRef.getASTContext()))
1271 SemaRef.Diag(ReportLoc, diag::note_omp_predetermined_dsa)
1275 SemaRef
1283 Sema &SemaRef;
1326 SemaRef.Diag(ELoc, diag::err_omp_reduction_in_task);
1327 ReportOriginalDSA(SemaRef, Stack, VD, DVar);
1361 DSAAttrChecker(DSAStackTy *S, Sema &SemaRef, CapturedStmt *CS)
1362 : Stack(S), SemaRef(SemaRef), ErrorFound(false), CS(CS) {}
1627 static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
2231 SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region_simd);
2237 SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region_atomic);
2247 SemaRef.Diag(StartLoc, diag::err_omp_orphaned_section_directive)
2307 SemaRef.Diag(StartLoc,
2311 SemaRef.Diag(PreviousCriticalLoc,
2375 SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region)
2692 Sema &SemaRef;
2725 OpenMPIterationSpaceChecker(Sema &SemaRef, SourceLocation DefaultLoc)
2726 : SemaRef(SemaRef), DefaultLoc(DefaultLoc), ConditionLoc(DefaultLoc),
2850 SemaRef.PerformOpenMPImplicitIntegerConversion(StepLoc, NewStep);
2867 bool IsConstant = NewStep->isIntegerConstantExpr(Result, SemaRef.Context);
2877 SemaRef.Diag(NewStep->getExprLoc(),
2880 SemaRef.Diag(ConditionLoc,
2886 NewStep = SemaRef.CreateBuiltinUnaryOp(NewStep->getExprLoc(), UO_Minus,
2908 SemaRef.Diag(DefaultLoc, diag::err_omp_loop_not_canonical_init);
2926 SemaRef.Diag(S->getLocStart(),
2940 SemaRef.Diag(S->getLocStart(), diag::err_omp_loop_not_canonical_init)
2972 SemaRef.Diag(DefaultLoc, diag::err_omp_loop_not_canonical_cond) << Var;
3012 SemaRef.Diag(CondLoc, diag::err_omp_loop_not_canonical_cond)
3041 SemaRef.Diag(RHS->getLocStart(), diag::err_omp_loop_not_canonical_incr)
3061 SemaRef.Diag(DefaultLoc, diag::err_omp_loop_not_canonical_incr) << Var;
3069 SemaRef.ActOnIntegerConstant(UO->getLocStart(),
3092 SemaRef.ActOnIntegerConstant(
3110 SemaRef.Diag(S->getLocStart(), diag::err_omp_loop_not_canonical_incr)
3122 TransformToNewDefs(Sema &SemaRef) : BaseTransform(SemaRef) {}
3129 SemaRef.Context, VD->getDeclContext(), VD->getLocStart(),
3155 NewD->markUsed(SemaRef.Context);
3157 SemaRef.Context, E->getQualifierLoc(), E->getTemplateKeywordLoc(),
3170 TransformToNewDefs Transform(SemaRef);
3174 SemaRef.getLangOpts().CPlusPlus) {
3182 Upper = SemaRef.PerformImplicitConversion(Upper, UBExpr->getType(),
3186 Lower = SemaRef.PerformImplicitConversion(Lower, LBExpr->getType(),
3193 Diff = SemaRef.BuildBinOp(S, DefaultLoc, BO_Sub, Upper, Lower);
3198 SemaRef.Diag(Upper->getLocStart(), diag::err_omp_loop_diff_cxx)
3209 Diff = SemaRef.BuildBinOp(
3211 SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get());
3219 NewStep = SemaRef.PerformImplicitConversion(
3224 Diff = SemaRef.BuildBinOp(S, DefaultLoc, BO_Add, Diff.get(), NewStep.get());
3229 Diff = SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, Diff.get());
3237 NewStep = SemaRef.PerformImplicitConversion(
3242 Diff = SemaRef.BuildBinOp(S, DefaultLoc, BO_Div, Diff.get(), NewStep.get());
3248 auto &C = SemaRef.Context;
3257 Diff = SemaRef.PerformImplicitConversion(
3267 SemaRef.Diag(DefaultLoc, diag::warn_omp_loop_64_bit_var)
3273 Diff = SemaRef.PerformImplicitConversion(Diff.get(), NewType,
3285 bool Suppress = SemaRef.getDiagnostics().getSuppressAllDiagnostics();
3286 SemaRef.getDiagnostics().setSuppressAllDiagnostics(/*Val=*/true);
3287 TransformToNewDefs Transform(SemaRef);
3293 NewLB = SemaRef.PerformImplicitConversion(NewLB.get(), LB->getType(),
3296 NewUB = SemaRef.PerformImplicitConversion(NewUB.get(), UB->getType(),
3301 auto CondExpr = SemaRef.BuildBinOp(
3306 CondExpr = SemaRef.PerformImplicitConversion(
3307 CondExpr.get(), SemaRef.Context.BoolTy, /*Action=*/Sema::AA_Casting,
3310 SemaRef.getDiagnostics().setSuppressAllDiagnostics(Suppress);
3317 return buildDeclRefExpr(SemaRef, Var, Var->getType().getNonReferenceType(),
3325 buildVarDecl(SemaRef, DefaultLoc, Type, Var->getName(),
3329 return buildDeclRefExpr(SemaRef, PrivateVar, Type, DefaultLoc);
3385 OpenMPDirectiveKind DKind, Stmt *S, Sema &SemaRef, DSAStackTy &DSA,
3394 SemaRef.Diag(S->getLocStart(), diag::err_omp_not_for)
3400 SemaRef.Diag(DSA.getConstructLoc(),
3405 SemaRef.Diag(CollapseLoopCountExpr->getExprLoc(),
3409 SemaRef.Diag(OrderedLoopCountExpr->getExprLoc(),
3417 OpenMPIterationSpaceChecker ISC(SemaRef, For->getForLoc());
3438 !(SemaRef.getLangOpts().CPlusPlus && VarType->isOverloadableType())) {
3439 SemaRef.Diag(Init->getLocStart(), diag::err_omp_loop_variable_type)
3440 << SemaRef.getLangOpts().CPlusPlus;
3479 SemaRef.Diag(Init->getLocStart(), diag::err_omp_loop_var_dsa)
3484 ReportOriginalDSA(SemaRef, &DSA, Var, DVar, /*IsLoopIterVar=*/true);
3505 if (ISC.Dependent() || SemaRef.CurContext->isDependentContext() || HasErrors)
3534 static ExprResult BuildCounterInit(Sema &SemaRef, Scope *S, SourceLocation Loc,
3536 TransformToNewDefs Transform(SemaRef);
3541 NewStart = SemaRef.PerformImplicitConversion(
3547 NewStart = SemaRef.PerformImplicitConversion(
3554 SemaRef.BuildBinOp(S, Loc, BO_Assign, VarRef.get(), NewStart.get());
3559 static ExprResult BuildCounterUpdate(Sema &SemaRef, Scope *S,
3564 Iter = SemaRef.ActOnParenExpr(Loc, Loc, Iter.get());
3569 TransformToNewDefs Transform(SemaRef);
3573 NewStep = SemaRef.PerformImplicitConversion(
3580 SemaRef.BuildBinOp(S, Loc, BO_Mul, Iter.get(), NewStep.get());
3588 NewStart = SemaRef.PerformImplicitConversion(
3594 Update = SemaRef.BuildBinOp(S, Loc, (Subtract ? BO_Sub : BO_Add),
3599 Update = SemaRef.PerformImplicitConversion(
3604 Update = SemaRef.BuildBinOp(S, Loc, BO_Assign, VarRef.get(), Update.get());
3611 Sema &SemaRef) {
3614 auto &C = SemaRef.Context;
3621 return SemaRef.PerformImplicitConversion(E, NewType, Sema::AA_Converting,
3627 static bool FitsInto(unsigned Bits, bool Signed, Expr *E, Sema &SemaRef) {
3631 if (E->isIntegerConstantExpr(Result, SemaRef.Context))
3641 Expr *OrderedLoopCountExpr, Stmt *AStmt, Sema &SemaRef,
3649 if (CollapseLoopCountExpr->EvaluateAsInt(Result, SemaRef.getASTContext()))
3655 if (OrderedLoopCountExpr->EvaluateAsInt(Result, SemaRef.getASTContext())) {
3657 SemaRef.Diag(OrderedLoopCountExpr->getExprLoc(),
3660 SemaRef.Diag(CollapseLoopCountExpr->getExprLoc(),
3673 if (CheckOpenMPIterationSpace(DKind, CurStmt, SemaRef, DSA, Cnt,
3688 if (SemaRef.CurContext->isDependentContext())
3725 32 /* Bits */, SemaRef.PerformImplicitConversion(
3729 SemaRef);
3731 64 /* Bits */, SemaRef.PerformImplicitConversion(
3735 SemaRef);
3740 auto &C = SemaRef.Context;
3746 PreCond = SemaRef.BuildBinOp(CurScope, SourceLocation(), BO_LAnd,
3752 LastIteration32 = SemaRef.BuildBinOp(
3754 SemaRef.PerformImplicitConversion(N->IgnoreImpCasts(), N->getType(),
3759 LastIteration64 = SemaRef.BuildBinOp(
3761 SemaRef.PerformImplicitConversion(N->IgnoreImpCasts(), N->getType(),
3775 LastIteration64.get(), SemaRef)))
3784 LastIteration = SemaRef.BuildBinOp(
3786 SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get());
3795 LastIteration.get()->isIntegerConstantExpr(Result, SemaRef.Context);
3800 buildVarDecl(SemaRef, SaveLoc, LastIteration.get()->getType(),
3803 SemaRef, SaveVar, LastIteration.get()->getType(), SaveLoc);
3804 CalcLastIteration = SemaRef.BuildBinOp(CurScope, SaveLoc, BO_Assign,
3809 NumIterations = SemaRef.BuildBinOp(
3811 SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get());
3824 VarDecl *LBDecl = buildVarDecl(SemaRef, InitLoc, VType, ".omp.lb");
3825 LB = buildDeclRefExpr(SemaRef, LBDecl, VType, InitLoc);
3826 SemaRef.AddInitializerToDecl(
3827 LBDecl, SemaRef.ActOnIntegerConstant(InitLoc, 0).get(),
3831 VarDecl *UBDecl = buildVarDecl(SemaRef, InitLoc, VType, ".omp.ub");
3832 UB = buildDeclRefExpr(SemaRef, UBDecl, VType, InitLoc);
3833 SemaRef.AddInitializerToDecl(UBDecl, LastIteration.get(),
3839 QualType Int32Ty = SemaRef.Context.getIntTypeForBitwidth(32, true);
3840 VarDecl *ILDecl = buildVarDecl(SemaRef, InitLoc, Int32Ty, ".omp.is_last");
3841 IL = buildDeclRefExpr(SemaRef, ILDecl, Int32Ty, InitLoc);
3842 SemaRef.AddInitializerToDecl(
3843 ILDecl, SemaRef.ActOnIntegerConstant(InitLoc, 0).get(),
3847 VarDecl *STDecl = buildVarDecl(SemaRef, InitLoc, VType, ".omp.stride");
3848 ST = buildDeclRefExpr(SemaRef, STDecl, VType, InitLoc);
3849 SemaRef.AddInitializerToDecl(
3850 STDecl, SemaRef.ActOnIntegerConstant(InitLoc, 1).get(),
3855 ExprResult IsUBGreater = SemaRef.BuildBinOp(CurScope, InitLoc, BO_GT,
3857 ExprResult CondOp = SemaRef.ActOnConditionalOp(
3859 EUB = SemaRef.BuildBinOp(CurScope, InitLoc, BO_Assign, UB.get(),
3861 EUB = SemaRef.ActOnFinishFullExpr(EUB.get());
3868 VarDecl *IVDecl = buildVarDecl(SemaRef, InitLoc, VType, ".omp.iv");
3869 IV = buildDeclRefExpr(SemaRef, IVDecl, VType, InitLoc);
3874 : SemaRef
3875 Init = SemaRef.BuildBinOp(CurScope, InitLoc, BO_Assign, IV.get(), RHS);
3876 Init = SemaRef.ActOnFinishFullExpr(Init.get());
3884 ? SemaRef.BuildBinOp(CurScope, CondLoc, BO_LE, IV.get(), UB.get())
3885 : SemaRef.BuildBinOp(CurScope, CondLoc, BO_LT, IV.get(),
3891 SemaRef.BuildBinOp(CurScope, IncLoc, BO_Add, IV.get(),
3892 SemaRef.ActOnIntegerConstant(IncLoc, 1).get());
3895 Inc = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Assign, IV.get(), Inc.get());
3896 Inc = SemaRef.ActOnFinishFullExpr(Inc.get());
3906 NextLB = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Add, LB.get(), ST.get());
3911 SemaRef.BuildBinOp(CurScope, IncLoc, BO_Assign, LB.get(), NextLB.get());
3912 NextLB = SemaRef.ActOnFinishFullExpr(NextLB.get());
3916 NextUB = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Add, UB.get(), ST.get());
3921 SemaRef.BuildBinOp(CurScope, IncLoc, BO_Assign, UB.get(), NextUB.get());
3922 NextUB = SemaRef.ActOnFinishFullExpr(NextUB.get());
3944 SemaRef.BuildBinOp(CurScope, UpdLoc, BO_Div, IV.get(), Div.get());
3952 Iter = SemaRef.BuildBinOp(CurScope, UpdLoc, BO_Rem, Iter.get(),
3961 SemaRef, cast<VarDecl>(cast<DeclRefExpr>(IS.CounterVar)->getDecl()),
3964 ExprResult Init = BuildCounterInit(SemaRef, CurScope, UpdLoc, CounterVar,
3971 BuildCounterUpdate(SemaRef, CurScope, UpdLoc, CounterVar,
3980 SemaRef, CurScope, UpdLoc, CounterVar, IS.CounterInit,
3992 Div = SemaRef.BuildBinOp(CurScope, UpdLoc, BO_Mul, Div.get(),
3997 Div = SemaRef.ActOnParenExpr(UpdLoc, UpdLoc, Div.get());
4024 SemaRef.ActOnFinishFullExpr(CalcLastIteration.get()).get();
4663 Sema &SemaRef;
4684 OpenMPAtomicUpdateChecker(Sema &SemaRef)
4685 : SemaRef(SemaRef), X(nullptr), E(nullptr), UpdateExpr(nullptr),
4737 X->IgnoreParenImpCasts()->Profile(XId, SemaRef.getASTContext(),
4739 LHS->IgnoreParenImpCasts()->Profile(LHSId, SemaRef.getASTContext(),
4741 RHS->IgnoreParenImpCasts()->Profile(RHSId, SemaRef.getASTContext(),
4776 SemaRef.Diag(ErrorLoc, DiagId) << ErrorRange;
4777 SemaRef.Diag(NoteLoc, NoteId) << ErrorFound << NoteRange;
4779 } else if (SemaRef.CurContext->isDependentContext())
4823 E = SemaRef.ActOnIntegerConstant(OpLoc, /*uint64_t Val=*/1).get();
4848 SemaRef.Diag(ErrorLoc, DiagId) << ErrorRange;
4849 SemaRef.Diag(NoteLoc, NoteId) << ErrorFound << NoteRange;
4851 } else if (SemaRef.CurContext->isDependentContext())
4857 auto *OVEX = new (SemaRef.getASTContext())
4859 auto *OVEExpr = new (SemaRef.getASTContext())
4862 SemaRef.CreateBuiltinBinOp(OpLoc, Op, IsXLHSInRHSPart ? OVEX : OVEExpr,
4866 Update = SemaRef.PerformImplicitConversion(Update.get(), X->getType(),
5712 static bool IsNonNegativeIntegerValue(Expr *&ValExpr, Sema &SemaRef,
5719 SemaRef.PerformOpenMPImplicitIntegerConversion(Loc, ValExpr);
5726 if (ValExpr->isIntegerConstantExpr(Result, SemaRef.Context) &&
5730 SemaRef.Diag(Loc, diag::err_omp_negative_expression_in_clause)
7628 Expr *NumIterations, Sema &SemaRef,
7638 Step = SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get();
7655 buildDeclRefExpr(SemaRef, cast<VarDecl>(DE->getDecl()),
7661 BuildCounterUpdate(SemaRef, S, RefExpr->getExprLoc(), *CurPrivate,
7663 Update = SemaRef.ActOnFinishFullExpr(Update.get(), DE->getLocStart(),
7668 BuildCounterUpdate(SemaRef, S, RefExpr->getExprLoc(), CapturedRef,
7670 Final = SemaRef.ActOnFinishFullExpr(Final.get(), DE->getLocStart(),
8077 static bool IsCXXRecordForMappable(Sema &SemaRef, SourceLocation Loc,
8085 auto QTy = SemaRef.Context.getRecordType(RD);
8087 SemaRef.Diag(Loc, diag::err_omp_not_mappable_type) << QTy;
8088 SemaRef.Diag(RD->getLocation(), diag::note_omp_polymorphic_in_target);
8097 SemaRef.Diag(Loc, diag::err_omp_not_mappable_type) << QTy;
8098 SemaRef.Diag(MD->getLocation(),
8104 SemaRef.Diag(Loc, diag::err_omp_not_mappable_type) << QTy;
8105 SemaRef.Diag(VD->getLocation(),
8114 if (!IsCXXRecordForMappable(SemaRef, I.getLocStart(), Stack,
8121 static bool CheckTypeMappable(SourceLocation SL, SourceRange SR, Sema &SemaRef,
8125 SemaRef.Diag(SL, diag::err_incomplete_type) << QTy << SR;
8129 !IsCXXRecordForMappable(SemaRef, SL, Stack, RD))