--- /dev/null
+// RUN: mlir-tblgen -gen-directive-decl -I %S/../../../llvm/include %s | FileCheck -match-full-lines %s
+
+include "llvm/Frontend/Directive/DirectiveBase.td"
+
+def TDLCV_vala : ClauseVal<"vala",1,1> {}
+def TDLCV_valb : ClauseVal<"valb",2,1> {}
+def TDLCV_valc : ClauseVal<"valc",3,0> { let isDefault = 1; }
+
+def TDLC_ClauseA : Clause<"clausea"> {
+ let flangClass = "TdlClauseA";
+ let enumClauseValue = "AKind";
+ let allowedClauseValues = [
+ TDLCV_vala,
+ TDLCV_valb,
+ TDLCV_valc
+ ];
+}
+
+// CHECK: def AKindvala : StrEnumAttrCase<"vala">;
+// CHECK: def AKindvalb : StrEnumAttrCase<"valb">;
+// CHECK: def AKind: StrEnumAttr<
+// CHECK: "ClauseAKind",
+// CHECK: "AKind Clause",
+// CHECK: [AKindvala,AKindvalb]> {
+// CHECK: let cppNamespace = "::mlir::omp";
+// CHECK: }
using llvm::RecordKeeper;
using llvm::Twine;
+// LLVM has multiple places (Clang, Flang, MLIR) where information about
+// the OpenMP directives, and clauses are needed. It is good software
+// engineering to keep the common information in a single place to avoid
+// duplication, reduce engineering effort and prevent mistakes.
+// Currently that common place is llvm/include/llvm/Frontend/OpenMP/OMP.td.
+// We plan to use this tablegen source to generate all the required
+// declarations, functions etc.
+//
+// Some OpenMP clauses accept only a fixed set of values as inputs. These
+// can be represented as a String Enum Attribute (StrEnumAttr) in MLIR ODS.
+// The emitDecls function below currently generates these enumerations. The
+// name of the enumeration is specified in the enumClauseValue field of
+// Clause record in OMP.td. This name can be used to specify the type of the
+// OpenMP operation's operand. The allowedClauseValues field provides the list
+// of ClauseValues which are part of the enumeration.
static bool emitDecls(const RecordKeeper &recordKeeper, raw_ostream &os) {
const auto &clauses = recordKeeper.getAllDerivedDefinitions("Clause");