35 lines
715 B
C++
35 lines
715 B
C++
|
#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
|