[llvm-branch-commits] [flang] [llvm] [flang][OpenMP] Switch OpenMP version from unsigned to llvm::omp::Version (PR #219822)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Aug 30 09:11:54 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-semantics

Author: Krzysztof Parzyszek (kparzysz)

<details>
<summary>Changes</summary>

Also make llvm::omp::Version converting constructor/operstor explicit.

---

<sub>Stack created with <a href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>

---

Patch is 82.14 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/219822.diff


27 Files Affected:

- (modified) flang/include/flang/Parser/openmp-utils.h (+2-2) 
- (modified) flang/include/flang/Semantics/openmp-modifiers.h (+10-10) 
- (modified) flang/include/flang/Semantics/openmp-utils.h (+20-18) 
- (modified) flang/include/flang/Semantics/symbol.h (+2-2) 
- (modified) flang/include/flang/Support/LangOptions.h (+5) 
- (modified) flang/lib/Frontend/CompilerInvocation.cpp (+7-4) 
- (modified) flang/lib/Frontend/FrontendActions.cpp (+2-1) 
- (modified) flang/lib/Lower/OpenMP/Atomic.cpp (+5-5) 
- (modified) flang/lib/Lower/OpenMP/ClauseProcessor.cpp (+3-3) 
- (modified) flang/lib/Lower/OpenMP/ClauseProcessor.h (+1-1) 
- (modified) flang/lib/Lower/OpenMP/DataSharingProcessor.cpp (+3-3) 
- (modified) flang/lib/Lower/OpenMP/DataSharingProcessor.h (+3-3) 
- (modified) flang/lib/Lower/OpenMP/Decomposer.cpp (+3-3) 
- (modified) flang/lib/Lower/OpenMP/OpenMP.cpp (+3-3) 
- (modified) flang/lib/Lower/PFTBuilder.cpp (+1-1) 
- (modified) flang/lib/Parser/openmp-parsers.cpp (+5-5) 
- (modified) flang/lib/Parser/openmp-utils.cpp (+2-2) 
- (modified) flang/lib/Parser/unparse.cpp (+2-2) 
- (modified) flang/lib/Semantics/check-omp-atomic.cpp (+1-1) 
- (modified) flang/lib/Semantics/check-omp-loop.cpp (+6-6) 
- (modified) flang/lib/Semantics/check-omp-structure.cpp (+91-88) 
- (modified) flang/lib/Semantics/check-omp-variant.cpp (+5-5) 
- (modified) flang/lib/Semantics/mod-file.cpp (+2-2) 
- (modified) flang/lib/Semantics/openmp-utils.cpp (+18-17) 
- (modified) flang/lib/Semantics/resolve-directives.cpp (+7-7) 
- (modified) flang/unittests/Semantics/OpenMPUtils.cpp (+6-3) 
- (modified) llvm/include/llvm/Frontend/OpenMP/OMPVersion.h (+5-3) 


``````````diff
diff --git a/flang/include/flang/Parser/openmp-utils.h b/flang/include/flang/Parser/openmp-utils.h
index 9f47689906035..cd19ed1d72f0d 100644
--- a/flang/include/flang/Parser/openmp-utils.h
+++ b/flang/include/flang/Parser/openmp-utils.h
@@ -142,8 +142,8 @@ template <typename T> OmpDirectiveName GetOmpDirectiveName(const T &x) {
   return detail::DirectiveNameScope::GetOmpDirectiveName(x);
 }
 
-std::string GetUpperName(llvm::omp::Clause id, unsigned version);
-std::string GetUpperName(llvm::omp::Directive id, unsigned version);
+std::string GetUpperName(llvm::omp::Clause id, llvm::omp::Version version);
+std::string GetUpperName(llvm::omp::Directive id, llvm::omp::Version version);
 
 const OpenMPDeclarativeConstruct *GetOmp(const DeclarationConstruct &x);
 const OpenMPConstruct *GetOmp(const ExecutionPartConstruct &x);
diff --git a/flang/include/flang/Semantics/openmp-modifiers.h b/flang/include/flang/Semantics/openmp-modifiers.h
index a199e55639ea8..ef92cd397dd89 100644
--- a/flang/include/flang/Semantics/openmp-modifiers.h
+++ b/flang/include/flang/Semantics/openmp-modifiers.h
@@ -295,7 +295,7 @@ bool verifyVersions(const std::optional<std::list<UnionTy>> &modifiers,
   if (!modifiers) {
     return true;
   }
-  unsigned version{semaCtx.langOptions().OpenMPVersion};
+  llvm::omp::Version version{semaCtx.langOptions().getOpenMP()};
   bool result{true};
   for (auto &m : *modifiers) {
     const llvm::omp::descriptor::Modifier &desc{OmpGetDescriptor(m)};
@@ -304,8 +304,8 @@ bool verifyVersions(const std::optional<std::list<UnionTy>> &modifiers,
     }
     // Find the next higher version that allows this modifier on this clause.
     const auto &versions{desc.getVersions()};
-    unsigned since{~0u}, until{0u};
-    for (unsigned v : versions) {
+    llvm::omp::Version since(~0u), until(0u);
+    for (llvm::omp::Version v : versions) {
       if (desc.getClauses(v).test(id)) {
         if (v < version) {
           until = std::max(until, v);
@@ -314,20 +314,20 @@ bool verifyVersions(const std::optional<std::list<UnionTy>> &modifiers,
         }
       }
     }
-    if (since == ~0u && until == 0u) {
+    if (since == ~0 && until == 0) {
       // This shouldn't really happen, but have it just in case.
       semaCtx.Say(m.source,
           "'%s' modifier is not supported on %s clause"_err_en_US,
           desc.getName().str(),
           parser::ToUpperCaseLetters(llvm::omp::getOpenMPClauseName(id)));
-    } else if (since != ~0u && version < since) {
+    } else if (since != ~0 && version < since) {
       semaCtx.Say(m.source,
           "'%s' modifier is not supported in %s on %s clause, %s"_warn_en_US,
           desc.getName().str(), omp::ThisVersion(version),
           parser::ToUpperCaseLetters(llvm::omp::getOpenMPClauseName(id)),
           omp::TryVersion(since));
       result = false;
-    } else if (until != 0u && version > until) {
+    } else if (until != 0 && version > until) {
       semaCtx.Say(m.source,
           "'%s' modifier is no longer supported in %s on %s clause"_warn_en_US,
           desc.getName().str(), omp::ThisVersion(version),
@@ -346,7 +346,7 @@ template <typename SpecificTy, typename UnionTy>
 bool verifyIfRequired(const SpecificTy *,
     const std::optional<std::list<UnionTy>> &modifiers,
     parser::CharBlock clauseSource, SemanticsContext &semaCtx) {
-  unsigned version{semaCtx.langOptions().OpenMPVersion};
+  llvm::omp::Version version{semaCtx.langOptions().getOpenMP()};
   const llvm::omp::descriptor::Modifier &desc{OmpGetDescriptor<SpecificTy>()};
   if (!desc.getProperties(version).test(llvm::omp::Property::Required)) {
     // If the modifier is not required, there is nothing to do.
@@ -400,7 +400,7 @@ bool verifyIfUnique(const SpecificTy *,
   // `specific` is the location of the modifier of type SpecificTy.
   assert(specific != end && "`specific` must be a valid location");
 
-  unsigned version{semaCtx.langOptions().OpenMPVersion};
+  llvm::omp::Version version{semaCtx.langOptions().getOpenMP()};
   const llvm::omp::descriptor::Modifier &desc{OmpGetDescriptor<SpecificTy>()};
   // Ultimate implies Unique.
   if (!desc.getProperties(version).test(llvm::omp::Property::Unique) &&
@@ -449,7 +449,7 @@ bool verifyUltimate(const std::optional<std::list<UnionTy>> &modifiers,
   if (!modifiers || modifiers->size() <= 1) {
     return true;
   }
-  unsigned version{semaCtx.langOptions().OpenMPVersion};
+  llvm::omp::Version version{semaCtx.langOptions().getOpenMP()};
   bool result{true};
   auto first{modifiers->cbegin()};
   auto last{std::prev(modifiers->cend())};
@@ -498,7 +498,7 @@ bool verifyExclusive(const std::optional<std::list<UnionTy>> &modifiers,
   if (!modifiers || modifiers->size() <= 1) {
     return true;
   }
-  unsigned version{semaCtx.langOptions().OpenMPVersion};
+  llvm::omp::Version version{semaCtx.langOptions().getOpenMP()};
   const UnionTy &front{modifiers->front()};
   const llvm::omp::descriptor::Modifier &frontDesc{OmpGetDescriptor(front)};
 
diff --git a/flang/include/flang/Semantics/openmp-utils.h b/flang/include/flang/Semantics/openmp-utils.h
index de3d532c7f79a..eab005c2a08ac 100644
--- a/flang/include/flang/Semantics/openmp-utils.h
+++ b/flang/include/flang/Semantics/openmp-utils.h
@@ -25,6 +25,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Frontend/OpenMP/OMPContext.h"
+#include "llvm/Frontend/OpenMP/OMPVersion.h"
 
 #include <memory>
 #include <optional>
@@ -69,8 +70,8 @@ struct SourcedActionStmt
 SourcedActionStmt GetActionStmt(const parser::ExecutionPartConstruct *x);
 SourcedActionStmt GetActionStmt(const parser::Block &block);
 
-std::string ThisVersion(unsigned version);
-std::string TryVersion(unsigned version);
+std::string ThisVersion(llvm::omp::Version version);
+std::string TryVersion(llvm::omp::Version version);
 
 const Symbol *GetObjectSymbol(
     const parser::OmpObject &object, bool ultimate = false);
@@ -275,7 +276,7 @@ enum struct ListItemKind : uint32_t {
 };
 
 std::optional<ListItemKind> GetArgumentListItemKind(
-    llvm::omp::Clause clause, unsigned version);
+    llvm::omp::Clause clause, llvm::omp::Version version);
 
 bool IsLoopTransforming(llvm::omp::Directive dir);
 bool HasDataEnvironment(llvm::omp::Directive dir);
@@ -297,7 +298,7 @@ struct OmpErrorArgs {
 /// MESSAGE clause values.
 OmpErrorArgs GetErrorDirectiveArgs(const parser::OmpErrorDirective &errDir);
 
-inline bool IsDoConcurrentLegal(unsigned version) {
+inline bool IsDoConcurrentLegal(llvm::omp::Version version) {
   // DO CONCURRENT is allowed (as an alternative to a Canonical Loop Nest)
   // in OpenMP 6.0+.
   return version >= 60;
@@ -358,33 +359,33 @@ template <typename T> struct WithReason {
 
 WithReason<int64_t> GetArgumentValueWithReason(
     const parser::OmpDirectiveSpecification &spec, llvm::omp::Clause clauseId,
-    unsigned version, SemanticsContext *semaCtx = nullptr);
+    llvm::omp::Version version, SemanticsContext *semaCtx = nullptr);
 WithReason<int64_t> GetNumArgumentsWithReason(
     const parser::OmpDirectiveSpecification &spec, llvm::omp::Clause clauseId,
-    unsigned version, SemanticsContext *semaCtx = nullptr);
+    llvm::omp::Version version, SemanticsContext *semaCtx = nullptr);
 WithReason<int64_t> GetHeightWithReason(
-    const parser::OmpDirectiveSpecification &spec, unsigned version,
+    const parser::OmpDirectiveSpecification &spec, llvm::omp::Version version,
     SemanticsContext *semaCtx = nullptr);
 
 /// Return the depth of the affected nest(s):
 ///   {affected-depth, must-be-perfect-nest}.
 std::pair<WithReason<int64_t>, bool> GetAffectedNestDepthWithReason(
-    const parser::OmpDirectiveSpecification &spec, unsigned version,
+    const parser::OmpDirectiveSpecification &spec, llvm::omp::Version version,
     SemanticsContext *semaCtx = nullptr);
 /// Return the depth of the generated nest(s):
 ///   {generated-depth, is-perfect-nest}
 std::pair<WithReason<int64_t>, bool> GetGeneratedNestDepthWithReason(
-    const parser::OmpDirectiveSpecification &spec, unsigned version,
+    const parser::OmpDirectiveSpecification &spec, llvm::omp::Version version,
     SemanticsContext *semaCtx = nullptr);
 /// Return the range of the affected nests in the sequence:
 ///   {first, count}.
 /// If the range is "the whole sequence", the return value will be {1, -1}.
 WithReason<std::pair<int64_t, int64_t>> GetAffectedLoopRangeWithReason(
-    const parser::OmpDirectiveSpecification &spec, unsigned version,
+    const parser::OmpDirectiveSpecification &spec, llvm::omp::Version version,
     SemanticsContext *semaCtx = nullptr);
 /// Return the depth in which all loops must be rectangular.
 WithReason<int64_t> GetRectangularNestDepthWithReason(
-    const parser::OmpDirectiveSpecification &spec, unsigned version,
+    const parser::OmpDirectiveSpecification &spec, llvm::omp::Version version,
     SemanticsContext *semaCtx = nullptr);
 
 /// Calculate the minimum length of a sequence that contains the specified
@@ -401,7 +402,7 @@ std::optional<int64_t> GetMinimumSequenceCount(
 /// Returns std::nullopt if `x` or code nested in `x` was malformed in a
 /// way that prevented the function from returning an accurate result.
 std::optional<std::vector<const parser::DoConstruct *>> CollectAffectedDoLoops(
-    const parser::OpenMPLoopConstruct &x, unsigned version,
+    const parser::OpenMPLoopConstruct &x, llvm::omp::Version version,
     SemanticsContext *semaCtx = nullptr);
 
 /// Returns whether the loop nest associated with `x` is a doacross loop nest,
@@ -411,12 +412,13 @@ std::optional<std::vector<const parser::DoConstruct *>> CollectAffectedDoLoops(
 bool IsDoacrossAffected(const parser::OpenMPLoopConstruct &x);
 
 struct LoopSequence {
-  LoopSequence(const parser::ExecutionPartConstruct &root, unsigned version,
-      bool allowAllLoops = false, SemanticsContext *semaCtx = nullptr);
+  LoopSequence(const parser::ExecutionPartConstruct &root,
+      llvm::omp::Version version, bool allowAllLoops = false,
+      SemanticsContext *semaCtx = nullptr);
 
   template <typename R, typename = std::enable_if_t<is_range_v<R>>>
-  LoopSequence(const R &range, unsigned version, bool allowAllLoops = false,
-      SemanticsContext *semaCtx = nullptr)
+  LoopSequence(const R &range, llvm::omp::Version version,
+      bool allowAllLoops = false, SemanticsContext *semaCtx = nullptr)
       : version_(version), allowAllLoops_(allowAllLoops), semaCtx_(semaCtx) {
     entry_ = std::make_unique<Construct>(range, nullptr);
     createChildrenFromRange(entry_->location);
@@ -455,7 +457,7 @@ struct LoopSequence {
 private:
   using Construct = ExecutionPartIterator::Construct;
 
-  LoopSequence(std::unique_ptr<Construct> entry, unsigned version,
+  LoopSequence(std::unique_ptr<Construct> entry, llvm::omp::Version version,
       bool allowAllLoops, SemanticsContext *semaCtx = nullptr);
 
   template <typename R, typename = std::enable_if_t<is_range_v<R>>>
@@ -504,7 +506,7 @@ struct LoopSequence {
   WithReason<int64_t> height_;
 
   // The core structure of the class:
-  unsigned version_; // Needed for GetXyzWithReason
+  llvm::omp::Version version_; // Needed for GetXyzWithReason
   bool allowAllLoops_;
   std::unique_ptr<Construct> entry_;
   std::vector<LoopSequence> children_;
diff --git a/flang/include/flang/Semantics/symbol.h b/flang/include/flang/Semantics/symbol.h
index a51b4542e4f36..e62b52f1f0bd4 100644
--- a/flang/include/flang/Semantics/symbol.h
+++ b/flang/include/flang/Semantics/symbol.h
@@ -99,10 +99,10 @@ class WithOmpDeclarative {
   friend llvm::raw_ostream &operator<<(
       llvm::raw_ostream &, const WithOmpDeclarative &);
 
-  void set_version(unsigned version) { version_ = version; }
+  void set_version(llvm::omp::Version version) { version_ = version; }
 
 private:
-  unsigned version_;
+  llvm::omp::Version version_;
   // The set of clauses from a REQUIRES directive. Only applicable
   // to program unit symbols (i.e. scopes of the REQUIRES directive).
   // The set of requirements for any program unit include requirements
diff --git a/flang/include/flang/Support/LangOptions.h b/flang/include/flang/Support/LangOptions.h
index 42b488c3d18a3..054bafb78354a 100644
--- a/flang/include/flang/Support/LangOptions.h
+++ b/flang/include/flang/Support/LangOptions.h
@@ -18,6 +18,7 @@
 #include <string>
 #include <vector>
 
+#include "llvm/Frontend/OpenMP/OMPVersion.h"
 #include "llvm/TargetParser/Triple.h"
 
 namespace Fortran::common {
@@ -87,6 +88,10 @@ class LangOptions : public LangOptionsBase {
   /// List of triples passed in using -fopenmp-targets.
   std::vector<llvm::Triple> OMPTargetTriples;
 
+  llvm::omp::Version getOpenMP() const {
+    return llvm::omp::Version(OpenMPVersion);
+  }
+
   LangOptions();
 };
 
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 933446771dddc..b92ad8e2982b4 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -1305,8 +1305,10 @@ static bool parseOpenMPArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
   res.getFrontendOpts().features.Enable(
       Fortran::common::LanguageFeature::OpenMP);
   if (auto *arg = args.getLastArg(clang::options::OPT_fopenmp_version_EQ)) {
-    llvm::ArrayRef<llvm::omp::Version> ompVersions =
-        llvm::omp::getOpenMPVersions();
+    llvm::SmallVector<unsigned> ompVersions;
+    for (llvm::omp::Version v : llvm::omp::getOpenMPVersions()) {
+      ompVersions.push_back(static_cast<unsigned>(v));
+    }
     unsigned oldVersions[] = {11, 20, 25, 30};
     unsigned version = 0;
 
@@ -1955,8 +1957,9 @@ void CompilerInvocation::setDefaultPredefinitions() {
   }
   if (frontendOptions.features.IsEnabled(
           Fortran::common::LanguageFeature::OpenMP)) {
-    Fortran::common::setOpenMPMacro(getLangOpts().OpenMPVersion,
-                                    fortranOptions.predefinitions);
+    Fortran::common::setOpenMPMacro(
+        static_cast<unsigned>(getLangOpts().getOpenMP()),
+        fortranOptions.predefinitions);
   }
 
   if (frontendOptions.features.IsEnabled(
diff --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp
index 8a2d1a6c2e2a2..2f5930890aaf9 100644
--- a/flang/lib/Frontend/FrontendActions.cpp
+++ b/flang/lib/Frontend/FrontendActions.cpp
@@ -275,8 +275,9 @@ bool CodeGenAction::beginSourceFileAction() {
     mlir::omp::setOffloadModuleInterfaceAttributes(
         lb.getModule(),
         makeOffloadModuleOpts(ci.getInvocation().getLangOpts()));
+    llvm::omp::Version version = ci.getInvocation().getLangOpts().getOpenMP();
     mlir::omp::setOpenMPVersionAttribute(
-        lb.getModule(), ci.getInvocation().getLangOpts().OpenMPVersion);
+        lb.getModule(), static_cast<unsigned>(version));
     if (!ci.getInvocation().getLoweringOpts().getIntegerWrapAround())
       mlir::omp::setOpenMPIntegerWrapAround(lb.getModule(), false);
   }
diff --git a/flang/lib/Lower/OpenMP/Atomic.cpp b/flang/lib/Lower/OpenMP/Atomic.cpp
index 37c856795defe..79f4681c67275 100644
--- a/flang/lib/Lower/OpenMP/Atomic.cpp
+++ b/flang/lib/Lower/OpenMP/Atomic.cpp
@@ -226,7 +226,7 @@ getMemoryOrderFromRequires(const semantics::Scope &scope) {
 
 static std::optional<mlir::omp::ClauseMemoryOrderKind>
 getDefaultAtomicMemOrder(semantics::SemanticsContext &semaCtx) {
-  unsigned version = semaCtx.langOptions().OpenMPVersion;
+  llvm::omp::Version version = semaCtx.langOptions().getOpenMP();
   if (version > 50)
     return mlir::omp::ClauseMemoryOrderKind::Relaxed;
   return std::nullopt;
@@ -250,7 +250,7 @@ getAtomicMemoryOrder(semantics::SemanticsContext &semaCtx,
 
 static std::optional<mlir::omp::ClauseMemoryOrderKind>
 makeValidForAction(std::optional<mlir::omp::ClauseMemoryOrderKind> memOrder,
-                   int action0, int action1, unsigned version) {
+                   int action0, int action1, llvm::omp::Version version) {
   // When the atomic default memory order specified on a REQUIRES directive is
   // disallowed on a given ATOMIC operation, and it's not ACQ_REL, the order
   // reverts to RELAXED. ACQ_REL decays to either ACQUIRE or RELEASE, depending
@@ -355,7 +355,7 @@ genAtomicRead(lower::AbstractConverter &converter,
     if (*memOrder == mlir::omp::ClauseMemoryOrderKind::Release) {
       // Reset it back to the default.
       memOrder = getDefaultAtomicMemOrder(semaCtx);
-    } else if (semaCtx.langOptions().OpenMPVersion <= 50 &&
+    } else if (semaCtx.langOptions().getOpenMP() <= 50 &&
                *memOrder == mlir::omp::ClauseMemoryOrderKind::Acq_rel) {
       // In OpenMP 5.0, acq_rel is not allowed on read; decay to acquire.
       // In OpenMP 5.1+, acq_rel is permitted on read.
@@ -418,7 +418,7 @@ genAtomicWrite(lower::AbstractConverter &converter,
     if (*memOrder == mlir::omp::ClauseMemoryOrderKind::Acquire) {
       // Reset it back to the default.
       memOrder = getDefaultAtomicMemOrder(semaCtx);
-    } else if (semaCtx.langOptions().OpenMPVersion <= 50 &&
+    } else if (semaCtx.langOptions().getOpenMP() <= 50 &&
                *memOrder == mlir::omp::ClauseMemoryOrderKind::Acq_rel) {
       // In OpenMP 5.0, acq_rel is not allowed on write; decay to release.
       // In OpenMP 5.1+, acq_rel is permitted on write.
@@ -574,7 +574,7 @@ void Fortran::lower::omp::lowerAtomic(
   auto [memOrder, canOverride] = getAtomicMemoryOrder(
       semaCtx, clauses, semaCtx.FindScope(construct.source));
 
-  unsigned version = semaCtx.langOptions().OpenMPVersion;
+  llvm::omp::Version version = semaCtx.langOptions().getOpenMP();
   int action0 = analysis.op0.what & analysis.Action;
   int action1 = analysis.op1.what & analysis.Action;
   memOrder = makeValidForAction(memOrder, action0, action1, version);
diff --git a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
index b2f511c2c9cd1..044dd65e16fa0 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
@@ -1831,7 +1831,7 @@ bool ClauseProcessor::processLinear(mlir::omp::LinearClauseOps &result,
       std::optional<mlir::omp::LinearModifier> linearMod;
       if (explicitLinearMod)
         linearMod = *explicitLinearMod;
-      else if (semaCtx.langOptions().OpenMPVersion >= 52)
+      else if (semaCtx.langOptions().getOpenMP() >= 52)
         linearMod = isDeclareSimd ? getDeclareSimdDefaultMod(*sym)
                                   : mlir::omp::LinearModifier::val;
 
@@ -1979,10 +1979,10 @@ bool ClauseProcessor::processMap(
     // default value
     Map::MapType type;
     if (directive == llvm::omp::Directive::OMPD_target_enter_data &&
-        semaCtx.langOptions().OpenMPVersion >= 52)
+        semaCtx.langOptions().getOpenMP() >= 52)
       type = mapType.value_or(Map::MapType::To);
     else if (directive == llvm::omp::Directive::OMPD_target_exit_data &&
-             semaCtx.langOptions().OpenMPVersion >= 52)
+             semaCtx.langOptions().getOpenMP() >= 52)
       type = mapType.value_or(Map::MapType::From);
     else
       type = mapType.value_or(Map::MapType::Tofrom);
diff --git a/flang/lib/Lower/OpenMP/ClauseProcessor.h b/flang/lib/Lower/OpenMP/ClauseProcessor.h
index 10d52bcdf89de..177a5ff33f231 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.h
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.h
@@ -236,7 +236,7 @@ void ClauseProcessor::processTODO(mlir::Location currentLocation,
   auto checkUnhandledClause = [&](llvm::omp::Clause id, const auto *x) {
     if (!x)
       return;
-    unsigned version = semaCtx.langOptions().OpenMPVersion;
+    llvm::omp::Version version = semaCtx.langOptions().getOpenMP();
     bool isSimdDirective = llvm::omp::getOpenMPDirectiveName(directive, version)
                                .upper()
                                .find("SIMD") != llvm::StringRef::npos;
diff --git a/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp b/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
index 1d39c1a8d4b77..a4d09375dfbfc 100644
--- a/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
@@ -287,7 +287,7 @@ void DataSharingProcessor::collectSymbolsForPrivatization() {
         // versions semantics only warns and ignores it, so fall back to a
         // regular lastprivate here to keep lowering consistent and avoid the
         // conditional path for entities it cannot hand...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/219822


More information about the llvm-branch-commits mailing list