Revert "[mlir][ODS] Use StringLiteral instead of StringRef when applicable"

This reverts commit 953086ddbb because
it breaks GCC 5 build:

  error: could not convert '(const char*)""' from 'const char*' to 'llvm::StringLiteral'
     static ::llvm::StringLiteral getDialectNamespace() { return ""; }
This commit is contained in:
Lei Zhang 2021-02-04 13:55:22 -05:00
parent 57a371d701
commit 63dc26450b
5 changed files with 4 additions and 8 deletions

View File

@ -1177,7 +1177,7 @@ class EnumAttrInfo<string name, list<EnumAttrCaseInfo> cases> {
// <return-type> <fn-name>(<qualified-enum-class-name>);
// ```
string symbolToStringFnName = "stringify" # name;
string symbolToStringFnRetType = "::llvm::StringLiteral";
string symbolToStringFnRetType = "::llvm::StringRef";
// The name of the utility function that returns the max enum value used
// within the enum class. It will have the following signature:

View File

@ -67,7 +67,7 @@ def NS_AOp : NS_Op<"a_op", [IsolatedFromAbove, IsolatedFromAbove]> {
// CHECK: public:
// CHECK: using Op::Op;
// CHECK: using Adaptor = AOpAdaptor;
// CHECK: static ::llvm::StringLiteral getOperationName();
// CHECK: static ::llvm::StringRef getOperationName();
// CHECK: ::mlir::Operation::operand_range getODSOperands(unsigned index);
// CHECK: ::mlir::Value a();
// CHECK: ::mlir::Operation::operand_range b();

View File

@ -75,7 +75,7 @@ class {0} : public ::mlir::Dialect {
void initialize();
friend class ::mlir::MLIRContext;
public:
static ::llvm::StringLiteral getDialectNamespace() { return "{1}"; }
static ::llvm::StringRef getDialectNamespace() { return "{1}"; }
)";
/// Registration for a single dependent dialect: to be inserted in the ctor

View File

@ -2180,7 +2180,7 @@ void OpEmitter::genTraits() {
void OpEmitter::genOpNameGetter() {
auto *method = opClass.addMethodAndPrune(
"::llvm::StringLiteral", "getOperationName", OpMethod::MP_Static);
"::llvm::StringRef", "getOperationName", OpMethod::MP_Static);
method->body() << " return \"" << op.getOperationName() << "\";\n";
}

View File

@ -45,17 +45,13 @@ const char *const passDeclBegin = R"(
template <typename DerivedT>
class {0}Base : public {1} {
public:
using Base = {0}Base;
{0}Base() : {1}(::mlir::TypeID::get<DerivedT>()) {{}
{0}Base(const {0}Base &) : {1}(::mlir::TypeID::get<DerivedT>()) {{}
/// 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.