set_scope(scope_decl*);
protected:
- const context_rel_sptr
+ const context_rel*
get_context_rel() const;
- context_rel_sptr
+ context_rel*
get_context_rel();
void
get_member_access_specifier(const decl_base_sptr d);
friend void
- set_member_access_specifier(const decl_base_sptr d,
+ set_member_access_specifier(decl_base& d,
access_specifier a);
friend bool
get_member_is_static(const decl_base_sptr d);
friend void
- set_member_is_static(decl_base_sptr d, bool s);
+ set_member_is_static(const decl_base_sptr& d, bool s);
+
+ friend void
+ set_member_is_static(decl_base& d, bool s);
friend bool
get_member_function_is_virtual(const function_decl& f);
friend void
- set_member_function_is_virtual(const function_decl&, bool);
+ set_member_function_is_virtual(function_decl&, bool);
friend class class_decl;
};// end class decl_base
get_member_access_specifier(const decl_base_sptr);
void
-set_member_access_specifier(decl_base_sptr,
+set_member_access_specifier(decl_base&,
+ access_specifier);
+
+void
+set_member_access_specifier(const decl_base_sptr&,
access_specifier);
+
std::ostream&
operator<<(std::ostream&, access_specifier);
get_member_function_is_ctor(const function_decl&);
friend void
- set_member_function_is_ctor(const function_decl&, bool);
+ set_member_function_is_ctor(function_decl&, bool);
friend bool
get_member_function_is_dtor(const function_decl&);
friend void
- set_member_function_is_dtor(const function_decl&, bool);
+ set_member_function_is_dtor(function_decl&, bool);
friend bool
get_member_function_is_static(const function_decl&);
get_member_function_is_const(const function_decl&);
friend void
- set_member_function_is_const(const function_decl&, bool);
+ set_member_function_is_const(function_decl&, bool);
friend size_t
get_member_function_vtable_offset(const function_decl&);
friend void
- set_member_function_vtable_offset(const function_decl&, size_t);
+ set_member_function_vtable_offset(function_decl&, size_t);
friend bool
get_member_function_is_virtual(const function_decl&);
friend void
- set_member_function_is_virtual(const function_decl&, bool);
+ set_member_function_is_virtual(function_decl&, bool);
virtual ~method_decl();
};// end class class_decl::method_decl
///Getter for the context relationship.
///
///@return the context relationship for the current decl_base.
-const context_rel_sptr
+const context_rel*
decl_base::get_context_rel() const
-{return priv_->context_;}
+{return priv_->context_.get();}
///Getter for the context relationship.
///
///@return the context relationship for the current decl_base.
-context_rel_sptr
+context_rel*
decl_base::get_context_rel()
-{return priv_->context_;}
+{return priv_->context_.get();}
void
decl_base::set_context_rel(context_rel_sptr c)
if (is_member_decl(l) && is_member_decl(r))
{
- context_rel_sptr r1 = l.get_context_rel(), r2 = r.get_context_rel();
+ const context_rel* r1 = l.get_context_rel(), *r2 = r.get_context_rel();
if (*r1 != *r2)
{
result = false;
{
assert(is_member_decl(d));
- context_rel_sptr c = d.get_context_rel();
+ const context_rel* c = d.get_context_rel();
assert(c);
return c->get_access_specifier();
///
/// @param a the new access specifier to set the class member to.
void
-set_member_access_specifier(decl_base_sptr d,
+set_member_access_specifier(decl_base& d,
access_specifier a)
{
assert(is_member_decl(d));
- context_rel_sptr c = d->get_context_rel();
+ context_rel* c = d.get_context_rel();
assert(c);
c->set_access_specifier(a);
}
+/// Sets the access specifier for a class member.
+///
+/// @param d the class member to set the access specifier for. Note
+/// that this must be a class member otherwise the function aborts the
+/// current process.
+///
+/// @param a the new access specifier to set the class member to.
+void
+set_member_access_specifier(const decl_base_sptr& d,
+ access_specifier a)
+{set_member_access_specifier(*d, a);}
+
/// Gets a flag saying if a class member is static or not.
///
/// @param d the declaration for the class member to consider. Note
{
assert(is_member_decl(d));
- context_rel_sptr c = d.get_context_rel();
+ const context_rel* c = d.get_context_rel();
assert(c);
return c->get_is_static();
/// @param s this must be true if the member is to be static, false
/// otherwise.
void
-set_member_is_static(decl_base_sptr d, bool s)
+set_member_is_static(decl_base& d, bool s)
{
assert(is_member_decl(d));
- context_rel_sptr c = d->get_context_rel();
+ context_rel* c = d.get_context_rel();
assert(c);
c->set_is_static(s);
}
+/// Sets the static-ness property of a class member.
+///
+/// @param d the class member to set the static-ness property for.
+/// Note that this must be a class member otherwise the function
+/// aborts the current process.
+///
+/// @param s this must be true if the member is to be static, false
+/// otherwise.
+void
+set_member_is_static(const decl_base_sptr& d, bool s)
+{set_member_is_static(*d, s);}
+
/// Test if a var_decl is a data member.
///
/// @param v the var_decl to consider.
{
assert(is_data_member(m));
- dm_context_rel_sptr ctxt_rel =
- dynamic_pointer_cast<dm_context_rel>(m->get_context_rel());
+ dm_context_rel* ctxt_rel =
+ dynamic_cast<dm_context_rel*>(m->get_context_rel());
assert(ctxt_rel);
ctxt_rel->set_offset_in_bits(o);
get_data_member_offset(const var_decl& m)
{
assert(is_data_member(m));
- dm_context_rel_sptr ctxt_rel =
- dynamic_pointer_cast<dm_context_rel>(m.get_context_rel());
+ const dm_context_rel* ctxt_rel =
+ dynamic_cast<const dm_context_rel*>(m.get_context_rel());
assert(ctxt_rel);
return ctxt_rel->get_offset_in_bits();
}
set_data_member_is_laid_out(var_decl_sptr m, bool l)
{
assert(is_data_member(m));
- dm_context_rel_sptr ctxt_rel =
- dynamic_pointer_cast<dm_context_rel>(m->get_context_rel());
+ dm_context_rel* ctxt_rel =
+ dynamic_cast<dm_context_rel*>(m->get_context_rel());
ctxt_rel->set_is_laid_out(l);
}
get_data_member_is_laid_out(const var_decl& m)
{
assert(is_data_member(m));
- dm_context_rel_sptr ctxt_rel =
- dynamic_pointer_cast<dm_context_rel>(m.get_context_rel());
+ const dm_context_rel* ctxt_rel =
+ dynamic_cast<const dm_context_rel*>(m.get_context_rel());
return ctxt_rel->get_is_laid_out();
}
dynamic_cast<const class_decl::method_decl*>(&f);
assert(m);
- mem_fn_context_rel_sptr ctxt =
- dynamic_pointer_cast<mem_fn_context_rel>(m->get_context_rel());
+ const mem_fn_context_rel* ctxt =
+ dynamic_cast<const mem_fn_context_rel*>(m->get_context_rel());
return ctxt->is_constructor();
}
/// @param f the new boolean value of the is_ctor property. Is true
/// if @p f is a constructor, false otherwise.
void
-set_member_function_is_ctor(const function_decl& f, bool c)
+set_member_function_is_ctor(function_decl& f, bool c)
{
assert(is_member_function(f));
- const class_decl::method_decl* m =
- dynamic_cast<const class_decl::method_decl*>(&f);
+ class_decl::method_decl* m =
+ dynamic_cast<class_decl::method_decl*>(&f);
assert(m);
- mem_fn_context_rel_sptr ctxt =
- dynamic_pointer_cast<mem_fn_context_rel>(m->get_context_rel());
+ mem_fn_context_rel* ctxt =
+ dynamic_cast<mem_fn_context_rel*>(m->get_context_rel());
ctxt->is_constructor(c);
}
dynamic_cast<const class_decl::method_decl*>(&f);
assert(m);
- mem_fn_context_rel_sptr ctxt =
- dynamic_pointer_cast<mem_fn_context_rel>(m->get_context_rel());
+ const mem_fn_context_rel* ctxt =
+ dynamic_cast<const mem_fn_context_rel*>(m->get_context_rel());
return ctxt->is_destructor();
}
///
/// @param d true if @p f is a destructor, false otherwise.
void
-set_member_function_is_dtor(const function_decl& f, bool d)
+set_member_function_is_dtor(function_decl& f, bool d)
{
assert(is_member_function(f));
- const class_decl::method_decl* m =
- dynamic_cast<const class_decl::method_decl*>(&f);
+ class_decl::method_decl* m =
+ dynamic_cast<class_decl::method_decl*>(&f);
assert(m);
- mem_fn_context_rel_sptr ctxt =
- dynamic_pointer_cast<mem_fn_context_rel>(m->get_context_rel());
+ mem_fn_context_rel* ctxt =
+ dynamic_cast<mem_fn_context_rel*>(m->get_context_rel());
ctxt->is_destructor(d);
}
dynamic_cast<const class_decl::method_decl*>(&f);
assert(m);
- mem_fn_context_rel_sptr ctxt =
- dynamic_pointer_cast<mem_fn_context_rel>(m->get_context_rel());
+ const mem_fn_context_rel* ctxt =
+ dynamic_cast<const mem_fn_context_rel*>(m->get_context_rel());
return ctxt->is_const();
}
///
/// @param is_const the new value of the const-ness property of @p f
void
-set_member_function_is_const(const function_decl& f, bool is_const)
+set_member_function_is_const(function_decl& f, bool is_const)
{
assert(is_member_function(f));
- const class_decl::method_decl* m =
- dynamic_cast<const class_decl::method_decl*>(&f);
+ class_decl::method_decl* m =
+ dynamic_cast<class_decl::method_decl*>(&f);
assert(m);
- mem_fn_context_rel_sptr ctxt =
- dynamic_pointer_cast<mem_fn_context_rel>(m->get_context_rel());
+ mem_fn_context_rel* ctxt =
+ dynamic_cast<mem_fn_context_rel*>(m->get_context_rel());
ctxt->is_const(is_const);
}
dynamic_cast<const class_decl::method_decl*>(&f);
assert(m);
- mem_fn_context_rel_sptr ctxt =
- dynamic_pointer_cast<mem_fn_context_rel>(m->get_context_rel());
+ const mem_fn_context_rel* ctxt =
+ dynamic_cast<const mem_fn_context_rel*>(m->get_context_rel());
return ctxt->vtable_offset();
}
///
/// @param s the new vtable offset.
void
-set_member_function_vtable_offset(const function_decl& f, size_t s)
+set_member_function_vtable_offset(function_decl& f, size_t s)
{
assert(is_member_function(f));
- const class_decl::method_decl* m =
- dynamic_cast<const class_decl::method_decl*>(&f);
+ class_decl::method_decl* m =
+ dynamic_cast<class_decl::method_decl*>(&f);
assert(m);
- mem_fn_context_rel_sptr ctxt =
- dynamic_pointer_cast<mem_fn_context_rel>(m->get_context_rel());
+ mem_fn_context_rel* ctxt =
+ dynamic_cast<mem_fn_context_rel*>(m->get_context_rel());
ctxt->vtable_offset(s);
}
dynamic_cast<const class_decl::method_decl*>(&f);
assert(m);
- mem_fn_context_rel_sptr ctxt =
- dynamic_pointer_cast<mem_fn_context_rel>(m->get_context_rel());
+ const mem_fn_context_rel* ctxt =
+ dynamic_cast<const mem_fn_context_rel*>(m->get_context_rel());
return ctxt->is_virtual();
}
///
/// @param is_virtual set to true if the function is virtual.
void
-set_member_function_is_virtual(const function_decl& f, bool is_virtual)
+set_member_function_is_virtual(function_decl& f, bool is_virtual)
{
assert(is_member_function(f));
- const class_decl::method_decl* m =
- dynamic_cast<const class_decl::method_decl*>(&f);
+ class_decl::method_decl* m =
+ dynamic_cast<class_decl::method_decl*>(&f);
assert(m);
- mem_fn_context_rel_sptr ctxt =
- dynamic_pointer_cast<mem_fn_context_rel>(m->get_context_rel());
+ mem_fn_context_rel* ctxt =
+ dynamic_cast<mem_fn_context_rel*>(m->get_context_rel());
ctxt->is_virtual(is_virtual);
}
return false;
}
- dm_context_rel_sptr c0 =
- dynamic_pointer_cast<dm_context_rel>(l.get_context_rel());
- dm_context_rel_sptr c1 =
- dynamic_pointer_cast<dm_context_rel>(r.get_context_rel());
+ const dm_context_rel* c0 =
+ dynamic_cast<const dm_context_rel*>(l.get_context_rel());
+ const dm_context_rel* c1 =
+ dynamic_cast<const dm_context_rel*>(r.get_context_rel());
assert(c0 && c1);
if (*c0 != *c1)