[flang-commits] [flang] [llvm] [OpenMP][flang] Use auto-generated data for modifier verification (PR #215648)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Thu Aug 13 05:03:11 PDT 2026
================
@@ -0,0 +1,125 @@
+//===-- OMPDescriptors.h - OpenMP descriptors --------------------- 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 definitions and declarations of OpenMP elements.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_FRONTEND_OPENMP_OMPDESCRIPTORS_H
+#define LLVM_FRONTEND_OPENMP_OMPDESCRIPTORS_H
+
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/Frontend/OpenMP/OMP.h"
+
+namespace llvm::omp {
+enum class Property {
+#define GEN_OMP_PROPERTY_ENUMS
+#include "llvm/Frontend/OpenMP/OMPDescriptors.h.inc"
+#undef GEN_OMP_PROPERTY_ENUMS
+};
+
+static constexpr size_t Property_enumSize =
+ llvm::to_underlying(Property::Last_) -
+ llvm::to_underlying(Property::First_) + 1;
+
+enum class Modifier {
+#define GEN_OMP_MODIFIER_ENUMS
+#include "llvm/Frontend/OpenMP/OMPDescriptors.h.inc"
+#undef GEN_OMP_MODIFIER_ENUMS
+};
+
+static constexpr size_t Modifier_enumSize =
+ llvm::to_underlying(Modifier::Last_) -
+ llvm::to_underlying(Modifier::First_) + 1;
+
+using Properties = EnumSet<Property, Property_enumSize>;
+using Modifiers = EnumSet<Modifier, Modifier_enumSize>;
+
+using Clauses = llvm::omp::ClauseSet;
+using Directives = llvm::omp::DirectiveSet;
+
+namespace descriptor {
+namespace details {
+struct Base {
+ Properties Props;
+};
+
+// struct Directive : public Base {
+// StringRef Spelling;
+// Association Assoc;
+// Category Cat;
+// Clauses Cls;
+// SourceLanguage Langs;
+// };
+
+struct Clause : public Base {
+ StringRef Spelling;
+ Directives Dirs;
+ SourceLanguage Langs;
+ Modifiers Mods;
+};
+
+struct Modifier : public Base {
+ Clauses Cls;
+};
+} // namespace details
+
+template <typename DetailsTy> using DetailsMap = DenseMap<unsigned, DetailsTy>;
+
+template <typename DetailsTy> struct Descriptor {
+ Descriptor(const Descriptor &) = default;
+ Descriptor(Descriptor &&) = default;
+ Descriptor(StringRef N, DetailsMap<DetailsTy> &&D)
+ : Name(N), Details(std::move(D)) {}
+
+ StringRef getName() const { return Name; }
+ const DetailsMap<DetailsTy> getDetails() const { return Details; }
----------------
kparzysz wrote:
Done
https://github.com/llvm/llvm-project/pull/215648
More information about the flang-commits
mailing list