[Mlir-commits] [mlir] ecaad4a - [mlir][ods][nfc] fix gcc-5 build
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Dec 1 10:35:26 PST 2021
Author: Mogball
Date: 2021-12-01T18:34:59Z
New Revision: ecaad4a87611c0c6e0d6e448906d15b6fec06dc9
URL: https://github.com/llvm/llvm-project/commit/ecaad4a87611c0c6e0d6e448906d15b6fec06dc9
DIFF: https://github.com/llvm/llvm-project/commit/ecaad4a87611c0c6e0d6e448906d15b6fec06dc9.diff
LOG: [mlir][ods][nfc] fix gcc-5 build
Added:
Modified:
mlir/include/mlir/TableGen/Class.h
mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/TableGen/Class.h b/mlir/include/mlir/TableGen/Class.h
index ea56158fe3319..11fa261faccf0 100644
--- a/mlir/include/mlir/TableGen/Class.h
+++ b/mlir/include/mlir/TableGen/Class.h
@@ -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) {}
diff --git a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
index 8402877d9cb24..372b6690eeaea 100644
--- a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
+++ b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
@@ -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())
More information about the Mlir-commits
mailing list