61 lines
1.6 KiB
C++
61 lines
1.6 KiB
C++
#ifndef fk_SYMENTRY_HPP
|
|
#define fk_SYMENTRY_HPP
|
|
|
|
#include "commons.hpp"
|
|
#include "Loc.hpp"
|
|
#include "types.hpp"
|
|
|
|
namespace fk
|
|
{
|
|
class Node;
|
|
|
|
class SymEntry
|
|
{
|
|
public:
|
|
explicit SymEntry(std::string const& name,
|
|
addr_t addr,
|
|
bool is_global,
|
|
int scope,
|
|
std::shared_ptr<Node> parent,
|
|
Loc const& loc);
|
|
virtual ~SymEntry();
|
|
|
|
std::string name() const { return m_name; }
|
|
addr_t addr() const { return m_addr; }
|
|
bool is_global() const { return m_is_global; }
|
|
int scope() const { return m_scope; }
|
|
std::shared_ptr<Node> parent() const { return m_parent; }
|
|
std::shared_ptr<Node> node() const { return m_node; }
|
|
Loc loc() const { return m_loc; }
|
|
size_t arity() const { return m_arity; }
|
|
bool is_array() const { return m_is_array; }
|
|
|
|
SymEntry& set_global(bool global) { m_is_global = global; return *this; }
|
|
SymEntry& set_addr(addr_t addr) { m_addr = addr; return *this; }
|
|
SymEntry& set_arity(size_t arity) { m_arity = arity; return *this; }
|
|
SymEntry& set_is_array(bool is_array)
|
|
{ m_is_array = is_array; return *this;}
|
|
|
|
SymEntry& set_parent(std::shared_ptr<Node> parent)
|
|
{ m_parent = parent; return *this; }
|
|
SymEntry& set_node(std::shared_ptr<Node> node)
|
|
{ m_node = node; return *this; }
|
|
|
|
|
|
std::string string() const;
|
|
|
|
private:
|
|
std::string m_name;
|
|
addr_t m_addr;
|
|
bool m_is_global = false;
|
|
int m_scope;
|
|
std::shared_ptr<Node> m_parent;
|
|
std::shared_ptr<Node> m_node;
|
|
Loc m_loc;
|
|
size_t m_arity = 0;
|
|
bool m_is_array = false;
|
|
};
|
|
}
|
|
|
|
#endif
|