diff --git a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp index 06ef396b9b21d..cd41e6d20d70e 100644 --- a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp +++ b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp @@ -1166,7 +1166,7 @@ getAllCppAttrConstraints(const RecordKeeper &records) { /// Emit the declarations for the given constraints, of the form: /// `bool ( );` -static void emitConstraintDecls(const std::vector &constraints, +static void emitConstraintDecls(ArrayRef constraints, raw_ostream &os, StringRef parameterTypeName, StringRef parameterName) { static const char *const constraintDecl = "bool {0}({1} {2});\n"; @@ -1192,7 +1192,7 @@ static void emitAttrConstraintDecls(const RecordKeeper &records, /// return (); }` /// where `` is the condition template with the `self` variable /// replaced with the `selfName` parameter. -static void emitConstraintDefs(const std::vector &constraints, +static void emitConstraintDefs(ArrayRef constraints, raw_ostream &os, StringRef parameterTypeName, StringRef selfName) { static const char *const constraintDef = R"( diff --git a/mlir/tools/mlir-tblgen/EnumsGen.cpp b/mlir/tools/mlir-tblgen/EnumsGen.cpp index d4d32f5885971..d55ad482f02c2 100644 --- a/mlir/tools/mlir-tblgen/EnumsGen.cpp +++ b/mlir/tools/mlir-tblgen/EnumsGen.cpp @@ -46,8 +46,7 @@ static std::string makeIdentifier(StringRef str) { static void emitEnumClass(const Record &enumDef, StringRef enumName, StringRef underlyingType, StringRef description, - const std::vector &enumerants, - raw_ostream &os) { + ArrayRef enumerants, raw_ostream &os) { os << "// " << description << "\n"; os << "enum class " << enumName; @@ -55,14 +54,13 @@ static void emitEnumClass(const Record &enumDef, StringRef enumName, os << " : " << underlyingType; os << " {\n"; - for (const auto &enumerant : enumerants) { + for (const EnumCase &enumerant : enumerants) { auto symbol = makeIdentifier(enumerant.getSymbol()); auto value = enumerant.getValue(); - if (value >= 0) { + if (value >= 0) os << formatv(" {0} = {1},\n", symbol, value); - } else { + else os << formatv(" {0},\n", symbol); - } } os << "};\n\n"; } diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp index c3420d433523a..6895a04f85518 100644 --- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp +++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp @@ -4801,11 +4801,9 @@ void OpOperandAdaptorEmitter::emitDef( } /// Emit the class declarations or definitions for the given op defs. -static void -emitOpClasses(const RecordKeeper &records, - const std::vector &defs, raw_ostream &os, - const StaticVerifierFunctionEmitter &staticVerifierEmitter, - bool emitDecl) { +static void emitOpClasses( + const RecordKeeper &records, ArrayRef defs, raw_ostream &os, + const StaticVerifierFunctionEmitter &staticVerifierEmitter, bool emitDecl) { if (defs.empty()) return; @@ -4840,11 +4838,10 @@ emitOpClasses(const RecordKeeper &records, /// Emit the declarations for the provided op classes. static void emitOpClassDecls(const RecordKeeper &records, - const std::vector &defs, - raw_ostream &os) { + ArrayRef defs, raw_ostream &os) { // First emit forward declaration for each class, this allows them to refer // to each others in traits for example. - for (auto *def : defs) { + for (const Record *def : defs) { Operator op(*def); NamespaceEmitter emitter(os, op.getCppNamespace()); std::string comments = tblgen::emitSummaryAndDescComments( diff --git a/mlir/tools/mlir-tblgen/TosaUtilsGen.cpp b/mlir/tools/mlir-tblgen/TosaUtilsGen.cpp index c92954600f411..dc8cc58498230 100644 --- a/mlir/tools/mlir-tblgen/TosaUtilsGen.cpp +++ b/mlir/tools/mlir-tblgen/TosaUtilsGen.cpp @@ -1,4 +1,4 @@ -//===- TosaUtilsGen.cpp - Tosa utility generator -===// +//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information.