From: Dodji Seketeli Date: Thu, 15 Oct 2015 07:42:54 +0000 (+0200) Subject: Pass some more parameters in reference X-Git-Tag: 1.0.rc0~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=093bc5da06abe2b477693627b57cd49a48969efb;p=platform%2Fupstream%2Flibabigail.git Pass some more parameters in reference Profiling as shown that we might gain some precious cycles by passing some well chosen parameters by reference. * include/abg-ir.h (operator==): For the type_base_sptr and decl_base_sptr overloads, pass the parameters by reference. ({var,function}_decl::{set,get}_symbol): Pass the elf_symbol_ptr by reference. * src/abg-ir.cc (operator==): For the type_base_sptr and decl_base_sptr overloads, pass the parameters by reference, now in the definition. ({var,function}_decl::{set,get}_symbol): Pass the elf_symbol_ptr by reference, now in the definition. Signed-off-by: Dodji Seketeli --- diff --git a/include/abg-ir.h b/include/abg-ir.h index 412536d..8c56709 100644 --- a/include/abg-ir.h +++ b/include/abg-ir.h @@ -1055,10 +1055,10 @@ public: };// end class decl_base bool -operator==(const decl_base_sptr, const decl_base_sptr); +operator==(const decl_base_sptr&, const decl_base_sptr&); bool -operator==(const type_base_sptr, const type_base_sptr); +operator==(const type_base_sptr&, const type_base_sptr&); std::ostream& operator<<(std::ostream&, decl_base::visibility); @@ -1998,9 +1998,9 @@ public: set_binding(binding b); void - set_symbol(elf_symbol_sptr sym); + set_symbol(const elf_symbol_sptr& sym); - elf_symbol_sptr + const elf_symbol_sptr& get_symbol() const; var_decl_sptr @@ -2114,9 +2114,9 @@ public: set_type(function_type_sptr fn_type); void - set_symbol(elf_symbol_sptr sym); + set_symbol(const elf_symbol_sptr& sym); - elf_symbol_sptr + const elf_symbol_sptr& get_symbol() const; bool diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 100bd30..eb41314 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -2461,7 +2461,7 @@ operator<<(std::ostream& o, decl_base::binding b) /// @return true if the decl_base pointed to by the shared_ptrs are /// equal, false otherwise. bool -operator==(const decl_base_sptr l, const decl_base_sptr r) +operator==(const decl_base_sptr& l, const decl_base_sptr& r) { if (l.get() == r.get()) return true; @@ -2483,7 +2483,7 @@ operator==(const decl_base_sptr l, const decl_base_sptr r) /// @return true if the type_base pointed to by the shared_ptrs are /// equal, false otherwise. bool -operator==(const type_base_sptr l, const type_base_sptr r) +operator==(const type_base_sptr& l, const type_base_sptr& r) { if (l.get() == r.get()) return true; @@ -8430,7 +8430,7 @@ var_decl::set_binding(decl_base::binding b) /// /// @param sym the new ELF symbol for this variable decl. void -var_decl::set_symbol(elf_symbol_sptr sym) +var_decl::set_symbol(const elf_symbol_sptr& sym) {priv_->symbol_ = sym;} /// Gets the the underlying ELF symbol for the current variable, @@ -8440,7 +8440,7 @@ var_decl::set_symbol(elf_symbol_sptr sym) /// /// @return sym the underlying ELF symbol for this variable decl, if /// one exists. -elf_symbol_sptr +const elf_symbol_sptr& var_decl::get_symbol() const {return priv_->symbol_;} @@ -9505,7 +9505,7 @@ function_decl::set_type(shared_ptr fn_type) /// /// @param sym the new ELF symbol for this function decl. void -function_decl::set_symbol(elf_symbol_sptr sym) +function_decl::set_symbol(const elf_symbol_sptr& sym) {priv_->symbol_ = sym;} /// Gets the the underlying ELF symbol for the current variable, @@ -9515,7 +9515,7 @@ function_decl::set_symbol(elf_symbol_sptr sym) /// /// @return sym the underlying ELF symbol for this function decl, if /// one exists. -elf_symbol_sptr +const elf_symbol_sptr& function_decl::get_symbol() const {return priv_->symbol_;}