[Mlir-commits] [mlir] [MLIR][TableGen] Migrate MLIR backend to use const RecordKeeper (PR #107505)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Sep 5 23:01:31 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Rahul Joshi (jurahul)

<details>
<summary>Changes</summary>

- Migrate MLIR backend to use a const RecordKeeper reference.

---

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


18 Files Affected:

- (modified) mlir/include/mlir/TableGen/CodeGenHelpers.h (+2-2) 
- (modified) mlir/include/mlir/TableGen/GenInfo.h (+3-3) 
- (modified) mlir/lib/TableGen/CodeGenHelpers.cpp (+3-3) 
- (modified) mlir/lib/Tools/PDLL/Parser/Parser.cpp (+8-7) 
- (modified) mlir/lib/Tools/mlir-tblgen/MlirTblgenMain.cpp (+1-1) 
- (modified) mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp (+19-18) 
- (modified) mlir/tools/mlir-tblgen/BytecodeDialectGen.cpp (+3-2) 
- (modified) mlir/tools/mlir-tblgen/DirectiveCommonGen.cpp (+3-4) 
- (modified) mlir/tools/mlir-tblgen/EnumPythonBindingGen.cpp (+3-2) 
- (modified) mlir/tools/mlir-tblgen/EnumsGen.cpp (+4-4) 
- (modified) mlir/tools/mlir-tblgen/OmpOpGen.cpp (+9-8) 
- (modified) mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp (+12-12) 
- (modified) mlir/tools/mlir-tblgen/OpDocGen.cpp (+34-40) 
- (modified) mlir/tools/mlir-tblgen/OpGenHelpers.cpp (+5-5) 
- (modified) mlir/tools/mlir-tblgen/OpGenHelpers.h (+4-3) 
- (modified) mlir/tools/mlir-tblgen/OpInterfacesGen.cpp (+14-13) 
- (modified) mlir/tools/mlir-tblgen/RewriterGen.cpp (+12-12) 
- (modified) mlir/tools/tblgen-to-irdl/OpDefinitionsGen.cpp (+7-13) 


``````````diff
diff --git a/mlir/include/mlir/TableGen/CodeGenHelpers.h b/mlir/include/mlir/TableGen/CodeGenHelpers.h
index c263c69c53d1e3..465240907a3dee 100644
--- a/mlir/include/mlir/TableGen/CodeGenHelpers.h
+++ b/mlir/include/mlir/TableGen/CodeGenHelpers.h
@@ -106,7 +106,7 @@ class StaticVerifierFunctionEmitter {
                                 StringRef tag = "");
 
   /// Collect and unique all the constraints used by operations.
-  void collectOpConstraints(ArrayRef<llvm::Record *> opDefs);
+  void collectOpConstraints(ArrayRef<const llvm::Record *> opDefs);
 
   /// Collect and unique all compatible type, attribute, successor, and region
   /// constraints from the operations in the file and emit them at the top of
@@ -114,7 +114,7 @@ class StaticVerifierFunctionEmitter {
   ///
   /// Constraints that do not meet the restriction that they can only reference
   /// `$_self` and `$_op` are not uniqued.
-  void emitOpConstraints(ArrayRef<llvm::Record *> opDefs);
+  void emitOpConstraints(ArrayRef<const llvm::Record *> opDefs);
 
   /// Unique all compatible type and attribute constraints from a pattern file
   /// and emit them at the top of the generated file.
diff --git a/mlir/include/mlir/TableGen/GenInfo.h b/mlir/include/mlir/TableGen/GenInfo.h
index d59d64223827bd..ef2e12f07df16d 100644
--- a/mlir/include/mlir/TableGen/GenInfo.h
+++ b/mlir/include/mlir/TableGen/GenInfo.h
@@ -21,8 +21,8 @@ class RecordKeeper;
 namespace mlir {
 
 /// Generator function to invoke.
-using GenFunction =
-    std::function<bool(llvm::RecordKeeper &recordKeeper, raw_ostream &os)>;
+using GenFunction = std::function<bool(const llvm::RecordKeeper &recordKeeper,
+                                       raw_ostream &os)>;
 
 /// Structure to group information about a generator (argument to invoke via
 /// mlir-tblgen, description, and generator function).
@@ -34,7 +34,7 @@ class GenInfo {
       : arg(arg), description(description), generator(std::move(generator)) {}
 
   /// Invokes the generator and returns whether the generator failed.
-  bool invoke(llvm::RecordKeeper &recordKeeper, raw_ostream &os) const {
+  bool invoke(const llvm::RecordKeeper &recordKeeper, raw_ostream &os) const {
     assert(generator && "Cannot call generator with null generator");
     return generator(recordKeeper, os);
   }
diff --git a/mlir/lib/TableGen/CodeGenHelpers.cpp b/mlir/lib/TableGen/CodeGenHelpers.cpp
index 718a8136944bdf..314b20491460aa 100644
--- a/mlir/lib/TableGen/CodeGenHelpers.cpp
+++ b/mlir/lib/TableGen/CodeGenHelpers.cpp
@@ -49,7 +49,7 @@ StaticVerifierFunctionEmitter::StaticVerifierFunctionEmitter(
     : os(os), uniqueOutputLabel(getUniqueOutputLabel(records, tag)) {}
 
 void StaticVerifierFunctionEmitter::emitOpConstraints(
-    ArrayRef<llvm::Record *> opDefs) {
+    ArrayRef<const llvm::Record *> opDefs) {
   NamespaceEmitter namespaceEmitter(os, Operator(*opDefs[0]).getCppNamespace());
   emitTypeConstraints();
   emitAttrConstraints();
@@ -264,14 +264,14 @@ void StaticVerifierFunctionEmitter::collectConstraint(ConstraintMap &map,
 }
 
 void StaticVerifierFunctionEmitter::collectOpConstraints(
-    ArrayRef<Record *> opDefs) {
+    ArrayRef<const Record *> opDefs) {
   const auto collectTypeConstraints = [&](Operator::const_value_range values) {
     for (const NamedTypeConstraint &value : values)
       if (value.hasPredicate())
         collectConstraint(typeConstraints, "type", value.constraint);
   };
 
-  for (Record *def : opDefs) {
+  for (const Record *def : opDefs) {
     Operator op(*def);
     /// Collect type constraints.
     collectTypeConstraints(op.getOperands());
diff --git a/mlir/lib/Tools/PDLL/Parser/Parser.cpp b/mlir/lib/Tools/PDLL/Parser/Parser.cpp
index 01c78e280080ee..2f842df48826d5 100644
--- a/mlir/lib/Tools/PDLL/Parser/Parser.cpp
+++ b/mlir/lib/Tools/PDLL/Parser/Parser.cpp
@@ -164,7 +164,7 @@ class Parser {
                                SmallVectorImpl<ast::Decl *> &decls);
 
   /// Process the records of a parsed tablegen include file.
-  void processTdIncludeRecords(llvm::RecordKeeper &tdRecords,
+  void processTdIncludeRecords(const llvm::RecordKeeper &tdRecords,
                                SmallVectorImpl<ast::Decl *> &decls);
 
   /// Create a user defined native constraint for a constraint imported from
@@ -863,7 +863,7 @@ LogicalResult Parser::parseTdInclude(StringRef filename, llvm::SMRange fileLoc,
   return success();
 }
 
-void Parser::processTdIncludeRecords(llvm::RecordKeeper &tdRecords,
+void Parser::processTdIncludeRecords(const llvm::RecordKeeper &tdRecords,
                                      SmallVectorImpl<ast::Decl *> &decls) {
   // Return the length kind of the given value.
   auto getLengthKind = [](const auto &value) {
@@ -887,7 +887,7 @@ void Parser::processTdIncludeRecords(llvm::RecordKeeper &tdRecords,
 
   // Process the parsed tablegen records to build ODS information.
   /// Operations.
-  for (llvm::Record *def : tdRecords.getAllDerivedDefinitions("Op")) {
+  for (const llvm::Record *def : tdRecords.getAllDerivedDefinitions("Op")) {
     tblgen::Operator op(def);
 
     // Check to see if this operation is known to support type inferrence.
@@ -920,13 +920,13 @@ void Parser::processTdIncludeRecords(llvm::RecordKeeper &tdRecords,
     }
   }
 
-  auto shouldBeSkipped = [this](llvm::Record *def) {
+  auto shouldBeSkipped = [this](const llvm::Record *def) {
     return def->isAnonymous() || curDeclScope->lookup(def->getName()) ||
            def->isSubClassOf("DeclareInterfaceMethods");
   };
 
   /// Attr constraints.
-  for (llvm::Record *def : tdRecords.getAllDerivedDefinitions("Attr")) {
+  for (const llvm::Record *def : tdRecords.getAllDerivedDefinitions("Attr")) {
     if (shouldBeSkipped(def))
       continue;
 
@@ -936,7 +936,7 @@ void Parser::processTdIncludeRecords(llvm::RecordKeeper &tdRecords,
         constraint.getStorageType()));
   }
   /// Type constraints.
-  for (llvm::Record *def : tdRecords.getAllDerivedDefinitions("Type")) {
+  for (const llvm::Record *def : tdRecords.getAllDerivedDefinitions("Type")) {
     if (shouldBeSkipped(def))
       continue;
 
@@ -947,7 +947,8 @@ void Parser::processTdIncludeRecords(llvm::RecordKeeper &tdRecords,
   }
   /// OpInterfaces.
   ast::Type opTy = ast::OperationType::get(ctx);
-  for (llvm::Record *def : tdRecords.getAllDerivedDefinitions("OpInterface")) {
+  for (const llvm::Record *def :
+       tdRecords.getAllDerivedDefinitions("OpInterface")) {
     if (shouldBeSkipped(def))
       continue;
 
diff --git a/mlir/lib/Tools/mlir-tblgen/MlirTblgenMain.cpp b/mlir/lib/Tools/mlir-tblgen/MlirTblgenMain.cpp
index 564161fe4c1a24..1911b6e3aa3927 100644
--- a/mlir/lib/Tools/mlir-tblgen/MlirTblgenMain.cpp
+++ b/mlir/lib/Tools/mlir-tblgen/MlirTblgenMain.cpp
@@ -90,7 +90,7 @@ static bool findUse(Record &record, Init *deprecatedInit,
   });
 }
 
-static void warnOfDeprecatedUses(RecordKeeper &records) {
+static void warnOfDeprecatedUses(const RecordKeeper &records) {
   // This performs a direct check for any def marked as deprecated and then
   // finds all uses of deprecated def. Deprecated defs are not expected to be
   // either numerous or long lived.
diff --git a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
index feca04bff643d5..0a10d54e479211 100644
--- a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
+++ b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
@@ -30,7 +30,7 @@ using namespace mlir::tblgen;
 /// Find all the AttrOrTypeDef for the specified dialect. If no dialect
 /// specified and can only find one dialect's defs, use that.
 static void collectAllDefs(StringRef selectedDialect,
-                           std::vector<llvm::Record *> records,
+                           const std::vector<const llvm::Record *> &records,
                            SmallVectorImpl<AttrOrTypeDef> &resultDefs) {
   // Nothing to do if no defs were found.
   if (records.empty())
@@ -690,14 +690,15 @@ class DefGenerator {
   bool emitDefs(StringRef selectedDialect);
 
 protected:
-  DefGenerator(const std::vector<llvm::Record *> &defs, raw_ostream &os,
+  DefGenerator(ArrayRef<const llvm::Record *> defs, raw_ostream &os,
                StringRef defType, StringRef valueType, bool isAttrGenerator)
       : defRecords(defs), os(os), defType(defType), valueType(valueType),
         isAttrGenerator(isAttrGenerator) {
     // Sort by occurrence in file.
-    llvm::sort(defRecords, [](llvm::Record *lhs, llvm::Record *rhs) {
-      return lhs->getID() < rhs->getID();
-    });
+    llvm::sort(defRecords,
+               [](const llvm::Record *lhs, const llvm::Record *rhs) {
+                 return lhs->getID() < rhs->getID();
+               });
   }
 
   /// Emit the list of def type names.
@@ -706,7 +707,7 @@ class DefGenerator {
   void emitParsePrintDispatch(ArrayRef<AttrOrTypeDef> defs);
 
   /// The set of def records to emit.
-  std::vector<llvm::Record *> defRecords;
+  std::vector<const llvm::Record *> defRecords;
   /// The attribute or type class to emit.
   /// The stream to emit to.
   raw_ostream &os;
@@ -721,13 +722,13 @@ class DefGenerator {
 
 /// A specialized generator for AttrDefs.
 struct AttrDefGenerator : public DefGenerator {
-  AttrDefGenerator(llvm::RecordKeeper &records, raw_ostream &os)
+  AttrDefGenerator(const llvm::RecordKeeper &records, raw_ostream &os)
       : DefGenerator(records.getAllDerivedDefinitionsIfDefined("AttrDef"), os,
                      "Attr", "Attribute", /*isAttrGenerator=*/true) {}
 };
 /// A specialized generator for TypeDefs.
 struct TypeDefGenerator : public DefGenerator {
-  TypeDefGenerator(llvm::RecordKeeper &records, raw_ostream &os)
+  TypeDefGenerator(const llvm::RecordKeeper &records, raw_ostream &os)
       : DefGenerator(records.getAllDerivedDefinitionsIfDefined("TypeDef"), os,
                      "Type", "Type", /*isAttrGenerator=*/false) {}
 };
@@ -1029,9 +1030,9 @@ bool DefGenerator::emitDefs(StringRef selectedDialect) {
 
 /// Find all type constraints for which a C++ function should be generated.
 static std::vector<Constraint>
-getAllTypeConstraints(llvm::RecordKeeper &records) {
+getAllTypeConstraints(const llvm::RecordKeeper &records) {
   std::vector<Constraint> result;
-  for (llvm::Record *def :
+  for (const llvm::Record *def :
        records.getAllDerivedDefinitionsIfDefined("TypeConstraint")) {
     // Ignore constraints defined outside of the top-level file.
     if (llvm::SrcMgr.FindBufferContainingLoc(def->getLoc()[0]) !=
@@ -1046,7 +1047,7 @@ getAllTypeConstraints(llvm::RecordKeeper &records) {
   return result;
 }
 
-static void emitTypeConstraintDecls(llvm::RecordKeeper &records,
+static void emitTypeConstraintDecls(const llvm::RecordKeeper &records,
                                     raw_ostream &os) {
   static const char *const typeConstraintDecl = R"(
 bool {0}(::mlir::Type type);
@@ -1056,7 +1057,7 @@ bool {0}(::mlir::Type type);
     os << strfmt(typeConstraintDecl, *constr.getCppFunctionName());
 }
 
-static void emitTypeConstraintDefs(llvm::RecordKeeper &records,
+static void emitTypeConstraintDefs(const llvm::RecordKeeper &records,
                                    raw_ostream &os) {
   static const char *const typeConstraintDef = R"(
 bool {0}(::mlir::Type type) {
@@ -1087,13 +1088,13 @@ static llvm::cl::opt<std::string>
 
 static mlir::GenRegistration
     genAttrDefs("gen-attrdef-defs", "Generate AttrDef definitions",
-                [](llvm::RecordKeeper &records, raw_ostream &os) {
+                [](const llvm::RecordKeeper &records, raw_ostream &os) {
                   AttrDefGenerator generator(records, os);
                   return generator.emitDefs(attrDialect);
                 });
 static mlir::GenRegistration
     genAttrDecls("gen-attrdef-decls", "Generate AttrDef declarations",
-                 [](llvm::RecordKeeper &records, raw_ostream &os) {
+                 [](const llvm::RecordKeeper &records, raw_ostream &os) {
                    AttrDefGenerator generator(records, os);
                    return generator.emitDecls(attrDialect);
                  });
@@ -1109,13 +1110,13 @@ static llvm::cl::opt<std::string>
 
 static mlir::GenRegistration
     genTypeDefs("gen-typedef-defs", "Generate TypeDef definitions",
-                [](llvm::RecordKeeper &records, raw_ostream &os) {
+                [](const llvm::RecordKeeper &records, raw_ostream &os) {
                   TypeDefGenerator generator(records, os);
                   return generator.emitDefs(typeDialect);
                 });
 static mlir::GenRegistration
     genTypeDecls("gen-typedef-decls", "Generate TypeDef declarations",
-                 [](llvm::RecordKeeper &records, raw_ostream &os) {
+                 [](const llvm::RecordKeeper &records, raw_ostream &os) {
                    TypeDefGenerator generator(records, os);
                    return generator.emitDecls(typeDialect);
                  });
@@ -1123,14 +1124,14 @@ static mlir::GenRegistration
 static mlir::GenRegistration
     genTypeConstrDefs("gen-type-constraint-defs",
                       "Generate type constraint definitions",
-                      [](llvm::RecordKeeper &records, raw_ostream &os) {
+                      [](const llvm::RecordKeeper &records, raw_ostream &os) {
                         emitTypeConstraintDefs(records, os);
                         return false;
                       });
 static mlir::GenRegistration
     genTypeConstrDecls("gen-type-constraint-decls",
                        "Generate type constraint declarations",
-                       [](llvm::RecordKeeper &records, raw_ostream &os) {
+                       [](const llvm::RecordKeeper &records, raw_ostream &os) {
                          emitTypeConstraintDecls(records, os);
                          return false;
                        });
diff --git a/mlir/tools/mlir-tblgen/BytecodeDialectGen.cpp b/mlir/tools/mlir-tblgen/BytecodeDialectGen.cpp
index 66a3750d7c8266..964b33a9fa41f8 100644
--- a/mlir/tools/mlir-tblgen/BytecodeDialectGen.cpp
+++ b/mlir/tools/mlir-tblgen/BytecodeDialectGen.cpp
@@ -429,14 +429,15 @@ struct AttrOrType {
 
 static bool emitBCRW(const RecordKeeper &records, raw_ostream &os) {
   MapVector<StringRef, AttrOrType> dialectAttrOrType;
-  for (auto &it : records.getAllDerivedDefinitions("DialectAttributes")) {
+  for (const Record *it :
+       records.getAllDerivedDefinitions("DialectAttributes")) {
     if (!selectedBcDialect.empty() &&
         it->getValueAsString("dialect") != selectedBcDialect)
       continue;
     dialectAttrOrType[it->getValueAsString("dialect")].attr =
         it->getValueAsListOfDefs("elems");
   }
-  for (auto &it : records.getAllDerivedDefinitions("DialectTypes")) {
+  for (const Record *it : records.getAllDerivedDefinitions("DialectTypes")) {
     if (!selectedBcDialect.empty() &&
         it->getValueAsString("dialect") != selectedBcDialect)
       continue;
diff --git a/mlir/tools/mlir-tblgen/DirectiveCommonGen.cpp b/mlir/tools/mlir-tblgen/DirectiveCommonGen.cpp
index 337b6a5e5d5bd1..de3e6d8ee8cbc8 100644
--- a/mlir/tools/mlir-tblgen/DirectiveCommonGen.cpp
+++ b/mlir/tools/mlir-tblgen/DirectiveCommonGen.cpp
@@ -23,6 +23,7 @@
 using llvm::Clause;
 using llvm::ClauseVal;
 using llvm::raw_ostream;
+using llvm::Record;
 using llvm::RecordKeeper;
 
 // LLVM has multiple places (Clang, Flang, MLIR) where information about
@@ -49,13 +50,11 @@ static bool emitDecls(const RecordKeeper &recordKeeper, llvm::StringRef dialect,
                           "'--directives-dialect'");
   }
 
-  const auto &directiveLanguages =
+  const auto directiveLanguages =
       recordKeeper.getAllDerivedDefinitions("DirectiveLanguage");
   assert(!directiveLanguages.empty() && "DirectiveLanguage missing.");
 
-  const auto &clauses = recordKeeper.getAllDerivedDefinitions("Clause");
-
-  for (const auto &r : clauses) {
+  for (const Record *r : recordKeeper.getAllDerivedDefinitions("Clause")) {
     Clause c{r};
     const auto &clauseVals = c.getClauseVals();
     if (clauseVals.empty())
diff --git a/mlir/tools/mlir-tblgen/EnumPythonBindingGen.cpp b/mlir/tools/mlir-tblgen/EnumPythonBindingGen.cpp
index f4ced0803772ed..79249944e484f7 100644
--- a/mlir/tools/mlir-tblgen/EnumPythonBindingGen.cpp
+++ b/mlir/tools/mlir-tblgen/EnumPythonBindingGen.cpp
@@ -136,13 +136,14 @@ static bool emitDialectEnumAttributeBuilder(StringRef attrDefName,
 static bool emitPythonEnums(const llvm::RecordKeeper &recordKeeper,
                             raw_ostream &os) {
   os << fileHeader;
-  for (auto &it :
+  for (const llvm::Record *it :
        recordKeeper.getAllDerivedDefinitionsIfDefined("EnumAttrInfo")) {
     EnumAttr enumAttr(*it);
     emitEnumClass(enumAttr, os);
     emitAttributeBuilder(enumAttr, os);
   }
-  for (auto &it : recordKeeper.getAllDerivedDefinitionsIfDefined("EnumAttr")) {
+  for (const llvm::Record *it :
+       recordKeeper.getAllDerivedDefinitionsIfDefined("EnumAttr")) {
     AttrOrTypeDef attr(&*it);
     if (!attr.getMnemonic()) {
       llvm::errs() << "enum case " << attr
diff --git a/mlir/tools/mlir-tblgen/EnumsGen.cpp b/mlir/tools/mlir-tblgen/EnumsGen.cpp
index f1d7a233b66a9a..95767a29b9c3cf 100644
--- a/mlir/tools/mlir-tblgen/EnumsGen.cpp
+++ b/mlir/tools/mlir-tblgen/EnumsGen.cpp
@@ -645,8 +645,8 @@ class {1} : public ::mlir::{2} {
 static bool emitEnumDecls(const RecordKeeper &recordKeeper, raw_ostream &os) {
   llvm::emitSourceFileHeader("Enum Utility Declarations", os, recordKeeper);
 
-  auto defs = recordKeeper.getAllDerivedDefinitionsIfDefined("EnumAttrInfo");
-  for (const auto *def : defs)
+  for (const Record *def :
+       recordKeeper.getAllDerivedDefinitionsIfDefined("EnumAttrInfo"))
     emitEnumDecl(*def, os);
 
   return false;
@@ -683,8 +683,8 @@ static void emitEnumDef(const Record &enumDef, raw_ostream &os) {
 static bool emitEnumDefs(const RecordKeeper &recordKeeper, raw_ostream &os) {
   llvm::emitSourceFileHeader("Enum Utility Definitions", os, recordKeeper);
 
-  auto defs = recordKeeper.getAllDerivedDefinitionsIfDefined("EnumAttrInfo");
-  for (const auto *def : defs)
+  for (const Record *def :
+       recordKeeper.getAllDerivedDefinitionsIfDefined("EnumAttrInfo"))
     emitEnumDef(*def, os);
 
   return false;
diff --git a/mlir/tools/mlir-tblgen/OmpOpGen.cpp b/mlir/tools/mlir-tblgen/OmpOpGen.cpp
index b7f6ca975a9a34..15458212637888 100644
--- a/mlir/tools/mlir-tblgen/OmpOpGen.cpp
+++ b/mlir/tools/mlir-tblgen/OmpOpGen.cpp
@@ -24,8 +24,8 @@ using namespace llvm;
 /// `OpenMP_Clause` class the record is based on is found, the optional
 /// "OpenMP_" prefix and "Skip" and "Clause" suffixes are removed to return only
 /// the clause name, i.e. "OpenMP_CollapseClauseSkip" is returned as "Collapse".
-static StringRef extractOmpClauseName(Record *clause) {
-  Record *ompClause = clause->getRecords().getClass("OpenMP_Clause");
+static StringRef extractOmpClauseName(const Record *clause) {
+  const Record *ompClause = clause->getRecords().getClass("OpenMP_Clause");
   assert(ompClause && "base OpenMP records expected to be defined");
 
   StringRef clauseClassName;
@@ -33,7 +33,7 @@ static StringRef extractOmpClauseName(Record *clause) {
   clause->getDirectSuperClasses(clauseSuperClasses);
 
   // Check if OpenMP_Clause is a direct superclass.
-  for (Record *superClass : clauseSuperClasses) {
+  for (const Record *superClass : clauseSuperClasses) {
     if (superClass == ompClause) {
       clauseClassName = clause->getName();
       break;
@@ -83,7 +83,8 @@ static bool verifyArgument(DagInit *arguments, StringRef argName,
 /// Check that the given string record value, identified by its name \c value,
 /// is either undefined or empty in both the given operation and clause record
 /// or its contents for the clause record are contained in the operation record.
-static bool verifyStringValue(StringRef value, Record *op, Record *clause) {
+static bool verifyStringValue(StringRef value, const Record *op,
+                              const Record *clause) {
   auto opValue = op->getValueAsOptionalString(value);
   auto clauseValue = clause->getValueAsOptionalString(value);
 
@@ -100,7 +101,7 @@ static bool verifyStringValue(StringRef value, Record *op, Record *clause) {
 /// present in the corresponding operation field.
 ///
 /// Print warnings or errors where this is not the case.
-static void verifyClause(Record *op, Record *clause) {
+static void verifyClause(const R...
[truncated]

``````````

</details>


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


More information about the Mlir-commits mailing list