From d0ee3316eaf48020fef461442d9761024c3f0549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Fri, 20 Sep 2024 10:52:51 +0300 Subject: [PATCH] Fix the build --- tests/src/tests/tests.instruction.cpp | 28 -------------------------- zasm/include/zasm/base/instruction.hpp | 16 --------------- 2 files changed, 44 deletions(-) diff --git a/tests/src/tests/tests.instruction.cpp b/tests/src/tests/tests.instruction.cpp index 3fcb52d..65a7553 100644 --- a/tests/src/tests/tests.instruction.cpp +++ b/tests/src/tests/tests.instruction.cpp @@ -78,32 +78,4 @@ namespace zasm::tests } } - TEST(InstructionTests, TestVisit) - { - auto ins = zasm::Instruction() // - .setMnemonic(x86::Mnemonic::Mov) // - .addOperand(x86::rax) // - .addOperand(x86::rdx); // - - // Test if the conversion from base to upper works. - auto testVisit = [](InstructionBase& base) { - return base.visit([](auto&& real) { - // - real.setMnemonic(x86::Mnemonic::Sub); - return real.getOperandCount(); - }); - }; - - auto detail = ins.getDetail(MachineMode::AMD64); - detail->addOperand(x86::rdx); - - auto opCount1 = testVisit(ins); - ASSERT_EQ(ins.getMnemonic(), x86::Mnemonic::Sub); - ASSERT_EQ(opCount1, 2); - - auto opCount2 = testVisit(*detail); - ASSERT_EQ(detail->getMnemonic(), x86::Mnemonic::Sub); - ASSERT_EQ(opCount2, 3); - } - } // namespace zasm::tests diff --git a/zasm/include/zasm/base/instruction.hpp b/zasm/include/zasm/base/instruction.hpp index 5d80b8e..b117242 100644 --- a/zasm/include/zasm/base/instruction.hpp +++ b/zasm/include/zasm/base/instruction.hpp @@ -86,22 +86,6 @@ namespace zasm return *this; } - template auto visit(TPred&& fn) const - { - if (_type == Type::Detail) - return fn(static_cast(*this)); - else - return fn(static_cast(*this)); - } - - template auto visit(TPred&& fn) - { - if (_type == Type::Detail) - return fn(static_cast(*this)); - else - return fn(static_cast(*this)); - } - /// /// Casts this object to T. T must be a type that inherits InstructionBase and has kInstrType. /// Casting to the wrong type is UB.