================
@@ -0,0 +1,63 @@
+//===-- OMPVersion.h - OpenMP version definition ------------------ 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
+//
+//===----------------------------------------------------------------------===//
+//
+// 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 Version(value_type Ver = 0) : V(Ver) {}
+ constexpr operator value_type() const { return V; }
+ constexpr explicit operator bool() const { return V != 0; }
+
+ 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;
+}
+inline constexpr bool operator>(Version A, Version B) { return !(A <= B); }
+inline constexpr bool operator>=(Version A, Version B) { return !(A < B); }
----------------
alexey-bataev wrote:
Remove, constexpr operator value_type() const { return V; } does all these
https://github.com/llvm/llvm-project/pull/219820
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits