[Mlir-commits] [mlir] 7fa57cd - [MLIR] Add move constructor to BytecodeWriterConfig (#126130)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Feb 6 21:30:59 PST 2025


Author: Karim Nosseir
Date: 2025-02-06T21:30:55-08:00
New Revision: 7fa57cd430f5811beed8cfc862768238fc5d06bb

URL: https://github.com/llvm/llvm-project/commit/7fa57cd430f5811beed8cfc862768238fc5d06bb
DIFF: https://github.com/llvm/llvm-project/commit/7fa57cd430f5811beed8cfc862768238fc5d06bb.diff

LOG: [MLIR] Add move constructor to BytecodeWriterConfig (#126130)

The config is currently not movable and because there are constructors
the default move won't be generated, which prevents it from being moved.
Also, it is not copyable because of the unique_ptr. This PR adds move
constructor to allow moving it.

Added: 
    

Modified: 
    mlir/include/mlir/Bytecode/BytecodeWriter.h
    mlir/lib/Bytecode/Writer/BytecodeWriter.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Bytecode/BytecodeWriter.h b/mlir/include/mlir/Bytecode/BytecodeWriter.h
index 0287e004bb99367..c6cff0bc813143e 100644
--- a/mlir/include/mlir/Bytecode/BytecodeWriter.h
+++ b/mlir/include/mlir/Bytecode/BytecodeWriter.h
@@ -82,6 +82,7 @@ class BytecodeWriterConfig {
   /// printers for the fallback resources within the map.
   BytecodeWriterConfig(FallbackAsmResourceMap &map,
                        StringRef producer = "MLIR" LLVM_VERSION_STRING);
+  BytecodeWriterConfig(BytecodeWriterConfig &&);
   ~BytecodeWriterConfig();
 
   /// An internal implementation class that contains the state of the

diff  --git a/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp b/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
index 0e96aa97abeba6f..2b4697434717d2c 100644
--- a/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
+++ b/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
@@ -66,6 +66,9 @@ BytecodeWriterConfig::BytecodeWriterConfig(FallbackAsmResourceMap &map,
     : BytecodeWriterConfig(producer) {
   attachFallbackResourcePrinter(map);
 }
+BytecodeWriterConfig::BytecodeWriterConfig(BytecodeWriterConfig &&config)
+    : impl(std::move(config.impl)) {}
+
 BytecodeWriterConfig::~BytecodeWriterConfig() = default;
 
 ArrayRef<std::unique_ptr<AttrTypeBytecodeWriter<Attribute>>>


        


More information about the Mlir-commits mailing list