Pass a bunch of smart pointers by reference

Some smart pointers handling got high on performance profiles.  I am
passing those by reference here.

	* include/abg-fwd.h (get_member_is_static, is_member_function)
	(get_member_function_is_ctor, set_member_function_is_ctor)
	(get_member_function_is_dtor, set_member_function_is_dtor)
	(get_member_function_is_const, set_member_function_is_const)
	(get_member_function_vtable_offset)
	(set_member_function_vtable_offset)
	(get_member_function_is_virtual): Declare the smart pointer
	parameter of these as being passed by reference.
	* include/abg-ir.h (get_member_access_specifier)
	(get_member_is_static, get_member_access_specifier)
	(set_member_function_is_ctor, set_member_function_is_const)
	(set_member_function_vtable_offset): Likewise, for these friend
	declarations to the decl_base type.
	* src/abg-ir.cc (get_member_access_specifier)
	(get_member_is_static, is_member_function)
	(get_member_function_is_ctor, set_member_function_is_ctor)
	(get_member_function_is_dtor, set_member_function_is_dtor)
	(get_member_function_is_const, set_member_function_is_const)
	(get_member_function_vtable_offset)
	(set_member_function_vtable_offset)
	(get_member_function_is_virtual): In these definitions, the smart
	pointer parameter is passed by reference.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2015-03-10 18:41:44 +01:00
parent ffeb36eeda
commit 915042e207
3 changed files with 38 additions and 26 deletions

View File

