Remove the 'm_kind' member from the IR

* src/abg-ir.{h,cc}: Remove use of the m_kind field.  We are using
	full blown rtti so this uselessly just clutter the code.
This commit is contained in:
Dodji Seketeli 2013-03-26 13:06:47 +01:00
parent 90930a5716
commit bde5ab9c40
2 changed files with 7 additions and 93 deletions

View File

@ -136,47 +136,28 @@ location_manager::expand_location(const location location,
// <Decl definition>
decl_base::decl_base()
: m_kind(KIND_DECL)
{
}
decl_base::decl_base(const std::string& name,
location locus)
:m_kind(KIND_DECL),
m_location(locus),
m_name(name)
{
}
decl_base::decl_base(kind what_kind,
const std::string& name,
location locus)
: m_kind(what_kind),
m_location(locus),
: m_location(locus),
m_name(name)
{
}
decl_base::decl_base(location l)
:m_kind(KIND_DECL),
m_location(l)
: m_location(l)
{
}
decl_base::decl_base(const decl_base& d)
{
m_kind = d.m_kind;
m_location = d.m_location;
m_name = d.m_name;
m_context = d.m_context;
}
enum decl_base::kind
decl_base::what_kind () const
{
return m_kind;
}
decl_base::~decl_base()
{
}
@ -192,19 +173,13 @@ decl_base::set_scope(shared_ptr<scope_decl> scope)
// <scope_decl definitions>
scope_decl::scope_decl(const std::string& name,
location locus)
: decl_base(KIND_SCOPE_DECL, name, locus)
: decl_base(name, locus)
{
}
scope_decl::scope_decl(kind akind,
const std::string& name,
location locus)
: decl_base(akind, name, locus)
{
}
scope_decl::scope_decl(location l)
: decl_base(KIND_SCOPE_DECL, "", l)
: decl_base("", l)
{
}
@ -289,21 +264,11 @@ type_decl::type_decl(const std::string& name,
size_t size_in_bits,
size_t alignment_in_bits,
location locus)
: decl_base(KIND_TYPE_DECL, name, locus),
: decl_base(name, locus),
type_base(size_in_bits, alignment_in_bits)
{
}
type_decl::type_decl(kind akind,
const std::string& name,
size_t size_in_bits,
size_t alignment_in_bits,
location locus)
: decl_base(akind, name, locus),
type_base(size_in_bits, alignment_in_bits)
{
}
type_decl::~type_decl()
{
}
@ -316,21 +281,11 @@ scope_type_decl::scope_type_decl(const std::string& name,
size_t size_in_bits,
size_t alignment_in_bits,
location locus)
:scope_decl(KIND_SCOPE_TYPE_DECL, name, locus),
:scope_decl(name, locus),
type_base(size_in_bits, alignment_in_bits)
{
}
scope_type_decl::scope_type_decl(kind akind,
const std::string& name,
size_t size_in_bits,
size_t alignment_in_bits,
location locus)
: scope_decl(akind, name, locus),
type_base(size_in_bits, alignment_in_bits)
{
}
scope_type_decl::~scope_type_decl()
{
}
@ -340,7 +295,7 @@ scope_type_decl::~scope_type_decl()
// <namespace_decl>
namespace_decl::namespace_decl(const std::string& name,
location locus)
: scope_decl(KIND_NAMESPACE_DECL, name, locus)
: scope_decl(name, locus)
{
}

View File

@ -95,26 +95,6 @@ class decl_base
void
set_scope(shared_ptr<scope_decl>);
public:
enum kind
{
KIND_DECL,
KIND_SCOPE_DECL,
KIND_TYPE_DECL,
KIND_SCOPE_TYPE_DECL,
KIND_NAMESPACE_DECL
};
enum kind
what_kind () const;
protected:
decl_base(kind what_kind,
const std::string& name,
location locus);
public:
decl_base(const std::string& name,
@ -157,7 +137,6 @@ public:
add_decl_to_scope(shared_ptr<decl_base>,
shared_ptr<scope_decl>);
private:
kind m_kind;
location m_location;
std::string m_name;
shared_ptr<scope_decl> m_context;
@ -171,11 +150,6 @@ class scope_decl : public decl_base
void
add_member_decl(const shared_ptr<decl_base>);
protected:
scope_decl(kind akind,
const std::string& name,
location locus);
public:
scope_decl(const std::string& name,
location locus);
@ -249,14 +223,6 @@ class type_decl : public decl_base, public type_base
// Forbidden.
type_decl();
protected:
type_decl(kind akind,
const std::string& name,
size_t size_in_bits,
size_t alignment_in_bits,
location locus);
public:
type_decl(const std::string& name,
@ -290,13 +256,6 @@ class scope_type_decl : public scope_decl, public type_base
{
scope_type_decl();
protected:
scope_type_decl(kind akind,
const std::string& name,
size_t size_in_bits,
size_t alignment_in_bits,
location locus);
public:
scope_type_decl(const std::string& name,