summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2019-10-05 08:43:44 -0400
committerGravatar Lioncash2019-10-05 09:14:26 -0400
commit3a20d9734fa8996434895bc3d27e4b255ae98bea (patch)
tree44d6844d3eca0c1abe195ae8adfe1d02cd40b123 /src
parentvideo_core/{ast, expr}: Organize forward declaration (diff)
downloadyuzu-3a20d9734fa8996434895bc3d27e4b255ae98bea.tar.gz
yuzu-3a20d9734fa8996434895bc3d27e4b255ae98bea.tar.xz
yuzu-3a20d9734fa8996434895bc3d27e4b255ae98bea.zip
video_core/ast: Default the move constructor and assignment operator
This is behaviorally equivalent and also fixes a bug where some members weren't being moved over.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/shader/ast.cpp24
-rw-r--r--src/video_core/shader/ast.h4
2 files changed, 2 insertions, 26 deletions
diff --git a/src/video_core/shader/ast.cpp b/src/video_core/shader/ast.cpp
index 986e4cd64..2627c563c 100644
--- a/src/video_core/shader/ast.cpp
+++ b/src/video_core/shader/ast.cpp
@@ -374,30 +374,6 @@ void ASTManager::Init() {
374 false_condition = MakeExpr<ExprBoolean>(false); 374 false_condition = MakeExpr<ExprBoolean>(false);
375} 375}
376 376
377ASTManager::ASTManager(ASTManager&& other) noexcept
378 : labels_map(std::move(other.labels_map)), labels_count{other.labels_count},
379 gotos(std::move(other.gotos)), labels(std::move(other.labels)), variables{other.variables},
380 program{other.program}, main_node{other.main_node}, false_condition{other.false_condition},
381 disable_else_derivation{other.disable_else_derivation} {
382 other.main_node.reset();
383}
384
385ASTManager& ASTManager::operator=(ASTManager&& other) noexcept {
386 full_decompile = other.full_decompile;
387 labels_map = std::move(other.labels_map);
388 labels_count = other.labels_count;
389 gotos = std::move(other.gotos);
390 labels = std::move(other.labels);
391 variables = other.variables;
392 program = other.program;
393 main_node = other.main_node;
394 false_condition = other.false_condition;
395 disable_else_derivation = other.disable_else_derivation;
396
397 other.main_node.reset();
398 return *this;
399}
400
401void ASTManager::DeclareLabel(u32 address) { 377void ASTManager::DeclareLabel(u32 address) {
402 const auto pair = labels_map.emplace(address, labels_count); 378 const auto pair = labels_map.emplace(address, labels_count);
403 if (pair.second) { 379 if (pair.second) {
diff --git a/src/video_core/shader/ast.h b/src/video_core/shader/ast.h
index 6d2dc0895..d280ed143 100644
--- a/src/video_core/shader/ast.h
+++ b/src/video_core/shader/ast.h
@@ -313,8 +313,8 @@ public:
313 ASTManager(const ASTManager& o) = delete; 313 ASTManager(const ASTManager& o) = delete;
314 ASTManager& operator=(const ASTManager& other) = delete; 314 ASTManager& operator=(const ASTManager& other) = delete;
315 315
316 ASTManager(ASTManager&& other) noexcept; 316 ASTManager(ASTManager&& other) noexcept = default;
317 ASTManager& operator=(ASTManager&& other) noexcept; 317 ASTManager& operator=(ASTManager&& other) noexcept = default;
318 318
319 void Init(); 319 void Init();
320 320