///
/// @return true iff the access specifier changed.
static bool
-access_changed(decl_base_sptr f, decl_base_sptr s)
+access_changed(const decl_base_sptr& f, const decl_base_sptr& s)
{
if (!is_member_decl(f)
|| !is_member_decl(s))
///
/// @return true if the test is positive, false otherwise.
static bool
-function_name_changed_but_not_symbol(const function_decl_sptr f,
- const function_decl_sptr s)
+function_name_changed_but_not_symbol(const function_decl_sptr& f,
+ const function_decl_sptr& s)
{
if (!f || !s)
return false;
///
/// @param s the second version of the non-static data member.
static bool
-non_static_data_member_type_size_changed(decl_base_sptr f, decl_base_sptr s)
+non_static_data_member_type_size_changed(const decl_base_sptr& f,
+ const decl_base_sptr& s)
{
if (!is_member_decl(f)
|| !is_member_decl(s))
///
/// @param s the second version of the static data member.
static bool
-static_data_member_type_size_changed(decl_base_sptr f, decl_base_sptr s)
+static_data_member_type_size_changed(const decl_base_sptr& f,
+ const decl_base_sptr& s)
{
if (!is_member_decl(f)
|| !is_member_decl(s))
///
/// @return true if d1 and d2 are different but compatible.
static bool
-is_compatible_change(decl_base_sptr d1, decl_base_sptr d2)
+is_compatible_change(const decl_base_sptr& d1, const decl_base_sptr& d2)
{
if ((d1 && d2)
&& (d1 != d2)
///
/// @return true if d1 and d2 have different names.
static bool
-decl_name_changed(decl_base_sptr d1, decl_base_sptr d2)
+decl_name_changed(const decl_base_sptr& d1, const decl_base_sptr& d2)
{
string d1_name, d2_name;
///
/// @return true iff decl @p s represents a harmless change over @p f.
bool
-has_harmless_name_change(decl_base_sptr f, decl_base_sptr s)
+has_harmless_name_change(const decl_base_sptr& f, const decl_base_sptr& s)
{
return (decl_name_changed(f, s)
&& ((is_typedef(f) && is_typedef(s))
bool in_pub_sym_tab_;
bool is_anonymous_;
location location_;
- context_rel_sptr context_;
+ context_rel *context_;
interned_string name_;
interned_string qualified_parent_name_;
// This temporary qualified name is the cache used for the qualified
priv()
: in_pub_sym_tab_(false),
is_anonymous_(true),
+ context_(),
visibility_(VISIBILITY_DEFAULT)
{}
interned_string linkage_name, visibility vis)
: in_pub_sym_tab_(false),
location_(locus),
+ context_(),
name_(name),
linkage_name_(linkage_name),
visibility_(vis)
: in_pub_sym_tab_(false),
is_anonymous_(true),
location_(l),
+ context_(),
visibility_(VISIBILITY_DEFAULT)
{}
+
+ ~priv()
+ {
+ delete context_;
+ }
};// end struct decl_base::priv
/// Constructor for the @ref decl_base type.
///@return the context relationship for the current decl_base.
const context_rel*
decl_base::get_context_rel() const
-{return priv_->context_.get();}
+{return priv_->context_;}
///Getter for the context relationship.
///
///@return the context relationship for the current decl_base.
context_rel*
decl_base::get_context_rel()
-{return priv_->context_.get();}
+{return priv_->context_;}
void
-decl_base::set_context_rel(context_rel_sptr c)
+decl_base::set_context_rel(context_rel *c)
{priv_->context_ = c;}
/// Get the hash of a decl. If the hash hasn't been computed yet,
decl_base::set_scope(scope_decl* scope)
{
if (!priv_->context_)
- priv_->context_.reset(new context_rel(scope));
+ priv_->context_ = new context_rel(scope);
else
priv_->context_->set_scope(scope);
}
var_decl::set_scope(scope_decl* scope)
{
if (!get_context_rel())
- {
- context_rel_sptr c(new dm_context_rel(scope));
- set_context_rel(c);
- }
+ set_context_rel(new dm_context_rel(scope));
else
get_context_rel()->set_scope(scope);
}
equals(const var_decl& l, const var_decl& r, change_kind* k)
{
bool result = true;
+
+ // First test types of variables. This should be fast because in
+ // the general case, most types should be canonicalized.
+ if (*l.get_naked_type() != *r.get_naked_type())
+ {
+ result = false;
+ if (k)
+ *k |= SUBTYPE_CHANGE_KIND;
+ else
+ return false;
+ }
+
// If there are underlying elf symbols for these variables,
// compare them. And then compare the other parts.
const elf_symbol_sptr &s0 = l.get_symbol(), &s1 = r.get_symbol();
return false;
}
- if (*l.get_naked_type() != *r.get_naked_type())
- {
- result = false;
- if (k)
- *k |= SUBTYPE_CHANGE_KIND;
- else
- return false;
- }
-
return result;
}
function_decl(name, static_pointer_cast<function_type>(type),
declared_inline, locus, linkage_name, vis, bind)
{
- context_rel_sptr c(new mem_fn_context_rel(0));
- set_context_rel(c);
+ set_context_rel(new mem_fn_context_rel(0));
set_member_function_is_const(*this, type->get_is_const());
}
(dynamic_pointer_cast<method_type>(type)),
declared_inline, locus, linkage_name, vis, bind)
{
- context_rel_sptr c(new mem_fn_context_rel(0));
- set_context_rel(c);
+ set_context_rel(new mem_fn_context_rel(0));
}
/// A constructor for instances of method_decl.
(dynamic_pointer_cast<method_type>(type)),
declared_inline, locus, linkage_name, vis, bind)
{
- context_rel_sptr c(new mem_fn_context_rel(0));
- set_context_rel(c);
+ set_context_rel(new mem_fn_context_rel(0));
}
/// Set the linkage name of the method.
method_decl::set_scope(scope_decl* scope)
{
if (!get_context_rel())
- {
- context_rel_sptr c(new mem_fn_context_rel(scope));
- set_context_rel(c);
- }
+ set_context_rel(new mem_fn_context_rel(scope));
else
get_context_rel()->set_scope(scope);
}