@ -292,7 +292,7 @@ bool
get_member_is_static(const decl_base*);
bool
get_member_is_static(const shared_ptr<decl_base>);
get_member_is_static(const shared_ptr<decl_base>&);
void
set_member_is_static(decl_base&, bool);
@ -343,63 +343,63 @@ bool
is_member_function(const function_decl*);
bool
is_member_function(const shared_ptr<function_decl>);
is_member_function(const shared_ptr<function_decl>&);
bool
get_member_function_is_ctor(const function_decl&);
bool
get_member_function_is_ctor(const shared_ptr<function_decl>);
get_member_function_is_ctor(const shared_ptr<function_decl>&);
void
set_member_function_is_ctor(const function_decl&, bool);
void
set_member_function_is_ctor(const shared_ptr<function_decl>, bool);
set_member_function_is_ctor(const shared_ptr<function_decl>&, bool);
bool
get_member_function_is_dtor(const function_decl&);
bool
get_member_function_is_dtor(const shared_ptr<function_decl>);
get_member_function_is_dtor(const shared_ptr<function_decl>&);
void
set_member_function_is_dtor(function_decl&, bool);
void
set_member_function_is_dtor(const shared_ptr<function_decl>, bool);
set_member_function_is_dtor(const shared_ptr<function_decl>&, bool);
bool
get_member_function_is_const(const function_decl&);
bool
get_member_function_is_const(const shared_ptr<function_decl>);
get_member_function_is_const(const shared_ptr<function_decl>&);
void
set_member_function_is_const(function_decl&, bool);
void
set_member_function_is_const(const shared_ptr<function_decl>, bool);
set_member_function_is_const(const shared_ptr<function_decl>&, bool);
size_t
get_member_function_vtable_offset(const function_decl&);
size_t
get_member_function_vtable_offset(const shared_ptr<function_decl>);
get_member_function_vtable_offset(const shared_ptr<function_decl>&);
void
set_member_function_vtable_offset(const function_decl& f,
size_t s);
void
set_member_function_vtable_offset(const shared_ptr<function_decl> f,
set_member_function_vtable_offset(const shared_ptr<function_decl> &f,
size_t s);
bool
get_member_function_is_virtual(const function_decl&);
bool
get_member_function_is_virtual(const shared_ptr<function_decl>);
get_member_function_is_virtual(const shared_ptr<function_decl>&);
bool
get_member_function_is_virtual(const function_decl*);

View File

@ -767,7 +767,7 @@ public:
get_member_access_specifier(const decl_base& d);
friend enum access_specifier
get_member_access_specifier(const decl_base_sptr d);
get_member_access_specifier(const decl_base_sptr& d);
friend void
set_member_access_specifier(decl_base& d,
@ -777,7 +777,7 @@ public:
get_member_is_static(const decl_base& d);
friend bool
get_member_is_static(const decl_base_sptr d);
get_member_is_static(const decl_base_sptr& d);
friend void
set_member_is_static(const decl_base_sptr& d, bool s);
@ -2644,7 +2644,7 @@ enum access_specifier
get_member_access_specifier(const decl_base&);
enum access_specifier
get_member_access_specifier(const decl_base_sptr);
get_member_access_specifier(const decl_base_sptr&);
void
set_member_access_specifier(decl_base&,
@ -2951,12 +2951,18 @@ public:
friend void
set_member_function_is_ctor(function_decl&, bool);
friend void
set_member_function_is_ctor(const function_decl_sptr&, bool);
friend bool
get_member_function_is_dtor(const function_decl&);
friend void
set_member_function_is_dtor(function_decl&, bool);
friend void
set_member_function_is_dtor(const function_decl_sptr&, bool);
friend bool
get_member_function_is_static(const function_decl&);
@ -2969,12 +2975,18 @@ public:
friend void
set_member_function_is_const(function_decl&, bool);
friend void
set_member_function_is_const(const function_decl_sptr&, bool);
friend size_t
get_member_function_vtable_offset(const function_decl&);
friend void
set_member_function_vtable_offset(function_decl&, size_t);
friend void
set_member_function_vtable_offset(const function_decl_sptr&, size_t);
friend bool
get_member_function_is_virtual(const function_decl&);

View File

@ -1737,7 +1737,7 @@ get_member_access_specifier(const decl_base& d)
///
/// @return the access specifier for the class member @p d.
access_specifier
get_member_access_specifier(const decl_base_sptr d)
get_member_access_specifier(const decl_base_sptr& d)
{return get_member_access_specifier(*d);}
/// Sets the access specifier for a class member.
@ -1808,7 +1808,7 @@ get_member_is_static(const decl_base* d)
///
/// @return true if the class member @p d is static, false otherwise.
bool
get_member_is_static(const decl_base_sptr d)
get_member_is_static(const decl_base_sptr& d)
{return get_member_is_static(*d);}
/// Sets the static-ness property of a class member.
@ -1998,7 +1998,7 @@ is_member_function(const function_decl* f)
///
/// @return true if @p f is a member function, false otherwise.
bool
is_member_function(const function_decl_sptr f)
is_member_function(const function_decl_sptr& f)
{return is_member_function(*f);}
/// Test whether a member function is a constructor.
@ -2027,7 +2027,7 @@ get_member_function_is_ctor(const function_decl& f)
///
/// @return true if @p f is a constructor, false otherwise.
bool
get_member_function_is_ctor(const function_decl_sptr f)
get_member_function_is_ctor(const function_decl_sptr& f)
{return get_member_function_is_ctor(*f);}
@ -2059,7 +2059,7 @@ set_member_function_is_ctor(function_decl& f, bool c)
/// @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_sptr f, bool c)
set_member_function_is_ctor(const function_decl_sptr& f, bool c)
{set_member_function_is_ctor(*f, c);}
/// Test whether a member function is a destructor.
@ -2088,7 +2088,7 @@ get_member_function_is_dtor(const function_decl& f)
///
/// @return true if @p f is a destructor, false otherwise.
bool
get_member_function_is_dtor(const function_decl_sptr f)
get_member_function_is_dtor(const function_decl_sptr& f)
{return get_member_function_is_dtor(*f);}
/// Set the destructor-ness property of a member function.
@ -2117,7 +2117,7 @@ set_member_function_is_dtor(function_decl& f, bool d)
///
/// @param d true if @p f is a destructor, false otherwise.
void
set_member_function_is_dtor(const function_decl_sptr f, bool d)
set_member_function_is_dtor(const function_decl_sptr& f, bool d)
{set_member_function_is_dtor(*f, d);}
/// Test whether a member function is const.
@ -2146,7 +2146,7 @@ get_member_function_is_const(const function_decl& f)
///
/// @return true if @p f is const, false otherwise.
bool
get_member_function_is_const(const function_decl_sptr f)
get_member_function_is_const(const function_decl_sptr& f)
{return get_member_function_is_const(*f);}
/// set the const-ness property of a member function.
@ -2175,7 +2175,7 @@ set_member_function_is_const(function_decl& f, bool 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_sptr f, bool is_const)
set_member_function_is_const(const function_decl_sptr& f, bool is_const)
{set_member_function_is_const(*f, is_const);}
/// Get the vtable offset of a member function.
@ -2204,7 +2204,7 @@ get_member_function_vtable_offset(const function_decl& f)
///
/// @return the vtable offset of @p f.
size_t
get_member_function_vtable_offset(const function_decl_sptr f)
get_member_function_vtable_offset(const function_decl_sptr& f)
{return get_member_function_vtable_offset(*f);}
/// Set the vtable offset of a member function.
@ -2232,7 +2232,7 @@ set_member_function_vtable_offset(function_decl& f, size_t s)
///
/// @param s the new vtable offset.
void
set_member_function_vtable_offset(const function_decl_sptr f, size_t s)
set_member_function_vtable_offset(const function_decl_sptr& f, size_t s)
{return set_member_function_vtable_offset(*f, s);}
/// Test if a given member function is virtual.
@ -2261,7 +2261,7 @@ get_member_function_is_virtual(const function_decl& f)
///
/// @return true iff a @p mem_fn is virtual.
bool
get_member_function_is_virtual(const function_decl_sptr mem_fn)
get_member_function_is_virtual(const function_decl_sptr& mem_fn)
{return mem_fn ? get_member_function_is_virtual(*mem_fn) : false;}
/// Test if a given member function is virtual.