https://github.com/kparzysz updated https://github.com/llvm/llvm-project/pull/219821
>From 5e5d1ad81e1b7022ff4f60c9bdc6bd9555faf9c1 Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek <[email protected]> Date: Fri, 28 Aug 2026 13:50:52 -0500 Subject: [PATCH] [clang][OpenMP] Switch OpenMP version from unsigned to llvm::omp::Version --- clang/include/clang/AST/OpenMPClause.h | 5 +- clang/include/clang/ASTMatchers/ASTMatchers.h | 2 +- clang/include/clang/Basic/LangOptions.h | 6 + clang/lib/AST/DeclPrinter.cpp | 6 +- clang/lib/AST/StmtPrinter.cpp | 15 +-- clang/lib/Parse/ParseOpenMP.cpp | 32 ++--- clang/lib/Sema/SemaOpenMP.cpp | 119 +++++++++--------- clang/lib/Sema/TreeTransform.h | 7 +- 8 files changed, 100 insertions(+), 92 deletions(-) diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h index db490ff9951b8..ec84f10956ff4 100644 --- a/clang/include/clang/AST/OpenMPClause.h +++ b/clang/include/clang/AST/OpenMPClause.h @@ -35,6 +35,7 @@ #include "llvm/Frontend/OpenMP/OMPAssume.h" #include "llvm/Frontend/OpenMP/OMPConstants.h" #include "llvm/Frontend/OpenMP/OMPContext.h" +#include "llvm/Frontend/OpenMP/OMPVersion.h" #include "llvm/Support/Casting.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/TrailingObjects.h" @@ -10035,7 +10036,7 @@ class ConstOMPClauseVisitor : class OMPClausePrinter final : public OMPClauseVisitor<OMPClausePrinter> { raw_ostream &OS; const PrintingPolicy &Policy; - unsigned Version; + llvm::omp::Version Version; /// Process clauses with list of variables. template <typename T> void VisitOMPClauseList(T *Node, char StartSym); @@ -10044,7 +10045,7 @@ class OMPClausePrinter final : public OMPClauseVisitor<OMPClausePrinter> { public: OMPClausePrinter(raw_ostream &OS, const PrintingPolicy &Policy, - unsigned OpenMPVersion) + llvm::omp::Version OpenMPVersion) : OS(OS), Policy(Policy), Version(OpenMPVersion) {} #define GEN_CLANG_CLAUSE_CLASS diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h index 43cbeb3b40eac..c860d6856c568 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchers.h +++ b/clang/include/clang/ASTMatchers/ASTMatchers.h @@ -8959,7 +8959,7 @@ AST_MATCHER_P(OMPExecutableDirective, isAllowedToContainClauseKind, OpenMPClauseKind, CKind) { return llvm::omp::isAllowedClauseForDirective( Node.getDirectiveKind(), CKind, - Finder->getASTContext().getLangOpts().OpenMP); + Finder->getASTContext().getLangOpts().getOpenMP()); } /// Matches OpenMP ``from`` clause. diff --git a/clang/include/clang/Basic/LangOptions.h b/clang/include/clang/Basic/LangOptions.h index f21131622d03d..9fa698dc2a29a 100644 --- a/clang/include/clang/Basic/LangOptions.h +++ b/clang/include/clang/Basic/LangOptions.h @@ -25,6 +25,7 @@ #include "llvm/ADT/FloatingPointMode.h" #include "llvm/ADT/StringRef.h" #include "llvm/BinaryFormat/DXContainer.h" +#include "llvm/Frontend/OpenMP/OMPVersion.h" #include "llvm/Support/AllocToken.h" #include "llvm/TargetParser/Triple.h" #include <optional> @@ -822,6 +823,11 @@ class LangOptions : public LangOptionsBase { return OpenMPIsTargetDevice || CUDAIsDevice || SYCLIsDevice; } + /// Return the OpenMP version. + llvm::omp::Version getOpenMP() const { + return llvm::omp::Version(OpenMP); + } + /// Returns the most applicable C standard-compliant language version code. /// If none could be determined, returns \ref std::nullopt. std::optional<uint32_t> getCLangStd() const; diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp index 141ba50941685..5fdcf40ac8069 100644 --- a/clang/lib/AST/DeclPrinter.cpp +++ b/clang/lib/AST/DeclPrinter.cpp @@ -1886,7 +1886,7 @@ void DeclPrinter::VisitOMPAllocateDecl(OMPAllocateDecl *D) { Out << ")"; } if (!D->clauselist_empty()) { - OMPClausePrinter Printer(Out, Policy, Context.getLangOpts().OpenMP); + OMPClausePrinter Printer(Out, Policy, Context.getLangOpts().getOpenMP()); for (OMPClause *C : D->clauselists()) { Out << " "; Printer.Visit(C); @@ -1897,7 +1897,7 @@ void DeclPrinter::VisitOMPAllocateDecl(OMPAllocateDecl *D) { void DeclPrinter::VisitOMPRequiresDecl(OMPRequiresDecl *D) { Out << "#pragma omp requires "; if (!D->clauselist_empty()) { - OMPClausePrinter Printer(Out, Policy, Context.getLangOpts().OpenMP); + OMPClausePrinter Printer(Out, Policy, Context.getLangOpts().getOpenMP()); for (auto I = D->clauselist_begin(), E = D->clauselist_end(); I != E; ++I) Printer.Visit(*I); } @@ -1950,7 +1950,7 @@ void DeclPrinter::VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D) { Out << D->getVarName(); Out << ")"; if (!D->clauselist_empty()) { - OMPClausePrinter Printer(Out, Policy, Context.getLangOpts().OpenMP); + OMPClausePrinter Printer(Out, Policy, Context.getLangOpts().getOpenMP()); for (auto *C : D->clauselists()) { Out << " "; Printer.Visit(C); diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index 3cab31a300028..c76a8226a04fe 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -779,9 +779,8 @@ void StmtPrinter::VisitOMPCanonicalLoop(OMPCanonicalLoop *Node) { void StmtPrinter::PrintOMPExecutableDirective(OMPExecutableDirective *S, bool ForceNoStmt) { - unsigned OpenMPVersion = - Context ? Context->getLangOpts().OpenMP - : static_cast<unsigned>(llvm::omp::FallbackVersion); + llvm::omp::Version OpenMPVersion = + Context ? Context->getLangOpts().getOpenMP() : llvm::omp::FallbackVersion; OMPClausePrinter Printer(OS, Policy, OpenMPVersion); ArrayRef<OMPClause *> Clauses = S->clauses(); for (auto *Clause : Clauses) @@ -1026,18 +1025,16 @@ void StmtPrinter::VisitOMPTeamsDirective(OMPTeamsDirective *Node) { void StmtPrinter::VisitOMPCancellationPointDirective( OMPCancellationPointDirective *Node) { - unsigned OpenMPVersion = - Context ? Context->getLangOpts().OpenMP - : static_cast<unsigned>(llvm::omp::FallbackVersion); + llvm::omp::Version OpenMPVersion = + Context ? Context->getLangOpts().getOpenMP() : llvm::omp::FallbackVersion; Indent() << "#pragma omp cancellation point " << getOpenMPDirectiveName(Node->getCancelRegion(), OpenMPVersion); PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPCancelDirective(OMPCancelDirective *Node) { - unsigned OpenMPVersion = - Context ? Context->getLangOpts().OpenMP - : static_cast<unsigned>(llvm::omp::FallbackVersion); + llvm::omp::Version OpenMPVersion = + Context ? Context->getLangOpts().getOpenMP() : llvm::omp::FallbackVersion; Indent() << "#pragma omp cancel " << getOpenMPDirectiveName(Node->getCancelRegion(), OpenMPVersion); PrintOMPExecutableDirective(Node); diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp index 4497fd488d79f..12bd48f9e32c3 100644 --- a/clang/lib/Parse/ParseOpenMP.cpp +++ b/clang/lib/Parse/ParseOpenMP.cpp @@ -162,7 +162,7 @@ static DeclarationName parseOpenMPReductionId(Parser &P) { Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclareReductionDirective(AccessSpecifier AS) { - unsigned OMPVersion = Actions.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP(); // Parse '('. BalancedDelimiterTracker T(*this, tok::l_paren, tok::annot_pragma_openmp_end); if (T.expectAndConsume( @@ -407,7 +407,7 @@ void Parser::ParseOpenMPReductionInitializerForDecl(VarDecl *OmpPrivParm) { Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclareMapperDirective(AccessSpecifier AS) { bool IsCorrect = true; - unsigned OMPVersion = Actions.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP(); // Parse '(' BalancedDelimiterTracker T(*this, tok::l_paren, tok::annot_pragma_openmp_end); if (T.expectAndConsume( @@ -686,7 +686,8 @@ static bool parseDeclareSimdClauses( P.ConsumeToken(); } else if (ClauseName == "simdlen") { if (SimdLen.isUsable()) { - unsigned OMPVersion = P.getActions().getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = + P.getActions().getLangOpts().getOpenMP(); P.Diag(Tok, diag::err_omp_more_one_clause) << getOpenMPDirectiveName(OMPD_declare_simd, OMPVersion) << ClauseName << 0; @@ -1335,7 +1336,7 @@ bool Parser::parseOMPContextSelectors(SourceLocation Loc, OMPTraitInfo &TI) { void Parser::ParseOMPDeclareVariantClauses(Parser::DeclGroupPtrTy Ptr, CachedTokens &Toks, SourceLocation Loc) { - unsigned OMPVersion = Actions.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP(); PP.EnterToken(Tok, /*IsReinject*/ true); PP.EnterTokenStream(Toks, /*DisableMacroExpansion=*/true, /*IsReinject*/ true); @@ -1388,8 +1389,7 @@ void Parser::ParseOMPDeclareVariantClauses(Parser::DeclGroupPtrTy Ptr, OpenMPClauseKind CKind = Tok.isAnnotation() ? OMPC_unknown : getOpenMPClauseKind(PP.getSpelling(Tok)); - if (!isAllowedClauseForDirective(OMPD_declare_variant, CKind, - getLangOpts().OpenMP)) { + if (!isAllowedClauseForDirective(OMPD_declare_variant, CKind, OMPVersion)) { Diag(Tok.getLocation(), diag::err_omp_declare_variant_wrong_clause) << (getLangOpts().OpenMP < 51 ? 0 : 1); IsError = true; @@ -1665,7 +1665,7 @@ void Parser::ParseOpenMPAssumesDirective(OpenMPDirectiveKind DKind, bool NextIsLPar = Tok.is(tok::l_paren); // Handle unknown clauses by skipping them. if (Idx == -1) { - unsigned OMPVersion = Actions.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP(); Diag(StartLoc, diag::warn_omp_unknown_assumption_clause_missing_id) << llvm::omp::getOpenMPDirectiveName(DKind, OMPVersion) << llvm::omp::getAllAssumeClauseOptions() << NextIsLPar; @@ -1781,7 +1781,7 @@ void Parser::ParseOMPDeclareTargetClauses( getOpenMPClauseKind(ClauseName) == OMPC_indirect; if (DTCI.Indirect && IsIndirectClause) { - unsigned OMPVersion = Actions.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP(); Diag(Tok, diag::err_omp_more_one_clause) << getOpenMPDirectiveName(OMPD_declare_target, OMPVersion) << getOpenMPClauseName(OMPC_indirect) << 0; @@ -1933,7 +1933,7 @@ void Parser::skipUntilPragmaOpenMPEnd(OpenMPDirectiveKind DKind) { if (Tok.is(tok::annot_pragma_openmp_end)) return; - unsigned OMPVersion = Actions.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP(); Diag(Tok, diag::warn_omp_extra_tokens_at_eol) << getOpenMPDirectiveName(DKind, OMPVersion); while (Tok.isNot(tok::annot_pragma_openmp_end)) @@ -1954,7 +1954,7 @@ void Parser::parseOMPEndDirective(OpenMPDirectiveKind BeginKind, return; } - unsigned OMPVersion = Actions.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP(); Diag(FoundLoc, diag::err_expected_end_declare_target_or_variant) << DiagSelection; Diag(BeginLoc, diag::note_matching) @@ -1982,7 +1982,7 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl( "Not an OpenMP directive!"); ParsingOpenMPDirectiveRAII DirScope(*this); ParenBraceBracketBalancer BalancerRAIIObj(*this); - unsigned OMPVersion = Actions.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP(); SourceLocation Loc; OpenMPDirectiveKind DKind; @@ -2303,7 +2303,7 @@ StmtResult Parser::ParseOpenMPExecutableDirective( ParsedStmtContext StmtCtx, OpenMPDirectiveKind DKind, SourceLocation Loc, bool ReadDirectiveWithinMetadirective) { assert(isOpenMPExecutableDirective(DKind) && "Unexpected directive category"); - unsigned OMPVersion = Actions.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP(); bool HasAssociatedStatement = true; Association Assoc = getDirectiveAssociation(DKind); @@ -2573,7 +2573,7 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective( SourceLocation Loc = ReadDirectiveWithinMetadirective ? Tok.getLocation() : ConsumeAnnotationToken(); - unsigned OMPVersion = Actions.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP(); OpenMPDirectiveKind DKind = parseOpenMPDirectiveKind(*this); if (ReadDirectiveWithinMetadirective && DKind == OMPD_unknown) { Diag(Tok, diag::err_omp_unknown_directive); @@ -2953,7 +2953,7 @@ bool Parser::ParseOpenMPSimpleVarList( const llvm::function_ref<void(CXXScopeSpec &, DeclarationNameInfo)> &Callback, bool AllowScopeSpecifier) { - unsigned OMPVersion = Actions.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP(); // Parse '('. BalancedDelimiterTracker T(*this, tok::l_paren, tok::annot_pragma_openmp_end); if (T.expectAndConsume(diag::err_expected_lparen_after, @@ -3239,7 +3239,7 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind, OMPClause *Clause = nullptr; bool ErrorFound = false; bool WrongDirective = false; - unsigned OMPVersion = Actions.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP(); auto CheckClauseValid = [&](OpenMPDirectiveKind D, OpenMPClauseKind C) { if (!isAllowedClauseForDirective(D, C, OMPVersion)) { @@ -5490,7 +5490,7 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind, else if (Tok.isNot(tok::r_paren) && Tok.isNot(tok::annot_pragma_openmp_end) && (!MayHaveTail || Tok.isNot(tok::colon))) { - unsigned OMPVersion = Actions.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP(); Diag(Tok, diag::err_omp_expected_punc) << ((Kind == OMPC_flush) ? getOpenMPDirectiveName(OMPD_flush, OMPVersion) diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 7ddda157dad9d..d5ea6f259ff09 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -46,6 +46,7 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/Frontend/OpenMP/OMPAssume.h" #include "llvm/Frontend/OpenMP/OMPConstants.h" +#include "llvm/Frontend/OpenMP/OMPVersion.h" #include "llvm/IR/Assumptions.h" #include <optional> @@ -3167,7 +3168,7 @@ ExprResult SemaOpenMP::ActOnOpenMPIdExpression(Scope *CurScope, const DeclarationNameInfo &Id, OpenMPDirectiveKind Kind) { ASTContext &Context = getASTContext(); - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); LookupResult Lookup(SemaRef, Id, Sema::LookupOrdinaryName); SemaRef.LookupParsedName(Lookup, CurScope, &ScopeSpec, /*ObjectType=*/QualType(), @@ -3310,9 +3311,9 @@ SemaOpenMP::ActOnOpenMPThreadprivateDirective(SourceLocation Loc, SemaOpenMP::DeclGroupPtrTy SemaOpenMP::ActOnOpenMPGroupPrivateDirective(SourceLocation Loc, ArrayRef<Expr *> VarList) { - if (!getLangOpts().OpenMP || getLangOpts().OpenMP < 60) { + if (!getLangOpts().OpenMP || getLangOpts().getOpenMP() < 60) { Diag(Loc, diag::err_omp_unexpected_directive) - << getOpenMPDirectiveName(OMPD_groupprivate, getLangOpts().OpenMP); + << getOpenMPDirectiveName(OMPD_groupprivate, getLangOpts().getOpenMP()); return nullptr; } if (OMPGroupPrivateDecl *D = CheckOMPGroupPrivateDecl(Loc, VarList)) { @@ -3383,7 +3384,7 @@ SemaOpenMP::CheckOMPThreadPrivateDecl(SourceLocation Loc, // OpenMP [2.9.2, Restrictions, C/C++, p.10] // A threadprivate variable must not have a reference type. if (VD->getType()->isReferenceType()) { - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); Diag(ILoc, diag::err_omp_ref_type_arg) << getOpenMPDirectiveName(OMPD_threadprivate, OMPVersion) << VD->getType(); @@ -3702,7 +3703,7 @@ void SemaOpenMP::ActOnOpenMPAssumesDirective(SourceLocation Loc, ArrayRef<std::string> Assumptions, bool SkippedClauses) { if (!SkippedClauses && Assumptions.empty()) { - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); Diag(Loc, diag::err_omp_no_clause_for_directive) << llvm::omp::getAllAssumeClauseOptions() << llvm::omp::getOpenMPDirectiveName(DKind, OMPVersion); @@ -3854,7 +3855,7 @@ static void reportOriginalDsa(Sema &SemaRef, const DSAStackTy *Stack, Reason = PDSA_LocalVarPrivate; } if (Reason != PDSA_Implicit) { - unsigned OMPVersion = SemaRef.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = SemaRef.getLangOpts().getOpenMP(); SemaRef.Diag(ReportLoc, diag::note_omp_predetermined_dsa) << Reason << ReportHint << getOpenMPDirectiveName(Stack->getCurrentDirective(), OMPVersion); @@ -4923,7 +4924,7 @@ StmtResult SemaOpenMP::ActOnOpenMPRegionEnd(StmtResult S, if (isOpenMPWorksharingDirective(DSAStack->getCurrentDirective()) && isOpenMPSimdDirective(DSAStack->getCurrentDirective()) && OC && OC->getNumForLoops()) { - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); Diag(OC->getBeginLoc(), diag::err_omp_ordered_simd) << getOpenMPDirectiveName(DSAStack->getCurrentDirective(), OMPVersion); ErrorFound = true; @@ -5005,7 +5006,7 @@ static bool checkCancelRegion(Sema &SemaRef, OpenMPDirectiveKind CurrentRegion, CancelRegion == OMPD_sections || CancelRegion == OMPD_taskgroup) return false; - unsigned OMPVersion = SemaRef.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = SemaRef.getLangOpts().getOpenMP(); SemaRef.Diag(StartLoc, diag::err_omp_wrong_cancel_region) << getOpenMPDirectiveName(CancelRegion, OMPVersion); return true; @@ -5038,7 +5039,7 @@ static bool checkNestingOfRegions(Sema &SemaRef, const DSAStackTy *Stack, ArrayRef<OpenMPDirectiveKind> ParentLOC = getLeafOrCompositeConstructs(ParentRegion, LeafOrComposite); OpenMPDirectiveKind EnclosingConstruct = ParentLOC.back(); - unsigned OMPVersion = SemaRef.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = SemaRef.getLangOpts().getOpenMP(); if (OMPVersion >= 50 && Stack->isParentOrderConcurrent() && !isOpenMPOrderConcurrentNestableDirective(CurrentRegion, @@ -5314,7 +5315,7 @@ static bool checkIfClauses(Sema &S, OpenMPDirectiveKind Kind, llvm::IndexedMap<const OMPIfClause *, Kind2Unsigned> FoundNameModifiers; FoundNameModifiers.resize(llvm::omp::Directive_enumSize + 1); SmallVector<SourceLocation, 4> NameModifierLoc; - unsigned OMPVersion = S.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = S.getLangOpts().getOpenMP(); for (const OMPClause *C : Clauses) { if (const auto *IC = dyn_cast_or_null<OMPIfClause>(C)) { // At most one if clause without a directive-name-modifier can appear on @@ -5592,7 +5593,7 @@ static void checkAllocateClauses(Sema &S, DSAStackTy *Stack, if (AllocatorKind == OMPAllocateDeclAttr::OMPThreadMemAlloc && (isOpenMPTaskingDirective(Stack->getCurrentDirective()) || isOpenMPTargetExecutionDirective(Stack->getCurrentDirective()))) { - unsigned OMPVersion = S.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = S.getLangOpts().getOpenMP(); S.Diag(AC->getAllocator()->getExprLoc(), diag::warn_omp_allocate_thread_on_task_target_directive) << getOpenMPDirectiveName(Stack->getCurrentDirective(), OMPVersion); @@ -6946,7 +6947,7 @@ StmtResult SemaOpenMP::ActOnOpenMPExecutableDirective( llvm::SmallVector<OpenMPDirectiveKind, 4> AllowedNameModifiers; for (OpenMPDirectiveKind D : getLeafConstructsOrSelf(Kind)) { - if (isAllowedClauseForDirective(D, OMPC_if, getLangOpts().OpenMP)) + if (isAllowedClauseForDirective(D, OMPC_if, getLangOpts().getOpenMP())) AllowedNameModifiers.push_back(D); } if (!AllowedNameModifiers.empty()) @@ -9592,7 +9593,7 @@ void SemaOpenMP::ActOnOpenMPLoopInitialization(SourceLocation ForLoc, !isOpenMPSimdDirective(DKind) && DVar.CKind != OMPC_unknown && DVar.CKind != OMPC_private && DVar.CKind != OMPC_lastprivate)) && (DVar.CKind != OMPC_private || DVar.RefExpr)) { - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); Diag(Init->getBeginLoc(), diag::err_omp_loop_var_dsa) << getOpenMPClauseNameForDiag(DVar.CKind) << getOpenMPDirectiveName(DKind, OMPVersion) @@ -9651,7 +9652,7 @@ static bool checkOpenMPIterationSpace( auto *CXXFor = dyn_cast_or_null<CXXForRangeStmt>(S); // Ranged for is supported only in OpenMP 5.0. if (!For && (SemaRef.LangOpts.OpenMP <= 45 || !CXXFor)) { - unsigned OMPVersion = SemaRef.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = SemaRef.getLangOpts().getOpenMP(); SemaRef.Diag(S->getBeginLoc(), diag::err_omp_not_for) << (CollapseLoopCountExpr != nullptr || OrderedLoopCountExpr != nullptr) << getOpenMPDirectiveName(DKind, OMPVersion) << TotalNestedLoopCount @@ -10956,7 +10957,7 @@ static bool checkSectionsDirective(Sema &SemaRef, OpenMPDirectiveKind DKind, return true; assert(isa<CapturedStmt>(AStmt) && "Captured statement expected"); - unsigned OMPVersion = SemaRef.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = SemaRef.getLangOpts().getOpenMP(); auto BaseStmt = AStmt; while (auto *CS = dyn_cast_or_null<CapturedStmt>(BaseStmt)) BaseStmt = CS->getCapturedStmt(); @@ -11084,7 +11085,7 @@ static bool checkGenericLoopLastprivate(Sema &S, ArrayRef<OMPClause *> Clauses, if (ValueDecl *D = Res.first) { auto &&Info = Stack->isLoopControlVariable(D); if (!Info.first) { - unsigned OMPVersion = S.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = S.getLangOpts().getOpenMP(); S.Diag(ELoc, diag::err_omp_lastprivate_loop_var_non_loop_iteration) << getOpenMPDirectiveName(K, OMPVersion); ErrorFound = true; @@ -11700,7 +11701,7 @@ StmtResult SemaOpenMP::ActOnOpenMPFlushDirective(ArrayRef<OMPClause *> Clauses, else OrderClause = C; } - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); OpenMPClauseKind MemOrderKind = OMPC_unknown; SourceLocation MemOrderLoc; for (const OMPClause *C : Clauses) { @@ -11766,7 +11767,7 @@ StmtResult SemaOpenMP::ActOnOpenMPScanDirective(ArrayRef<OMPClause *> Clauses, Scope *ParentS = S->getParent(); if (!ParentS || ParentS->getParent() != ParentS->getBreakParent() || !ParentS->getBreakParent()->isOpenMPLoopScope()) { - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); return StmtError(Diag(StartLoc, diag::err_omp_orphaned_device_directive) << getOpenMPDirectiveName(OMPD_scan, OMPVersion) << 5); } @@ -11807,7 +11808,7 @@ SemaOpenMP::ActOnOpenMPOrderedDirective(ArrayRef<OMPClause *> Clauses, if ((DC && DC->getDependencyKind() == OMPC_DEPEND_source) || (DOC && (ODK.isSource(DOC)))) { if ((DC && DependSourceClause) || (DOC && DoacrossSourceClause)) { - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); Diag(C->getBeginLoc(), diag::err_omp_more_one_clause) << getOpenMPDirectiveName(DSAStack->getCurrentDirective(), OMPVersion) @@ -13000,7 +13001,7 @@ StmtResult SemaOpenMP::ActOnOpenMPAtomicDirective(ArrayRef<OMPClause *> Clauses, SourceLocation StartLoc, SourceLocation EndLoc) { ASTContext &Context = getASTContext(); - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); // Register location of the first atomic directive. DSAStack->addAtomicDirectiveLoc(StartLoc); if (!AStmt) @@ -13727,7 +13728,7 @@ SemaOpenMP::ActOnOpenMPTargetDataDirective(ArrayRef<OMPClause *> Clauses, Expected = "'map' or 'use_device_ptr'"; else Expected = "'map', 'use_device_ptr', or 'use_device_addr'"; - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); Diag(StartLoc, diag::err_omp_no_clause_for_directive) << Expected << getOpenMPDirectiveName(OMPD_target_data, OMPVersion); return StmtError(); @@ -13750,7 +13751,7 @@ StmtResult SemaOpenMP::ActOnOpenMPTargetEnterDataDirective( // OpenMP [2.10.2, Restrictions, p. 99] // At least one map clause must appear on the directive. if (!hasClauses(Clauses, OMPC_map)) { - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); Diag(StartLoc, diag::err_omp_no_clause_for_directive) << "'map'" << getOpenMPDirectiveName(OMPD_target_enter_data, OMPVersion); @@ -13772,7 +13773,7 @@ StmtResult SemaOpenMP::ActOnOpenMPTargetExitDataDirective( // OpenMP [2.10.3, Restrictions, p. 102] // At least one map clause must appear on the directive. if (!hasClauses(Clauses, OMPC_map)) { - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); Diag(StartLoc, diag::err_omp_no_clause_for_directive) << "'map'" << getOpenMPDirectiveName(OMPD_target_exit_data, OMPVersion); return StmtError(); @@ -17157,14 +17158,15 @@ OMPClause *SemaOpenMP::ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, // A return value of OMPD_unknown signifies that the expression should not // be captured. static OpenMPDirectiveKind getOpenMPCaptureRegionForClause( - OpenMPDirectiveKind DKind, OpenMPClauseKind CKind, unsigned OpenMPVersion, + OpenMPDirectiveKind DKind, OpenMPClauseKind CKind, + llvm::omp::Version OMPVersion, OpenMPDirectiveKind NameModifier = OMPD_unknown) { - assert(isAllowedClauseForDirective(DKind, CKind, OpenMPVersion) && + assert(isAllowedClauseForDirective(DKind, CKind, OMPVersion) && "Invalid directive with CKind-clause"); // Invalid modifier will be diagnosed separately, just return OMPD_unknown. if (NameModifier != OMPD_unknown && - !isAllowedClauseForDirective(NameModifier, CKind, OpenMPVersion)) + !isAllowedClauseForDirective(NameModifier, CKind, OMPVersion)) return OMPD_unknown; ArrayRef<OpenMPDirectiveKind> Leafs = getLeafConstructsOrSelf(DKind); @@ -17237,7 +17239,7 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause( // EndIdx may be set to the index of the NameModifier, if present. int InnermostIdx = [&]() { for (int I = EndIdx - 1; I >= 0; --I) { - if (isAllowedClauseForDirective(Leafs[I], Clause, OpenMPVersion)) + if (isAllowedClauseForDirective(Leafs[I], Clause, OMPVersion)) return I; } return -1; @@ -17291,7 +17293,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPIfClause( OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); CaptureRegion = getOpenMPCaptureRegionForClause( - DKind, OMPC_if, getLangOpts().OpenMP, NameModifier); + DKind, OMPC_if, getLangOpts().getOpenMP(), NameModifier); if (CaptureRegion != OMPD_unknown && !SemaRef.CurContext->isDependentContext()) { ValExpr = SemaRef.MakeFullExpr(ValExpr).get(); @@ -17324,7 +17326,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPFinalClause(Expr *Condition, OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); CaptureRegion = getOpenMPCaptureRegionForClause(DKind, OMPC_final, - getLangOpts().OpenMP); + getLangOpts().getOpenMP()); if (CaptureRegion != OMPD_unknown && !SemaRef.CurContext->isDependentContext()) { ValExpr = SemaRef.MakeFullExpr(ValExpr).get(); @@ -17412,8 +17414,8 @@ isNonNegativeIntegerValue(Expr *&ValExpr, Sema &SemaRef, OpenMPClauseKind CKind, } if (!BuildCapture) return true; - *CaptureRegion = - getOpenMPCaptureRegionForClause(DKind, CKind, SemaRef.LangOpts.OpenMP); + *CaptureRegion = getOpenMPCaptureRegionForClause( + DKind, CKind, SemaRef.getLangOpts().getOpenMP()); if (*CaptureRegion != OMPD_unknown && !SemaRef.CurContext->isDependentContext()) { ValExpr = SemaRef.MakeFullExpr(ValExpr).get(); @@ -17506,7 +17508,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPNumThreadsClause( OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); OpenMPDirectiveKind CaptureRegion = getOpenMPCaptureRegionForClause( - DKind, OMPC_num_threads, getLangOpts().OpenMP); + DKind, OMPC_num_threads, getLangOpts().getOpenMP()); if (CaptureRegion == OMPD_unknown || SemaRef.CurContext->isDependentContext()) return OMPNumThreadsClause::Create( getASTContext(), CaptureRegion, StartLoc, LParenLoc, EndLoc, Vars, @@ -18048,7 +18050,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPTransparentClause(Expr *ImpexTypeArg, Stmt *HelperValStmt = nullptr; OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); OpenMPDirectiveKind CaptureRegion = getOpenMPCaptureRegionForClause( - DKind, OMPC_transparent, getLangOpts().OpenMP); + DKind, OMPC_transparent, getLangOpts().getOpenMP()); if (CaptureRegion != OMPD_unknown && !SemaRef.CurContext->isDependentContext()) { Expr *ValExpr = SemaRef.MakeFullExpr(ImpexTypeArg).get(); @@ -18202,9 +18204,10 @@ OMPClause *SemaOpenMP::ActOnOpenMPMessageClause(Expr *ME, // we may or may not build a capture. OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); OpenMPDirectiveKind CaptureRegion = - DKind == OMPD_unknown ? OMPD_unknown - : getOpenMPCaptureRegionForClause( - DKind, OMPC_message, getLangOpts().OpenMP); + DKind == OMPD_unknown + ? OMPD_unknown + : getOpenMPCaptureRegionForClause(DKind, OMPC_message, + getLangOpts().getOpenMP()); if (CaptureRegion != OMPD_unknown && !SemaRef.CurContext->isDependentContext()) { ME = SemaRef.MakeFullExpr(ME).get(); @@ -18731,7 +18734,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPScheduleClause( } } else if (getOpenMPCaptureRegionForClause( DSAStack->getCurrentDirective(), OMPC_schedule, - getLangOpts().OpenMP) != OMPD_unknown && + getLangOpts().getOpenMP()) != OMPD_unknown && !SemaRef.CurContext->isDependentContext()) { ValExpr = SemaRef.MakeFullExpr(ValExpr).get(); llvm::MapVector<const Expr *, DeclRefExpr *> Captures; @@ -19065,7 +19068,7 @@ SemaOpenMP::ActOnOpenMPInteropDirective(ArrayRef<OMPClause *> Clauses, // OpenMP 5.1 [2.15.1, interop Construct, Restrictions] // At least one action-clause must appear on a directive. if (!hasClauses(Clauses, OMPC_init, OMPC_use, OMPC_destroy, OMPC_nowait)) { - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); StringRef Expected = "'init', 'use', 'destroy', or 'nowait'"; Diag(StartLoc, diag::err_omp_no_clause_for_directive) << Expected << getOpenMPDirectiveName(OMPD_interop, OMPVersion); @@ -19225,7 +19228,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation EndLoc) { if (!InteropVar && getLangOpts().OpenMP >= 52 && DSAStack->getCurrentDirective() == OMPD_depobj) { - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); Diag(StartLoc, diag::err_omp_expected_clause_argument) << getOpenMPClauseNameForDiag(OMPC_destroy) << getOpenMPDirectiveName(OMPD_depobj, OMPVersion); @@ -19257,7 +19260,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPNovariantsClause(Expr *Condition, OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); CaptureRegion = getOpenMPCaptureRegionForClause(DKind, OMPC_novariants, - getLangOpts().OpenMP); + getLangOpts().getOpenMP()); if (CaptureRegion != OMPD_unknown && !SemaRef.CurContext->isDependentContext()) { ValExpr = SemaRef.MakeFullExpr(ValExpr).get(); @@ -19289,7 +19292,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPNocontextClause(Expr *Condition, OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); CaptureRegion = getOpenMPCaptureRegionForClause(DKind, OMPC_nocontext, - getLangOpts().OpenMP); + getLangOpts().getOpenMP()); if (CaptureRegion != OMPD_unknown && !SemaRef.CurContext->isDependentContext()) { ValExpr = SemaRef.MakeFullExpr(ValExpr).get(); @@ -19311,8 +19314,8 @@ OMPClause *SemaOpenMP::ActOnOpenMPFilterClause(Expr *ThreadID, Stmt *HelperValStmt = nullptr; OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); - OpenMPDirectiveKind CaptureRegion = - getOpenMPCaptureRegionForClause(DKind, OMPC_filter, getLangOpts().OpenMP); + OpenMPDirectiveKind CaptureRegion = getOpenMPCaptureRegionForClause( + DKind, OMPC_filter, getLangOpts().getOpenMP()); if (CaptureRegion != OMPD_unknown && !SemaRef.CurContext->isDependentContext()) { ValExpr = SemaRef.MakeFullExpr(ValExpr).get(); @@ -19603,7 +19606,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPPrivateClause(ArrayRef<Expr *> VarList, SourceLocation EndLoc) { SmallVector<Expr *, 8> Vars; SmallVector<Expr *, 8> PrivateCopies; - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); bool IsImplicitClause = StartLoc.isInvalid() && LParenLoc.isInvalid() && EndLoc.isInvalid(); for (Expr *RefExpr : VarList) { @@ -19758,7 +19761,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPFirstprivateClause(ArrayRef<Expr *> VarList, bool IsImplicitClause = StartLoc.isInvalid() && LParenLoc.isInvalid() && EndLoc.isInvalid(); SourceLocation ImplicitClauseLoc = DSAStack->getConstructLoc(); - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); for (Expr *RefExpr : VarList) { assert(RefExpr && "NULL expr in OpenMP firstprivate clause."); @@ -22026,7 +22029,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPCopyinClause(ArrayRef<Expr *> VarList, // OpenMP [2.14.4.1, Restrictions, C/C++, p.1] // A list item that appears in a copyin clause must be threadprivate. if (!DSAStack->isThreadPrivate(VD)) { - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); Diag(ELoc, diag::err_omp_required_access) << getOpenMPClauseNameForDiag(OMPC_copyin) << getOpenMPDirectiveName(OMPD_threadprivate, OMPVersion); @@ -22136,7 +22139,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPCopyprivateClause(ArrayRef<Expr *> VarList, // Variably modified types are not supported. if (!Type->isAnyPointerType() && Type->isVariablyModifiedType()) { - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); Diag(ELoc, diag::err_omp_variably_modified_type_not_supported) << getOpenMPClauseNameForDiag(OMPC_copyprivate) << Type << getOpenMPDirectiveName(DSAStack->getCurrentDirective(), @@ -22637,8 +22640,8 @@ OMPClause *SemaOpenMP::ActOnOpenMPDeviceClause( } OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); - OpenMPDirectiveKind CaptureRegion = - getOpenMPCaptureRegionForClause(DKind, OMPC_device, getLangOpts().OpenMP); + OpenMPDirectiveKind CaptureRegion = getOpenMPCaptureRegionForClause( + DKind, OMPC_device, getLangOpts().getOpenMP()); if (CaptureRegion != OMPD_unknown && !SemaRef.CurContext->isDependentContext()) { ValExpr = SemaRef.MakeFullExpr(ValExpr).get(); @@ -23738,7 +23741,7 @@ static void checkMappableExpressionList( assert((CKind == OMPC_map || CKind == OMPC_to || CKind == OMPC_from || CKind == OMPC_use_device_addr) && "Unexpected clause kind with mappable expressions!"); - unsigned OMPVersion = SemaRef.getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = SemaRef.getLangOpts().getOpenMP(); // If the identifier of user-defined mapper is not specified, it is "default". // We do not change the actual name in this clause to distinguish whether a @@ -24689,7 +24692,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPNumTeamsClause( OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); OpenMPDirectiveKind CaptureRegion = getOpenMPCaptureRegionForClause( - DKind, OMPC_num_teams, getLangOpts().OpenMP); + DKind, OMPC_num_teams, getLangOpts().getOpenMP()); if (CaptureRegion == OMPD_unknown || SemaRef.CurContext->isDependentContext()) return OMPNumTeamsClause::Create(getASTContext(), CaptureRegion, StartLoc, LParenLoc, EndLoc, VarList, Modifier, @@ -24741,7 +24744,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPThreadLimitClause( OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); OpenMPDirectiveKind CaptureRegion = getOpenMPCaptureRegionForClause( - DKind, OMPC_thread_limit, getLangOpts().OpenMP); + DKind, OMPC_thread_limit, getLangOpts().getOpenMP()); if (CaptureRegion == OMPD_unknown || SemaRef.CurContext->isDependentContext()) return OMPThreadLimitClause::Create(getASTContext(), CaptureRegion, StartLoc, LParenLoc, EndLoc, VarList, @@ -24974,7 +24977,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPDistScheduleClause( } } else if (getOpenMPCaptureRegionForClause( DSAStack->getCurrentDirective(), OMPC_dist_schedule, - getLangOpts().OpenMP) != OMPD_unknown && + getLangOpts().getOpenMP()) != OMPD_unknown && !SemaRef.CurContext->isDependentContext()) { ValExpr = SemaRef.MakeFullExpr(ValExpr).get(); llvm::MapVector<const Expr *, DeclRefExpr *> Captures; @@ -25119,7 +25122,7 @@ void SemaOpenMP::DiagnoseUnterminatedOpenMPDeclareTarget() { if (DeclareTargetNesting.empty()) return; DeclareTargetContextInfo &DTCI = DeclareTargetNesting.back(); - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); Diag(DTCI.Loc, diag::warn_omp_unterminated_declare_target) << getOpenMPDirectiveName(DTCI.Kind, OMPVersion); } @@ -25724,7 +25727,7 @@ SemaOpenMP::ActOnOpenMPIsDevicePtrClause(ArrayRef<Expr *> VarList, // sharing attribute. DSAStackTy::DSAVarData DVar = DSAStack->getTopDSA(D, /*FromParent=*/false); if (isOpenMPPrivate(DVar.CKind)) { - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); Diag(ELoc, diag::err_omp_variable_in_given_clause_and_dsa) << getOpenMPClauseNameForDiag(DVar.CKind) << getOpenMPClauseNameForDiag(OMPC_is_device_ptr) @@ -25802,7 +25805,7 @@ SemaOpenMP::ActOnOpenMPHasDeviceAddrClause(ArrayRef<Expr *> VarList, // sharing attribute. DSAStackTy::DSAVarData DVar = DSAStack->getTopDSA(D, /*FromParent=*/false); if (isOpenMPPrivate(DVar.CKind)) { - unsigned OMPVersion = getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = getLangOpts().getOpenMP(); Diag(ELoc, diag::err_omp_variable_in_given_clause_and_dsa) << getOpenMPClauseNameForDiag(DVar.CKind) << getOpenMPClauseNameForDiag(OMPC_has_device_addr) @@ -26320,7 +26323,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPXDynCGroupMemClause(Expr *Size, OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); OpenMPDirectiveKind CaptureRegion = getOpenMPCaptureRegionForClause( - DKind, OMPC_ompx_dyn_cgroup_mem, getLangOpts().OpenMP); + DKind, OMPC_ompx_dyn_cgroup_mem, getLangOpts().getOpenMP()); if (CaptureRegion != OMPD_unknown && !SemaRef.CurContext->isDependentContext()) { ValExpr = SemaRef.MakeFullExpr(ValExpr).get(); @@ -26362,7 +26365,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPDynGroupprivateClause( OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); OpenMPDirectiveKind CaptureRegion = getOpenMPCaptureRegionForClause( - DKind, OMPC_dyn_groupprivate, getLangOpts().OpenMP); + DKind, OMPC_dyn_groupprivate, getLangOpts().getOpenMP()); if (CaptureRegion != OMPD_unknown && !SemaRef.CurContext->isDependentContext()) { ValExpr = SemaRef.MakeFullExpr(ValExpr).get(); diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 3f28504f223ab..5a9073e3a9436 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -8687,7 +8687,7 @@ TreeTransform<Derived>::TransformDoStmt(DoStmt *S) { template<typename Derived> StmtResult TreeTransform<Derived>::TransformForStmt(ForStmt *S) { - if (getSema().getLangOpts().OpenMP) + if (getSema().getLangOpts().getOpenMP()) getSema().OpenMP().startOpenMPLoop(); // Transform the initialization statement @@ -8697,7 +8697,7 @@ TreeTransform<Derived>::TransformForStmt(ForStmt *S) { // In OpenMP loop region loop control variable must be captured and be // private. Perform analysis of first part (if any). - if (getSema().getLangOpts().OpenMP && Init.isUsable()) + if (getSema().getLangOpts().getOpenMP() && Init.isUsable()) getSema().OpenMP().ActOnOpenMPLoopInitialization(S->getForLoc(), Init.get()); @@ -10059,7 +10059,8 @@ template <typename Derived> StmtResult TreeTransform<Derived>::TransformOMPMetaDirective(OMPMetaDirective *D) { // TODO: Fix This - unsigned OMPVersion = getDerived().getSema().getLangOpts().OpenMP; + llvm::omp::Version OMPVersion = + getDerived().getSema().getLangOpts().getOpenMP(); SemaRef.Diag(D->getBeginLoc(), diag::err_omp_instantiation_not_supported) << getOpenMPDirectiveName(D->getDirectiveKind(), OMPVersion); return StmtError(); _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
