aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/vm/AsmBuilder.hpp
blob: 38fa19594f91ce90297a8d267e6af754581c15a6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once

#include "Utility.hpp"
#include <lauf/asm/builder.h>
#include <lauf/asm/module.h>

namespace OpenVic::Vm {
   struct AsmBuilder : utility::MoveOnlyHandleBase<AsmBuilder, lauf_asm_builder> {
      using MoveOnlyHandleBase::MoveOnlyHandleBase;
      using MoveOnlyHandleBase::operator=;

      AsmBuilder(lauf_asm_build_options options) : MoveOnlyHandleBase(lauf_asm_create_builder(options)) {}

      ~AsmBuilder() {
         if (_handle == nullptr) {
            return;
         }
         lauf_asm_destroy_builder(*this);
         _handle = nullptr;
      }
   };
}