[mlir][ods][nfc] fix gcc-5 build

This commit is contained in:
Mogball 2021-12-01 18:12:37 +00:00
parent 435d44bf8a
commit ecaad4a876
2 changed files with 9 additions and 3 deletions

View File

@ -556,9 +556,15 @@ class Class {
public:
virtual ~Class() = default;
/// Explicitly delete the copy constructor. This is to work around a gcc-5 bug
/// with std::is_trivially_move_constructible.
Class(const Class &) = delete;
/// Create a class with a name, and whether it should be declared as a `class`
/// or `struct`.
template <typename NameT>
/// or `struct`. Also, prevent this from being mistaken as a move constructor
/// candidate.
template <typename NameT, typename = typename std::enable_if_t<
!std::is_same<NameT, Class>::value>>
Class(NameT &&name, bool isStruct = false)
: className(stringify(std::forward<NameT>(name))), isStruct(isStruct) {}

View File

@ -251,7 +251,7 @@ void DefGen::emitVerifier() {
void DefGen::emitParserPrinter() {
auto *mnemonic = defCls.addStaticMethod<Method::Constexpr>(
"::llvm::StringLiteral", "getMnemonic");
mnemonic->body().indent() << strfmt("return \"{0}\";", *def.getMnemonic());
mnemonic->body().indent() << strfmt("return {\"{0}\"};", *def.getMnemonic());
// Declare the parser and printer, if needed.
if (!def.needsParserPrinter() && !def.hasGeneratedParser() &&
!def.hasGeneratedPrinter())