diff --git a/mlir/include/mlir/IR/OpBase.td b/mlir/include/mlir/IR/OpBase.td --- a/mlir/include/mlir/IR/OpBase.td +++ b/mlir/include/mlir/IR/OpBase.td @@ -1173,7 +1173,7 @@ // (); // ``` string symbolToStringFnName = "stringify" # name; - string symbolToStringFnRetType = "::llvm::StringRef"; + string symbolToStringFnRetType = "::llvm::StringLiteral"; // The name of the utility function that returns the max enum value used // within the enum class. It will have the following signature: diff --git a/mlir/test/mlir-tblgen/op-decl.td b/mlir/test/mlir-tblgen/op-decl.td --- a/mlir/test/mlir-tblgen/op-decl.td +++ b/mlir/test/mlir-tblgen/op-decl.td @@ -67,7 +67,7 @@ // CHECK: public: // CHECK: using Op::Op; // CHECK: using Adaptor = AOpAdaptor; -// CHECK: static ::llvm::StringRef getOperationName(); +// CHECK: static ::llvm::StringLiteral getOperationName(); // CHECK: ::mlir::Operation::operand_range getODSOperands(unsigned index); // CHECK: ::mlir::Value a(); // CHECK: ::mlir::Operation::operand_range b(); diff --git a/mlir/tools/mlir-tblgen/DialectGen.cpp b/mlir/tools/mlir-tblgen/DialectGen.cpp --- a/mlir/tools/mlir-tblgen/DialectGen.cpp +++ b/mlir/tools/mlir-tblgen/DialectGen.cpp @@ -75,7 +75,7 @@ void initialize(); friend class ::mlir::MLIRContext; public: - static ::llvm::StringRef getDialectNamespace() { return "{1}"; } + static ::llvm::StringLiteral getDialectNamespace() { return "{1}"; } )"; /// Registration for a single dependent dialect: to be inserted in the ctor diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp --- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp +++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp @@ -2180,7 +2180,7 @@ void OpEmitter::genOpNameGetter() { auto *method = opClass.addMethodAndPrune( - "::llvm::StringRef", "getOperationName", OpMethod::MP_Static); + "::llvm::StringLiteral", "getOperationName", OpMethod::MP_Static); method->body() << " return \"" << op.getOperationName() << "\";\n"; } diff --git a/mlir/tools/mlir-tblgen/PassGen.cpp b/mlir/tools/mlir-tblgen/PassGen.cpp --- a/mlir/tools/mlir-tblgen/PassGen.cpp +++ b/mlir/tools/mlir-tblgen/PassGen.cpp @@ -45,13 +45,17 @@ template class {0}Base : public {1} { public: + using Base = {0}Base; + {0}Base() : {1}(::mlir::TypeID::get()) {{} {0}Base(const {0}Base &) : {1}(::mlir::TypeID::get()) {{} /// Returns the command-line argument attached to this pass. + static ::llvm::StringLiteral getArgumentName() { return "{2}"; } ::llvm::StringRef getArgument() const override { return "{2}"; } /// Returns the derived pass name. + static ::llvm::StringLiteral getPassName() { return "{0}"; } ::llvm::StringRef getName() const override { return "{0}"; } /// Support isa/dyn_cast functionality for the derived pass class.