-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[MLIR] Add move constructor to BytecodeWriterConfig #126130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MLIR] Add move constructor to BytecodeWriterConfig #126130
Conversation
@llvm/pr-subscribers-mlir @llvm/pr-subscribers-mlir-core Author: Karim Nosseir (karimnosseir) ChangesFull diff: https://github.com/llvm/llvm-project/pull/126130.diff 2 Files Affected:
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..8af98dd137568dc 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 &&config)
+ : impl(std::move(config.impl)) {}
+
BytecodeWriterConfig::~BytecodeWriterConfig() = default;
ArrayRef<std::unique_ptr<AttrTypeBytecodeWriter<Attribute>>>
|
Can you some context to the description? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change LGTM.
Done. |
a433db0
to
0ceea68
Compare
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.
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.