[llvm-branch-commits] [clang] [flang] [llvm] [OpenMP] Unify Version with directive::VersionRange (PR #236090)

Krzysztof Parzyszek via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Oct 28 10:49:06 PDT 2026


https://github.com/kparzysz updated https://github.com/llvm/llvm-project/pull/236090

>From e010cecaefb1fac4fe7467354504333701484361 Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Tue, 6 Oct 2026 15:41:15 -0500
Subject: [PATCH] [OpenMP] Unify Version with directive::VersionRange

The limits of VersionRange will now be represented as Versions,
not unsigned values.
---
 clang/lib/Parse/ParseOpenMP.cpp               |  2 +-
 flang/include/flang/Parser/openmp-utils.h     |  6 +-
 flang/lib/Parser/openmp-utils.cpp             |  6 +-
 flang/lib/Semantics/check-omp-syntax.cpp      |  6 +-
 .../llvm/Frontend/Directive/Spelling.h        | 18 +----
 .../include/llvm/Frontend/Directive/Version.h | 74 +++++++++++++++++++
 .../include/llvm/Frontend/OpenMP/OMPVersion.h | 48 +-----------
 llvm/include/llvm/TableGen/DirectiveEmitter.h |  9 ++-
 llvm/lib/Frontend/Directive/Spelling.cpp      | 15 ++--
 llvm/test/TableGen/directive1.td              | 26 ++++---
 llvm/test/TableGen/directive2.td              | 24 +++---
 llvm/unittests/Frontend/OpenACCTest.cpp       | 48 ++++++------
 .../Frontend/OpenMPDirectiveNameTest.cpp      |  4 +-
 .../utils/TableGen/Basic/DirectiveEmitter.cpp | 32 ++++----
 14 files changed, 172 insertions(+), 146 deletions(-)
 create mode 100644 llvm/include/llvm/Frontend/Directive/Version.h

diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index ff8b72a5d06a20..8f384c3b888906 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -61,7 +61,7 @@ static OpenMPDirectiveKind checkOpenMPDirectiveName(Parser &P,
                                                     SourceLocation Loc,
                                                     OpenMPDirectiveKind Kind,
                                                     StringRef Name) {
-  unsigned Version = P.getLangOpts().OpenMP;
+  llvm::omp::Version Version = P.getLangOpts().getOpenMPVersion();
   auto [D, VR] = getOpenMPDirectiveKindAndVersions(Name);
   // "ORDERED" is parsed as OMPD_ordered_standalone.
   if (D == Directive::OMPD_ordered_blockassoc)
diff --git a/flang/include/flang/Parser/openmp-utils.h b/flang/include/flang/Parser/openmp-utils.h
index db91cfba5e24f9..35df7d9170afda 100644
--- a/flang/include/flang/Parser/openmp-utils.h
+++ b/flang/include/flang/Parser/openmp-utils.h
@@ -79,8 +79,8 @@ auto GetAllowedElements(const DescriptorTy &desc, llvm::omp::Version version) {
 template <typename ElemTy, typename OwnerTy>
 llvm::directive::VersionRange GetVersionRangeForElement(
     ElemTy elemId, OwnerTy ownerId) {
-  llvm::omp::Version minVer{std::numeric_limits<int>::max()};
-  llvm::omp::Version maxVer{0u};
+  llvm::omp::Version minVer{llvm::omp::Version::Max()};
+  llvm::omp::Version maxVer{0};
   const auto &desc{llvm::omp::getDescriptor(ownerId)};
   for (llvm::omp::Version v : desc.getVersions()) {
     if (GetAllowedElements(desc, v).test(elemId)) {
@@ -88,7 +88,7 @@ llvm::directive::VersionRange GetVersionRangeForElement(
       maxVer = std::max(maxVer, v);
     }
   }
-  return llvm::directive::VersionRange{minVer.value(), maxVer.value()};
+  return llvm::directive::VersionRange{minVer, maxVer};
 }
 
 llvm::directive::VersionRange GetVersionRangeForDirective(
diff --git a/flang/lib/Parser/openmp-utils.cpp b/flang/lib/Parser/openmp-utils.cpp
index 4bc4de86e9b0da..9fdae7cd003639 100644
--- a/flang/lib/Parser/openmp-utils.cpp
+++ b/flang/lib/Parser/openmp-utils.cpp
@@ -56,14 +56,14 @@ llvm::omp::Modifiers GetElements(const llvm::omp::descriptor::ModifierSet &desc,
 
 llvm::directive::VersionRange GetVersionRangeForDirective(
     llvm::omp::Directive dirId) {
-  llvm::omp::Version minVer{std::numeric_limits<int>::max()};
-  llvm::omp::Version maxVer{0u};
+  llvm::omp::Version minVer{llvm::omp::Version::Max()};
+  llvm::omp::Version maxVer{0};
   auto &desc = llvm::omp::getDescriptor(dirId);
   for (llvm::omp::Version v : desc.getVersions()) {
     minVer = std::min(minVer, v);
     maxVer = std::max(maxVer, v);
   }
-  return llvm::directive::VersionRange{minVer.value(), maxVer.value()};
+  return llvm::directive::VersionRange{minVer, maxVer};
 }
 } // namespace descriptor
 
diff --git a/flang/lib/Semantics/check-omp-syntax.cpp b/flang/lib/Semantics/check-omp-syntax.cpp
index 7ce3910c3dceab..d4fd6857fc89e2 100644
--- a/flang/lib/Semantics/check-omp-syntax.cpp
+++ b/flang/lib/Semantics/check-omp-syntax.cpp
@@ -48,7 +48,7 @@ static llvm::omp::Version GetClosestVersion(
     llvm::directive::VersionRange range, llvm::omp::Version version) {
   if (range.isValid()) {
     return llvm::omp::Version(
-        std::min(std::max(version.value(), range.Min), range.Max));
+        std::min(std::max(version, range.Min), range.Max));
   }
   return llvm::omp::Version();
 }
@@ -354,7 +354,7 @@ static ResultTy VerifyUltimate(
 bool OmpStructureChecker::VerifyClauseVersion(
     parser::OmpDirectiveName dirName, const AppliedClauseInfo &info) {
   llvm::omp::Version version{context_.langOptions().getOpenMPVersion()};
-  llvm::omp::Version maxVer{std::numeric_limits<int>::max()};
+  llvm::omp::Version maxVer{llvm::omp::Version::Max()};
   bool isCancel{dirName.v == llvm::omp::Directive::OMPD_cancel ||
       dirName.v == llvm::omp::Directive::OMPD_cancellation_point};
 
@@ -604,7 +604,7 @@ bool OmpStructureChecker::VerifyModifierVersion(
     WithSource<llvm::omp::Clause> clause, const AppliedModifierInfo &info) {
   // Verify that the specified modifiers are allowed in this version.
   llvm::omp::Version version{context_.langOptions().getOpenMPVersion()};
-  llvm::omp::Version maxVer{std::numeric_limits<int>::max()};
+  llvm::omp::Version maxVer{llvm::omp::Version::Max()};
 
   auto result = VerifyVersions(info, clause.value, version);
 
diff --git a/llvm/include/llvm/Frontend/Directive/Spelling.h b/llvm/include/llvm/Frontend/Directive/Spelling.h
index 31c2e51094c354..321c45e5e1e78f 100644
--- a/llvm/include/llvm/Frontend/Directive/Spelling.h
+++ b/llvm/include/llvm/Frontend/Directive/Spelling.h
@@ -10,34 +10,20 @@
 
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/iterator_range.h"
+#include "llvm/Frontend/Directive/Version.h"
 #include "llvm/Support/Compiler.h"
 
 #include <limits>
 #include <tuple>
 
 namespace llvm::directive {
-
-struct VersionRange {
-  static constexpr unsigned MaxValue = std::numeric_limits<int>::max();
-  // The default "Version" value in get<Lang><Enum>Name() is 0, include that
-  // in the maximum range.
-  unsigned Min = 0;
-  unsigned Max = MaxValue;
-
-  constexpr bool operator<(const VersionRange &R) const {
-    return std::tie(Min, Max) < std::tie(R.Min, R.Max);
-  }
-  constexpr bool isValid() const { return Min <= Max; }
-};
-
 struct Spelling {
   StringRef Name;
   VersionRange Versions;
 };
 
 LLVM_ABI StringRef FindName(llvm::iterator_range<const Spelling *>,
-                            unsigned Version);
-
+                            Version Version);
 } // namespace llvm::directive
 
 #endif // LLVM_FRONTEND_DIRECTIVE_SPELLING_H
diff --git a/llvm/include/llvm/Frontend/Directive/Version.h b/llvm/include/llvm/Frontend/Directive/Version.h
new file mode 100644
index 00000000000000..f511b91720c059
--- /dev/null
+++ b/llvm/include/llvm/Frontend/Directive/Version.h
@@ -0,0 +1,74 @@
+//===-------------------------------------------------------------- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_FRONTEND_DIRECTIVE_VERSION_H
+#define LLVM_FRONTEND_DIRECTIVE_VERSION_H
+
+#include "llvm/ADT/DenseMapInfo.h"
+
+#include <limits>
+
+namespace llvm {
+namespace directive {
+struct Version {
+  using value_type = int;
+  constexpr explicit Version(value_type Ver = 0) : V(Ver) {}
+  constexpr explicit operator bool() const { return V != 0; }
+  constexpr value_type value() const { return V; }
+
+  friend constexpr bool operator<(Version A, Version B);
+  friend constexpr bool operator==(Version A, Version B);
+
+  static constexpr Version Max() {
+    return Version(std::numeric_limits<value_type>::max());
+  }
+
+private:
+  value_type V;
+};
+
+inline constexpr bool operator==(Version A, Version B) { return A.V == B.V; }
+inline constexpr bool operator!=(Version A, Version B) { return !(A == B); }
+inline constexpr bool operator<(Version A, Version B) { return A.V < B.V; }
+inline constexpr bool operator<=(Version A, Version B) {
+  return A < B || A == B;
+}
+inline constexpr bool operator>(Version A, Version B) { return !(A <= B); }
+inline constexpr bool operator>=(Version A, Version B) { return !(A < B); }
+
+inline constexpr bool operator==(Version A, int B) { return A == Version(B); }
+inline constexpr bool operator!=(Version A, int B) { return A != Version(B); }
+inline constexpr bool operator<(Version A, int B) { return A < Version(B); }
+inline constexpr bool operator<=(Version A, int B) { return A <= Version(B); }
+inline constexpr bool operator>(Version A, int B) { return A > Version(B); }
+inline constexpr bool operator>=(Version A, int B) { return A >= Version(B); }
+
+struct VersionRange {
+  Version Min = Version(0);
+  Version Max = Version::Max();
+
+  constexpr bool operator<(const VersionRange &R) const {
+    return std::tie(Min, Max) < std::tie(R.Min, R.Max);
+  }
+  constexpr bool isValid() const { return Min <= Max; }
+  constexpr bool contains(Version V) const { return Min <= V && V <= Max; }
+};
+} // namespace directive
+
+template <> struct DenseMapInfo<directive::Version> {
+  static unsigned getHashValue(directive::Version V) {
+    using UnderlyingTy = directive::Version::value_type;
+    return DenseMapInfo<UnderlyingTy>::getHashValue(V.value());
+  }
+  static bool isEqual(directive::Version LHS, directive::Version RHS) {
+    return LHS == RHS;
+  }
+};
+} // namespace llvm
+
+#endif // LLVM_FRONTEND_DIRECTIVE_VERSION_H
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPVersion.h b/llvm/include/llvm/Frontend/OpenMP/OMPVersion.h
index 649d5deaa85a36..4a12c94916ffee 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPVersion.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPVersion.h
@@ -5,56 +5,14 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-//
-// This file contains the core set of OpenMP definitions and declarations.
-//
-//===----------------------------------------------------------------------===//
 
 #ifndef LLVM_FRONTEND_OPENMP_OMPVERSION_H
 #define LLVM_FRONTEND_OPENMP_OMPVERSION_H
 
-#include "llvm/ADT/DenseMapInfo.h"
-
-namespace llvm {
-namespace omp {
-struct Version {
-  using value_type = unsigned;
-  constexpr explicit Version(value_type Ver = 0) : V(Ver) {}
-  constexpr explicit operator value_type() const { return V; }
-  constexpr explicit operator bool() const { return V != 0; }
+#include "llvm/Frontend/Directive/Version.h"
 
-  friend constexpr bool operator<(Version A, Version B);
-  friend constexpr bool operator==(Version A, Version B);
-
-private:
-  value_type V;
-};
-
-inline constexpr bool operator==(Version A, Version B) { return A.V == B.V; }
-inline constexpr bool operator!=(Version A, Version B) { return !(A == B); }
-inline constexpr bool operator<(Version A, Version B) { return A.V < B.V; }
-inline constexpr bool operator<=(Version A, Version B) {
-  return A < B || A == B;
+namespace llvm::omp {
+using Version = llvm::directive::Version;
 }
-inline constexpr bool operator>(Version A, Version B) { return !(A <= B); }
-inline constexpr bool operator>=(Version A, Version B) { return !(A < B); }
-
-inline constexpr bool operator==(Version A, int B) { return A == Version(B); }
-inline constexpr bool operator!=(Version A, int B) { return A != Version(B); }
-inline constexpr bool operator<(Version A, int B) { return A < Version(B); }
-inline constexpr bool operator<=(Version A, int B) { return A <= Version(B); }
-inline constexpr bool operator>(Version A, int B) { return A > Version(B); }
-inline constexpr bool operator>=(Version A, int B) { return A >= Version(B); }
-} // namespace omp
-
-template <> struct DenseMapInfo<omp::Version> {
-  static unsigned getHashValue(omp::Version V) {
-    using UnderlyingTy = omp::Version::value_type;
-    return DenseMapInfo<UnderlyingTy>::getHashValue(
-        static_cast<UnderlyingTy>(V));
-  }
-  static bool isEqual(omp::Version LHS, omp::Version RHS) { return LHS == RHS; }
-};
-} // namespace llvm
 
 #endif // LLVM_FRONTEND_OPENMP_OMPVERSION_H
diff --git a/llvm/include/llvm/TableGen/DirectiveEmitter.h b/llvm/include/llvm/TableGen/DirectiveEmitter.h
index c0f2102f877656..9cd4d699752d74 100644
--- a/llvm/include/llvm/TableGen/DirectiveEmitter.h
+++ b/llvm/include/llvm/TableGen/DirectiveEmitter.h
@@ -18,6 +18,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Frontend/Directive/Spelling.h"
+#include "llvm/Frontend/Directive/Version.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/TableGen/Record.h"
 #include <string>
@@ -131,8 +132,9 @@ class Spelling : public Versioned {
 
   StringRef getText() const { return Def->getValueAsString("spelling"); }
   llvm::directive::VersionRange getVersions() const {
-    return llvm::directive::VersionRange{getMinVersion(Def),
-                                         getMaxVersion(Def)};
+    return llvm::directive::VersionRange{
+        llvm::directive::Version(getMinVersion(Def)),
+        llvm::directive::Version(getMaxVersion(Def))};
   }
 
   Value get() const { return Value{getText(), getVersions()}; }
@@ -175,7 +177,8 @@ class BaseRecord {
     // This is a suitable spelling for generating an identifier name,
     // since it will remain unchanged when any potential new spellings
     // are added.
-    Spelling::Value Oldest{"not found", {/*Min=*/INT_MAX, 0}};
+    using Version = directive::Version;
+    Spelling::Value Oldest{"not found", {/*Min=*/Version::Max(), Version(0)}};
     for (auto V : getSpellings())
       if (V.Versions.Min < Oldest.Versions.Min)
         Oldest = V;
diff --git a/llvm/lib/Frontend/Directive/Spelling.cpp b/llvm/lib/Frontend/Directive/Spelling.cpp
index c6bde6503ef32f..590ffc35aebc3c 100644
--- a/llvm/lib/Frontend/Directive/Spelling.cpp
+++ b/llvm/lib/Frontend/Directive/Spelling.cpp
@@ -6,22 +6,17 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Frontend/Directive/Spelling.h"
-
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/MathExtras.h"
+#include "llvm/Frontend/Directive/Spelling.h"
+#include "llvm/Frontend/Directive/Version.h"
 
 #include <cassert>
 
 using namespace llvm;
 
-static bool Contains(directive::VersionRange V, unsigned P) {
-  return V.Min <= P && P <= V.Max;
-}
-
 llvm::StringRef llvm::directive::FindName(
-    llvm::iterator_range<const directive::Spelling *> Range, unsigned Version) {
-  unsigned V = Version;
+    llvm::iterator_range<const directive::Spelling *> Range,
+    directive::Version Ver) {
   // Do a linear search to find the first Spelling that contains Version.
   // The condition "contains(S, Version)" does not partition the list of
   // spellings, so std::[lower|upper]_bound cannot be used.
@@ -29,7 +24,7 @@ llvm::StringRef llvm::directive::FindName(
   // linear search seems appropriate. In general, an interval tree may be
   // a better choice, but in this case it may be an overkill.
   for (auto &S : Range) {
-    if (Contains(S.Versions, V))
+    if (S.Versions.contains(Ver))
       return S.Name;
   }
   return StringRef();
diff --git a/llvm/test/TableGen/directive1.td b/llvm/test/TableGen/directive1.td
index d426bc9a3bd3a7..6ed3a4025ab8bb 100644
--- a/llvm/test/TableGen/directive1.td
+++ b/llvm/test/TableGen/directive1.td
@@ -57,6 +57,7 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
 // CHECK-NEXT:  #include "llvm/ADT/STLExtras.h"
 // CHECK-NEXT:  #include "llvm/ADT/StringRef.h"
 // CHECK-NEXT:  #include "llvm/Frontend/Directive/Spelling.h"
+// CHECK-NEXT:  #include "llvm/Frontend/Directive/Version.h"
 // CHECK-NEXT:  #include "llvm/Support/Compiler.h"
 // CHECK-NEXT:  #include <cstddef>
 // CHECK-NEXT:  #include <utility>
@@ -191,8 +192,8 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
 // CHECK-NEXT:  #endif
 // CHECK-NEXT:  }
 // CHECK-EMPTY:
-// CHECK-NEXT:  constexpr unsigned getDirectivePureSince(Directive) {
-// CHECK-NEXT:    return unsigned(2147483647);
+// CHECK-NEXT:  constexpr directive::Version getDirectivePureSince(Directive) {
+// CHECK-NEXT:    return directive::Version(2147483647);
 // CHECK-NEXT:  }
 // CHECK-EMPTY:
 // CHECK-NEXT:  constexpr SourceLanguage getDirectiveLanguages(Directive D) {
@@ -213,7 +214,7 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
 // CHECK-NEXT:   return getTdlDirectiveKindAndVersions(Str).first;
 // CHECK-NEXT:  }
 // CHECK-EMPTY:
-// CHECK-NEXT:  LLVM_ABI StringRef getTdlDirectiveName(Directive D, unsigned V = unsigned(0));
+// CHECK-NEXT:  LLVM_ABI StringRef getTdlDirectiveName(Directive D, directive::Version V = directive::Version(0));
 // CHECK-EMPTY:
 // CHECK-NEXT:  LLVM_ABI std::pair<Clause, directive::VersionRange> getTdlClauseKindAndVersions(StringRef Str);
 // CHECK-EMPTY:
@@ -221,14 +222,14 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
 // CHECK-NEXT:    return getTdlClauseKindAndVersions(Str).first;
 // CHECK-NEXT:  }
 // CHECK-EMPTY:
-// CHECK-NEXT:  LLVM_ABI StringRef getTdlClauseName(Clause C, unsigned V = unsigned(0));
+// CHECK-NEXT:  LLVM_ABI StringRef getTdlClauseName(Clause C, directive::Version V = directive::Version(0));
 // CHECK-EMPTY:
 // CHECK-NEXT:  /// Return true if \p C is a valid clause for \p D in version \p V.
-// CHECK-NEXT:  LLVM_ABI bool isAllowedClauseForDirective(Directive D, Clause C, unsigned V);
+// CHECK-NEXT:  LLVM_ABI bool isAllowedClauseForDirective(Directive D, Clause C, directive::Version V);
 // CHECK-EMPTY:
 // CHECK-NEXT:  constexpr std::size_t getMaxLeafCount() { return 0; }
 // CHECK-NEXT:  LLVM_ABI bool isAllowedLoopModifier(Directive D, LoopModifier LM);
-// CHECK-NEXT:  LLVM_ABI StringRef getLoopModifierName(LoopModifier LM, unsigned V = unsigned(0));
+// CHECK-NEXT:  LLVM_ABI StringRef getLoopModifierName(LoopModifier LM, directive::Version V = directive::Version(0));
 // CHECK-NEXT:  LLVM_ABI AKind getAKind(StringRef Str);
 // CHECK-NEXT:  LLVM_ABI StringRef getTdlAKindName(AKind x);
 // CHECK-EMPTY:
@@ -423,6 +424,7 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
 // IMPL-NEXT:  #undef GEN_DIRECTIVES_IMPL
 // IMPL-EMPTY:
 // IMPL-NEXT:  #include "llvm/Frontend/Directive/Spelling.h"
+// IMPL-NEXT:  #include "llvm/Frontend/Directive/Version.h"
 // IMPL-NEXT:  #include "llvm/Support/ErrorHandling.h"
 // IMPL-NEXT:  #include <utility>
 // IMPL-EMPTY:
@@ -433,7 +435,7 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
 // IMPL-NEXT:     .Default({TDLD_dira, All});
 // IMPL-NEXT: }
 // IMPL-EMPTY:
-// IMPL-NEXT:  llvm::StringRef llvm::tdl::getTdlDirectiveName(llvm::tdl::Directive Kind, unsigned V) {
+// IMPL-NEXT:  llvm::StringRef llvm::tdl::getTdlDirectiveName(llvm::tdl::Directive Kind, llvm::directive::Version V) {
 // IMPL-NEXT:    switch (Kind) {
 // IMPL-NEXT:      case TDLD_dira:
 // IMPL-NEXT:        return "dira";
@@ -451,7 +453,7 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
 // IMPL-NEXT:     .Default({TDLC_clauseb, All});
 // IMPL-NEXT: }
 // IMPL-EMPTY:
-// IMPL-NEXT:  llvm::StringRef llvm::tdl::getTdlClauseName(llvm::tdl::Clause Kind, unsigned V) {
+// IMPL-NEXT:  llvm::StringRef llvm::tdl::getTdlClauseName(llvm::tdl::Clause Kind, llvm::directive::Version V) {
 // IMPL-NEXT:    switch (Kind) {
 // IMPL-NEXT:      case TDLC_clausea:
 // IMPL-NEXT:        return "clausea";
@@ -459,8 +461,8 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
 // IMPL-NEXT:        return "clauseb";
 // IMPL-NEXT:      case TDLC_clausec: {
 // IMPL-NEXT:        static constexpr llvm::directive::Spelling TDLC_clausec_spellings[] = {
-// IMPL-NEXT:            {"clausec", {0, 2147483647}},
-// IMPL-NEXT:            {"ccccccc", {0, 2147483647}},
+// IMPL-NEXT:            {"clausec", {directive::Version(0), directive::Version(2147483647)}},
+// IMPL-NEXT:            {"ccccccc", {directive::Version(0), directive::Version(2147483647)}},
 // IMPL-NEXT:        };
 // IMPL-NEXT:        return llvm::directive::FindName(TDLC_clausec_spellings, static_cast<unsigned>(V));
 // IMPL-NEXT:      }
@@ -488,7 +490,7 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
 // IMPL-NEXT:    llvm_unreachable("Invalid Tdl AKind kind");
 // IMPL-NEXT:  }
 // IMPL-EMPTY:
-// IMPL-NEXT:  bool llvm::tdl::isAllowedClauseForDirective(llvm::tdl::Directive D, llvm::tdl::Clause C, unsigned V) {
+// IMPL-NEXT:  bool llvm::tdl::isAllowedClauseForDirective(llvm::tdl::Directive D, llvm::tdl::Clause C, llvm::directive::Version V) {
 // IMPL-NEXT:    assert(unsigned(D) <= Directive_enumSize);
 // IMPL-NEXT:    assert(unsigned(C) <= Clause_enumSize);
 // IMPL-NEXT:    switch (D) {
@@ -516,7 +518,7 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
 // IMPL-NEXT:    llvm_unreachable("Invalid Tdl Directive kind");
 // IMPL-NEXT:  }
 // IMPL-EMPTY:
-// IMPL-NEXT:  llvm::StringRef llvm::tdl::getLoopModifierName(llvm::tdl::LoopModifier Kind, unsigned V) {
+// IMPL-NEXT:  llvm::StringRef llvm::tdl::getLoopModifierName(llvm::tdl::LoopModifier Kind, llvm::directive::Version V) {
 // IMPL-NEXT:    switch (Kind) {
 // IMPL-NEXT:      case flattened:
 // IMPL-NEXT:        return "flattened";
diff --git a/llvm/test/TableGen/directive2.td b/llvm/test/TableGen/directive2.td
index b6cd8d6b6d9cbe..60d83f018b7bd6 100644
--- a/llvm/test/TableGen/directive2.td
+++ b/llvm/test/TableGen/directive2.td
@@ -51,6 +51,7 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
 // CHECK-NEXT:  #include "llvm/ADT/STLExtras.h"
 // CHECK-NEXT:  #include "llvm/ADT/StringRef.h"
 // CHECK-NEXT:  #include "llvm/Frontend/Directive/Spelling.h"
+// CHECK-NEXT:  #include "llvm/Frontend/Directive/Version.h"
 // CHECK-NEXT:  #include "llvm/Support/Compiler.h"
 // CHECK-NEXT:  #include <cstddef>
 // CHECK-NEXT:  #include <utility>
@@ -157,12 +158,12 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
 // CHECK-NEXT:  #endif
 // CHECK-NEXT:  }
 // CHECK-EMPTY:
-// CHECK-NEXT:  constexpr unsigned getDirectivePureSince(Directive Dir) {
+// CHECK-NEXT:  constexpr directive::Version getDirectivePureSince(Directive Dir) {
 // CHECK-NEXT:    switch (Dir) {
 // CHECK-NEXT:    case TDLD_dira:
-// CHECK-NEXT:      return unsigned(57066);
+// CHECK-NEXT:      return directive::Version(57066);
 // CHECK-NEXT:    default:
-// CHECK-NEXT:      return unsigned(2147483647);
+// CHECK-NEXT:      return directive::Version(2147483647);
 // CHECK-NEXT:    } // switch (Dir)
 // CHECK-NEXT:  }
 // CHECK-EMPTY:
@@ -184,7 +185,7 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
 // CHECK-NEXT:    return getTdlDirectiveKindAndVersions(Str).first;
 // CHECK-NEXT:  }
 // CHECK-EMPTY:
-// CHECK-NEXT:  LLVM_ABI StringRef getTdlDirectiveName(Directive D, unsigned V = unsigned(0));
+// CHECK-NEXT:  LLVM_ABI StringRef getTdlDirectiveName(Directive D, directive::Version V = directive::Version(0));
 // CHECK-EMPTY:
 // CHECK-NEXT:  LLVM_ABI std::pair<Clause, directive::VersionRange> getTdlClauseKindAndVersions(StringRef Str);
 // CHECK-EMPTY:
@@ -192,14 +193,14 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
 // CHECK-NEXT:    return getTdlClauseKindAndVersions(Str).first;
 // CHECK-NEXT:  }
 // CHECK-EMPTY:
-// CHECK-NEXT:  LLVM_ABI StringRef getTdlClauseName(Clause C, unsigned V = unsigned(0));
+// CHECK-NEXT:  LLVM_ABI StringRef getTdlClauseName(Clause C, directive::Version V = directive::Version(0));
 // CHECK-EMPTY:
 // CHECK-NEXT:  /// Return true if \p C is a valid clause for \p D in version \p V.
-// CHECK-NEXT:  LLVM_ABI bool isAllowedClauseForDirective(Directive D, Clause C, unsigned V);
+// CHECK-NEXT:  LLVM_ABI bool isAllowedClauseForDirective(Directive D, Clause C, directive::Version V);
 // CHECK-EMPTY:
 // CHECK-NEXT:  constexpr std::size_t getMaxLeafCount() { return 0; }
 // CHECK-NEXT:  LLVM_ABI bool isAllowedLoopModifier(Directive D, LoopModifier LM);
-// CHECK-NEXT:  LLVM_ABI StringRef getLoopModifierName(LoopModifier LM, unsigned V = unsigned(0));
+// CHECK-NEXT:  LLVM_ABI StringRef getLoopModifierName(LoopModifier LM, directive::Version V = directive::Version(0));
 // CHECK-EMPTY:
 // CHECK-NEXT:  } // namespace tdl
 // CHECK-EMPTY:
@@ -366,6 +367,7 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
 // IMPL-NEXT:  #undef GEN_DIRECTIVES_IMPL
 // IMPL-EMPTY:
 // IMPL-NEXT:  #include "llvm/Frontend/Directive/Spelling.h"
+// IMPL-NEXT:  #include "llvm/Frontend/Directive/Version.h"
 // IMPL-NEXT:  #include "llvm/Support/ErrorHandling.h"
 // IMPL-NEXT:  #include <utility>
 // IMPL-EMPTY:
@@ -376,7 +378,7 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
 // IMPL-NEXT:     .Default({TDLD_dira, All});
 // IMPL-NEXT: }
 // IMPL-EMPTY:
-// IMPL-NEXT:  llvm::StringRef llvm::tdl::getTdlDirectiveName(llvm::tdl::Directive Kind, unsigned V) {
+// IMPL-NEXT:  llvm::StringRef llvm::tdl::getTdlDirectiveName(llvm::tdl::Directive Kind, llvm::directive::Version V) {
 // IMPL-NEXT:    switch (Kind) {
 // IMPL-NEXT:      case TDLD_dira:
 // IMPL-NEXT:        return "dira";
@@ -394,7 +396,7 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
 // IMPL-NEXT:     .Default({TDLC_clauseb, All});
 // IMPL-NEXT: }
 // IMPL-EMPTY:
-// IMPL-NEXT:  llvm::StringRef llvm::tdl::getTdlClauseName(llvm::tdl::Clause Kind, unsigned V) {
+// IMPL-NEXT:  llvm::StringRef llvm::tdl::getTdlClauseName(llvm::tdl::Clause Kind, llvm::directive::Version V) {
 // IMPL-NEXT:    switch (Kind) {
 // IMPL-NEXT:      case TDLC_clausea:
 // IMPL-NEXT:        return "clausea";
@@ -408,7 +410,7 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
 // IMPL-NEXT:    llvm_unreachable("Invalid Tdl Clause kind");
 // IMPL-NEXT:  }
 // IMPL-EMPTY:
-// IMPL-NEXT:  bool llvm::tdl::isAllowedClauseForDirective(llvm::tdl::Directive D, llvm::tdl::Clause C, unsigned V) {
+// IMPL-NEXT:  bool llvm::tdl::isAllowedClauseForDirective(llvm::tdl::Directive D, llvm::tdl::Clause C, llvm::directive::Version V) {
 // IMPL-NEXT:    assert(unsigned(D) <= Directive_enumSize);
 // IMPL-NEXT:    assert(unsigned(C) <= Clause_enumSize);
 // IMPL-NEXT:    switch (D) {
@@ -436,7 +438,7 @@ def TDL_DirA : Directive<[Spelling<"dira">]> {
 // IMPL-NEXT:    llvm_unreachable("Invalid Tdl Directive kind");
 // IMPL-NEXT:  }
 // IMPL-EMPTY:
-// IMPL-NEXT:  llvm::StringRef llvm::tdl::getLoopModifierName(llvm::tdl::LoopModifier Kind, unsigned V) {
+// IMPL-NEXT:  llvm::StringRef llvm::tdl::getLoopModifierName(llvm::tdl::LoopModifier Kind, llvm::directive::Version V) {
 // IMPL-NEXT:    switch (Kind) {
 // IMPL-NEXT:      case flattened:
 // IMPL-NEXT:        return "flattened";
diff --git a/llvm/unittests/Frontend/OpenACCTest.cpp b/llvm/unittests/Frontend/OpenACCTest.cpp
index 1209f50c90f2d4..c5121a3625aca1 100644
--- a/llvm/unittests/Frontend/OpenACCTest.cpp
+++ b/llvm/unittests/Frontend/OpenACCTest.cpp
@@ -9,6 +9,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/Frontend/Directive/Version.h"
 #include "llvm/Frontend/OpenACC/ACC.h.inc"
 #include "gtest/gtest.h"
 
@@ -208,7 +209,7 @@ TEST(OpenACCTest, ClauseHelpers) {
   EXPECT_EQ(getOpenACCClauseName(ACCC_write), "write");
 }
 
-static void expectAllowedClauses(Directive Dir, unsigned Version,
+static void expectAllowedClauses(Directive Dir, directive::Version Version,
                                  const ArrayRef<Clause> &AllowedClauses) {
   SmallSet<Clause, 30> AllowedClausesSet;
   for (Clause Cl : AllowedClauses) {
@@ -224,36 +225,37 @@ static void expectAllowedClauses(Directive Dir, unsigned Version,
 }
 
 TEST(OpenACCTest, AllowedClause) {
-  expectAllowedClauses(ACCD_atomic, 3, {});
-  expectAllowedClauses(ACCD_cache, 3, {});
-  expectAllowedClauses(ACCD_unknown, 3, {});
-  expectAllowedClauses(ACCD_parallel, 0, {}); // Version starts at 1
+  using Version = directive::Version;
+  expectAllowedClauses(ACCD_atomic, Version(3), {});
+  expectAllowedClauses(ACCD_cache, Version(3), {});
+  expectAllowedClauses(ACCD_unknown, Version(3), {});
+  expectAllowedClauses(ACCD_parallel, Version(0), {}); // Version starts at 1
 
-  expectAllowedClauses(ACCD_data, 3,
+  expectAllowedClauses(ACCD_data, Version(3),
                        {ACCC_if, ACCC_attach, ACCC_copy, ACCC_copyin,
                         ACCC_copyout, ACCC_create, ACCC_default, ACCC_deviceptr,
                         ACCC_no_create, ACCC_present});
 
-  expectAllowedClauses(ACCD_declare, 3,
+  expectAllowedClauses(ACCD_declare, Version(3),
                        {ACCC_copy, ACCC_copyin, ACCC_copyout, ACCC_create,
                         ACCC_present, ACCC_deviceptr, ACCC_device_resident,
                         ACCC_link});
 
   expectAllowedClauses(
-      ACCD_enter_data, 3,
+      ACCD_enter_data, Version(3),
       {ACCC_async, ACCC_if, ACCC_wait, ACCC_attach, ACCC_create, ACCC_copyin});
 
-  expectAllowedClauses(ACCD_exit_data, 3,
+  expectAllowedClauses(ACCD_exit_data, Version(3),
                        {ACCC_async, ACCC_if, ACCC_wait, ACCC_finalize,
                         ACCC_copyout, ACCC_delete, ACCC_detach});
 
-  expectAllowedClauses(ACCD_host_data, 3,
+  expectAllowedClauses(ACCD_host_data, Version(3),
                        {ACCC_if, ACCC_if_present, ACCC_use_device});
 
-  expectAllowedClauses(ACCD_init, 3,
+  expectAllowedClauses(ACCD_init, Version(3),
                        {ACCC_device_num, ACCC_device_type, ACCC_if});
 
-  expectAllowedClauses(ACCD_kernels, 3,
+  expectAllowedClauses(ACCD_kernels, Version(3),
                        {ACCC_attach, ACCC_copy, ACCC_copyin, ACCC_copyout,
                         ACCC_create, ACCC_device_type, ACCC_no_create,
                         ACCC_present, ACCC_deviceptr, ACCC_async, ACCC_default,
@@ -261,7 +263,7 @@ TEST(OpenACCTest, AllowedClause) {
                         ACCC_vector_length, ACCC_wait});
 
   expectAllowedClauses(
-      ACCD_kernels_loop, 3,
+      ACCD_kernels_loop, Version(3),
       {ACCC_copy,        ACCC_copyin,        ACCC_copyout, ACCC_create,
        ACCC_device_type, ACCC_no_create,     ACCC_present, ACCC_private,
        ACCC_reduction,   ACCC_deviceptr,     ACCC_attach,  ACCC_async,
@@ -270,13 +272,13 @@ TEST(OpenACCTest, AllowedClause) {
        ACCC_vector,      ACCC_vector_length, ACCC_wait,    ACCC_worker,
        ACCC_auto,        ACCC_independent,   ACCC_seq});
 
-  expectAllowedClauses(ACCD_loop, 3,
+  expectAllowedClauses(ACCD_loop, Version(3),
                        {ACCC_device_type, ACCC_private, ACCC_reduction,
                         ACCC_collapse, ACCC_gang, ACCC_tile, ACCC_vector,
                         ACCC_worker, ACCC_auto, ACCC_independent, ACCC_seq});
 
   expectAllowedClauses(
-      ACCD_parallel, 3,
+      ACCD_parallel, Version(3),
       {ACCC_async,         ACCC_wait,         ACCC_num_gangs, ACCC_num_workers,
        ACCC_vector_length, ACCC_device_type,  ACCC_if,        ACCC_self,
        ACCC_copy,          ACCC_copyin,       ACCC_copyout,   ACCC_create,
@@ -284,7 +286,7 @@ TEST(OpenACCTest, AllowedClause) {
        ACCC_private,       ACCC_firstprivate, ACCC_reduction, ACCC_default});
 
   expectAllowedClauses(
-      ACCD_parallel_loop, 3,
+      ACCD_parallel_loop, Version(3),
       {ACCC_attach,      ACCC_copy,      ACCC_copyin,      ACCC_copyout,
        ACCC_create,      ACCC_deviceptr, ACCC_device_type, ACCC_firstprivate,
        ACCC_no_create,   ACCC_present,   ACCC_private,     ACCC_reduction,
@@ -293,11 +295,11 @@ TEST(OpenACCTest, AllowedClause) {
        ACCC_num_workers, ACCC_self,      ACCC_vector,      ACCC_vector_length,
        ACCC_worker,      ACCC_auto,      ACCC_independent, ACCC_seq});
 
-  expectAllowedClauses(ACCD_routine, 3,
+  expectAllowedClauses(ACCD_routine, Version(3),
                        {ACCC_bind, ACCC_device_type, ACCC_nohost, ACCC_gang,
                         ACCC_seq, ACCC_vector, ACCC_worker});
 
-  expectAllowedClauses(ACCD_serial, 3,
+  expectAllowedClauses(ACCD_serial, Version(3),
                        {ACCC_attach, ACCC_copy, ACCC_copyin, ACCC_copyout,
                         ACCC_create, ACCC_deviceptr, ACCC_device_type,
                         ACCC_no_create, ACCC_present, ACCC_private,
@@ -305,7 +307,7 @@ TEST(OpenACCTest, AllowedClause) {
                         ACCC_async, ACCC_default, ACCC_if, ACCC_self});
 
   expectAllowedClauses(
-      ACCD_serial_loop, 3,
+      ACCD_serial_loop, Version(3),
       {ACCC_attach,    ACCC_copy,      ACCC_copyin,      ACCC_copyout,
        ACCC_create,    ACCC_deviceptr, ACCC_device_type, ACCC_firstprivate,
        ACCC_no_create, ACCC_present,   ACCC_private,     ACCC_reduction,
@@ -315,17 +317,17 @@ TEST(OpenACCTest, AllowedClause) {
        ACCC_seq});
 
   expectAllowedClauses(
-      ACCD_set, 3,
+      ACCD_set, Version(3),
       {ACCC_default_async, ACCC_device_num, ACCC_device_type, ACCC_if});
 
-  expectAllowedClauses(ACCD_shutdown, 3,
+  expectAllowedClauses(ACCD_shutdown, Version(3),
                        {ACCC_device_num, ACCC_device_type, ACCC_if});
 
-  expectAllowedClauses(ACCD_update, 3,
+  expectAllowedClauses(ACCD_update, Version(3),
                        {ACCC_async, ACCC_wait, ACCC_device_type, ACCC_if,
                         ACCC_if_present, ACCC_self, ACCC_host, ACCC_device});
 
-  expectAllowedClauses(ACCD_wait, 3, {ACCC_async, ACCC_if});
+  expectAllowedClauses(ACCD_wait, Version(3), {ACCC_async, ACCC_if});
 }
 
 } // namespace
diff --git a/llvm/unittests/Frontend/OpenMPDirectiveNameTest.cpp b/llvm/unittests/Frontend/OpenMPDirectiveNameTest.cpp
index 519e6b9c3fced1..a48a91b95224e3 100644
--- a/llvm/unittests/Frontend/OpenMPDirectiveNameTest.cpp
+++ b/llvm/unittests/Frontend/OpenMPDirectiveNameTest.cpp
@@ -82,7 +82,7 @@ TEST(OpenMPDirectiveNames, DirectiveKind52) {
     auto [K, R] = getOpenMPDirectiveKindAndVersions(Name);
     ASSERT_EQ(K, Kind);
     // Expect the name to be valid in 5.2, but not in 6.0.
-    EXPECT_TRUE(52 <= R.Max && R.Max < 60);
+    EXPECT_TRUE(R.Max >= 52 && R.Max < 60);
   }
 }
 
@@ -91,6 +91,6 @@ TEST(OpenMPDirectiveNames, DirectiveKind60) {
     auto [K, R] = getOpenMPDirectiveKindAndVersions(Name);
     ASSERT_EQ(K, Kind);
     // Expect the name to be valid in 6.0 and later.
-    EXPECT_TRUE(60 <= R.Min);
+    EXPECT_TRUE(R.Min >= 60);
   }
 }
diff --git a/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp b/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp
index 30dc4be285b6a6..c0175d4d0dfaff 100644
--- a/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp
+++ b/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp
@@ -37,10 +37,9 @@ enum class Frontend { LLVM, Flang, Clang };
 static void emitDirectivesConstexprImpl(const DirectiveLanguage &DirLang,
                                         raw_ostream &OS);
 
-static StringRef getVersionType(const DirectiveLanguage &DirLang) {
-  if (DirLang.getName() == "OpenMP")
-    return "Version";
-  return "unsigned";
+static StringRef getVersionType(const DirectiveLanguage &DirLang,
+                                bool FullQual = false) {
+  return FullQual ? "llvm::directive::Version" : "directive::Version";
 }
 
 static StringRef getFESpelling(Frontend FE) {
@@ -281,8 +280,7 @@ static void emitDirectivesDecl(const RecordKeeper &Records, raw_ostream &OS) {
   OS << "#include \"llvm/ADT/STLExtras.h\"\n";
   OS << "#include \"llvm/ADT/StringRef.h\"\n";
   OS << "#include \"llvm/Frontend/Directive/Spelling.h\"\n";
-  if (DirLang.getName() == "OpenMP")
-    OS << "#include \"llvm/Frontend/OpenMP/OMPVersion.h\"\n";
+  OS << "#include \"llvm/Frontend/Directive/Version.h\"\n";
   OS << "#include \"llvm/Support/Compiler.h\"\n";
   OS << "#include <cstddef>\n"; // for size_t
   OS << "#include <utility>\n"; // for std::pair
@@ -405,10 +403,12 @@ orderSpellings(ArrayRef<Spelling::Value> Spellings) {
 static void generateGetName(ArrayRef<const Record *> Records, raw_ostream &OS,
                             StringRef Enum, const DirectiveLanguage &DirLang,
                             StringRef LangName, StringRef Prefix) {
+  StringRef VersionType = getVersionType(DirLang);
   std::string Qual = getQualifier(DirLang);
   OS << "\n";
   OS << "llvm::StringRef " << Qual << "get" << LangName << Enum << "Name("
-     << Qual << Enum << " Kind, " << getVersionType(DirLang) << " V) {\n";
+     << Qual << Enum << " Kind, " << getVersionType(DirLang, /*FullQual=*/true)
+     << " V) {\n";
   OS << "  switch (Kind) {\n";
   for (const Record *R : Records) {
     BaseRecord Rec(R);
@@ -425,12 +425,13 @@ static void generateGetName(ArrayRef<const Record *> Records, raw_ostream &OS,
       OS << "      static constexpr llvm::directive::Spelling " << SpellingsName
          << "[] = {\n";
       for (auto &S : Spellings) {
-        OS << "          {\"" << S.Name << "\", {" << S.Versions.Min << ", "
-           << S.Versions.Max << "}},\n";
+        OS << "          {\"" << S.Name << "\", {" << VersionType << "("
+           << S.Versions.Min.value() << "), " << VersionType << "("
+           << S.Versions.Max.value() << ")}},\n";
       }
       OS << "      };\n";
-      OS << "      return llvm::directive::FindName(" << SpellingsName
-         << ", static_cast<unsigned>(V));\n";
+      OS << "      return llvm::directive::FindName(" << SpellingsName << ", V"
+         << ");\n";
       OS << "    }\n";
     }
   }
@@ -469,6 +470,7 @@ static void generateGetKind(ArrayRef<const Record *> Records, raw_ostream &OS,
      << "directive::VersionRange>>(Str)\n";
 
   directive::VersionRange All;
+  StringRef VersionType = getVersionType(DirLang);
 
   // When a given spelling maps to more than one enum kind, this function
   // will return one of them, but it's unspecified which one.
@@ -490,7 +492,8 @@ static void generateGetKind(ArrayRef<const Record *> Records, raw_ostream &OS,
       if (Versions.Min == All.Min && Versions.Max == All.Max)
         OS << "All})\n";
       else
-        OS << "{" << Versions.Min << ", " << Versions.Max << "}})\n";
+        OS << "{" << VersionType << "(" << Versions.Min.value() << "), "
+           << VersionType << "(" << Versions.Max.value() << ")}})\n";
     }
   }
   OS << "    .Default({" << DefaultName << ", All});\n";
@@ -578,8 +581,8 @@ static void generateIsAllowedClause(const DirectiveLanguage &DirLang,
 
   OS << "\n";
   OS << "bool " << Qual << "isAllowedClauseForDirective(" << Qual
-     << "Directive D, " << Qual << "Clause C, " << getVersionType(DirLang)
-     << " V) {\n";
+     << "Directive D, " << Qual << "Clause C, "
+     << getVersionType(DirLang, /*FullQual=*/true) << " V) {\n";
   OS << "  assert(unsigned(D) <= Directive_enumSize);\n";
   OS << "  assert(unsigned(C) <= Clause_enumSize);\n";
 
@@ -1453,6 +1456,7 @@ void emitDirectivesBasicImpl(const DirectiveLanguage &DirLang,
   StringRef CPrefix = DirLang.getClausePrefix();
 
   OS << "#include \"llvm/Frontend/Directive/Spelling.h\"\n";
+  OS << "#include \"llvm/Frontend/Directive/Version.h\"\n";
   OS << "#include \"llvm/Support/ErrorHandling.h\"\n";
   OS << "#include <utility>\n";
 



More information about the llvm-branch-commits mailing list