• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-12-stable/contrib/llvm-project/clang/lib/Sema/

Lines Matching defs:SemaRef

43     Sema &SemaRef, Expr *E,
177 Sema &SemaRef;
273 explicit DSAStackTy(Sema &S) : SemaRef(S) {}
390 const FunctionScopeInfo *CurFnScope = SemaRef.getCurFunction();
403 for (const FunctionScopeInfo *FSI : llvm::reverse(SemaRef.FunctionScopes)) {
571 SemaRef.Diag(CNew->getBeginLoc(),
574 SemaRef.Diag(CPrev->getBeginLoc(),
1170 static VarDecl *buildVarDecl(Sema &SemaRef, SourceLocation Loc, QualType Type,
1173 DeclContext *DC = SemaRef.CurContext;
1174 IdentifierInfo *II = &SemaRef.PP.getIdentifierTable().get(Name);
1175 TypeSourceInfo *TInfo = SemaRef.Context.getTrivialTypeSourceInfo(Type, Loc);
1177 VarDecl::Create(SemaRef.Context, DC, Loc, Loc, II, Type, TInfo, SC_None);
1186 OMPReferencedVarAttr::CreateImplicit(SemaRef.Context, OrigRef));
1217 VarDecl *VD = buildVarDecl(SemaRef, SR.getBegin(),
1218 SemaRef.Context.VoidPtrTy, ".task_red.");
1220 buildDeclRefExpr(SemaRef, VD, SemaRef.Context.VoidPtrTy, SR.getBegin());
1240 VarDecl *VD = buildVarDecl(SemaRef, SR.getBegin(),
1241 SemaRef.Context.VoidPtrTy, ".task_red.");
1243 buildDeclRefExpr(SemaRef, VD, SemaRef.Context.VoidPtrTy, SR.getBegin());
1312 static bool isConstNotMutableType(Sema &SemaRef, QualType Type,
1315 ASTContext &Context = SemaRef.getASTContext();
1319 const CXXRecordDecl *RD = AcceptIfMutable && SemaRef.getLangOpts().CPlusPlus
1327 return IsConstant && !(SemaRef.getLangOpts().CPlusPlus && RD &&
1331 static bool rejectConstNotMutableType(Sema &SemaRef, const ValueDecl *D,
1336 ASTContext &Context = SemaRef.getASTContext();
1338 if (isConstNotMutableType(SemaRef, Type, AcceptIfMutable, &IsClassType)) {
1343 SemaRef.Diag(ELoc, Diag) << getOpenMPClauseName(CKind);
1348 SemaRef.Diag(D->getLocation(),
1371 SemaRef, VD, D->getType().getNonReferenceType(),
1382 SemaRef.getLangOpts().OpenMPUseTLS &&
1383 SemaRef.getASTContext().getTargetInfo().isTLSSupported())) ||
1387 SemaRef, VD, D->getType().getNonReferenceType(), D->getLocation());
1392 if (SemaRef.getLangOpts().OpenMPCUDAMode && VD &&
1405 buildDeclRefExpr(SemaRef, VD, D->getType().getNonReferenceType(),
1420 if (!SemaRef.isOpenMPCapturedByRef(
1424 buildDeclRefExpr(SemaRef, VD, D->getType().getNonReferenceType(),
1468 if (SemaRef.LangOpts.OpenMP <= 31) {
1473 if (isConstNotMutableType(SemaRef, D->getType())) {
2320 Expr *NumIterations, Sema &SemaRef,
2327 Sema &SemaRef;
2330 explicit VarDeclFilterCCC(Sema &S) : SemaRef(S) {}
2335 SemaRef.isDeclInScope(ND, SemaRef.getCurLexicalContext(),
2336 SemaRef.getCurScope());
2349 Sema &SemaRef;
2352 explicit VarOrFuncDeclFilterCCC(Sema &S) : SemaRef(S) {}
2357 return SemaRef.isDeclInScope(ND, SemaRef.getCurLexicalContext(),
2358 SemaRef.getCurScope());
2510 Sema &SemaRef;
2516 SemaRef.Diag(E->getBeginLoc(),
2519 SemaRef.Diag(VD->getLocation(), diag::note_defined_here)
2533 explicit LocalVarRefChecker(Sema &SemaRef) : SemaRef(SemaRef) {}
2824 static void reportOriginalDsa(Sema &SemaRef, const DSAStackTy *Stack,
2829 SemaRef.Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
2865 else if (D->getType().isConstant(SemaRef.getASTContext()))
2872 SemaRef.Diag(ReportLoc, diag::note_omp_predetermined_dsa)
2876 SemaRef.Diag(DVar.ImplicitDSALoc, diag::note_omp_implicit_dsa)
2920 Sema &SemaRef;
3007 getVariableCategoryFromDecl(SemaRef.getLangOpts(), VD);
3008 if (SemaRef.getLangOpts().OpenMP >= 50) {
3087 SemaRef.Diag(ELoc, diag::err_omp_reduction_in_task);
3088 reportOriginalDsa(SemaRef, Stack, VD, DVar);
3170 SemaRef.Diag(ELoc, diag::err_omp_reduction_in_task);
3171 reportOriginalDsa(SemaRef, Stack, FD, DVar);
3190 if (!checkMapClauseExpressionBase(SemaRef, E, CurComponents, OMPC_map,
3272 SemaRef, VD, VD->getType().getNonLValueExprType(SemaRef.Context),
3288 DSAAttrChecker(DSAStackTy *S, Sema &SemaRef, CapturedStmt *CS)
3289 : Stack(S), SemaRef(SemaRef), ErrorFound(false), CS(CS) {
3962 static bool checkCancelRegion(Sema &SemaRef, OpenMPDirectiveKind CurrentRegion,
3973 SemaRef.Diag(StartLoc, diag::err_omp_wrong_cancel_region)
3978 static bool checkNestingOfRegions(Sema &SemaRef, const DSAStackTy *Stack,
3997 ((SemaRef.LangOpts.OpenMP <= 45 && CurrentRegion != OMPD_ordered) ||
3998 (SemaRef.LangOpts.OpenMP >= 50 && CurrentRegion != OMPD_ordered &&
4012 SemaRef.Diag(StartLoc, (CurrentRegion != OMPD_simd)
4015 << (SemaRef.LangOpts.OpenMP >= 50 ? 1 : 0);
4021 SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region_atomic);
4031 SemaRef.Diag(StartLoc, diag::err_omp_orphaned_section_directive)
4098 SemaRef.Diag(StartLoc,
4102 SemaRef.Diag(PreviousCriticalLoc,
4148 (SemaRef.LangOpts.OpenMP <= 45 && ParentRegion != OMPD_target) ||
4149 (SemaRef.LangOpts.OpenMP >= 50 && ParentRegion != OMPD_unknown &&
4196 SemaRef.Diag(StartLoc, diag::err_omp_orphaned_device_directive)
4199 SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region)
5665 Sema &SemaRef;
5714 OpenMPIterationSpaceChecker(Sema &SemaRef, DSAStackTy &Stack,
5716 : SemaRef(SemaRef), Stack(Stack), DefaultLoc(DefaultLoc),
5856 ExprResult Val = SemaRef.PerformOpenMPImplicitIntegerConversion(
5874 bool IsConstant = NewStep->isIntegerConstantExpr(Result, SemaRef.Context);
5889 SemaRef.Diag(NewStep->getExprLoc(),
5892 SemaRef.Diag(ConditionLoc,
5899 SemaRef.CreateBuiltinUnaryOp(NewStep->getExprLoc(), UO_Minus, NewStep)
5915 Sema &SemaRef;
5924 SemaRef.Diag(E->getExprLoc(), diag::err_omp_stmt_depends_on_loop_counter)
5935 VD->getNameForDiagnostic(OS, SemaRef.getPrintingPolicy(),
5937 SemaRef.Diag(E->getExprLoc(),
5940 SemaRef.Diag(VD->getLocation(), diag::note_previous_decl) << VD;
5950 DepDecl->getNameForDiagnostic(OS, SemaRef.getPrintingPolicy(),
5952 SemaRef.Diag(E->getExprLoc(),
5985 explicit LoopCounterRefChecker(Sema &SemaRef, DSAStackTy &Stack,
5988 : SemaRef(SemaRef), Stack(Stack), CurLCDecl(CurLCDecl),
6005 LoopCounterRefChecker LoopStmtChecker(SemaRef, Stack, LCDecl, IsInitializer,
6025 SemaRef.Diag(DefaultLoc, diag::err_omp_loop_not_canonical_init);
6059 SemaRef.Diag(S->getBeginLoc(),
6064 buildDeclRefExpr(SemaRef, Var,
6090 if (dependent() || SemaRef.CurContext->isDependentContext())
6093 SemaRef.Diag(S->getBeginLoc(), diag::err_omp_loop_not_canonical_init)
6128 bool IneqCondIsCanonical = SemaRef.getLangOpts().OpenMP >= 50;
6130 SemaRef.Diag(DefaultLoc, diag::err_omp_loop_not_canonical_cond)
6184 if (dependent() || SemaRef.CurContext->isDependentContext())
6186 SemaRef.Diag(CondLoc, diag::err_omp_loop_not_canonical_cond)
6215 if (dependent() || SemaRef.CurContext->isDependentContext())
6217 SemaRef.Diag(RHS->getBeginLoc(), diag::err_omp_loop_not_canonical_incr)
6237 SemaRef.Diag(DefaultLoc, diag::err_omp_loop_not_canonical_incr) << LCDecl;
6249 return setStep(SemaRef
6273 return setStep(SemaRef
6293 if (dependent() || SemaRef.CurContext->isDependentContext())
6295 SemaRef.Diag(S->getBeginLoc(), diag::err_omp_loop_not_canonical_incr)
6301 tryBuildCapture(Sema &SemaRef, Expr *Capture,
6303 if (SemaRef.CurContext->isDependentContext())
6305 if (Capture->isEvaluatable(SemaRef.Context, Expr::SE_AllowSideEffects))
6306 return SemaRef.PerformImplicitConversion(
6311 return buildCapture(SemaRef, Capture, I->second);
6313 ExprResult Res = buildCapture(SemaRef, Capture, Ref);
6325 SemaRef.getLangOpts().CPlusPlus) {
6339 SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, IS.MinValue);
6343 ExprResult LBMinVal = SemaRef.BuildBinOp(S, DefaultLoc, BO_Assign,
6349 SemaRef.BuildBinOp(S, DefaultLoc, BO_Comma, LBMinVal.get(), LBVal);
6353 LBMinVal = SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, LBMinVal.get());
6359 SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, IS.MaxValue);
6363 ExprResult LBMaxVal = SemaRef.BuildBinOp(S, DefaultLoc, BO_Assign,
6369 SemaRef.BuildBinOp(S, DefaultLoc, BO_Comma, LBMaxVal.get(), LBVal);
6373 LBMaxVal = SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, LBMaxVal.get());
6377 Expr *LBMin = tryBuildCapture(SemaRef, LBMinVal.get(), Captures).get();
6378 Expr *LBMax = tryBuildCapture(SemaRef, LBMaxVal.get(), Captures).get();
6383 SemaRef.BuildBinOp(S, DefaultLoc, BO_LT, LBMin, LBMax);
6387 tryBuildCapture(SemaRef, MinLessMaxRes.get(), Captures).get();
6393 ExprResult MinLB = SemaRef.ActOnConditionalOp(DefaultLoc, DefaultLoc,
6401 ExprResult MaxLB = SemaRef.ActOnConditionalOp(DefaultLoc, DefaultLoc,
6419 SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, IS.MinValue);
6423 ExprResult UBMinVal = SemaRef.BuildBinOp(S, DefaultLoc, BO_Assign,
6429 SemaRef.BuildBinOp(S, DefaultLoc, BO_Comma, UBMinVal.get(), UBVal);
6433 UBMinVal = SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, UBMinVal.get());
6439 SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, IS.MaxValue);
6443 ExprResult UBMaxVal = SemaRef.BuildBinOp(S, DefaultLoc, BO_Assign,
6449 SemaRef.BuildBinOp(S, DefaultLoc, BO_Comma, UBMaxVal.get(), UBVal);
6453 UBMaxVal = SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, UBMaxVal.get());
6457 Expr *UBMin = tryBuildCapture(SemaRef, UBMinVal.get(), Captures).get();
6458 Expr *UBMax = tryBuildCapture(SemaRef, UBMaxVal.get(), Captures).get();
6463 SemaRef.BuildBinOp(S, DefaultLoc, BO_GT, UBMin, UBMax);
6467 tryBuildCapture(SemaRef, MinGreaterMaxRes.get(), Captures).get();
6473 ExprResult MaxUB = SemaRef.ActOnConditionalOp(
6481 ExprResult MinUB = SemaRef.ActOnConditionalOp(
6491 Expr *Upper = tryBuildCapture(SemaRef, UBExpr, Captures).get();
6492 Expr *Lower = tryBuildCapture(SemaRef, LBExpr, Captures).get();
6496 Diff = SemaRef.BuildBinOp(S, DefaultLoc, BO_Sub, Upper, Lower);
6501 SemaRef.Diag(Upper->getBeginLoc(), diag::err_omp_loop_diff_cxx)
6512 Diff = SemaRef.BuildBinOp(
6514 SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get());
6519 ExprResult NewStep = tryBuildCapture(SemaRef, Step, Captures);
6522 Diff = SemaRef.BuildBinOp(S, DefaultLoc, BO_Add, Diff.get(), NewStep.get());
6527 Diff = SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, Diff.get());
6532 Diff = SemaRef.BuildBinOp(S, DefaultLoc, BO_Div, Diff.get(), NewStep.get());
6538 ASTContext &C = SemaRef.Context;
6547 if (!SemaRef.Context.hasSameType(Diff.get()->getType(), Type)) {
6548 Diff = SemaRef.PerformImplicitConversion(
6559 SemaRef.Diag(DefaultLoc, diag::warn_omp_loop_64_bit_var)
6565 if (!SemaRef.Context.hasSameType(Diff.get()->getType(), NewType)) {
6566 Diff = SemaRef.PerformImplicitConversion(Diff.get(), NewType,
6594 LBNonRect ? LBExpr : tryBuildCapture(SemaRef, LBExpr, Captures).get();
6596 UBNonRect ? UBExpr : tryBuildCapture(SemaRef, UBExpr, Captures).get();
6609 Diff = SemaRef.BuildBinOp(S, DefaultLoc, BO_Sub, Upper, Lower);
6615 Diff = SemaRef.BuildBinOp(
6617 SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get());
6622 ExprResult NewStep = tryBuildCapture(SemaRef, Step, Captures);
6627 Diff = SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, Diff.get());
6632 Diff = SemaRef.BuildBinOp(S, DefaultLoc, BO_Div, Diff.get(), NewStep.get());
6638 Diff = SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, Diff.get());
6642 Diff = SemaRef.BuildBinOp(S, DefaultLoc, BO_Mul, Diff.get(), NewStep.get());
6648 !SemaRef.Context.hasSameType(Diff.get()->getType(), VarType)) {
6649 Diff = SemaRef.PerformImplicitConversion(
6652 !SemaRef.Context.hasSameType(
6654 SemaRef.Context.getUnsignedPointerDiffType())) {
6655 Diff = SemaRef.PerformImplicitConversion(
6656 Diff.get(), SemaRef.Context.getUnsignedPointerDiffType(),
6663 Diff = SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, Diff.get());
6670 Diff = SemaRef.BuildBinOp(S, DefaultLoc, BO_Add, Lower, Diff.get());
6673 Diff = SemaRef.ActOnFinishFullExpr(Diff.get(), /*DiscardedValue*/ false);
6680 Diff = SemaRef.BuildBinOp(S, DefaultLoc, BO_Sub, Upper, Diff.get());
6683 Diff = SemaRef.ActOnFinishFullExpr(Diff.get(), /*DiscardedValue*/ false);
6706 return SemaRef.PerformImplicitConversion(
6707 SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get(),
6708 SemaRef.Context.BoolTy, /*Action=*/Sema::AA_Casting,
6712 Sema::TentativeAnalysisScope Trap(SemaRef);
6714 ExprResult NewLB = tryBuildCapture(SemaRef, LB, Captures);
6715 ExprResult NewUB = tryBuildCapture(SemaRef, UB, Captures);
6720 SemaRef.BuildBinOp(S, DefaultLoc,
6726 if (!SemaRef.Context.hasSameUnqualifiedType(CondExpr.get()->getType(),
6727 SemaRef.Context.BoolTy))
6728 CondExpr = SemaRef.PerformImplicitConversion(
6729 CondExpr.get(), SemaRef.Context.BoolTy, /*Action=*/Sema::AA_Casting,
6743 VD = SemaRef.isOpenMPCapturedDecl(LCDecl);
6745 SemaRef, VD, VD->getType().getNonReferenceType(), DefaultLoc);
6761 SemaRef, DefaultLoc, Type, LCDecl->getName(),
6764 ? buildDeclRefExpr(SemaRef, cast<VarDecl>(LCDecl), Type, DefaultLoc)
6768 return buildDeclRefExpr(SemaRef, PrivateVar, Type, DefaultLoc);
6783 Expr *Cnt = SemaRef.DefaultLvalueConversion(Counter).get();
6790 Cnt = SemaRef.BuildBinOp(S, Loc, BOK, Cnt, Inc).get();
6797 SemaRef.getLangOpts().CPlusPlus) {
6801 : tryBuildCapture(SemaRef, UB, Captures).get();
6803 ? tryBuildCapture(SemaRef, LB, Captures).get()
6808 Diff = SemaRef.BuildBinOp(S, DefaultLoc, BO_Sub, Upper, Lower);
6813 SemaRef.Diag(Upper->getBeginLoc(), diag::err_omp_loop_diff_cxx)
6823 Diff = SemaRef.ActOnParenExpr(DefaultLoc, DefaultLoc, Diff.get());
6827 ExprResult NewStep = tryBuildCapture(SemaRef, Step, Captures);
6831 Diff = SemaRef.BuildBinOp(S, DefaultLoc, BO_Div, Diff.get(), NewStep.get());
6924 OpenMPDirectiveKind DKind, Stmt *S, Sema &SemaRef, DSAStackTy &DSA,
6937 if (!For && (SemaRef.LangOpts.OpenMP <= 45 || !CXXFor)) {
6938 SemaRef.Diag(S->getBeginLoc(), diag::err_omp_not_for)
6944 SemaRef.Diag(DSA.getConstructLoc(),
6949 SemaRef.Diag(CollapseLoopCountExpr->getExprLoc(),
6953 SemaRef.Diag(OrderedLoopCountExpr->getExprLoc(),
6962 OpenMPIterationSpaceChecker ISC(SemaRef, DSA,
6982 !(SemaRef.getLangOpts().CPlusPlus && VarType->isOverloadableType())) {
6983 SemaRef.Diag(Init->getBeginLoc(), diag::err_omp_loop_variable_type)
6984 << SemaRef.getLangOpts().CPlusPlus;
7008 if (ISC.dependent() || SemaRef.CurContext->isDependentContext() || HasErrors)
7098 buildCounterInit(Sema &SemaRef, Scope *S, SourceLocation Loc, ExprResult VarRef,
7104 : tryBuildCapture(SemaRef, Start.get(), Captures);
7107 if (!SemaRef.Context.hasSameType(NewStart.get()->getType(),
7109 NewStart = SemaRef.PerformImplicitConversion(
7117 SemaRef.BuildBinOp(S, Loc, BO_Assign, VarRef.get(), NewStart.get());
7123 Sema &SemaRef, Scope *S, SourceLocation Loc, ExprResult VarRef,
7128 Iter = SemaRef.ActOnParenExpr(Loc, Loc, Iter.get());
7135 NewStep = tryBuildCapture(SemaRef, Step.get(), *Captures);
7139 SemaRef.BuildBinOp(S, Loc, BO_Mul, Iter.get(), NewStep.get());
7147 ExprResult NewStart = SemaRef.ActOnParenExpr(Loc, Loc, Start.get());
7151 NewStart = tryBuildCapture(SemaRef, Start.get(), *Captures);
7161 Sema::TentativeAnalysisScope Trap(SemaRef);
7164 SemaRef.BuildBinOp(S, Loc, BO_Assign, VarRef.get(), NewStart.get());
7167 SemaRef.BuildBinOp(S, Loc, Subtract ? BO_SubAssign : BO_AddAssign,
7170 Update = SemaRef.CreateBuiltinBinOp(Loc, BO_Comma, Update.get(),
7178 Update = SemaRef.BuildBinOp(S, Loc, Subtract ? BO_Sub : BO_Add,
7183 if (!SemaRef.Context.hasSameType(Update.get()->getType(),
7185 Update = SemaRef.PerformImplicitConversion(
7191 Update = SemaRef.BuildBinOp(S, Loc, BO_Assign, VarRef.get(), Update.get());
7198 static ExprResult widenIterationCount(unsigned Bits, Expr *E, Sema &SemaRef) {
7201 ASTContext &C = SemaRef.Context;
7208 return SemaRef.PerformImplicitConversion(E, NewType, Sema::AA_Converting,
7214 static bool fitsInto(unsigned Bits, bool Signed, const Expr *E, Sema &SemaRef) {
7218 if (E->isIntegerConstantExpr(Result, SemaRef.Context))
7272 Expr *OrderedLoopCountExpr, Stmt *AStmt, Sema &SemaRef,
7281 CollapseLoopCountExpr->EvaluateAsInt(Result, SemaRef.getASTContext())) {
7294 SemaRef.getASTContext())) {
7297 SemaRef.Diag(OrderedLoopCountExpr->getExprLoc(),
7300 SemaRef.Diag(CollapseLoopCountExpr->getExprLoc(),
7318 DKind, CurStmt, SemaRef, DSA, Cnt, NestedLoopCount,
7335 CurStmt, SemaRef.LangOpts.OpenMP >= 50);
7339 DKind, CurStmt, SemaRef, DSA, Cnt, NestedLoopCount,
7363 CurStmt, SemaRef.LangOpts.OpenMP >= 50);
7368 if (SemaRef.CurContext->isDependentContext())
7406 SemaRef
7411 SemaRef);
7414 SemaRef
7419 SemaRef);
7424 ASTContext &C = SemaRef.Context;
7431 SemaRef.BuildBinOp(CurScope, PreCond.get()->getExprLoc(), BO_LAnd,
7438 LastIteration32 = SemaRef.BuildBinOp(
7440 SemaRef
7446 LastIteration64 = SemaRef.BuildBinOp(
7448 SemaRef
7457 if (SemaRef.getLangOpts().OpenMPOptimisticCollapse ||
7464 LastIteration64.get(), SemaRef))))
7471 SemaRef.Context.getIntTypeForBitwidth(/*DestWidth=*/64, /*Signed=*/0);
7473 SemaRef.Context.getIntTypeForBitwidth(/*DestWidth=*/64, /*Signed=*/1);
7482 LastIteration = SemaRef.BuildBinOp(
7485 SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get());
7494 LastIteration.get()->isIntegerConstantExpr(Result, SemaRef.Context);
7498 tryBuildCapture(SemaRef, LastIteration.get(), Captures);
7502 NumIterations = SemaRef.BuildBinOp(
7504 SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get());
7516 VarDecl *LBDecl = buildVarDecl(SemaRef, InitLoc, VType, ".omp.lb");
7517 LB = buildDeclRefExpr(SemaRef, LBDecl, VType, InitLoc);
7518 SemaRef.AddInitializerToDecl(LBDecl,
7519 SemaRef.ActOnIntegerConstant(InitLoc, 0).get(),
7523 VarDecl *UBDecl = buildVarDecl(SemaRef, InitLoc, VType, ".omp.ub");
7524 UB = buildDeclRefExpr(SemaRef, UBDecl, VType, InitLoc);
7525 SemaRef.AddInitializerToDecl(UBDecl, LastIteration.get(),
7530 QualType Int32Ty = SemaRef.Context.getIntTypeForBitwidth(32, true);
7531 VarDecl *ILDecl = buildVarDecl(SemaRef, InitLoc, Int32Ty, ".omp.is_last");
7532 IL = buildDeclRefExpr(SemaRef, ILDecl, Int32Ty, InitLoc);
7533 SemaRef.AddInitializerToDecl(ILDecl,
7534 SemaRef.ActOnIntegerConstant(InitLoc, 0).get(),
7539 buildVarDecl(SemaRef, InitLoc, StrideVType, ".omp.stride");
7540 ST = buildDeclRefExpr(SemaRef, STDecl, StrideVType, InitLoc);
7541 SemaRef.AddInitializerToDecl(STDecl,
7542 SemaRef.ActOnIntegerConstant(InitLoc, 1).get(),
7547 ExprResult IsUBGreater = SemaRef.BuildBinOp(CurScope, InitLoc, BO_GT,
7549 ExprResult CondOp = SemaRef.ActOnConditionalOp(
7552 EUB = SemaRef.BuildBinOp(CurScope, InitLoc, BO_Assign, UB.get(),
7554 EUB = SemaRef.ActOnFinishFullExpr(EUB.get(), /*DiscardedValue*/ false);
7563 buildVarDecl(SemaRef, InitLoc, VType, ".omp.comb.lb");
7564 CombLB = buildDeclRefExpr(SemaRef, CombLBDecl, VType, InitLoc);
7565 SemaRef.AddInitializerToDecl(
7566 CombLBDecl, SemaRef.ActOnIntegerConstant(InitLoc, 0).get(),
7571 buildVarDecl(SemaRef, InitLoc, VType, ".omp.comb.ub");
7572 CombUB = buildDeclRefExpr(SemaRef, CombUBDecl, VType, InitLoc);
7573 SemaRef.AddInitializerToDecl(CombUBDecl, LastIteration.get(),
7576 ExprResult CombIsUBGreater = SemaRef.BuildBinOp(
7579 SemaRef.ActOnConditionalOp(InitLoc, InitLoc, CombIsUBGreater.get(),
7581 CombEUB = SemaRef.BuildBinOp(CurScope, InitLoc, BO_Assign, CombUB.get(),
7584 SemaRef.ActOnFinishFullExpr(CombEUB.get(), /*DiscardedValue*/ false);
7600 buildDeclRefExpr(SemaRef, PrevLBDecl, PrevLBDecl->getType(), InitLoc);
7602 buildDeclRefExpr(SemaRef, PrevUBDecl, PrevUBDecl->getType(), InitLoc);
7610 VarDecl *IVDecl = buildVarDecl(SemaRef, InitLoc, RealVType, ".omp.iv");
7611 IV = buildDeclRefExpr(SemaRef, IVDecl, RealVType, InitLoc);
7616 : SemaRef.ActOnIntegerConstant(SourceLocation(), 0).get();
7617 Init = SemaRef.BuildBinOp(CurScope, InitLoc, BO_Assign, IV.get(), RHS);
7618 Init = SemaRef.ActOnFinishFullExpr(Init.get(), /*DiscardedValue*/ false);
7626 : SemaRef.ActOnIntegerConstant(SourceLocation(), 0).get();
7628 SemaRef.BuildBinOp(CurScope, InitLoc, BO_Assign, IV.get(), CombRHS);
7630 SemaRef.ActOnFinishFullExpr(CombInit.get(), /*DiscardedValue*/ false);
7645 SemaRef
7647 SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get())
7650 SemaRef.ActOnFinishFullExpr(BoundUB, /*DiscardedValue*/ false).get();
7655 ? SemaRef.BuildBinOp(CurScope, CondLoc,
7658 : SemaRef.BuildBinOp(CurScope, CondLoc, BO_LT, IV.get(),
7662 CombDistCond = SemaRef.BuildBinOp(CurScope, CondLoc, BO_LT, IV.get(),
7671 SemaRef
7674 SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get())
7677 SemaRef.ActOnFinishFullExpr(BoundCombUB, /*DiscardedValue*/ false)
7681 SemaRef.BuildBinOp(CurScope, CondLoc, UseStrictCompare ? BO_LT : BO_LE,
7687 SemaRef.BuildBinOp(CurScope, IncLoc, BO_Add, IV.get(),
7688 SemaRef.ActOnIntegerConstant(IncLoc, 1).get());
7691 Inc = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Assign, IV.get(), Inc.get());
7692 Inc = SemaRef.ActOnFinishFullExpr(Inc.get(), /*DiscardedValue*/ false);
7704 NextLB = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Add, LB.get(), ST.get());
7709 SemaRef.BuildBinOp(CurScope, IncLoc, BO_Assign, LB.get(), NextLB.get());
7711 SemaRef.ActOnFinishFullExpr(NextLB.get(), /*DiscardedValue*/ false);
7715 NextUB = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Add, UB.get(), ST.get());
7720 SemaRef.BuildBinOp(CurScope, IncLoc, BO_Assign, UB.get(), NextUB.get());
7722 SemaRef.ActOnFinishFullExpr(NextUB.get(), /*DiscardedValue*/ false);
7727 SemaRef.BuildBinOp(CurScope, IncLoc, BO_Add, CombLB.get(), ST.get());
7731 CombNextLB = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Assign, CombLB.get(),
7733 CombNextLB = SemaRef.ActOnFinishFullExpr(CombNextLB.get(),
7739 SemaRef.BuildBinOp(CurScope, IncLoc, BO_Add, CombUB.get(), ST.get());
7743 CombNextUB = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Assign, CombUB.get(),
7745 CombNextUB = SemaRef.ActOnFinishFullExpr(CombNextUB.get(),
7759 DistCond = SemaRef.BuildBinOp(
7764 SemaRef.BuildBinOp(CurScope, DistIncLoc, BO_Add, IV.get(), ST.get());
7766 DistInc = SemaRef.BuildBinOp(CurScope, DistIncLoc, BO_Assign, IV.get(),
7769 SemaRef.ActOnFinishFullExpr(DistInc.get(), /*DiscardedValue*/ false);
7776 SemaRef.BuildBinOp(CurScope, DistEUBLoc, BO_GT, UB.get(), PrevUB.get());
7777 ExprResult CondOp = SemaRef.ActOnConditionalOp(
7779 PrevEUB = SemaRef.BuildBinOp(CurScope, DistIncLoc, BO_Assign, UB.get(),
7782 SemaRef.ActOnFinishFullExpr(PrevEUB.get(), /*DiscardedValue*/ false);
7790 SemaRef
7793 SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get())
7796 SemaRef.ActOnFinishFullExpr(BoundPrevUB, /*DiscardedValue*/ false)
7800 SemaRef.BuildBinOp(CurScope, CondLoc, UseStrictCompare ? BO_LT : BO_LE,
7837 SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get();
7839 Prod = SemaRef.BuildBinOp(CurScope, UpdLoc, BO_Mul, Prod.get(),
7846 Iter = SemaRef.BuildBinOp(CurScope, UpdLoc, BO_Div,
7860 Prod = SemaRef.BuildBinOp(CurScope, UpdLoc, BO_Mul,
7864 Acc = SemaRef.BuildBinOp(CurScope, UpdLoc, BO_Sub,
7870 SemaRef, VD, IS.CounterVar->getType(), IS.CounterVar->getExprLoc(),
7873 buildCounterInit(SemaRef, CurScope, UpdLoc, CounterVar,
7880 SemaRef, CurScope, UpdLoc, CounterVar, IS.CounterInit, Iter,
7889 buildCounterUpdate(SemaRef, CurScope, UpdLoc, CounterVar,
7927 Built.CalcLastIteration = SemaRef
8602 Sema &SemaRef;
8623 OpenMPAtomicUpdateChecker(Sema &SemaRef)
8624 : SemaRef(SemaRef), X(nullptr), E(nullptr), UpdateExpr(nullptr),
8676 X->IgnoreParenImpCasts()->Profile(XId, SemaRef.getASTContext(),
8678 LHS->IgnoreParenImpCasts()->Profile(LHSId, SemaRef.getASTContext(),
8680 RHS->IgnoreParenImpCasts()->Profile(RHSId, SemaRef.getASTContext(),
8715 SemaRef.Diag(ErrorLoc, DiagId) << ErrorRange;
8716 SemaRef.Diag(NoteLoc, NoteId) << ErrorFound << NoteRange;
8719 if (SemaRef.CurContext->isDependentContext())
8763 E = SemaRef.ActOnIntegerConstant(OpLoc, /*uint64_t Val=*/1).get();
8788 SemaRef.Diag(ErrorLoc, DiagId) << ErrorRange;
8789 SemaRef.Diag(NoteLoc, NoteId) << ErrorFound << NoteRange;
8792 if (SemaRef.CurContext->isDependentContext())
8798 auto *OVEX = new (SemaRef.getASTContext())
8800 auto *OVEExpr = new (SemaRef.getASTContext())
8803 SemaRef.CreateBuiltinBinOp(OpLoc, Op, IsXLHSInRHSPart ? OVEX : OVEExpr,
8807 Update = SemaRef.PerformImplicitConversion(Update.get(), X->getType(),
11618 isNonNegativeIntegerValue(Expr *&ValExpr, Sema &SemaRef, OpenMPClauseKind CKind,
11627 SemaRef.PerformOpenMPImplicitIntegerConversion(Loc, ValExpr);
11634 if (ValExpr->isIntegerConstantExpr(Result, SemaRef.Context) &&
11638 SemaRef.Diag(Loc, diag::err_omp_negative_expression_in_clause)
11646 getOpenMPCaptureRegionForClause(DKind, CKind, SemaRef.LangOpts.OpenMP);
11648 !SemaRef.CurContext->isDependentContext()) {
11649 ValExpr = SemaRef.MakeFullExpr(ValExpr).get();
11651 ValExpr = tryBuildCapture(SemaRef, ValExpr, Captures).get();
11652 *HelperValStmt = buildPreInits(SemaRef.Context, Captures);
13278 TransformExprToCaptures(Sema &SemaRef, ValueDecl *FieldDecl)
13279 : BaseTransform(SemaRef), Field(FieldDecl), CapturedExpr(nullptr) {}
13284 CapturedExpr = buildCapture(SemaRef, Field, E, /*WithInit=*/false);
13305 static NamedDecl *findAcceptableDecl(Sema &SemaRef, NamedDecl *D) {
13306 assert(!LookupResult::isVisible(SemaRef, D) && "not in slow case");
13314 if (LookupResult::isVisible(SemaRef, ND))
13322 argumentDependentLookup(Sema &SemaRef, const DeclarationNameInfo &Id,
13330 SemaRef.FindAssociatedClassesAndNamespaces(Loc, &OVE, AssociatedNamespaces,
13366 if (!SemaRef.isVisible(D)) {
13367 D = findAcceptableDecl(SemaRef, D);
13380 buildDeclareReductionRef(Sema &SemaRef, SourceLocation Loc, SourceRange Range,
13388 LookupResult Lookup(SemaRef, ReductionId, Sema::LookupOMPReductionName);
13390 while (S && SemaRef.LookupParsedName(Lookup, S, &ReductionIdScopeSpec)) {
13413 if (SemaRef.CurContext->isDependentContext() || Ty->isDependentType() ||
13431 SemaRef.Context, /*NamingClass=*/nullptr,
13432 ReductionIdScopeSpec.getWithLocInContext(SemaRef.Context), ReductionId,
13448 LookupResult Lookup(SemaRef, ReductionId, Sema::LookupOMPReductionName);
13453 if (SemaRef.isCompleteType(Loc, Ty) || TyRec->isBeingDefined() ||
13456 SemaRef.LookupQualifiedName(Lookup, TyRec->getDecl());
13464 if (SemaRef.getLangOpts().CPlusPlus)
13465 argumentDependentLookup(SemaRef, ReductionId, Loc, Ty, Lookups);
13467 Lookups, [&SemaRef, Ty](ValueDecl *D) -> ValueDecl * {
13469 SemaRef.Context.hasSameType(D->getType(), Ty))
13473 return SemaRef.BuildDeclRefExpr(VD, VD->getType().getNonReferenceType(),
13475 if (SemaRef.getLangOpts().CPlusPlus) {
13477 Lookups, [&SemaRef, Ty, Loc](ValueDecl *D) -> ValueDecl * {
13479 SemaRef.IsDerivedFrom(Loc, Ty, D->getType()) &&
13486 if (SemaRef.IsDerivedFrom(Loc, Ty, VD->getType(), Paths)) {
13487 if (!Paths.isAmbiguous(SemaRef.Context.getCanonicalType(
13489 if (SemaRef.CheckBaseClassAccess(
13492 SemaRef.BuildBasePathArray(Paths, BasePath);
13493 return SemaRef.BuildDeclRefExpr(
13501 SemaRef.Diag(Loc, diag::err_omp_not_resolved_reduction_identifier)
14508 Expr *NumIterations, Sema &SemaRef,
14519 Step = SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get();
14530 auto Res = getPrivateItem(SemaRef, SimpleRefExpr, ELoc, ERange);
14544 SemaRef.Diag(ELoc,
14560 buildDeclRefExpr(SemaRef, cast<VarDecl>(DE->getDecl()),
14568 SemaRef, S, RefExpr->getExprLoc(), *CurPrivate, InitExpr, IV, Step,
14572 Update = SemaRef.ActOnFinishFullExpr(Update.get(), DE->getBeginLoc(),
14579 buildCounterUpdate(SemaRef, S, RefExpr->getExprLoc(), CapturedRef,
14584 Final = SemaRef.ActOnFinishFullExpr(Final.get(), DE->getBeginLoc(),
15111 static bool checkTypeMappable(SourceLocation SL, SourceRange SR, Sema &SemaRef,
15116 SemaRef.Diag(SL, diag::err_incomplete_type) << QTy << SR;
15119 if (FullCheck && !SemaRef.CurContext->isDependentContext() &&
15120 !QTy.isTriviallyCopyableType(SemaRef.Context))
15121 SemaRef.Diag(SL, diag::warn_omp_non_trivial_type_mapped) << QTy << SR;
15128 static bool checkArrayExpressionDoesNotReferToWholeSize(Sema &SemaRef,
15151 if (!LowerBound->EvaluateAsInt(Result, SemaRef.getASTContext()))
15175 if (!Length->EvaluateAsInt(Result, SemaRef.getASTContext()))
15185 static bool checkArrayExpressionDoesNotReferToUnitySize(Sema &SemaRef,
15210 if (!Length->EvaluateAsInt(Result, SemaRef.getASTContext()))
15222 Sema &SemaRef, Expr *E,
15296 SemaRef.Diag(ELoc, diag::err_omp_expected_access_to_data_field)
15312 SemaRef.Diag(ELoc, diag::err_omp_bit_fields_forbidden_in_clause)
15332 SemaRef.Diag(ELoc, diag::err_omp_union_type_not_allowed)
15356 SemaRef.Diag(ELoc, diag::err_omp_expected_base_var_name)
15366 if (checkArrayExpressionDoesNotReferToWholeSize(SemaRef, CurE,
15372 if (CurE->getIdx()->EvaluateAsInt(Result, SemaRef.getASTContext())) {
15374 SemaRef.Diag(CurE->getIdx()->getExprLoc(),
15376 SemaRef.Diag(CurE->getIdx()->getExprLoc(),
15401 SemaRef.Diag(ELoc, diag::err_omp_expected_base_var_name)
15407 checkArrayExpressionDoesNotReferToWholeSize(SemaRef, CurE, CurType);
15409 checkArrayExpressionDoesNotReferToUnitySize(SemaRef, CurE, CurType);
15423 SemaRef.Diag(
15433 SemaRef.getASTContext())) {
15435 SemaRef.Diag(CurE->getLength()->getExprLoc(),
15437 SemaRef.Diag(CurE->getLength()->getExprLoc(),
15442 ResultL, SemaRef.getASTContext())) {
15444 SemaRef.Diag(CurE->getLowerBound()->getExprLoc(),
15446 SemaRef.Diag(CurE->getLowerBound()->getExprLoc(),
15458 SemaRef.Diag(
15472 Sema &SemaRef, DSAStackTy *DSAS, const ValueDecl *VD, const Expr *E,
15494 [&IsEnclosedByDataEnvironmentExpr, &SemaRef, VD, CurrentRegionOnly, ELoc,
15526 SemaRef.Diag(CI->getAssociatedExpression()->getExprLoc(),
15529 SemaRef.Diag(SI->getAssociatedExpression()->getExprLoc(),
15560 SemaRef, SI->getAssociatedExpression(), Type))
15573 SemaRef.Diag(ELoc, diag::err_omp_map_shared_storage) << ERange;
15576 SemaRef.Diag(ELoc, diag::err_omp_once_referenced_in_target_update)
15579 SemaRef.Diag(RE->getExprLoc(), diag::note_used_here)
15612 SemaRef.Diag(
15616 SemaRef.Diag(RE->getExprLoc(), diag::note_used_here)
15625 SemaRef.Diag(DerivedLoc, diag::err_omp_same_pointer_dereferenced)
15627 SemaRef.Diag(RE->getExprLoc(), diag::note_used_here)
15660 SemaRef.Diag(ELoc, diag::err_omp_map_shared_storage) << ERange;
15663 SemaRef.Diag(ELoc, diag::err_omp_once_referenced_in_target_update)
15666 SemaRef.Diag(RE->getExprLoc(), diag::note_used_here)
15699 SemaRef.Diag(ELoc,
15702 SemaRef.Diag(EnclosingExpr->getExprLoc(), diag::note_used_here)
15712 static ExprResult buildUserDefinedMapperRef(Sema &SemaRef, Scope *S,
15726 LookupResult Lookup(SemaRef, MapperId, Sema::LookupOMPMapperName);
15729 while (S && SemaRef.LookupParsedName(Lookup, S, &MapperIdScopeSpec)) {
15750 if (SemaRef.CurContext->isDependentContext() || Type->isDependentType() ||
15766 SemaRef.Context, /*NamingClass=*/nullptr,
15767 MapperIdScopeSpec.getWithLocInContext(SemaRef.Context), MapperId,
15775 SemaRef.Diag(Loc, diag::err_omp_mapper_wrong_type);
15779 if (SemaRef.getLangOpts().CPlusPlus && !MapperIdScopeSpec.isSet())
15780 argumentDependentLookup(SemaRef, MapperId, Loc, Type, Lookups);
15783 Lookups, [&SemaRef, Type](ValueDecl *D) -> ValueDecl * {
15785 SemaRef.Context.hasSameType(D->getType(), Type))
15789 return SemaRef.BuildDeclRefExpr(VD, Type, VK_LValue, Loc);
15793 Lookups, [&SemaRef, Type, Loc](ValueDecl *D) -> ValueDecl * {
15795 SemaRef.IsDerivedFrom(Loc, Type, D->getType()) &&
15802 if (SemaRef.IsDerivedFrom(Loc, Type, VD->getType(), Paths)) {
15803 if (!Paths.isAmbiguous(SemaRef.Context.getCanonicalType(
15805 if (SemaRef.CheckBaseClassAccess(
15808 return SemaRef.BuildDeclRefExpr(VD, Type, VK_LValue, Loc);
15815 SemaRef.Diag(Loc, diag::err_omp_invalid_mapper)
15853 Sema &SemaRef, DSAStackTy *DSAS, OpenMPClauseKind CKind,
15868 auto &DeclNames = SemaRef.getASTContext().DeclarationNames;
15870 &SemaRef.getASTContext().Idents.get("default")));
15906 SemaRef, DSAS->getCurScope(), MapperIdScopeSpec, MapperId,
15920 SemaRef.Diag(ELoc,
15932 SemaRef, SimpleExpr, CurComponents, CKind, /*NoDiagnose=*/false);
15944 SemaRef, DSAS->getCurScope(), MapperIdScopeSpec, MapperId,
15979 SemaRef.Diag(ELoc, diag::err_omp_threadprivate_in_clause)
15981 reportOriginalDsa(SemaRef, DSAS, VD, DVar);
15993 if (checkMapConflicts(SemaRef, DSAS, CurDeclaration, SimpleExpr,
15997 checkMapConflicts(SemaRef, DSAS, CurDeclaration, SimpleExpr,
16032 if (!checkTypeMappable(VE->getExprLoc(), VE->getSourceRange(), SemaRef,
16046 SemaRef.Diag(StartLoc, diag::err_omp_invalid_map_type_for_directive)
16060 SemaRef.Diag(StartLoc, diag::err_omp_invalid_map_type_for_directive)
16075 if (VD && ((SemaRef.LangOpts.OpenMP <= 45 &&
16080 SemaRef.Diag(ELoc, diag::err_omp_variable_in_given_clause_and_dsa)
16084 reportOriginalDsa(SemaRef, DSAS, CurDeclaration, DVar);
16092 SemaRef, DSAS->getCurScope(), MapperIdScopeSpec, MapperId,
16890 Sema &SemaRef, Decl *D) {
16896 if (SemaRef.LangOpts.OpenMP >= 50 &&
16897 (SemaRef.getCurLambda(/*IgnoreNonLambdaCapturingScope=*/true) ||
16898 SemaRef.getCurBlock() || SemaRef.getCurCapturedRegion()) &&
16908 SemaRef.Diag(VD->getLocation(),
16910 SemaRef.Diag(SL, diag::note_var_explicitly_captured_here)
16917 SemaRef.Diag(VD->getLocation(), diag::warn_omp_not_in_target_context);
16918 SemaRef.Diag(SL, diag::note_used_here) << SR;
16922 Sema &SemaRef, DSAStackTy *Stack,
16925 checkTypeMappable(SL, SR, SemaRef, Stack, VD->getType(),