Author: Shilei Tian Date: 2021-12-10T22:05:25-05:00 New Revision: cdd5fb6e19c81c1a9c1eac22e7ac48d5b33abc3d
URL: https://github.com/llvm/llvm-project/commit/cdd5fb6e19c81c1a9c1eac22e7ac48d5b33abc3d DIFF: https://github.com/llvm/llvm-project/commit/cdd5fb6e19c81c1a9c1eac22e7ac48d5b33abc3d.diff LOG: [NFC][Clang] clang-format -i clang/lib/Sema/SemaOpenMP.cpp Added: Modified: clang/lib/Sema/SemaOpenMP.cpp Removed: ################################################################################ diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 581b7c8841d33..9672b0ac60a84 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -255,14 +255,14 @@ class DSAStackTy { return &Stack.back().first[Size - 1]; } const SharingMapTy *getTopOfStackOrNull() const { - return const_cast<DSAStackTy&>(*this).getTopOfStackOrNull(); + return const_cast<DSAStackTy &>(*this).getTopOfStackOrNull(); } SharingMapTy &getTopOfStack() { assert(!isStackEmpty() && "no current directive"); return *getTopOfStackOrNull(); } const SharingMapTy &getTopOfStack() const { - return const_cast<DSAStackTy&>(*this).getTopOfStack(); + return const_cast<DSAStackTy &>(*this).getTopOfStack(); } SharingMapTy *getSecondOnStackOrNull() { @@ -272,7 +272,7 @@ class DSAStackTy { return &Stack.back().first[Size - 2]; } const SharingMapTy *getSecondOnStackOrNull() const { - return const_cast<DSAStackTy&>(*this).getSecondOnStackOrNull(); + return const_cast<DSAStackTy &>(*this).getSecondOnStackOrNull(); } /// Get the stack element at a certain level (previously returned by @@ -286,7 +286,7 @@ class DSAStackTy { return Stack.back().first[Level]; } const SharingMapTy &getStackElemAtLevel(unsigned Level) const { - return const_cast<DSAStackTy&>(*this).getStackElemAtLevel(Level); + return const_cast<DSAStackTy &>(*this).getStackElemAtLevel(Level); } DSAVarData getDSA(const_iterator &Iter, ValueDecl *D) const; @@ -354,9 +354,7 @@ class DSAStackTy { const SharingMapTy *Top = getTopOfStackOrNull(); return Top && Top->BodyComplete; } - void setBodyComplete() { - getTopOfStack().BodyComplete = true; - } + void setBodyComplete() { getTopOfStack().BodyComplete = true; } bool isForceVarCapturing() const { return ForceCapturing; } void setForceVarCapturing(bool V) { ForceCapturing = V; } @@ -392,6 +390,7 @@ class DSAStackTy { class ParentDirectiveScope { DSAStackTy &Self; bool Active; + public: ParentDirectiveScope(DSAStackTy &Self, bool Activate) : Self(Self), Active(false) { @@ -433,8 +432,7 @@ class DSAStackTy { } /// Marks (or clears) declaration as possibly loop counter. void resetPossibleLoopCounter(const Decl *D = nullptr) { - getTopOfStack().PossiblyLoopCounter = - D ? D->getCanonicalDecl() : D; + getTopOfStack().PossiblyLoopCounter = D ? D->getCanonicalDecl() : D; } /// Gets the possible loop counter decl. const Decl *getPossiblyLoopCunter() const { @@ -631,13 +629,10 @@ class DSAStackTy { } /// Add requires decl to internal vector - void addRequiresDecl(OMPRequiresDecl *RD) { - RequiresDecls.push_back(RD); - } + void addRequiresDecl(OMPRequiresDecl *RD) { RequiresDecls.push_back(RD); } /// Checks if the defined 'requires' directive has specified type of clause. - template <typename ClauseType> - bool hasRequiresDeclWithClause() const { + template <typename ClauseType> bool hasRequiresDeclWithClause() const { return llvm::any_of(RequiresDecls, [](const OMPRequiresDecl *D) { return llvm::any_of(D->clauselists(), [](const OMPClause *C) { return isa<ClauseType>(C); @@ -680,9 +675,7 @@ class DSAStackTy { /// Returns the location of the first encountered atomic directive in the /// module. - SourceLocation getAtomicDirectiveLoc() const { - return AtomicLocation; - } + SourceLocation getAtomicDirectiveLoc() const { return AtomicLocation; } // Return previously encountered target region locations. ArrayRef<SourceLocation> getEncounteredTargetLocs() const { @@ -706,8 +699,7 @@ class DSAStackTy { } /// Set default data mapping attribute to Modifier:Kind void setDefaultDMAAttr(OpenMPDefaultmapClauseModifier M, - OpenMPDefaultmapClauseKind Kind, - SourceLocation Loc) { + OpenMPDefaultmapClauseKind Kind, SourceLocation Loc) { DefaultmapInfo &DMI = getTopOfStack().DefaultmapMap[Kind]; DMI.ImplicitBehavior = M; DMI.SLoc = Loc; @@ -749,12 +741,10 @@ class DSAStackTy { : getStackElemAtLevel(Level).DefaultAttr; } DefaultDataSharingAttributes getDefaultDSA() const { - return isStackEmpty() ? DSA_unspecified - : getTopOfStack().DefaultAttr; + return isStackEmpty() ? DSA_unspecified : getTopOfStack().DefaultAttr; } SourceLocation getDefaultDSALocation() const { - return isStackEmpty() ? SourceLocation() - : getTopOfStack().DefaultAttrLoc; + return isStackEmpty() ? SourceLocation() : getTopOfStack().DefaultAttrLoc; } OpenMPDefaultmapClauseModifier getDefaultmapModifier(OpenMPDefaultmapClauseKind Kind) const { @@ -1457,8 +1447,7 @@ void DSAStackTy::addTaskgroupReductionData(const ValueDecl *D, SourceRange SR, "Additional reduction info may be specified only once for reduction " "items."); ReductionData.set(BOK, SR); - Expr *&TaskgroupReductionRef = - getTopOfStack().TaskgroupReductionRef; + Expr *&TaskgroupReductionRef = getTopOfStack().TaskgroupReductionRef; if (!TaskgroupReductionRef) { VarDecl *VD = buildVarDecl(SemaRef, SR.getBegin(), SemaRef.Context.VoidPtrTy, ".task_red."); @@ -1483,8 +1472,7 @@ void DSAStackTy::addTaskgroupReductionData(const ValueDecl *D, SourceRange SR, "Additional reduction info may be specified only once for reduction " "items."); ReductionData.set(ReductionRef, SR); - Expr *&TaskgroupReductionRef = - getTopOfStack().TaskgroupReductionRef; + Expr *&TaskgroupReductionRef = getTopOfStack().TaskgroupReductionRef; if (!TaskgroupReductionRef) { VarDecl *VD = buildVarDecl(SemaRef, SR.getBegin(), SemaRef.Context.VoidPtrTy, ".task_red."); @@ -1595,10 +1583,9 @@ static bool rejectConstNotMutableType(Sema &SemaRef, const ValueDecl *D, ASTContext &Context = SemaRef.getASTContext(); bool IsClassType; if (isConstNotMutableType(SemaRef, Type, AcceptIfMutable, &IsClassType)) { - unsigned Diag = ListItemNotVar - ? diag::err_omp_const_list_item - : IsClassType ? diag::err_omp_const_not_mutable_variable - : diag::err_omp_const_variable; + unsigned Diag = ListItemNotVar ? diag::err_omp_const_list_item + : IsClassType ? diag::err_omp_const_not_mutable_variable + : diag::err_omp_const_variable; SemaRef.Diag(ELoc, Diag) << getOpenMPClauseName(CKind); if (!ListItemNotVar && D) { const VarDecl *VD = dyn_cast<VarDecl>(D); @@ -1658,8 +1645,7 @@ const DSAStackTy::DSAVarData DSAStackTy::getTopDSA(ValueDecl *D, }); if (IterTarget != end()) { const_iterator ParentIterTarget = IterTarget + 1; - for (const_iterator Iter = begin(); - Iter != ParentIterTarget; ++Iter) { + for (const_iterator Iter = begin(); Iter != ParentIterTarget; ++Iter) { if (isOpenMPLocal(VD, Iter)) { DVar.RefExpr = buildDeclRefExpr(SemaRef, VD, D->getType().getNonReferenceType(), @@ -1677,9 +1663,9 @@ const DSAStackTy::DSAVarData DSAStackTy::getTopDSA(ValueDecl *D, return DVar; } const_iterator End = end(); - if (!SemaRef.isOpenMPCapturedByRef( - D, std::distance(ParentIterTarget, End), - /*OpenMPCaptureLevel=*/0)) { + if (!SemaRef.isOpenMPCapturedByRef(D, + std::distance(ParentIterTarget, End), + /*OpenMPCaptureLevel=*/0)) { DVar.RefExpr = buildDeclRefExpr(SemaRef, VD, D->getType().getNonReferenceType(), IterTarget->ConstructLoc); @@ -1891,9 +1877,7 @@ void Sema::InitDataSharingAttributesStack() { #define DSAStack static_cast<DSAStackTy *>(VarDataSharingAttributesStack) -void Sema::pushOpenMPFunctionRegion() { - DSAStack->pushFunction(); -} +void Sema::pushOpenMPFunctionRegion() { DSAStack->pushFunction(); } void Sema::popOpenMPFunctionRegion(const FunctionScopeInfo *OldFSI) { DSAStack->popFunction(OldFSI); @@ -2070,8 +2054,8 @@ bool Sema::isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level, DSAStack->checkMappableExprComponentListsForDeclAtLevel( D, Level, - [&IsVariableUsedInMapClause, &IsVariableAssociatedWithSection, D]( - OMPClauseMappableExprCommon::MappableExprComponentListRef + [&IsVariableUsedInMapClause, &IsVariableAssociatedWithSection, + D](OMPClauseMappableExprCommon::MappableExprComponentListRef MapExprComponents, OpenMPClauseKind WhereFoundClauseKind) { // Only the map clause information influences how a variable is @@ -2248,7 +2232,7 @@ VarDecl *Sema::isOpenMPCapturedDecl(ValueDecl *D, bool CheckScopeInfo, bool OpenMPFound = false; for (unsigned I = StopAt + 1; I > 0; --I) { FunctionScopeInfo *FSI = FunctionScopes[I - 1]; - if(!isa<CapturingScopeInfo>(FSI)) + if (!isa<CapturingScopeInfo>(FSI)) return nullptr; if (auto *RSI = dyn_cast<CapturedRegionScopeInfo>(FSI)) if (RSI->CapRegionKind == CR_OpenMP) { @@ -2351,8 +2335,7 @@ OpenMPClauseKind Sema::isOpenMPPrivateDecl(ValueDecl *D, unsigned Level, } } if (isOpenMPLoopDirective(DSAStack->getCurrentDirective())) { - if (DSAStack->getAssociatedLoops() > 0 && - !DSAStack->isLoopStarted()) { + if (DSAStack->getAssociatedLoops() > 0 && !DSAStack->isLoopStarted()) { DSAStack->resetPossibleLoopCounter(D); DSAStack->loopStart(); return OMPC_private; @@ -2519,16 +2502,16 @@ void Sema::finalizeOpenMPDelayedAnalysis(const FunctionDecl *Caller, << HostDevTy; return; } - if (!LangOpts.OpenMPIsDevice && DevTy && - *DevTy == OMPDeclareTargetDeclAttr::DT_NoHost) { - // Diagnose nohost function called during host codegen. - StringRef NoHostDevTy = getOpenMPSimpleClauseTypeName( - OMPC_device_type, OMPC_DEVICE_TYPE_nohost); - Diag(Loc, diag::err_omp_wrong_device_function_call) << NoHostDevTy << 1; - Diag(*OMPDeclareTargetDeclAttr::getLocation(FD), - diag::note_omp_marked_device_type_here) - << NoHostDevTy; - } + if (!LangOpts.OpenMPIsDevice && DevTy && + *DevTy == OMPDeclareTargetDeclAttr::DT_NoHost) { + // Diagnose nohost function called during host codegen. + StringRef NoHostDevTy = getOpenMPSimpleClauseTypeName( + OMPC_device_type, OMPC_DEVICE_TYPE_nohost); + Diag(Loc, diag::err_omp_wrong_device_function_call) << NoHostDevTy << 1; + Diag(*OMPDeclareTargetDeclAttr::getLocation(FD), + diag::note_omp_marked_device_type_here) + << NoHostDevTy; + } } void Sema::StartOpenMPDSABlock(OpenMPDirectiveKind DKind, @@ -2779,7 +2762,6 @@ class VarDeclFilterCCC final : public CorrectionCandidateCallback { std::unique_ptr<CorrectionCandidateCallback> clone() override { return std::make_unique<VarDeclFilterCCC>(*this); } - }; class VarOrFuncDeclFilterCCC final : public CorrectionCandidateCallback { @@ -3151,9 +3133,10 @@ applyOMPAllocateAttribute(Sema &S, VarDecl *VD, ML->DeclarationMarkedOpenMPAllocate(VD, A); } -Sema::DeclGroupPtrTy Sema::ActOnOpenMPAllocateDirective( - SourceLocation Loc, ArrayRef<Expr *> VarList, - ArrayRef<OMPClause *> Clauses, DeclContext *Owner) { +Sema::DeclGroupPtrTy +Sema::ActOnOpenMPAllocateDirective(SourceLocation Loc, ArrayRef<Expr *> VarList, + ArrayRef<OMPClause *> Clauses, + DeclContext *Owner) { assert(Clauses.size() <= 2 && "Expected at most two clauses."); Expr *Alignment = nullptr; Expr *Allocator = nullptr; @@ -5103,8 +5086,8 @@ static std::pair<ValueDecl *, bool> getPrivateItem(Sema &S, Expr *&RefExpr, !isa<CXXThisExpr>(ME->getBase()->IgnoreParenImpCasts()) || !isa<FieldDecl>(ME->getMemberDecl()))) { if (IsArrayExpr != NoArrayExpr) { - S.Diag(ELoc, diag::err_omp_expected_base_var_name) << IsArrayExpr - << ERange; + S.Diag(ELoc, diag::err_omp_expected_base_var_name) + << IsArrayExpr << ERange; } else { S.Diag(ELoc, AllowArraySection @@ -5148,8 +5131,7 @@ static void checkAllocateClauses(Sema &S, DSAStackTy *Stack, "Expected non-dependent context."); auto AllocateRange = llvm::make_filter_range(Clauses, OMPAllocateClause::classof); - llvm::DenseMap<CanonicalDeclPtr<Decl>, CanonicalDeclPtr<VarDecl>> - DeclToCopy; + llvm::DenseMap<CanonicalDeclPtr<Decl>, CanonicalDeclPtr<VarDecl>> DeclToCopy; auto PrivateRange = llvm::make_filter_range(Clauses, [](const OMPClause *C) { return isOpenMPPrivate(C->getClauseKind()); }); @@ -6032,7 +6014,7 @@ StmtResult Sema::ActOnOpenMPExecutableDirective( break; case OMPD_parallel_master: Res = ActOnOpenMPParallelMasterDirective(ClausesWithImplicit, AStmt, - StartLoc, EndLoc); + StartLoc, EndLoc); AllowedNameModifiers.push_back(OMPD_parallel); break; case OMPD_parallel_sections: @@ -7640,10 +7622,10 @@ bool OpenMPIterationSpaceChecker::setStep(Expr *NewStep, bool Subtract) { // != with increment is treated as <; != with decrement is treated as > if (!TestIsLessOp.hasValue()) TestIsLessOp = IsConstPos || (IsUnsigned && !Subtract); - if (UB && (IsConstZero || - (TestIsLessOp.getValue() ? - (IsConstNeg || (IsUnsigned && Subtract)) : - (IsConstPos || (IsUnsigned && !Subtract))))) { + if (UB && + (IsConstZero || (TestIsLessOp.getValue() + ? (IsConstNeg || (IsUnsigned && Subtract)) + : (IsConstPos || (IsUnsigned && !Subtract))))) { SemaRef.Diag(NewStep->getExprLoc(), diag::err_omp_loop_incr_not_compatible) << LCDecl << TestIsLessOp.getValue() << NewStep->getSourceRange(); @@ -8082,11 +8064,13 @@ calculateNumIters(Sema &SemaRef, Scope *S, SourceLocation DefaultLoc, return nullptr; llvm::APSInt LRes, SRes; bool IsLowerConst = false, IsStepConst = false; - if (Optional<llvm::APSInt> Res = Lower->getIntegerConstantExpr(SemaRef.Context)) { + if (Optional<llvm::APSInt> Res = + Lower->getIntegerConstantExpr(SemaRef.Context)) { LRes = *Res; IsLowerConst = true; } - if (Optional<llvm::APSInt> Res = Step->getIntegerConstantExpr(SemaRef.Context)) { + if (Optional<llvm::APSInt> Res = + Step->getIntegerConstantExpr(SemaRef.Context)) { SRes = *Res; IsStepConst = true; } @@ -8124,7 +8108,8 @@ calculateNumIters(Sema &SemaRef, Scope *S, SourceLocation DefaultLoc, } llvm::APSInt URes; bool IsUpperConst = false; - if (Optional<llvm::APSInt> Res = Upper->getIntegerConstantExpr(SemaRef.Context)) { + if (Optional<llvm::APSInt> Res = + Upper->getIntegerConstantExpr(SemaRef.Context)) { URes = *Res; IsUpperConst = true; } @@ -8580,10 +8565,12 @@ Expr *OpenMPIterationSpaceChecker::buildPreCond( // TODO: this can be improved by calculating min/max values but not sure that // it will be very effective. if (CondDependOnLC || InitDependOnLC) - return SemaRef.PerformImplicitConversion( - SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get(), - SemaRef.Context.BoolTy, /*Action=*/Sema::AA_Casting, - /*AllowExplicit=*/true).get(); + return SemaRef + .PerformImplicitConversion( + SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get(), + SemaRef.Context.BoolTy, /*Action=*/Sema::AA_Casting, + /*AllowExplicit=*/true) + .get(); // Try to build LB <op> UB, where <op> is <, >, <=, or >=. Sema::TentativeAnalysisScope Trap(SemaRef); @@ -8593,12 +8580,11 @@ Expr *OpenMPIterationSpaceChecker::buildPreCond( if (!NewLB.isUsable() || !NewUB.isUsable()) return nullptr; - ExprResult CondExpr = - SemaRef.BuildBinOp(S, DefaultLoc, - TestIsLessOp.getValue() ? - (TestIsStrictOp ? BO_LT : BO_LE) : - (TestIsStrictOp ? BO_GT : BO_GE), - NewLB.get(), NewUB.get()); + ExprResult CondExpr = SemaRef.BuildBinOp( + S, DefaultLoc, + TestIsLessOp.getValue() ? (TestIsStrictOp ? BO_LT : BO_LE) + : (TestIsStrictOp ? BO_GT : BO_GE), + NewLB.get(), NewUB.get()); if (CondExpr.isUsable()) { if (!SemaRef.Context.hasSameUnqualifiedType(CondExpr.get()->getType(), SemaRef.Context.BoolTy)) @@ -9701,9 +9687,8 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr, ExprResult Iter; // Compute prod - ExprResult Prod = - SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get(); - for (unsigned int K = Cnt+1; K < NestedLoopCount; ++K) + ExprResult Prod = SemaRef.ActOnIntegerConstant(SourceLocation(), 1).get(); + for (unsigned int K = Cnt + 1; K < NestedLoopCount; ++K) Prod = SemaRef.BuildBinOp(CurScope, UpdLoc, BO_Mul, Prod.get(), IterSpaces[K].NumIterations); @@ -9711,8 +9696,8 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr, // If there is at least one more inner loop to avoid // multiplication by 1. if (Cnt + 1 < NestedLoopCount) - Iter = SemaRef.BuildBinOp(CurScope, UpdLoc, BO_Div, - Acc.get(), Prod.get()); + Iter = + SemaRef.BuildBinOp(CurScope, UpdLoc, BO_Div, Acc.get(), Prod.get()); else Iter = Acc; if (!Iter.isUsable()) { @@ -9725,12 +9710,11 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr, // Check if there is at least one more inner loop to avoid // multiplication by 1. if (Cnt + 1 < NestedLoopCount) - Prod = SemaRef.BuildBinOp(CurScope, UpdLoc, BO_Mul, - Iter.get(), Prod.get()); + Prod = SemaRef.BuildBinOp(CurScope, UpdLoc, BO_Mul, Iter.get(), + Prod.get()); else Prod = Iter; - Acc = SemaRef.BuildBinOp(CurScope, UpdLoc, BO_Sub, - Acc.get(), Prod.get()); + Acc = SemaRef.BuildBinOp(CurScope, UpdLoc, BO_Sub, Acc.get(), Prod.get()); // Build update: IS.CounterVar(Private) = IS.Start + Iter * IS.Step auto *VD = cast<VarDecl>(cast<DeclRefExpr>(IS.CounterVar)->getDecl()); @@ -11092,8 +11076,8 @@ StmtResult Sema::ActOnOpenMPAtomicDirective(ArrayRef<OMPClause *> Clauses, if (ErrorFound != NoError) { Diag(ErrorLoc, diag::err_omp_atomic_read_not_expression_statement) << ErrorRange; - Diag(NoteLoc, diag::note_omp_atomic_read_write) << ErrorFound - << NoteRange; + Diag(NoteLoc, diag::note_omp_atomic_read_write) + << ErrorFound << NoteRange; return StmtError(); } if (CurContext->isDependentContext()) @@ -11154,8 +11138,8 @@ StmtResult Sema::ActOnOpenMPAtomicDirective(ArrayRef<OMPClause *> Clauses, if (ErrorFound != NoError) { Diag(ErrorLoc, diag::err_omp_atomic_write_not_expression_statement) << ErrorRange; - Diag(NoteLoc, diag::note_omp_atomic_read_write) << ErrorFound - << NoteRange; + Diag(NoteLoc, diag::note_omp_atomic_read_write) + << ErrorFound << NoteRange; return StmtError(); } if (CurContext->isDependentContext()) @@ -11171,9 +11155,10 @@ StmtResult Sema::ActOnOpenMPAtomicDirective(ArrayRef<OMPClause *> Clauses, // x = expr binop x; OpenMPAtomicUpdateChecker Checker(*this); if (Checker.checkStatement( - Body, (AtomicKind == OMPC_update) - ? diag::err_omp_atomic_update_not_expression_statement - : diag::err_omp_atomic_not_expression_statement, + Body, + (AtomicKind == OMPC_update) + ? diag::err_omp_atomic_update_not_expression_statement + : diag::err_omp_atomic_not_expression_statement, diag::note_omp_atomic_update)) return StmtError(); if (!CurContext->isDependentContext()) { @@ -12300,8 +12285,8 @@ StmtResult Sema::ActOnOpenMPTargetParallelForSimdDirective( // define the nested loops number. unsigned NestedLoopCount = checkOpenMPLoop( OMPD_target_parallel_for_simd, getCollapseNumberExpr(Clauses), - getOrderedNumberExpr(Clauses), CS, *this, *DSAStack, - VarsWithImplicitDSA, B); + getOrderedNumberExpr(Clauses), CS, *this, *DSAStack, VarsWithImplicitDSA, + B); if (NestedLoopCount == 0) return StmtError(); @@ -15998,9 +15983,8 @@ OMPClause *Sema::ActOnOpenMPPrivateClause(ArrayRef<Expr *> VarList, Diag(ELoc, diag::err_omp_variably_modified_type_not_supported) << getOpenMPClauseName(OMPC_private) << Type << getOpenMPDirectiveName(CurrDir); - bool IsDecl = - !VD || - VD->isThisDeclarationADefinition(Context) == VarDecl::DeclarationOnly; + bool IsDecl = !VD || VD->isThisDeclarationADefinition(Context) == + VarDecl::DeclarationOnly; Diag(D->getLocation(), IsDecl ? diag::note_previous_decl : diag::note_defined_here) << D; @@ -16264,9 +16248,8 @@ OMPClause *Sema::ActOnOpenMPFirstprivateClause(ArrayRef<Expr *> VarList, Diag(ELoc, diag::err_omp_variably_modified_type_not_supported) << getOpenMPClauseName(OMPC_firstprivate) << Type << getOpenMPDirectiveName(DSAStack->getCurrentDirective()); - bool IsDecl = - !VD || - VD->isThisDeclarationADefinition(Context) == VarDecl::DeclarationOnly; + bool IsDecl = !VD || VD->isThisDeclarationADefinition(Context) == + VarDecl::DeclarationOnly; Diag(D->getLocation(), IsDecl ? diag::note_previous_decl : diag::note_defined_here) << D; @@ -17450,8 +17433,8 @@ static bool actOnOMPReductionKindClause( llvm::APInt InitValue = (BOK != BO_LT) ? IsSigned ? llvm::APInt::getSignedMinValue(Size) : llvm::APInt::getMinValue(Size) - : IsSigned ? llvm::APInt::getSignedMaxValue(Size) - : llvm::APInt::getMaxValue(Size); + : IsSigned ? llvm::APInt::getSignedMaxValue(Size) + : llvm::APInt::getMaxValue(Size); Init = IntegerLiteral::Create(Context, InitValue, IntTy, ELoc); if (Type->isPointerType()) { // Cast to pointer type. @@ -17862,9 +17845,8 @@ bool Sema::CheckOpenMPLinearDecl(const ValueDecl *D, SourceLocation ELoc, !Ty->isIntegralType(Context) && !Ty->isPointerType())) { Diag(ELoc, diag::err_omp_linear_expected_int_or_ptr) << Type; if (D) { - bool IsDecl = - !VD || - VD->isThisDeclarationADefinition(Context) == VarDecl::DeclarationOnly; + bool IsDecl = !VD || VD->isThisDeclarationADefinition(Context) == + VarDecl::DeclarationOnly; Diag(D->getLocation(), IsDecl ? diag::note_previous_decl : diag::note_defined_here) << D; @@ -18140,9 +18122,8 @@ OMPClause *Sema::ActOnOpenMPAlignedClause( if (!Ty || (!Ty->isArrayType() && !Ty->isPointerType())) { Diag(ELoc, diag::err_omp_aligned_expected_array_or_ptr) << QType << getLangOpts().CPlusPlus << ERange; - bool IsDecl = - !VD || - VD->isThisDeclarationADefinition(Context) == VarDecl::DeclarationOnly; + bool IsDecl = !VD || VD->isThisDeclarationADefinition(Context) == + VarDecl::DeclarationOnly; Diag(D->getLocation(), IsDecl ? diag::note_previous_decl : diag::note_defined_here) << D; @@ -18343,9 +18324,8 @@ OMPClause *Sema::ActOnOpenMPCopyprivateClause(ArrayRef<Expr *> VarList, Diag(ELoc, diag::err_omp_variably_modified_type_not_supported) << getOpenMPClauseName(OMPC_copyprivate) << Type << getOpenMPDirectiveName(DSAStack->getCurrentDirective()); - bool IsDecl = - !VD || - VD->isThisDeclarationADefinition(Context) == VarDecl::DeclarationOnly; + bool IsDecl = !VD || VD->isThisDeclarationADefinition(Context) == + VarDecl::DeclarationOnly; Diag(D->getLocation(), IsDecl ? diag::note_previous_decl : diag::note_defined_here) << D; @@ -18947,7 +18927,7 @@ class MapBaseChecker final : public StmtVisitor<MapBaseChecker, bool> { if (!isa<FieldDecl>(ME->getMemberDecl())) { if (!NoDiagnose) { SemaRef.Diag(ELoc, diag::err_omp_expected_access_to_data_field) - << ME->getSourceRange(); + << ME->getSourceRange(); return false; } if (RelevantExpr) @@ -18963,7 +18943,7 @@ class MapBaseChecker final : public StmtVisitor<MapBaseChecker, bool> { if (FD->isBitField()) { if (!NoDiagnose) { SemaRef.Diag(ELoc, diag::err_omp_bit_fields_forbidden_in_clause) - << ME->getSourceRange() << getOpenMPClauseName(CKind); + << ME->getSourceRange() << getOpenMPClauseName(CKind); return false; } if (RelevantExpr) @@ -18983,7 +18963,7 @@ class MapBaseChecker final : public StmtVisitor<MapBaseChecker, bool> { if (CurType->isUnionType()) { if (!NoDiagnose) { SemaRef.Diag(ELoc, diag::err_omp_union_type_not_allowed) - << ME->getSourceRange(); + << ME->getSourceRange(); return false; } return RelevantExpr || Visit(E); @@ -19010,7 +18990,7 @@ class MapBaseChecker final : public StmtVisitor<MapBaseChecker, bool> { if (!E->getType()->isAnyPointerType() && !E->getType()->isArrayType()) { if (!NoDiagnose) { SemaRef.Diag(ELoc, diag::err_omp_expected_base_var_name) - << 0 << AE->getSourceRange(); + << 0 << AE->getSourceRange(); return false; } return RelevantExpr || Visit(E); @@ -19019,8 +18999,7 @@ class MapBaseChecker final : public StmtVisitor<MapBaseChecker, bool> { // If we got an array subscript that express the whole dimension we // can have any array expressions before. If it only expressing part of // the dimension, we can only have unitary-size array expressions. - if (checkArrayExpressionDoesNotReferToWholeSize(SemaRef, AE, - E->getType())) + if (checkArrayExpressionDoesNotReferToWholeSize(SemaRef, AE, E->getType())) AllowWholeSizeArraySection = false; if (const auto *TE = dyn_cast<CXXThisExpr>(E->IgnoreParenCasts())) { @@ -19050,7 +19029,7 @@ class MapBaseChecker final : public StmtVisitor<MapBaseChecker, bool> { "Array sections cannot be implicitly mapped."); Expr *E = OASE->getBase()->IgnoreParenImpCasts(); QualType CurType = - OMPArraySectionExpr::getBaseOriginalType(E).getCanonicalType(); + OMPArraySectionExpr::getBaseOriginalType(E).getCanonicalType(); // OpenMP 4.5 [2.15.5.1, map Clause, Restrictions, C++, p.1] // If the type of a list item is a reference to a type T then the type @@ -19062,14 +19041,14 @@ class MapBaseChecker final : public StmtVisitor<MapBaseChecker, bool> { if (!IsPointer && !CurType->isArrayType()) { SemaRef.Diag(ELoc, diag::err_omp_expected_base_var_name) - << 0 << OASE->getSourceRange(); + << 0 << OASE->getSourceRange(); return false; } bool NotWhole = - checkArrayExpressionDoesNotReferToWholeSize(SemaRef, OASE, CurType); + checkArrayExpressionDoesNotReferToWholeSize(SemaRef, OASE, CurType); bool NotUnity = - checkArrayExpressionDoesNotReferToUnitySize(SemaRef, OASE, CurType); + checkArrayExpressionDoesNotReferToUnitySize(SemaRef, OASE, CurType); if (AllowWholeSizeArraySection) { // Any array section is currently allowed. Allowing a whole size array @@ -19092,9 +19071,9 @@ class MapBaseChecker final : public StmtVisitor<MapBaseChecker, bool> { // compatible with the properties of the current array section. if (NoDiagnose) return false; - SemaRef.Diag( - ELoc, diag::err_array_section_does_not_specify_contiguous_storage) - << OASE->getSourceRange(); + SemaRef.Diag(ELoc, + diag::err_array_section_does_not_specify_contiguous_storage) + << OASE->getSourceRange(); return false; } @@ -19193,9 +19172,7 @@ class MapBaseChecker final : public StmtVisitor<MapBaseChecker, bool> { emitErrorMsg(); return false; } - const Expr *getFoundBase() const { - return RelevantExpr; - } + const Expr *getFoundBase() const { return RelevantExpr; } explicit MapBaseChecker( Sema &SemaRef, OpenMPClauseKind CKind, OpenMPDirectiveKind DKind, OMPClauseMappableExprCommon::MappableExprComponentList &Components, @@ -19206,9 +19183,9 @@ class MapBaseChecker final : public StmtVisitor<MapBaseChecker, bool> { } // namespace /// Return the expression of the base of the mappable expression or null if it -/// cannot be determined and do all the necessary checks to see if the expression -/// is valid as a standalone mappable expression. In the process, record all the -/// components of the expression. +/// cannot be determined and do all the necessary checks to see if the +/// expression is valid as a standalone mappable expression. In the process, +/// record all the components of the expression. static const Expr *checkMapClauseExpressionBase( Sema &SemaRef, Expr *E, OMPClauseMappableExprCommon::MappableExprComponentList &CurComponents, @@ -19398,9 +19375,9 @@ static bool checkMapConflicts( return true; } if (CI->getAssociatedExpression()->getStmtClass() != - SI->getAssociatedExpression()->getStmtClass() || - CI->getAssociatedDeclaration()->getCanonicalDecl() == - SI->getAssociatedDeclaration()->getCanonicalDecl()) { + SI->getAssociatedExpression()->getStmtClass() || + CI->getAssociatedDeclaration()->getCanonicalDecl() == + SI->getAssociatedDeclaration()->getCanonicalDecl()) { assert(CI != CE && SI != SE); SemaRef.Diag(DerivedLoc, diag::err_omp_same_pointer_dereferenced) << DerivedLoc; @@ -19621,7 +19598,7 @@ struct MappableVarListInfo { VarBaseDeclarations.reserve(VarList.size()); } }; -} +} // namespace // Check the validity of the provided variable list for the provided clause kind // \a CKind. In the check process the valid expressions, mappable expression @@ -21354,8 +21331,7 @@ OMPClause *Sema::ActOnOpenMPInclusiveClause(ArrayRef<Expr *> VarList, // A list item that appears in the inclusive or exclusive clause must appear // in a reduction clause with the inscan modifier on the enclosing // worksharing-loop, worksharing-loop SIMD, or simd construct. - if (DVar.CKind != OMPC_reduction || - DVar.Modifier != OMPC_REDUCTION_inscan) + if (DVar.CKind != OMPC_reduction || DVar.Modifier != OMPC_REDUCTION_inscan) Diag(ELoc, diag::err_omp_inclusive_exclusive_not_reduction) << RefExpr->getSourceRange(); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits