mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-24 18:52:15 +00:00
Rename decl_base::get_mangled_name into decl_base::get_linkage_name
* include/abg-ir.h (decl_base::get_linkage_name): Renamed
decl_base::get_mangled_name into this.
* src/abg-comparison.cc
(class_diff::ensure_lookup_tables_populated)
(function_decl_diff::report, type_decl_diff::report)
(corpus_diff::priv::ensure_lookup_tables_populated)
(corpus_diff::report, compute_diff): Adjust.
* src/abg-corpus.cc ({var_comp, func_comp}::operator()): Likewise.
(corpus::priv::build_symbol_table): Likewise.
* src/abg-dwarf-reader.cc (die_linkage_name): Renamed
die_mangled_name into this.
(die_loc_and_name, build_translation_unit_and_add_to_ir)
(build_namespace_decl_and_add_to_ir, build_type_decl)
(build_enum_type, build_class_type_and_add_to_ir)
(build_typedef_type, build_var_decl, build_function_decl, ): Adjust.
* src/abg-hash.cc (decl_base:#️⃣:operator()): Likewise.
* src/abg-ir.cc (decl_base::priv::linkage_name_): Renamed
decl_base::priv::mangled_name_ into this.
(decl_base::priv::priv, decl_base::{decl_base, operator==})
(get_linkage_name, typedef_decl::typedef_decl, var_decl::var_decl)
(function_decl::function_decl, class_decl::base_spec::base_spec)
(class_decl::method_decl::method_decl): Adjust.
(decl_base::{g,s}et_linkage_name): Renamed
decl_base::{g,s}et_mangled_name into this.
* src/abg-writer.cc (write_decl, write_typedef_decl)
(write_var_decl, write_function_decl, dump): Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
46f81cc6e0
commit
bdf9e956d8
@ -383,10 +383,10 @@ public:
|
||||
set_name(const string& n);
|
||||
|
||||
const string&
|
||||
get_mangled_name() const;
|
||||
get_linkage_name() const;
|
||||
|
||||
void
|
||||
set_mangled_name(const std::string& m);
|
||||
set_linkage_name(const std::string& m);
|
||||
|
||||
scope_decl*
|
||||
get_scope() const;
|
||||
|
@ -2768,7 +2768,7 @@ class_diff::ensure_lookup_tables_populated(void) const
|
||||
unsigned i = it->index();
|
||||
class_decl::method_decl_sptr mem_fn =
|
||||
first_class_decl()->get_virtual_mem_fns()[i];
|
||||
string name = mem_fn->get_mangled_name();
|
||||
string name = mem_fn->get_linkage_name();
|
||||
if (name.empty())
|
||||
name = mem_fn->get_pretty_representation();
|
||||
assert(!name.empty());
|
||||
@ -2791,7 +2791,7 @@ class_diff::ensure_lookup_tables_populated(void) const
|
||||
|
||||
class_decl::method_decl_sptr mem_fn =
|
||||
second_class_decl()->get_virtual_mem_fns()[i];
|
||||
string name = mem_fn->get_mangled_name();
|
||||
string name = mem_fn->get_linkage_name();
|
||||
if (name.empty())
|
||||
name = mem_fn->get_pretty_representation();
|
||||
assert(!name.empty());
|
||||
@ -2801,7 +2801,7 @@ class_diff::ensure_lookup_tables_populated(void) const
|
||||
string_member_function_sptr_map::const_iterator j =
|
||||
priv_->deleted_member_functions_.find(name);
|
||||
if (j == priv_->deleted_member_functions_.end()
|
||||
&& name == mem_fn->get_mangled_name())
|
||||
&& name == mem_fn->get_linkage_name())
|
||||
{
|
||||
// So we didn't find a function with the same mangled
|
||||
// named that got previously deleted. Keep in mind
|
||||
@ -4968,8 +4968,8 @@ function_decl_diff::report(ostream& out, const string& indent) const
|
||||
|
||||
string qn1 = first_function_decl()->get_qualified_name(),
|
||||
qn2 = second_function_decl()->get_qualified_name(),
|
||||
mn1 = first_function_decl()->get_mangled_name(),
|
||||
mn2 = second_function_decl()->get_mangled_name();
|
||||
mn1 = first_function_decl()->get_linkage_name(),
|
||||
mn2 = second_function_decl()->get_linkage_name();
|
||||
|
||||
if (qn1 != qn2 && mn1 != mn2)
|
||||
{
|
||||
@ -5229,14 +5229,14 @@ type_decl_diff::report(ostream& out, const string& indent) const
|
||||
n = true;
|
||||
}
|
||||
|
||||
if (f->get_mangled_name() != s->get_mangled_name())
|
||||
if (f->get_linkage_name() != s->get_linkage_name())
|
||||
{
|
||||
if (n)
|
||||
out << "\n";
|
||||
out << indent
|
||||
<< "mangled name changed from '"
|
||||
<< f->get_mangled_name() << "' to "
|
||||
<< s->get_mangled_name();
|
||||
<< f->get_linkage_name() << "' to "
|
||||
<< s->get_linkage_name();
|
||||
n = true;
|
||||
}
|
||||
|
||||
@ -5699,7 +5699,7 @@ corpus_diff::priv::ensure_lookup_tables_populated()
|
||||
assert(i < first_->get_functions().size());
|
||||
|
||||
function_decl* deleted_fn = first_->get_functions()[i];
|
||||
string n = deleted_fn->get_mangled_name();
|
||||
string n = deleted_fn->get_linkage_name();
|
||||
if (n.empty())
|
||||
n = deleted_fn->get_pretty_representation();
|
||||
assert(!n.empty());
|
||||
@ -5718,7 +5718,7 @@ corpus_diff::priv::ensure_lookup_tables_populated()
|
||||
{
|
||||
unsigned i = *iit;
|
||||
function_decl* added_fn = second_->get_functions()[i];
|
||||
string n = added_fn->get_mangled_name();
|
||||
string n = added_fn->get_linkage_name();
|
||||
if (n.empty())
|
||||
n = added_fn->get_pretty_representation();
|
||||
assert(!n.empty());
|
||||
@ -5734,7 +5734,7 @@ corpus_diff::priv::ensure_lookup_tables_populated()
|
||||
// TODO: also query the underlying elf file's .dynsym
|
||||
// symbol table to see if the symbol is present in the
|
||||
// first diff subject before for real.
|
||||
if (!added_fn->get_mangled_name().empty())
|
||||
if (!added_fn->get_linkage_name().empty())
|
||||
j = deleted_fns_.find(added_fn->get_pretty_representation());
|
||||
}
|
||||
if (j != deleted_fns_.end())
|
||||
@ -5761,7 +5761,7 @@ corpus_diff::priv::ensure_lookup_tables_populated()
|
||||
assert(i < first_->get_variables().size());
|
||||
|
||||
var_decl* deleted_var = first_->get_variables()[i];
|
||||
string n = deleted_var->get_mangled_name();
|
||||
string n = deleted_var->get_linkage_name();
|
||||
if (n.empty())
|
||||
n = deleted_var->get_pretty_representation();
|
||||
assert(!n.empty());
|
||||
@ -5780,7 +5780,7 @@ corpus_diff::priv::ensure_lookup_tables_populated()
|
||||
{
|
||||
unsigned i = *iit;
|
||||
var_decl* added_var = second_->get_variables()[i];
|
||||
string n = added_var->get_mangled_name();
|
||||
string n = added_var->get_linkage_name();
|
||||
if (n.empty())
|
||||
n = added_var->get_name();
|
||||
assert(!n.empty());
|
||||
@ -6107,8 +6107,8 @@ corpus_diff::report(ostream& out, const string& indent) const
|
||||
i != priv_->deleted_vars_.end();
|
||||
++i)
|
||||
{
|
||||
if (!i->second->get_mangled_name().empty())
|
||||
n = demangle_cplus_mangled_name(i->second->get_mangled_name());
|
||||
if (!i->second->get_linkage_name().empty())
|
||||
n = demangle_cplus_mangled_name(i->second->get_linkage_name());
|
||||
else
|
||||
n = i->second->get_pretty_representation();
|
||||
out << indent
|
||||
@ -6144,13 +6144,13 @@ corpus_diff::report(ostream& out, const string& indent) const
|
||||
if (!diff || !diff->to_be_reported())
|
||||
continue;
|
||||
|
||||
if (!f->get_mangled_name().empty())
|
||||
n1 = demangle_cplus_mangled_name(f->get_mangled_name());
|
||||
if (!f->get_linkage_name().empty())
|
||||
n1 = demangle_cplus_mangled_name(f->get_linkage_name());
|
||||
else
|
||||
n1 = f->get_pretty_representation();
|
||||
|
||||
if (!s->get_mangled_name().empty())
|
||||
n2 = demangle_cplus_mangled_name(s->get_mangled_name());
|
||||
if (!s->get_linkage_name().empty())
|
||||
n2 = demangle_cplus_mangled_name(s->get_linkage_name());
|
||||
else
|
||||
n2 = s->get_pretty_representation();
|
||||
|
||||
@ -6254,8 +6254,8 @@ compute_diff(const corpus_sptr f,
|
||||
const var_decl* second)
|
||||
{
|
||||
string n1, n2;
|
||||
if (!first->get_mangled_name().empty())
|
||||
n1 = first->get_mangled_name();
|
||||
if (!first->get_linkage_name().empty())
|
||||
n1 = first->get_linkage_name();
|
||||
if (n1.empty())
|
||||
{
|
||||
n1 = first->get_pretty_representation();
|
||||
@ -6266,7 +6266,7 @@ compute_diff(const corpus_sptr f,
|
||||
|
||||
if (n2.empty())
|
||||
{
|
||||
n2 = second->get_mangled_name();
|
||||
n2 = second->get_linkage_name();
|
||||
if (n2.empty())
|
||||
{
|
||||
n2 = second->get_pretty_representation();
|
||||
|
@ -482,12 +482,12 @@ struct func_comp
|
||||
assert(first != 0 && second != 0);
|
||||
|
||||
string first_name, second_name;
|
||||
first_name = first->get_mangled_name();
|
||||
first_name = first->get_linkage_name();
|
||||
if (first_name.empty())
|
||||
first_name = first->get_name();
|
||||
assert(!first_name.empty());
|
||||
|
||||
second_name = second->get_mangled_name();
|
||||
second_name = second->get_linkage_name();
|
||||
if (second_name.empty())
|
||||
second_name = second->get_name();
|
||||
assert(!second_name.empty());
|
||||
@ -516,7 +516,7 @@ struct var_comp
|
||||
assert(first != 0 && second != 0);
|
||||
|
||||
string first_name, second_name;
|
||||
first_name = first->get_mangled_name();
|
||||
first_name = first->get_linkage_name();
|
||||
if (first_name.empty())
|
||||
{
|
||||
first_name = first->get_pretty_representation();
|
||||
@ -526,7 +526,7 @@ struct var_comp
|
||||
assert(!first_name.empty());
|
||||
|
||||
if (second_name.empty())
|
||||
second_name = second->get_mangled_name();
|
||||
second_name = second->get_linkage_name();
|
||||
|
||||
if (second_name.empty())
|
||||
{
|
||||
@ -562,7 +562,7 @@ corpus::priv::build_symbol_table()
|
||||
i != v.wip_fns.end();
|
||||
++i)
|
||||
{
|
||||
string n = (*i)->get_mangled_name();
|
||||
string n = (*i)->get_linkage_name();
|
||||
if (n.empty())
|
||||
n = (*i)->get_pretty_representation();
|
||||
assert(!n.empty());
|
||||
@ -586,7 +586,7 @@ corpus::priv::build_symbol_table()
|
||||
i != v.wip_vars.end();
|
||||
++i)
|
||||
{
|
||||
string n = (*i)->get_mangled_name();
|
||||
string n = (*i)->get_linkage_name();
|
||||
if (n.empty())
|
||||
n = (*i)->get_pretty_representation();
|
||||
assert(!n.empty());
|
||||
|
@ -651,15 +651,15 @@ die_flag_attribute(Dwarf_Die* die, unsigned attr_name, bool& flag)
|
||||
/// @return the mangled name if it's present in the DIE, or just an
|
||||
/// empty string if it's not.
|
||||
static string
|
||||
die_mangled_name(Dwarf_Die* die)
|
||||
die_linkage_name(Dwarf_Die* die)
|
||||
{
|
||||
if (!die)
|
||||
return "";
|
||||
|
||||
string mangled_name = die_string_attribute(die, DW_AT_linkage_name);
|
||||
if (mangled_name.empty())
|
||||
mangled_name = die_string_attribute(die, DW_AT_MIPS_linkage_name);
|
||||
return mangled_name;
|
||||
string linkage_name = die_string_attribute(die, DW_AT_linkage_name);
|
||||
if (linkage_name.empty())
|
||||
linkage_name = die_string_attribute(die, DW_AT_MIPS_linkage_name);
|
||||
return linkage_name;
|
||||
}
|
||||
|
||||
/// Get the file path that is the value of the DW_AT_decl_file
|
||||
@ -738,17 +738,17 @@ die_location(read_context& ctxt, Dwarf_Die* die)
|
||||
///
|
||||
/// @param name the name output parameter to set.
|
||||
///
|
||||
/// @param mangled_name the mangled_name output parameter to set.
|
||||
/// @param linkage_name the linkage_name output parameter to set.
|
||||
static void
|
||||
die_loc_and_name(read_context& ctxt,
|
||||
Dwarf_Die* die,
|
||||
location& loc,
|
||||
string& name,
|
||||
string& mangled_name)
|
||||
string& linkage_name)
|
||||
{
|
||||
loc = die_location(ctxt, die);
|
||||
name = die_string_attribute(die, DW_AT_name);
|
||||
mangled_name = die_mangled_name(die);
|
||||
linkage_name = die_linkage_name(die);
|
||||
}
|
||||
|
||||
/// Get the size of a (type) DIE as the value for the parameter
|
||||
@ -2204,7 +2204,7 @@ build_translation_unit_and_add_to_ir(read_context& ctxt,
|
||||
|
||||
assert((*v)->get_scope());
|
||||
string demangled_name =
|
||||
demangle_cplus_mangled_name((*v)->get_mangled_name());
|
||||
demangle_cplus_mangled_name((*v)->get_linkage_name());
|
||||
if (!demangled_name.empty())
|
||||
{
|
||||
std::list<string> fqn_comps;
|
||||
@ -2276,9 +2276,9 @@ build_namespace_decl_and_add_to_ir(read_context& ctxt,
|
||||
|
||||
scope_decl_sptr scope = get_scope_for_die(ctxt, die);
|
||||
|
||||
string name, mangled_name;
|
||||
string name, linkage_name;
|
||||
location loc;
|
||||
die_loc_and_name(ctxt, die, loc, name, mangled_name);
|
||||
die_loc_and_name(ctxt, die, loc, name, linkage_name);
|
||||
|
||||
result.reset(new namespace_decl(name, loc));
|
||||
add_decl_to_scope(result, scope.get());
|
||||
@ -2326,13 +2326,13 @@ build_type_decl(read_context& ctxt,
|
||||
bit_size = byte_size * 8;
|
||||
|
||||
size_t alignment = bit_size < 8 ? 8 : bit_size;
|
||||
string type_name, mangled_name;
|
||||
string type_name, linkage_name;
|
||||
location loc;
|
||||
die_loc_and_name(ctxt, die, loc, type_name, mangled_name);
|
||||
die_loc_and_name(ctxt, die, loc, type_name, linkage_name);
|
||||
|
||||
result.reset(new type_decl(type_name, bit_size,
|
||||
alignment, loc,
|
||||
mangled_name));
|
||||
linkage_name));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -2354,9 +2354,9 @@ build_enum_type(read_context& ctxt, Dwarf_Die* die)
|
||||
if (tag != DW_TAG_enumeration_type)
|
||||
return result;
|
||||
|
||||
string name, mangled_name;
|
||||
string name, linkage_name;
|
||||
location loc;
|
||||
die_loc_and_name(ctxt, die, loc, name, mangled_name);
|
||||
die_loc_and_name(ctxt, die, loc, name, linkage_name);
|
||||
|
||||
size_t size = 0;
|
||||
if (die_unsigned_constant_attribute(die, DW_AT_byte_size, size))
|
||||
@ -2400,7 +2400,7 @@ build_enum_type(read_context& ctxt, Dwarf_Die* die)
|
||||
|
||||
t = dynamic_pointer_cast<type_decl>(d);
|
||||
assert(t);
|
||||
result.reset(new enum_type_decl(name, loc, t, enms, mangled_name));
|
||||
result.reset(new enum_type_decl(name, loc, t, enms, linkage_name));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -2449,9 +2449,9 @@ build_class_type_and_add_to_ir(read_context& ctxt,
|
||||
return i->second;
|
||||
}
|
||||
|
||||
string name, mangled_name;
|
||||
string name, linkage_name;
|
||||
location loc;
|
||||
die_loc_and_name(ctxt, die, loc, name, mangled_name);
|
||||
die_loc_and_name(ctxt, die, loc, name, linkage_name);
|
||||
|
||||
size_t size = 0;
|
||||
die_size_in_bits(die, size);
|
||||
@ -2875,11 +2875,11 @@ build_typedef_type(read_context& ctxt,
|
||||
type_base_sptr utype = is_type(utype_decl);
|
||||
assert(utype);
|
||||
|
||||
string name, mangled_name;
|
||||
string name, linkage_name;
|
||||
location loc;
|
||||
die_loc_and_name(ctxt, die, loc, name, mangled_name);
|
||||
die_loc_and_name(ctxt, die, loc, name, linkage_name);
|
||||
|
||||
result.reset(new typedef_decl(name, utype, loc, mangled_name));
|
||||
result.reset(new typedef_decl(name, utype, loc, linkage_name));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -2922,25 +2922,25 @@ build_var_decl(read_context& ctxt,
|
||||
assert(type);
|
||||
}
|
||||
|
||||
string name, mangled_name;
|
||||
string name, linkage_name;
|
||||
location loc;
|
||||
die_loc_and_name(ctxt, die, loc, name, mangled_name);
|
||||
die_loc_and_name(ctxt, die, loc, name, linkage_name);
|
||||
|
||||
if (!result)
|
||||
result.reset(new var_decl(name, type, loc, mangled_name));
|
||||
result.reset(new var_decl(name, type, loc, linkage_name));
|
||||
else
|
||||
{
|
||||
// We were called to append properties that might have been
|
||||
// missing from the first version of the variable. And usually
|
||||
// that missing property is the mangled name.
|
||||
if (!mangled_name.empty())
|
||||
result->set_mangled_name(mangled_name);
|
||||
if (!linkage_name.empty())
|
||||
result->set_linkage_name(linkage_name);
|
||||
}
|
||||
|
||||
// Check if a symbol with this name is exported by the elf binary.
|
||||
string linkage_name = get_linkage_name(result);
|
||||
if (!linkage_name.empty())
|
||||
if (ctxt.lookup_public_variable_symbol_from_elf(linkage_name))
|
||||
string lname = get_linkage_name(result);
|
||||
if (!lname.empty())
|
||||
if (ctxt.lookup_public_variable_symbol_from_elf(lname))
|
||||
result->set_is_in_public_symbol_table(true);
|
||||
|
||||
return result;
|
||||
@ -2970,9 +2970,9 @@ build_function_decl(read_context& ctxt,
|
||||
translation_unit_sptr tu = ctxt.cur_tu();
|
||||
assert(tu);
|
||||
|
||||
string fname, fmangled_name;
|
||||
string fname, flinkage_name;
|
||||
location floc;
|
||||
die_loc_and_name(ctxt, die, floc, fname, fmangled_name);
|
||||
die_loc_and_name(ctxt, die, floc, fname, flinkage_name);
|
||||
|
||||
size_t is_inline = false;
|
||||
die_unsigned_constant_attribute(die, DW_AT_inline, is_inline);
|
||||
@ -2996,9 +2996,9 @@ build_function_decl(read_context& ctxt,
|
||||
int child_tag = dwarf_tag(&child);
|
||||
if (child_tag == DW_TAG_formal_parameter)
|
||||
{
|
||||
string name, mangled_name;
|
||||
string name, linkage_name;
|
||||
location loc;
|
||||
die_loc_and_name(ctxt, &child, loc, name, mangled_name);
|
||||
die_loc_and_name(ctxt, &child, loc, name, linkage_name);
|
||||
bool is_artificial = die_is_artificial(&child);
|
||||
decl_base_sptr parm_type_decl;
|
||||
Dwarf_Die parm_type_die;
|
||||
@ -3033,8 +3033,8 @@ build_function_decl(read_context& ctxt,
|
||||
// Add the properties that might have been missing from the
|
||||
// first declaration of the function. For now, it usually is
|
||||
// the mangled name that goes missing in the first declarations.
|
||||
if (!fmangled_name.empty())
|
||||
result->set_mangled_name(fmangled_name);
|
||||
if (!flinkage_name.empty())
|
||||
result->set_linkage_name(flinkage_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3052,10 +3052,10 @@ build_function_decl(read_context& ctxt,
|
||||
result.reset(is_method
|
||||
? new class_decl::method_decl(fname, fn_type,
|
||||
is_inline, floc,
|
||||
fmangled_name)
|
||||
flinkage_name)
|
||||
: new function_decl(fname, fn_type,
|
||||
is_inline, floc,
|
||||
fmangled_name));
|
||||
flinkage_name));
|
||||
}
|
||||
// Check if a symbol with this name is exported by the elf binary.
|
||||
string linkage_name = get_linkage_name(result);
|
||||
|
@ -86,8 +86,8 @@ struct decl_base::hash
|
||||
std::tr1::hash<string> str_hash;
|
||||
|
||||
size_t v = str_hash(typeid(d).name());
|
||||
if (!d.get_mangled_name().empty())
|
||||
v = hashing::combine_hashes(v, str_hash(d.get_mangled_name()));
|
||||
if (!d.get_linkage_name().empty())
|
||||
v = hashing::combine_hashes(v, str_hash(d.get_linkage_name()));
|
||||
else if (!d.get_name().empty())
|
||||
v = hashing::combine_hashes(v, str_hash(d.get_qualified_name()));
|
||||
if (is_member_decl(d))
|
||||
|
@ -311,7 +311,7 @@ struct decl_base::priv
|
||||
std::string name_;
|
||||
std::string qualified_parent_name_;
|
||||
std::string qualified_name_;
|
||||
std::string mangled_name_;
|
||||
std::string linkage_name_;
|
||||
visibility visibility_;
|
||||
|
||||
priv()
|
||||
@ -322,13 +322,13 @@ struct decl_base::priv
|
||||
{}
|
||||
|
||||
priv(const std::string& name, location locus,
|
||||
const std::string& mangled_name, visibility vis)
|
||||
const std::string& linkage_name, visibility vis)
|
||||
: hash_(0),
|
||||
hashing_started_(false),
|
||||
in_pub_sym_tab_(false),
|
||||
location_(locus),
|
||||
name_(name),
|
||||
mangled_name_(mangled_name),
|
||||
linkage_name_(linkage_name),
|
||||
visibility_(vis)
|
||||
{}
|
||||
|
||||
@ -343,9 +343,9 @@ struct decl_base::priv
|
||||
|
||||
decl_base::decl_base(const std::string& name,
|
||||
location locus,
|
||||
const std::string& mangled_name,
|
||||
const std::string& linkage_name,
|
||||
visibility vis)
|
||||
: priv_(new priv(name, locus, mangled_name, vis))
|
||||
: priv_(new priv(name, locus, linkage_name, vis))
|
||||
{}
|
||||
|
||||
decl_base::decl_base(location l)
|
||||
@ -360,7 +360,7 @@ decl_base::decl_base(const decl_base& d)
|
||||
priv_->name_ = d.priv_->name_;
|
||||
priv_->qualified_parent_name_ = d.priv_->qualified_parent_name_;
|
||||
priv_->qualified_name_ = d.priv_->qualified_name_;
|
||||
priv_->mangled_name_ = d.priv_->mangled_name_;
|
||||
priv_->linkage_name_ = d.priv_->linkage_name_;
|
||||
priv_->context_ = d.priv_->context_;
|
||||
priv_->visibility_ = d.priv_->visibility_;
|
||||
}
|
||||
@ -525,15 +525,15 @@ decl_base::set_name(const string& n)
|
||||
///
|
||||
/// @return the new mangled name.
|
||||
const string&
|
||||
decl_base::get_mangled_name() const
|
||||
{return priv_->mangled_name_;}
|
||||
decl_base::get_linkage_name() const
|
||||
{return priv_->linkage_name_;}
|
||||
|
||||
/// Setter for the mangled name.
|
||||
/// Setter for the linkage name.
|
||||
///
|
||||
/// @param m the new mangled name.
|
||||
/// @param m the new linkage name.
|
||||
void
|
||||
decl_base::set_mangled_name(const std::string& m)
|
||||
{priv_->mangled_name_ = m;}
|
||||
decl_base::set_linkage_name(const std::string& m)
|
||||
{priv_->linkage_name_ = m;}
|
||||
|
||||
/// Getter for the visibility of the decl.
|
||||
///
|
||||
@ -645,10 +645,10 @@ decl_base::get_qualified_name() const
|
||||
bool
|
||||
decl_base::operator==(const decl_base& other) const
|
||||
{
|
||||
if (!get_mangled_name().empty()
|
||||
&& !other.get_mangled_name().empty())
|
||||
if (!get_linkage_name().empty()
|
||||
&& !other.get_linkage_name().empty())
|
||||
{
|
||||
if (get_mangled_name() != other.get_mangled_name())
|
||||
if (get_linkage_name() != other.get_linkage_name())
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@ -1731,8 +1731,8 @@ get_type_name(const type_base_sptr t)
|
||||
string
|
||||
get_linkage_name(const decl_base& d)
|
||||
{
|
||||
if (!d.get_mangled_name().empty())
|
||||
return d.get_mangled_name();
|
||||
if (!d.get_linkage_name().empty())
|
||||
return d.get_linkage_name();
|
||||
|
||||
if (!is_at_global_scope(d))
|
||||
return d.get_name();
|
||||
@ -2519,10 +2519,10 @@ type_decl::type_decl(const std::string& name,
|
||||
size_t size_in_bits,
|
||||
size_t alignment_in_bits,
|
||||
location locus,
|
||||
const std::string& mangled_name,
|
||||
const std::string& linkage_name,
|
||||
visibility vis)
|
||||
|
||||
: decl_base(name, locus, mangled_name, vis),
|
||||
: decl_base(name, locus, linkage_name, vis),
|
||||
type_base(size_in_bits, alignment_in_bits)
|
||||
{
|
||||
}
|
||||
@ -3166,17 +3166,17 @@ enum_type_decl::operator==(const type_base& o) const
|
||||
///
|
||||
/// @param locus the source location of the typedef declaration.
|
||||
///
|
||||
/// @param mangled_name the mangled name of the typedef.
|
||||
/// @param linkage_name the mangled name of the typedef.
|
||||
///
|
||||
/// @param vis the visibility of the typedef type.
|
||||
typedef_decl::typedef_decl(const string& name,
|
||||
const shared_ptr<type_base> underlying_type,
|
||||
location locus,
|
||||
const std::string& mangled_name,
|
||||
const std::string& linkage_name,
|
||||
visibility vis)
|
||||
: type_base(underlying_type->get_size_in_bits(),
|
||||
underlying_type->get_alignment_in_bits()),
|
||||
decl_base(name, locus, mangled_name, vis),
|
||||
decl_base(name, locus, linkage_name, vis),
|
||||
underlying_type_(underlying_type)
|
||||
{}
|
||||
|
||||
@ -3273,10 +3273,10 @@ typedef_decl::~typedef_decl()
|
||||
var_decl::var_decl(const std::string& name,
|
||||
shared_ptr<type_base> type,
|
||||
location locus,
|
||||
const std::string& mangled_name,
|
||||
const std::string& linkage_name,
|
||||
visibility vis,
|
||||
binding bind)
|
||||
: decl_base(name, locus, mangled_name, vis),
|
||||
: decl_base(name, locus, linkage_name, vis),
|
||||
type_(type),
|
||||
binding_(bind)
|
||||
{}
|
||||
@ -3650,7 +3650,7 @@ function_decl::parameter::get_name_id() const
|
||||
///
|
||||
/// @param locus the source location of this function declaration.
|
||||
///
|
||||
/// @param mangled_name the mangled name of the function declaration.
|
||||
/// @param linkage_name the mangled name of the function declaration.
|
||||
///
|
||||
/// @param vis the visibility of the function declaration.
|
||||
///
|
||||
@ -3662,10 +3662,10 @@ function_decl::function_decl(const std::string& name,
|
||||
size_t fptr_align_in_bits,
|
||||
bool declared_inline,
|
||||
location locus,
|
||||
const std::string& mangled_name,
|
||||
const std::string& linkage_name,
|
||||
visibility vis,
|
||||
binding bind)
|
||||
: decl_base(name, locus, mangled_name, vis),
|
||||
: decl_base(name, locus, linkage_name, vis),
|
||||
type_(new function_type(return_type, parms, fptr_size_in_bits,
|
||||
fptr_align_in_bits)),
|
||||
declared_inline_(declared_inline), binding_(bind)
|
||||
@ -3688,7 +3688,7 @@ function_decl::function_decl(const std::string& name,
|
||||
///
|
||||
/// @param locus the source location of the function declaration.
|
||||
///
|
||||
/// @param mangled_name the mangled name of the function declaration.
|
||||
/// @param linkage_name the mangled name of the function declaration.
|
||||
///
|
||||
/// @param vis the visibility of the function declaration.
|
||||
///
|
||||
@ -3698,10 +3698,10 @@ function_decl::function_decl(const std::string& name,
|
||||
shared_ptr<type_base> fn_type,
|
||||
bool declared_inline,
|
||||
location locus,
|
||||
const std::string& mangled_name,
|
||||
const std::string& linkage_name,
|
||||
visibility vis,
|
||||
binding bind)
|
||||
: decl_base(name, locus, mangled_name, vis),
|
||||
: decl_base(name, locus, linkage_name, vis),
|
||||
type_(dynamic_pointer_cast<function_type>(fn_type)),
|
||||
declared_inline_(declared_inline),
|
||||
binding_(bind)
|
||||
@ -4385,7 +4385,7 @@ class_decl::base_spec::base_spec(shared_ptr<class_decl> base,
|
||||
long offset_in_bits,
|
||||
bool is_virtual)
|
||||
: decl_base(base->get_name(), base->get_location(),
|
||||
base->get_mangled_name(), base->get_visibility()),
|
||||
base->get_linkage_name(), base->get_visibility()),
|
||||
member_base(a),
|
||||
base_class_(base),
|
||||
offset_in_bits_(offset_in_bits),
|
||||
@ -4429,7 +4429,7 @@ class_decl::base_spec::base_spec(shared_ptr<type_base> base,
|
||||
bool is_virtual)
|
||||
: decl_base(get_type_declaration(base)->get_name(),
|
||||
get_type_declaration(base)->get_location(),
|
||||
get_type_declaration(base)->get_mangled_name(),
|
||||
get_type_declaration(base)->get_linkage_name(),
|
||||
get_type_declaration(base)->get_visibility()),
|
||||
member_base(a),
|
||||
base_class_(dynamic_pointer_cast<class_decl>(base)),
|
||||
@ -4509,7 +4509,7 @@ mem_fn_context_rel::~mem_fn_context_rel()
|
||||
///
|
||||
/// @param locus the source location of the method.
|
||||
///
|
||||
/// @param mangled_name the mangled name of the method.
|
||||
/// @param linkage_name the mangled name of the method.
|
||||
///
|
||||
/// @param vis the visibility of the method.
|
||||
///
|
||||
@ -4523,16 +4523,16 @@ class_decl::method_decl::method_decl
|
||||
size_t ftype_align_in_bits,
|
||||
bool declared_inline,
|
||||
location locus,
|
||||
const std::string& mangled_name,
|
||||
const std::string& linkage_name,
|
||||
visibility vis,
|
||||
binding bind)
|
||||
: decl_base(name, locus, mangled_name, vis),
|
||||
: decl_base(name, locus, linkage_name, vis),
|
||||
function_decl(name,
|
||||
shared_ptr<function_type>
|
||||
(new method_type(return_type, class_type, parms,
|
||||
ftype_size_in_bits,
|
||||
ftype_align_in_bits)),
|
||||
declared_inline, locus, mangled_name, vis, bind)
|
||||
declared_inline, locus, linkage_name, vis, bind)
|
||||
{
|
||||
}
|
||||
|
||||
@ -4547,7 +4547,7 @@ class_decl::method_decl::method_decl
|
||||
///
|
||||
/// @param locus the source location of the method.
|
||||
///
|
||||
/// @param mangled_name the mangled name of the method.
|
||||
/// @param linkage_name the mangled name of the method.
|
||||
///
|
||||
/// @param vis the visibility of the method.
|
||||
///
|
||||
@ -4557,13 +4557,13 @@ class_decl::method_decl::method_decl
|
||||
shared_ptr<method_type> type,
|
||||
bool declared_inline,
|
||||
location locus,
|
||||
const std::string& mangled_name,
|
||||
const std::string& linkage_name,
|
||||
visibility vis,
|
||||
binding bind)
|
||||
: decl_base(name, locus, mangled_name, vis),
|
||||
: decl_base(name, locus, linkage_name, vis),
|
||||
function_decl(name, static_pointer_cast<function_type>(type),
|
||||
declared_inline, locus,
|
||||
mangled_name, vis, bind)
|
||||
linkage_name, vis, bind)
|
||||
{}
|
||||
|
||||
/// A constructor for instances of class_decl::method_decl.
|
||||
@ -4578,7 +4578,7 @@ class_decl::method_decl::method_decl
|
||||
///
|
||||
/// @param locus the source location of the method.
|
||||
///
|
||||
/// @param mangled_name the mangled name of the method.
|
||||
/// @param linkage_name the mangled name of the method.
|
||||
///
|
||||
/// @param vis the visibility of the method.
|
||||
///
|
||||
@ -4587,13 +4587,13 @@ class_decl::method_decl::method_decl(const std::string& name,
|
||||
shared_ptr<function_type> type,
|
||||
bool declared_inline,
|
||||
location locus,
|
||||
const std::string& mangled_name,
|
||||
const std::string& linkage_name,
|
||||
visibility vis,
|
||||
binding bind)
|
||||
: decl_base(name, locus, mangled_name, vis),
|
||||
: decl_base(name, locus, linkage_name, vis),
|
||||
function_decl(name, static_pointer_cast<function_type>
|
||||
(dynamic_pointer_cast<method_type>(type)),
|
||||
declared_inline, locus, mangled_name, vis, bind)
|
||||
declared_inline, locus, linkage_name, vis, bind)
|
||||
{}
|
||||
|
||||
/// A constructor for instances of class_decl::method_decl.
|
||||
@ -4608,7 +4608,7 @@ class_decl::method_decl::method_decl(const std::string& name,
|
||||
///
|
||||
/// @param locus the source location of the method.
|
||||
///
|
||||
/// @param mangled_name the mangled name of the method.
|
||||
/// @param linkage_name the mangled name of the method.
|
||||
///
|
||||
/// @param vis the visibility of the method.
|
||||
///
|
||||
@ -4617,13 +4617,13 @@ class_decl::method_decl::method_decl(const std::string& name,
|
||||
shared_ptr<type_base> type,
|
||||
bool declared_inline,
|
||||
location locus,
|
||||
const std::string& mangled_name,
|
||||
const std::string& linkage_name,
|
||||
visibility vis,
|
||||
binding bind)
|
||||
: decl_base(name, locus, mangled_name, vis),
|
||||
: decl_base(name, locus, linkage_name, vis),
|
||||
function_decl(name, static_pointer_cast<function_type>
|
||||
(dynamic_pointer_cast<method_type>(type)),
|
||||
declared_inline, locus, mangled_name, vis, bind)
|
||||
declared_inline, locus, linkage_name, vis, bind)
|
||||
{}
|
||||
|
||||
class_decl::method_decl::~method_decl()
|
||||
|
@ -628,7 +628,7 @@ write_decl(const shared_ptr<decl_base> decl, write_context& ctxt,
|
||||
|| write_typedef_decl(dynamic_pointer_cast<typedef_decl>(decl),
|
||||
ctxt, indent)
|
||||
|| write_var_decl(dynamic_pointer_cast<var_decl>(decl), ctxt,
|
||||
/*write_mangled_name=*/true, indent)
|
||||
/*write_linkage_name=*/true, indent)
|
||||
|| write_function_decl(dynamic_pointer_cast<class_decl::method_decl>
|
||||
(decl), ctxt, /*skip_first_parameter=*/true,
|
||||
indent)
|
||||
@ -1183,7 +1183,7 @@ write_typedef_decl(const shared_ptr<typedef_decl> decl,
|
||||
///
|
||||
/// @param ctxt the context of the serialization.
|
||||
///
|
||||
/// @param write_mangled_name if true, serialize the mangled name of
|
||||
/// @param write_linkage_name if true, serialize the mangled name of
|
||||
/// this variable.
|
||||
///
|
||||
/// @param indent the number of indentation white spaces to use.
|
||||
@ -1191,7 +1191,7 @@ write_typedef_decl(const shared_ptr<typedef_decl> decl,
|
||||
/// @return true upon succesful completion, false otherwise.
|
||||
static bool
|
||||
write_var_decl(const shared_ptr<var_decl> decl, write_context& ctxt,
|
||||
bool write_mangled_name, unsigned indent)
|
||||
bool write_linkage_name, unsigned indent)
|
||||
{
|
||||
if (!decl)
|
||||
return false;
|
||||
@ -1203,11 +1203,11 @@ write_var_decl(const shared_ptr<var_decl> decl, write_context& ctxt,
|
||||
o << "<var-decl name='" << decl->get_name() << "'";
|
||||
o << " type-id='" << ctxt.get_id_for_type(decl->get_type()) << "'";
|
||||
|
||||
if (write_mangled_name)
|
||||
if (write_linkage_name)
|
||||
{
|
||||
const string& mangled_name = decl->get_mangled_name();
|
||||
if (!mangled_name.empty())
|
||||
o << " mangled-name='" << mangled_name << "'";
|
||||
const string& linkage_name = decl->get_linkage_name();
|
||||
if (!linkage_name.empty())
|
||||
o << " mangled-name='" << linkage_name << "'";
|
||||
}
|
||||
|
||||
write_visibility(decl, o);
|
||||
@ -1248,9 +1248,9 @@ write_function_decl(const shared_ptr<function_decl> decl, write_context& ctxt,
|
||||
<< xml::escape_xml_string(decl->get_name())
|
||||
<< "'";
|
||||
|
||||
if (!decl->get_mangled_name().empty())
|
||||
if (!decl->get_linkage_name().empty())
|
||||
o << " mangled-name='"
|
||||
<< xml::escape_xml_string(decl->get_mangled_name()) << "'";
|
||||
<< xml::escape_xml_string(decl->get_linkage_name()) << "'";
|
||||
|
||||
write_location(decl, o);
|
||||
|
||||
@ -2166,7 +2166,7 @@ void
|
||||
dump(const var_decl_sptr v, std::ostream& o)
|
||||
{
|
||||
xml_writer::write_context ctxt(o);
|
||||
write_var_decl(v, ctxt, /*mangled_name*/true, /*indent=*/0);
|
||||
write_var_decl(v, ctxt, /*linkage_name*/true, /*indent=*/0);
|
||||
cerr << "\n";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user