This repository has been archived on 2024-03-07. You can view files and clone it, but cannot push or open issues/pull-requests.
wongola/lib/Mod.hpp

35 lines
715 B
C++
Raw Normal View History

2023-09-29 16:26:05 +00:00
#ifndef wg_MOD_HPP
#define wg_MOD_HPP
#include <llvm/IR/LLVMContext.h>
#include <llvm/IR/Module.h>
#include "SymTable.hpp"
#include "commons.hpp"
namespace wg
{
class Mod
{
public:
explicit Mod(std::string const& name);
virtual ~Mod();
llvm::LLVMContext& context() { return *m_context; }
llvm::Module& mod() { return *m_module; }
SymTable& sym() { return *m_sym; }
private:
std::string m_name;
std::unique_ptr<llvm::LLVMContext> m_context =
std::make_unique<llvm::LLVMContext>();
std::unique_ptr<llvm::Module> m_module =
std::make_unique<llvm::Module>(m_name, *m_context);
std::unique_ptr<SymTable> m_sym = std::make_unique<SymTable>();
};
}
#endif