* doc/manuals/abidiff.rst: Adjust intro to mention that w/o debug
info, abidiff now works but just report about added/removed
symbols. Add documentation about the new
--no-unreferenced-symbols option.
* include/abg-comparison.h (string_elf_symbol_map): New typedef.
(diff_context::show_symbols_unreferenced_by_debug_info): Declare
new accessors.
* src/abg-comparison.cc
(diff_context::priv::show_syms_unreferenced_by_di_): New data
member.
(diff_context::priv::priv): Adjust.
(diff_context::show_symbols_unreferenced_by_debug_info): Implement
these accessors.
(corpus_diff::priv::{unrefed_fn_syms_edit_script_,
unrefed_var_syms_edit_script_, added_unrefed_fn_syms_,
deleted_unrefed_fn_syms_, added_unrefed_var_syms_,
deleted_unrefed_var_syms_}): New data members.
(corpus_diff::priv::diff_stats::{num_func_syms_removed,
num_func_syms_added, num_var_syms_removed, num_var_syms_added}):
New data members.
(corpus_diff::priv::diff_stats::diff_stats): Adjust.
(corpus_diff::ensure_lookup_tables_populated): Populate lookup
tables for added/removed symbols that are not referenced by any
debug info.
(corpus_diff::priv::apply_filters_and_compute_diff_stats): Compute
stats for the added/removed symbols not referenced by any debug
info.
(corpus_diff::priv::emit_diff_stats): Emit stats about
added/removed symbols that are not referenced by any debug info.
(corpus_diff::length): Adjust to take in account added/removed
symbols not referenced by any debug info.
(show_linkage_name_and_aliases): New static function.
(corpus_diff::report): When emitting a symbol name, emit its
version too, and tell if it aliases other symbols. Avoid emitted
extra new lines. Report added/removed symbols not referenced by
any debug info.
(compute_diff): In the overload for corpus_sptr, compute the diffs
for symbols not referenced by debug info.
* include/abg-corpus.h
(corpus::get_unreferenced_{function,variable}_symbols): Declare
new member functions.
* src/abg-corpus.cc (corpus_priv::{unrefed_fun_symbols,
unrefed_var_symbols}): New data members.
(corpus_priv::build_unreferenced_symbols_tables): Define new
member function.
(struct comp_elf_symbols_functor): New functor.
(corpus::is_empty): Adjust to take in account added/removed
symbols not referenced by debug info.
(corpus::{get_unreferenced_function_symbols,
corpus::get_unreferenced_variable_symbols}): Define these
accessors.
* include/abg-dwarf-reader.h (enum status): Transform this into
bitfields. Add a STATUS_UNKNOWN value that has the value 0.
(operator|(status, status), operator&(status, status))
(operator|=(status&, status), operator&=(status, status)): New
bit-wise operators to manipulate instances of the status bit-field.
* src/abg-dwarf-reader.cc (get_version_for_symbol): Fix this to
avoid returning garbage version sometimes.
(read_debug_info_into_corpus): Fix this to return a non-null but
empty corpus_sptr when there is no debug info available.
(operator|(status, status), operator&(status, status))
(operator|=(status&, status), operator&=(status, status)): Define
these new bitwise operators to manipulate instances of the status
bit-field.
(read_corpus_from_elf): Now that the abigail::dwarf_reader::status
is a bit-field, set it to reflect if debug info and/or symbol
tables have been found. Do not bail out if debug info hasn't been
found. Rather, keep going, and go look for symbols-only; this is
a kind of operating in degraded mode.
* include/abg-ir.h (elf_symbol::get_aliases_id_string): Add a flag
that says if the current instance of elf_symbol should be included
in the list of aliases or not.
* src/abg-ir.cc (elf_symbol::get_aliases_id_string): Define it.
* tests/data/test-diff-dwarf/test16-syms-only-v{0,1}.o: New test
input.
* tools/abidiff.cc
(options::show_symbols_not_referenced_by_debug_info): New data
member.
(options:options): Adjust.
(display_usage): Add an info string for the new
--no-unreferenced-symbols command line option.
(parse_command_line): Parse the new --no-unreferenced-symbols
command line.
(set_diff_context_from_opts): Set the diff_context according to
the presence of --no-unreferenced-symbols.
(main): Adjust for the fact that abigail::dwarf_reader::status is
now a bit-field.
* tools/abilint.cc (main): Adjust for the fact that
abigail::dwarf_reader::status is now a bit-field..
():
* tests/data/test-diff-dwarf/test16-syms-only-report.txt: New test
reference output.
* tests/data/test-diff-dwarf/test16-syms-only-v{0,1}.cc: Source code
for new test input.
* tests/data/test-diff-dwarf/test17-non-refed-syms-v{0,1}.o: New
test input.
* tests/data/test-diff-dwarf/test17-non-refed-syms-v{0,1}.cc: New
source code for test input.
* tests/data/test-diff-dwarf/libtest18-alias-sym-v{0,1}.so: New
test input.
* tests/data/test-diff-dwarf/test18-alias-sym-report-0.txt:
Reference output for new test input.
* tests/data/test-diff-dwarf/test18-alias-sym-v{0,1}.cc: Source
code for new test input.
* tests/data/test-diff-dwarf/test18-alias-sym-version-script:
Source code for new test input.
* tests/Makefile.am: Add the new test materials to the source
distribution.
* tests/test-diff-dwarf.cc(in_out_specs): Add the new input tests
above to the array of tests to run by this harness.
(main): Emit empty reports for empty resulting diffs.
* tests/data/test-diff-dwarf/test{0,8,9,12,14-inline-report,}-report.txt:
Adjust.
* tests/data/test-diff-filter/test{0,01,2,4,5,7,8,9,10,12,13,15-0,15-1}-report.txt:
Likewise.
* tests/data/test-diff-filter/test{19-enum,20-inline,}-report-0.txt:
Likewise.
* tests/data/test-diff-suppr/test0-type-suppr-report-{1,2}.txt:
Likewise.
* tests/data/test-diff-suppr/test{1,2}-typedef-suppr-report-1.txt:
Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-fwd.h: Wrap IR artifacts into abigail::ir namespace.
Inject that new abigail::ir namespace into the abigail namespace.
* include/abg-ir.h: Wrap IR artifacts into abigail::ir namespace.
(function_decl::parameter::get_type_name): Adjust the call to
abigail::get_type_name. It's now a call to
abigail::ir::get_type_name.
* src/abg-ir.cc: Wrap IR artifacts into abigail::ir namespace.
* include/abg-traverse.h: Wrap the ir traversing artifact into the
abigail::ir namespace too.
* src/abg-traverse.cc: Adjust.
* include/abg-corpus.h: Wrap corpus type stuff into abigail::ir.
* include/abg-dwarf-reader.h: Inject namespace abigail::ir stuff
into the abigail::dwarf_reader namespace.
* include/abg-reader.h: Inject namespace abigail::ir stuff into
the abigail::xml_reader namespace.
* src/abg-reader.cc: Adjust.
* include/abg-writer.h: Inject namespace abigail::ir stuff into
the abigail::xml_writer namespace.
* src/abg-writer.cc: Inject namespace abigail::ir stuff into
abigail namespace here too.
* src/abg-hash.cc: Inject the abigail::ir namespace into the
abigail namespace.
* tools/abg-tools-utils.cc: Adjust for the injection of
abigail::function_decl. It's now abigail::ir::function_decl.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (fixup_virtual_member_function): Declare new
function.
(class_decl): Declare fixup_virtual_member_function() as a member.
* src/abg-ir.cc (set_member_function_is_virtual): Ensure that the
member function that has seen its virtualness set is also put
correctly put in the vector of virtual member functions of its
class.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-fwd.h (set_member_function_is_ctor)
(set_member_function_is_dtor, set_member_function_is_const)
(set_member_function_vtable_offset): Declare new functions.
* include/abg-ir.h (class_decl::sort_virtual_mem_fns): Declare new
member function.
(mem_fn_context_rel::{vtable_offset, is_constructor is_destructor,
is_const}): Add these setters.
(set_member_function_is_ctor, set_member_function_is_dtor)
(set_member_function_is_static, set_member_function_is_const)
(set_member_function_vtable_offset)
(set_member_function_is_virtual): Declare these new friend
function to class class_decl::method_decl.
* src/abg-dwarf-reader.cc (finish_member_function_reading): Split
this out from build_class_type_and_add_to_ir. Use the new setters
for member functions properties introduced above.
(build_class_type_and_add_to_ir): Factorize the creation of member
function by using build_ir_node_from_die. Once that function has
created the member function in a rather generic way, use the new
finish_member_function_reading to set the remaining specific
properties for member functions.
(build_function_decl): When called to read additional properties
of a function_decl, allow this to read and update the elf symbol
properties too. This is useful for building a clone of a function
that already has an elf symbol.
(build_ir_node_from_die): When building a function decl, consider
the case of a DIE that has both DW_AT_specification and
DW_AT_abstract_origin set. That is, DW_AT_abstract_origin is set,
and the origin has DW_AT_specification set. This is basically a
clone of a function that implements an interface (this happens for
destructors, for instance). In this case, really do the cloning
of the interface implementation. If the cloned function happens
to be member function, use finish_member_function_reading to read
the properties relevant to its method-ness.
* src/abg-ir.cc (set_member_function_is_ctor)
(set_member_function_is_dtor, set_member_function_is_const)
(set_member_function_vtable_offset)
(class_decl::sort_virtual_mem_fns): Define new functions.
(sort_virtual_member_functions): Define new static function.
(struct virtual_member_function_less_than): New functor.
(class_decl::add_member_function): Keep virtual member functions
vector sorted.
* data/test-read-dwarf/test1.abi: Adjust. Now, both the
cdtor specification and all the clones that implements the
different are emitted.
* data/test-read-dwarf/test2.so.abi: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-comparison.h
(diff_category::HARMLESS_SYMBOL_ALIAS_CHANGE_CATEORY): New
enumerator.
(diff_category::EVERYTHING_CATEGORY): Adjust.
* include/abg-ir.h (elf_symbol::get_aliases_id_string)
(elf_symbol::does_alias, elf_symbols_alias)
(compute_aliases_for_elf_symbol): Declare new functions ...
* src/abg-ir.cc (elf_symbol::get_aliases_id_string)
(elf_symbol::does_alias, elf_symbols_alias)
(compute_aliases_for_elf_symbol): ... and define them.
(function_decl::operator==): Take in account elf symbol aliases.
* src/abg-comp-filter.cc (function_name_changed_but_not_symbol):
Define new static functions.
(harmless_filter::visit): Categorize function name changes that
n doesn't impact underlying elf symbols (or the fact that two
symbols were aliases and are not anymore) as harmless.
* src/abg-comparison.cc (function_decl_diff::report): Properly
report function name changes, or symbol aliases changes for that
matter. Also report inline-ness declaration changes.
* src/abg-dwarf-reader.cc (die_is_declared_inline): New static
function.
(build_function_decl): Use the above.
* tools/bidiff.cc (set_diff_context_from_opts): Add
abigail::comparison::HARMLESS_SYMBOL_ALIAS_CHANGE_CATEORY into the
harmless change camp.
* tests/data/test-diff-dwarf/test14-inline-report.txt: New test
input.
* tests/data/test-diff-dwarf/test14-inline-v0.o: Likewise.
* tests/data/test-diff-dwarf/test14-inline-v1.o: Likewise.
* tests/data/test-diff-dwarf/test14-inline-v0.cc: Source code for
test input.
* tests/data/test-diff-dwarf/test14-inline-v1.cc: Source code for
test input.
* tests/test-diff-dwarf.cc: Run this test harness over the new
input above.
* tests/data/test-diff-filter/test20-inline-report-0.txt: Likewise.
* tests/data/test-diff-filter/test20-inline-report-1.txt:
Likewise.
* tests/data/test-diff-filter/test20-inline-v0.o: New test input.
* tests/data/test-diff-filter/test20-inline-v1.o: New test input.
* tests/data/test-diff-filter/test20-inline-v0.cc: Source code for
test input.
* tests/data/test-diff-filter/test20-inline-v1.cc: Likewise.
* tests/test-diff-filter.cc: Run this test harness over the new
input above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (elf_symbol::operator==): Add a const to the
declaration ...
* src/abg-ir.cc (elf_symbol::operator==): ... and to the definition.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-fwd.h (std::tr1::weak_ptr): Inject this type in the
abigail namespace.
* include/abg-ir.h: Write a memory management guideline for the IR
artifacts.
(Type_base_wptr, function_type_wptr)
(class_decl_wptr): New typedefs.
(translation_unit::get_canonical_function_type): Declare new
member function.
(qualified_type_def::underlying_type_)
(reference_type_def::pointed_to_type_)
(typedef_decl::underlying_type_, function_decl::parameter::type_)
(function_type::return_type_, method_type::class_type_)
(non_type_tparameter::type_, type_composition::type_): Make this a
weak pointer.
(qualified_type_def::get_pointed_to_type)
(reference_type_def::get_pointed_to_type)
(array_type::get_element_type, typedef_decl::get_underlying_type)
(var_decl::get_type, function_decl::parameter::get_type)
(function_type::get_return_type, method_type::get_class_type)
(non_type_tparameter::get_type)
(type_composition::get_composed_type): Adjust to make this return
a shared pointer initialized with the content of the weak pointer.
(function_decl::function_decl, method_decl::method_decl): Remove
the overload that doesn't take a type. This is because now,
function types need to be registered to their containing
translation unit.
(struct function_type::hash): Declare here.
* src/abg-hash.cc (struct function_type::hash): Declare this in
abg-ir.h and just define the methods here.
* src/abg-ir.cc (fn_type_ptr_map): New typedef.
(translation_unit::priv::canonical_types_): Remove this unused
member.
(translation_unit::priv::canonical_function_types_): New member.
(translation_unit::get_canonical_function_type): Define this
function.
(array_type_def::priv::element_type_, var_decl::priv::type_)
(function_decl::priv::type_): Make this a weak pointer.
(qualified_type_def::get_underlying_type)
(pointer_type_def::get_pointed_to_type)
(reference_type_def::get_pointed_to_type)
(array_type_def::get_element_type)
(typedef_decl::get_underlying_type, var_decl::get_type)
(function_decl::get_type): Adjust to make this return a shared
pointer initialized with the content of the weak pointer.
(qualified_type_def::build_name)
(pointer_type_def::get_qualified_name)
(reference_type_def::get_qualified_name): Adjust.
(method_type::set_class_type): Cleanup the logic.
(function_decl::priv::priv): Remove the overload that takes a bare
pointer to a type. This should not be used now that we need the
function type to registered with the translation unit.
(function_decl::function_decl): Remove the overload that doesn't
take a type. This is because now, function types need to be
registered to their containing translation unit.
* src/abg-dwarf-reader.cc (build_function_decl): Register the
function type within its translation type and use its canonical
version. This complies with the new memory management rules.
* src/abg-reader.cc (build_function_decl): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h ({var,function}_decl::get_id): New member
function declarations.
* src/abg-ir.cc ({var,function}_decl::get_id): New member function
definitions.
* src/abg-comparison.cc
(corpus_diff::priv::ensure_lookup_tables_populated): Use the
::get_id() function to get an identifier for the function or
variable.
* src/abg-corpus.cc (symtab_build_visitor_type::build_id): Use the
get_id of the function/variable.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-corpus.h (corpus::lookup_function_symbol)
(corpus::lookup_variable_symbol): Add the name of the function
parameter in the declaration.
* include/abg-ir.h (elf_symbol::version::version): Properly indent
this constructor declaration.
* src/abg-corpus.cc
(symtab_build_visitor_type::symtab_build_visitor_type): Properly
indent constructor parameters.
* src/abg-ir.cc (function_decl::operator==): Fix typo in
comments.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-comparison.h (array_diff): Declare new class.
(array_diff_sptr): Shared pointer to type array_diff.
(compute_diff): Overload the function to take type
array_diff_sptr as the first two arguments.
* include/abg-fwd.h (array_type_def): Declare new class.
(subrange_type): Likewise.
(is_array_def): Declare new function.
* include/abg-ir.h (array_type_def_sptr): Shared pointer
to type array_type_def.
(array_type_def): Declare new class.
(ir_node_visitor::visit): Declare a new virtual function
taking a pointer to type array_type_def as an argument.
* src/abg-comparison.cc (compute_diff_for_types): Add
try_to_diff for two instances of type array_type_def.
(array_diff::priv): declare struct for holding private members
of type array_diff.
(array_diff::array_diff): Define constructor.
(array_diff::{first,second}_array):Define new
member functions.
(array_diff::element_type_diff): Likewise.
(array_diff::{length,report,traverse}): Likewise.
(compute_diff): Define function overloaded in
include/abg-comparison.h.
* src/abg-dwarf-reader.cc (build_array_type): Define new
function. Handle DW_TAG_array_type and DW_TAG_subrange type.
(build_ir_node_from_die): Amend case DW_TAG_array_type with
a call to build_array_type.
* src/abg-hash.cc (array_type_def::hash): Declare new struct.
(type_base::dynamic_hash::operator()): Attempt to dynamic_cast
the argument to type array_type_def as well.
(array_type_def::hash): Declare new struct.
* src/abg-ir.cc (array_type_def::array_type_def): Define
constructors.
(array_type_def::priv): declare struct for holding private members
of type array_type_def.
(array_type_def::operator==(const decl_base&):
Define new operator.
(array_type_def::operator==(const type_base&):
Likewise.
(array_type_def::append_subrange{,s}): Define
new functions.
(array_type_def::{set,get}_size_in_bits): Likewise.
(array_type_def::get_dimension_count): Likewise.
(array_type_def::get_qualified_name): Likewise.
(array_type_def::get_pretty_representation): Likewise.
(array_type_def::get_subrange_representation): Likewise.
(array_type_def::traverse): Likewise.
(array_type_def::get_{element_type,location,subranges}): Likewise.
(array_type_def::is_infinite): Likewise.
(array_type_def::~array_type_def): Define destructor.
(ir_node_visitor::visit): Define function, taking
pointer to array_type_def as an argument.
* src/abg-reader.cc (map_id_and_node): Check if node
is an array.
(is_array_def): Check if object is an array.
(handle_element_node): Handle array_type_def as well.
(build_subrange_type): Define new function.
(build_array_type_def): Likewise.
(build_type): Build type array_type_def as well.
(build_type_composition): Likewise.
(handle_array_type_def): Define new function.
* src/abg-writer.cc: (write_decl): Output arrays
as well.
(write_member_type): Likewise.
(write_type_composition): Likewise.
(write_array_type_def): Define new function.
* tests/data/test-diff-dwarf/test{10,11}-v{0,1}.{cc,o}: New test source
files
* tests/data/test-diff-dwarf/test{10,11}-report.txt: Likewise.
* tests/data/test-diff-dwarf/test10-report.txt: New test input.
* tests/data/test-read-dwarf/test7.cc: New test source
file.
* tests/data/test-read-dwarf/test7.so: New input binary
to read.
* tests/data/test-read-dwarf/test7.so.abi: New reference
test to compare against.
* tests/data/test-read-write/test25.xml: New test source
file.
* tests/test-diff-dwarf.cc: Adjust to launch the new test.
* tests/test-read-dwarf.cc: Likewise.
* tests/test-read-write.cc: Likewise.
* test/Makefile.am: Add the new test inputs to the source
distribution.
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (type_decl::get_void_type_decl): Declare new
static method.
* src/abg-ir.cc (type_decl::get_void_type_decl): Define it.
* src/abg-dwarf-reader.cc (build_ir_node_for_void_type): Define
new static function.
(build_pointer_type_def): Support void* type nodes here.
* tests/data/test-read-dwarf/test5.cc: Source code for new test
input.
* tests/data/test-read-dwarf/test5.o: New test input.
* tests/data/test-read-dwarf/test5.o.abi: Likewise.
* tests/Makefile.am: Add the above to the source distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-corpus.h (corpus::{g,s}et_{fun,var}_symbol_map{_sptr}):
Declare new accessors.
(corpus::lookup_{variable,function}_symbol): Declare new member
functions.
* src/abg-corpus.cc (corpus::{g,s}et_{fun,var}_symbol_map{_sptr}):
Define new accessors.
(corpus::lookup_{variable,function}_symbol): Define new member
functions.
* include/abg-ir.h (string_elf_symbol_sptr_map_type)
(string_elf_symbol_sptr_map_sptr, elf_symbols)
(string_elf_symbols_map_type, string_elf_symbols_map_sptr): New
convenience typedefs.
(elf_symbol::{get_main_symbol, is_main_symbol, get_next_alias,
has_aliases, add_alias, get_id_string,
get_name_and_version_from_id, operator=}): Declare new member
functions.
* src/abg-ir.cc (elf_symbol::{get_main_symbol, is_main_symbol,
get_next_alias, has_aliases, add_alias, get_id_string,
get_name_and_version_from_id, operator=}): Define new member
functions.
* include/abg-reader.h (read_corpus_from_file): Take a shared
pointer to corpus.
* src/abg-reader.cc (read_context::{g,s}et_corpus): Define these.
(build_elf_symbol_db, build_elf_symbol_from_reference)
(read_symbol_db_from_input): Define new functions.
(read_corpus_from_input): Adjust. Make it read symbol databases.
(build_elf_symbol): Harden this.
(build_{var,function}_decl): Read the symbol reference. Do not
read the local symbol serialization anymore.
(read_corpus_from_archive): Adjust.
(read_corpus_from_file): Take a reference to a shared pointer to
corpus, rather than a reference to the corpus.
(read_corpus_from_native_xml): Only keep the overload that returns
a corpus. Set the current context with the corpus.
* src/abg-dwarf-reader.cc (addr_elf_symbol_sptr_map_type)
(addr_elf_symbol_sptr_map_sptr): New convenience typedefs.
(read_context::{fun_sym_addr_sym_index_map_,
var_sym_addr_sym_index_map_): Remove.
(read_context::{fun,var}_addr_sym_map_): New. Replace the above
that got removed.
(read_context::{var,fun}_syms_): New.
(read_context::lookup_elf_{fn,var}_symbol_from_address): Adjust.
(read_context::{fun,var}_addr_sym_map{_sptr}): New.
(read_context::{fun,var}_syms{_sptr}): New.
(read_context::load_symbol_maps): Replace
read_context::load_symbol_addr_to_index_maps. Adjust to load all
the new maps.
(read_context::maybe_load_symbol_maps): New.
(read_debug_info_into_corpus): Renamed build_corpus into this.
Update to load symbol maps and set it to the corpus.
* src/abg-writer.cc (write_context::get_fun_symbol_map): New
accessor.
(write_elf_symbol_aliases, write_elf_symbol_reference)
(write_elf_symbols_table): Define new static functions.
(write_var_decl): Write the reference to the underlying symbol of
the variable. Do not write the full symbol here anymore.
(write_function_decl): Likewise, write the reference to the
underlying symbol of the function. Do not write the full symbol
here anymore.
(write_corpus_to_native_xml): Write the symbol databases at the
beginning of the corpus document.
* src/abg-comparison.cc
(corpus_diff::priv::ensure_lookup_tables_populated): Now that the
corpus has symbols, check if a the symbol of an allegedly deleted
function (resp. variable) is deleted; if not, then do not report
the function (resp. variable) as deleted. Similarly, check if the
symbol of an allegedly added function (resp. variable) is added.
if not, the do not report the function (resp. variable) as added.
* tests/test-write-read-archive.cc (main): Adjust.
* tools/biar.cc (extract_tus_from_archive): Likewise.
* tests/data/test-diff-filter/test9-report.txt: Adjust.
* tests/data/test-read-dwarf/test0.abi: Likewise.
* tests/data/test-read-dwarf/test1.abi: Likewise.
* tests/data/test-read-dwarf/test2.so.abi: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h ({var,function}_decl::clone): New method.
* src/abg-dwarf-reader.cc (die_die_attribute): Add a flag to avoid
looking through DW_AT_abstract_origin attribute here.
(build_function_decl): Set the linkage name from
DW_AT_linkage_name if it's not set yet.
(build_ir_node_from_die): For DW_TAG_{variable,subprogram}, when
we see DW_AT_abstract_origin, clone the decl they refer to.
Also, avoid dropping the DIE on the floor just because it doesn't
have die_is_artificial here.
* src/abg-ir.cc ({var,function}_decl::clone): Implement this.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* abg-ir.h (string_to_elf_symbol_type, string_to_elf_symbol_binding):
Declare new entry points.
* src/abg-ir.cc (string_to_elf_symbol_type)
(string_to_elf_symbol_binding): Define new entry points.
* include/abg-libxml-utils.h (xml_char_sptr_to_string): Declare
new entry points.
* src/abg-libxml-utils.cc (xml_char_sptr_to_string): Define new
entry points.
* src/abg-reader.cc (read_elf_symbol_type)
(read_elf_symbol_binding, build_elf_symbol): Define new static
functions.
(build_function_decl, build_var_decl): Use the new
build_elf_symbol and set the symbol to the function. Flag the
function as having a public symbol in the symbol table if the
symbol is public.
* src/abg-writer.cc (write_elf_symbol_type)
(write_elf_symbol_binding, write_elf_symbol): Define new static
functions.
(write_var_decl, write_function_decl): Use the new
write_elf_symbol to serialize the symbol for the decl.
* tests/data/test-read-dwarf/test[01].abi: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-fwd.h (get_linkage_name): Remove.
* include/abg-dwarf-reader.h (enum symbol_type)
(enum symbol_binding): Move these into abg-ir.h.
(lookup_symbol_from_elf, lookup_public_function_symbol_from_elf):
Adjust.
* src/abg-dwarf-reader.cc (eval_last_constant_dwarf_sub_expr):
Declare this before using it.
(die_address_attribute, die_location_address)
(stt_to_elf_symbol_type, stb_to_elf_symbol_binding)
(find_hash_table_section_index, find_symbol_table_section)
(find_symbol_table_section_index, find_text_section)
(find_bss_section, compare_symbol_name)
(get_symbol_versionning_sections get_version_for_symbol)
(lookup_symbol_from_sysv_hash_tab)
(lookup_symbol_from_gnu_hash_tab, get_elf_class_size_in_bytes)
(bloom_word_at, setup_gnu_ht, lookup_symbol_from_elf_hash_tab)
(lookup_symbol_from_symtab, maybe_adjust_fn_sym_address)
(maybe_adjust_var_sym_address): New static functions.
(enum hash_table_kind): New enum.
(struct gnu_ht): New struct.
(read_context::var_decls_to_add_): Renamed var_decls_to_add into
this.
(read_context::{fun, var}_sym_addr_sym_index_map_): New member.
(read_context::{lookup_symbol_from_elf,
lookup_elf_symbol_from_index, lookup_elf_fn_symbol_from_address,
lookup_elf_var_symbol_from_address, fun_sym_addr_sym_index_map,
var_sym_addr_sym_index_map, load_symbol_addr_to_index_maps,
get_function_address, get_variable_address}): New member
functions.
(read_context::lookup_public_{variable,
function}_symbol_from_elf): Adjust.
(op_pushes_constant_value): Fix a bug here.
(lookup_symbol_from_elf): Adjust. Support cases where there is no
elf hash table, e.g, for relocatable files.
(lookup_public_function_symbol_from_elf)
(lookup_public_variable_symbol_from_elf): Adjust.
(build_var_decl): Allow updating the var_decl to associate it with
its underlying symbol. In that case, if the linkage name is not
set, set it to the symbol name.
(build_function_decl): Likewise for function_decl.
(operator<<(std::ostream&, symbol_type)):
(operator<<(std::ostream&, symbol_binding)): Move these do
abg-ir.cc.
* include/abg-ir.h (class elf_symbol): Declare new class. Move
enum symbol_binding and enum symbol_type (from abg-dwarf-reader.h) to
elf_symbol::binding and elf_symbol::type here.
(operator<<(std::ostream&, elf_symbol::type))
(operator<<(std::ostream&, elf_symbol::binding))
(operator==(const elf_symbol_sptr, const elf_symbol_sptr)): New
operators.
(class elf_symbol::version): Declare new class.
(class var_decl): Make this pimpl, and add ...
(var_decl::{g,s}et_symbol): ... new member functions.
(class function_decl): Likewise, make this pimpl and add ...
(function_decl::{g,s}et_symbol): ... new member functions.
* src/abg-ir.cc (struct elf_symbol, elf_symbol::priv): New
types.
(elf_symbol::*): Lots of new members and member functions.
(operator==(const elf_symbol_sptr, const elf_symbol_sptr)): New.
(operator<<(std::ostream&, elf_symbol::type)): New.
(operator<<(std::ostream&, elf_symbol::binding)): New.
(elf_symbol::version::priv): New type.
(elf_symbol::version::*): Lots of member functions.
(get_linkage_name): Removed.
(var_decl::priv): New type. Pimplify the thing.
(var_decl::{s,g}et_symbol): New.
(var_decl::operator==): Take symbols in account in the comparison.
(function_decl::priv): New type.
(function_decl::*): Pimplify.
(function_decl::{s,g}et_symbol): New.
(function_decl::operator==): Take symbols in account in the
comparison.
* include/abg-comparison.h (diff_context::show_linkage_name): New
member function.
* src/abg-comparison.cc (diff_context::priv::show_linkage_name_):
New member.
(diff_context::priv::priv): Initialize it.
(diff_context::show_linkage_names): New member function.
(corpus_diff::report): If the user used --show-linkage-names,
display the linkage name after the name of the functions. Add
missing "'" in the some spots.
* tools/bidiff.cc (options.show_linkage_names): New member.
(display_usage, parse_command_line): Support --linkage-names.
* tools/bisym.cc (show_help): Add '\n' at the end of help string
for --demangle. Add --no-absolute-path option.
(parse_command_line): Support --no-absolute-path.
(main): Adjust for symbol (versionning) support. Consider that
the program successfully completed even when the symbol wasn't
found. Support --no-absolute-path.
* tests/data/test-lookup-syms/test0-report.txt: New.
* tests/data/test-lookup-syms/test01-report.txt: New.
* tests/data/test-lookup-syms/test02-report.txt: New.
* tests/data/test-read-dwarf/test0.abi: Adjust.
* tests/data/test-read-dwarf/test1.abi: Adjust.
* tests/data/test-diff-dwarf/test7-report.txt: Adjust.
* tests/data/test-diff-filter/test10-report.txt: Adjust.
* tests/data/test-diff-filter/test12-report.txt: Adjust.
* tests/data/test-lookup-syms/test1-[123]-report.txt: New.
* tests/data/test-lookup-syms/test1.c: New.
* tests/data/test-lookup-syms/test1.version-script: New.
* tests/test-lookup-syms.cc: Adjust for new tests.
* test/Makefile.am: Adjust makefile.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (qualified_type_def::get_size_in_bits): Declare
new member function ...
* src/abg-ir.cc (qualified_type_def::get_size_in_bits): ... and
define it. Keep in mind that some times the size of the
underlying type can change between the moment the qualified type
is created and the end of its life time. That is because a
subsequent DIE (from DWARF) can alter the size of the underlying
type. This overload allows the user to always query the size of
the underlying type and keep the size of the qualified type in
sync with it.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-fwd.h (set_member_function_is_virtual): Declare new
function.
* include/abg-ir.h (class class_decl): Declare
set_member_function_is_virtual and member_function_is_virtual as
friends of class_decl.
(class_decl::add_member_function): Take an is_virtual flag.
(class_decl::get_num_virtual_functions): Remove.
(class_decl::get_virtual_mem_fns): New member function.
(mem_fn_context_rel::is_virtual_): New member.
(mem_fn_context_rel::mem_fn_context_rel): Adjust to initialize the
new is_virtual_ member.
(mem_fn_context_rel::is_virtual): New member functions.
* src/abg-comparison.cc (represent): Adjust.
* src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Adjust.
* src/abg-ir.cc (member_function_is_virtual): Change this to use
mem_fn_context_rel::is_virtual.
(set_member_function_is_virtual): Define this new function.
(class_decl::priv::virtual_mem_fns_): New member to hold virtual
member functions.
(class_decl::get_virtual_mem_fns): Implement this member function.
(class_decl::get_num_virtual_functions): Remove.
(class_decl::add_member_function): Take a new is_virtual flag.
Add virtual member functions to
class_decl::priv::virtual_mem_fns_.
* src/abg-reader.cc (build_class_decl): Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (class_decl::{priv}): New private data member.
(class_decl::{get_is_declaration_only, set_is_declaration_only,
is_struct, get_definition_of_declaration, get_earlier_declaration,
add_base_specifier, get_base_specifiers, get_member_types,
get_data_members, get_member_functions,
get_member_function_templates, get_member_class_templates}): Move
these methods out-of-line.
(class_decl::{comparison_started_,
declaration_,is_declaration_only_, definition_of_declaration,
is_struct_, bases_, member_types_, data_members_,
member_functions_, member_function_template,
member_class_templates_}): Move these data members into the pimpl
in ...
* src/abg-ir.cc
(class_decl::priv::{declaration_,is_declaration_only_,
definition_of_declaration, is_struct_, bases_, member_types_,
data_members_, member_functions_, member_function_template,
member_class_templates_}): ... here.
(class_decl::priv::classes_being_compared_): New data member.
(class_decl::priv::priv): Initialize the data members.
(class_decl::priv::{mark_as_being_compared,
unmark_as_being_compared, comparison_started): New methods.
(class_decl::{get_is_declaration_only, set_is_declaration_only,
is_struct, get_definition_of_declaration, add_base_specifier,
get_base_specifiers, get_member_types, get_data_members,
get_member_functions, get_member_function_templates,
get_member_class_templates}): Move these out-of-line in here.
(class_decl::{class_decl, set_definition_of_declaration,
set_earlier_declaration, insert_member_type, add_member_type,
add_data_member, add_member_function,
add_member_function_template, add_member_class_template,
has_no_base_nor_member}): Adjust.
(class_decl::operator==): Harden inf-loop prevention during class
comparison using the new priv::mark/unmark_as_being_compared()
functions. Now comparison of a class really compares member
functions again. And it is *slooow*. I should probably change
this to compare only virtual member functions. But at least this
should be correct and robust for now.
* tests/data/test-diff-filter/test0-report.txt: Adjust.
* test01-report.txt: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (struct {scope_decl, non_type_tparameter,
type_composition, class_decl}::hash): Declare hashers.
({scope_decl, var_decl, non_type_tparameter, type_composition,
class_decl}::get_hash): Provide new overloads of the get_hash.
* src/abg-hash.cc ({type_decl, scope_type_decl,
qualified_type_def, pointer_type_def, reference_type_def,
enum_type_decl, typedef_decl, var_decl,
function_decl}:#️⃣:operator()): If the hash is being
calculated, do not use the not-yet fully calculated hash value.
Rather, calculate the hash, cache it and return the value.
({class_decl, non_type_tparameter}:#️⃣:operator()): Moved the
{class_decl, non_type_tparameter}::hash declaration out of here
and stick it in include/abg-ir.h. Keep the definition of the
hashing operators here though.
(type_composition:#️⃣:operator()): New operator definition.
* src/abg-ir.cc ({scope_decl, var_decl, class_decl,
non_type_tparameter, type_composition}::get_hash): Define new
virtual overload.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (function_decl::get_hash): Declare new virtual
overload.
* src/abg-hash.cc (class_decl::base_spec:#️⃣:operator()):
Properly hash the base specifier so that it doesn't collide with
hashing a class.
* src/abg-ir.cc (decl_base::get_hash): Abort if we detect a
missing overload for this;
(function_decl::get_hash() const): Implement this missing
overload, allowing using the virtual decl_base::get_hash for
function_decl.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (type_base::get_{size,alignment}_in_bits): Make
this virtual.
(typedef_decl::get_{size,alignment}_in_bits): Add new member
functions. Get the size,alignment from the underlying type and
update the current size/alignment if they differ. Keep in mind
that the size of an underlying class_decl can change over its
lifetime, given how the dwarf reader reads the type information,
i.e, there can be a DIE for a class type with no size information
that will lead to the creation of a class_decl with size zero.
Later during the DWARF reading process, another DIE will
supplement the type information, adding size information to that
class_decl. In between, a typedef_decl might have been created
with the first version of the class_decl that has a zero size. I
guess this should be extended to the other type constructs that
have an underlying type (qualified types, references and pointers).
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-comparison.h
(diff_category::COMPATIBLE_TYPE_CHANGE_CATEGORY): New enumerator.
(operator|=(diff_category&, diff_category)): New declaration.
* include/abg-fwd.h (is_typedef, strip_typedef)
(types_are_compatible): New declarations.
* include/abg-ir.h (operator==(const decl_base_sptr, const
decl_base_sptr)): Added the consts here.
(operator==(const type_base_sptr, const type_base_sptr)): New
declaration.
* src/abg-comp-filter.cc (is_compatible_change): New static
function.
(harmless_filter::visit): Detect compatible changes and add the
sub-tree into the new COMPATIBLE_TYPE_CHANGE_CATEGORY if
applicable. Cleanup the logic.
* src/abg-comparison.cc (operator|=(diff_category&,
diff_category)): Define new function.
(operator==(const decl_base_sptr l, const decl_base_sptr r)): Add
consts.
(operator==(const type_base_sptr l, const type_base_sptr r)):
Define new operator.
(is_typedef, strip_typedef, types_are_compatible): New function
definitions.
* tests/data/test-diff-filter/test3-report.txt: New test report
reference.
* tests/data/test-diff-filter/test3-v0.cc: Source code for new
test input.
* tests/data/test-diff-filter/test3-v0.o: New test input.
* tests/data/test-diff-filter/test3-v1.cc: Source code for new
test input.
* tests/data/test-diff-filter/test3-v1.o: New test input.
* tests/test-diff-filter.cc: Adjust to consume the new tests
inputs above.
* tools/bidiff.cc: Add the new COMPATIBLE_TYPE_CHANGE_CATEGORY
into the --harmless group.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-traverse.h (traversable_base::traversable): Change
the signature of this to return a boolean.
* include/abg-ir.h (ir_traversable_base::traverse): Change the
signature of this to return a boolean.
(*::traverse): Adjust.
(ir_node_visitor::visit): Change the signature of this to return a
boolean.
* src/abg-corpus.cc (symtab_build_visitor_type::visit): Adjust.
* src/abg-ir.cc (::traverse): Adjust.
* tests/test-walker.cc (name_printing_visitor::visit): Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (decl_base::get_hash): Make this virtual.
(class_decl::base_spec::get_hash): Declare a new virtual overload.
* src/abg-ir.cc (class_decl::base_spec::get_hash): Define.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-fwd.h (is_member_function)
(get_member_function_is_{ctor,dtor,const})
(get_member_function_vtable_offset): New function declarations.
* include/abg-ir.h (class_decl::member_function): Remove.
(class_decl::member_functions): Adjust. This is now just a vector
of method_decl_sptr.
(class_decl::add_member_function): Remove the overload taking
class_decl::member_function. Adjust the other overload to take a
method_decl_sptr.
(class mem_fn_context_rel): New class.
(class_decl::method_decl::set_scope): New virtual overload.
(class_decl::member_function): Remove.
(operator==): Remove the overload taking a
class_decl::member_function.
(class_decl::member_function::hash): Remove.
(ir_node_visitor::visit): Remove the overload taking a
class_decl::member_function.
* include/abg-comparison.h (changed_member_function_sptr)
(string_member_function_sptr_map): Adjust.
* src/abg-comparison.cc (represent): Adjust the overload taking a
class_decl::member_function to take a class_decl::method_decl.
(class_diff::{report, ensure_lookup_tables_populated}): Adjust.
* src/abg-corpus.cc (symtab_build_visitor_type::visit): Remove the
overload taking a class_decl::member_function.
* src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir):
Adjust.
* src/abg-hash.cc (decl_base:#️⃣:operator()): Use the fully
qualified name of the decl in the hash, to increase the likelihood
of avoiding hash collisions.
(method_type:#️⃣:operator()): Likewise.
(function_decl:#️⃣:operator()): Take member functions in
account.
(class_decl::member_function:#️⃣:operator()): Remove.
(class_decl:#️⃣:operator()): Adjust.
(type_base::dynamic_hash::operator()): Adjust.
* src/abg-ir.cc (is_member_function)
(get_member_function_is_{ctor,dtor,const})
(get_member_function_vtable_offset): New function definitions.
(function_decl::get_pretty_representation): Adjust.
(function_decl::operator): Take member functions in account here.
(class_decl::insert_member_decl): Adjust.
(mem_fn_context_rel::~mem_fn_context_rel): New definition.
(class_decl::member_function::*): Remove.
(class_decl::method_decl::set_scope): New definition.
(class_decl::get_num_virtual_functions): Adjust.
(class_decl::add_member_function): Remove overload taking a
class_decl::member_function. Define a new overload taking a
class_decl::method_decl.
(ir_node_visitor::visit): Remove the overload taking a
class_decl::member_function.
* src/abg-reader.cc (build_class_decl): Adjust.
* src/abg-writer.cc (write_voffset, write_class_decl): Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-fwd.h (has_scope): Delete the overloads for
type_base.
(get_member_is_static): Add an overload for decl_base*.
({is,get,set}_data_member,{get_,set}_data_member_is_laid_out)
({get,set}_data_member_offset): New access declarations.
* include/abg-ir.h (class context_rel): Move up.
(decl_base::set_context_rel): New definition.
(class dm_context_rel): New type.
(decl_base::hash_as_member): Remove.
(var_decl::set_scope): Declare new virtual member.
(class_decl::data_member): Remove.
(ir_node_visitor::visit): Remove the overload for
class_decl::data_member.
(represent_data_member): Remove the represent overload for
class_decl::data_member into this. Make it take a var_decl.
(represent): Change the overload that takes two
class_decl::data_member take two var_decl. And adjust it.
(class_diff::report): Adjust.
* src/abg-corpus.cc (symtab_build_visitor_type::visit): Remove the
overload that takes a class_decl::data_member*. Adjust the
overload that takes a var_decl to recognize (static) data members.
* src/abg-dwarf-reader.cc (build_translation_unit_and_add_to_ir)
(build_class_type_and_add_to_ir, build_ir_node_from_die):
Adjust.
* src/abg-hash.cc (var_decl:#️⃣:operator()): Adjust.
(class_decl::data_member:#️⃣:operator()): Remove.
(decl_base:#️⃣:operator()): Take the context relationship in
account here.
(decl_base::hash_as_member::operator()): Remove.
({enum_type_decl,typedef_decl}:#️⃣:operator()): Adjust.
(class_decl::member_function:#️⃣:operator()): Adjust.
(type_base::dynamic_hash::operator()): Adjust.
* src/abg-ir.cc (dm_context_rel::~dm_context_rel): New definition.
(has_scope): Remove overload for type_base.
(get_member_is_static): New overload for decl_base*.
(is_data_member): New function definition.
({get,set}_data_member_{offset,is_laid_out}): Define new
accessors.
(var_decl::set_scope): Define new member function. Make this set
a dm_context_rel as the context relationship.
(var_decl::operator==): Adjust to take in account the new data
member relationship.
(class_decl::class_decl): Adjust.
(class_decl::insert_member_decl): Adjust.
(class_decl::add_data_member): Remove the overload for
class_decl::data_member.
(class_decl::add_data_member): Adjust the overload for var_decl.
(operator==): Remove overload for class_decl::data_member*.
(class_decl::data_member::operator==): Likewise.
(ir_node_visitor::visit): Remove overload for
class_decl::data_member.
* src/abg-writer.cc (write_layout_offset, write_class_decl):
Adjust.
* tests/data/test-read-write/test20.xml: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-comparison.h (class base_diff): New.
* include/abg-ir.h (function_decl::get_first_non_implicit_parm):
New member function.
(function_type::get_first_non_implicit_parm): Likewise.
* src/abg-comparison.cc (base_has_changed): Change parm to take
class_decl::base_spec_sptr.
(class_diff::ensure_lookup_tables_populated): Compare the base
specs not just the base classes.
(class_diff::report): Adjust. Report sub-type changes in the
member functions.
(base_diff::*): Define member functions.
(compute_diff): Define an overload for base_diff_sptr.
* src/abg-hash.cc ({function_type,
method_type}:#️⃣:operator()): Do not hash the implicit parm of
member functions.
(class_decl:#️⃣:operator()): Do not hash member types.
* src/abg-ir.cc (decl_base::decl_base): Initialize the
hashing_started_ member that got moved here from class_decl.
(decl_base::get_hash): Do not set the hash if it's being set b/c
we are in a class_decl.
(decl_base::operator==) Do not compare hashes for now. Two decls
can have different hashes and compare equal; think about an
incomplete type foo, that compares equal with a complete foo.
Their hashes will be different though. So for now, just avoid
comparing these.
(compare_function_types): Avoid comparing the implicit parameter
for member functions.
({function, method}_type::get_first_non_implicit_parm): New
definition.
* tests/data/test-read-write/test20.xml: Update.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-fwd.h (is_at_class_scope): Add new oveloads.
(as_non_member_type, as_non_member_class_decl): Remove.
(has_scope, is_member_decl, is_member_type): New function
declarations. (get_member_is_static, set_member_is_static):
Likewise. * include/abg-ir.h (enum access_specifier): Move to
the abigail:: namespace, from ...
(class_decl::access_specifier): ... here. (class
context_rel): New type. (decl_base::hash_as_member): New
hasher. (decl_base::context_): Change the type of this to
context_rel_sptr. (decl_base::get_context_rel): New protected
getter. (decl_base::get_scope): Move this out-of-line.
(class_decl::member_type): Remove.
(class_decl::member_types): Adjust this typedef.
(class_decl::{insert,add}_member_type): Make these take a
type_base_sptr now. (class_decl::add_member_type): Change the
overload that returned a member_type to return a
type_base_sptr. (get_member_access_specifier,
set_member_access_specifier): New function declarations. *
include/abg-comparison.h (class member_type_diff): Remove.
(compute_diff): Remove the overload for member_type_diff. *
src/abg-comparison.cc (compute_diff_for_types): Adjust for the
removal of class_decl::member_type.
(maybe_report_diff_for_class_members): New static function.
(report_name_size_and_alignment_changes): Do not report a name
change just because of a struct -> class change. ({var_diff,
enum_diff, function_decl_diff}::report): Use the new
maybe_report_diff_for_class_members. (class_diff::report):
Adjust for the removal of class_decl::member_type. Use the
new maybe_report_diff_for_class_members. (class member_diff):
Remove. * src/abg-dwarf-reader.cc (die_access_specifier)
(get_scope_for_die, build_translation_unit_and_add_to_ir)
(build_class_type_and_add_to_ir, build_function_decl)
(build_ir_node_from_die): Adjust. * abg-hash.cc (struct
decl_base::hash_as_member): Define. ({scope_type_decl,
enum_type_decl, typedef_decl}:#️⃣:operator()): Use the
decl_base::hash_as_member.
* src/abg-ir.cc (decl_base::decl_base): Adjust.
(decl_base::get_scope): New out-of-line getter.
(decl_base::{operator==, set_scope): Adjust.
(has_scope, is_member_decl, is_member_type)
(get_member_access_specifier, set_member_access_specifier)
(get_member_is_static, set_member_is_static, is_at_class_scope):
New function definitions.
(as_non_member_type, as_non_member_class_decl): Remove.
(get_node_name): Adjust.
(class_decl::{class_decl, set_earlier_declaration,
insert_member_decl, insert_member_type, add_member_type):
Likewise.
(class_decl::member_type::*) Remove.
* src/abg-reader.cc (read_access, build_qualified_type_decl)
(build_reference_type_def, build_typedef_decl)
(build_class_decl): Adjust.
* src/abg-writer.cc (write_access, write_member_type)
(write_class_decl): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-fwd.h (lookup_type_in_scope)
(lookup_var_decl_in_scope): New declarations.
* include/abg-ir.h (class_decl::get_is_declaration_only): Rename
is_declaration_only on this.
(class_decl::set_is_declaration_only):
* src/abg-comparison.cc (try_to_diff<class_decl>)
(class_diff::ensure_lookup_tables_populated)
(scope_diff::ensure_lookup_tables_populated): Update for the
get_is_declaration_only renaming.
* src/abg-dwarf-reader.cc (get_scope_for_die): Likewize.
(build_class_type_and_add_to_ir): Make sure that a member type or
data member is not already present in the class before adding it.
Also, if a decl-only class gets a data member, it's not a
decl-only class anymore.
* src/abg-hash.cc (class_decl:#️⃣:operator()): Update for the
get_is_declaration_only renaming.
* src/abg-ir.cc (scope_decl::find_iterator_for_member)
(look_through_decl_only_class): Likewise.
(lookup_type_in_scope, lookup_var_decl_in_scope, get_node_name)
(convert_node_to_decl, lookup_node_in_scope)
(lookup_type_in_scope): New definitions.
(class_decl::{set_definition_of_declaration,
set_earlier_declaration, operator==}): Update for the
get_is_declaration_only renaming.
* src/abg-reader.cc (build_class_decl): Likewise.
* src/abg-writer.cc (write_class_is_declaration_only): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (class_decl::is_struct_): New member.
(class_decl::class_decl): Take an additional is_struct member.
(class_decl::is_struct): New getter.
* src/abg-ir.cc (class_decl::class_decl): Initialize the new
is_struct_ data member.
(class_decl::get_pretty_representation): Tell struct and class
apart.
* abg-reader.cc (read_is_struct): New static function.
(build_class_decl): Capture the struct-ness of the class.
* src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir):
Likewise.
* src/abg-writer.cc (write_is_struct): New static function.
(write_class_decl): Write the struct-ness of the class.
* tests/data/test-read-dwarf/test1.abi: Update test.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (function_decl::parameter::get_name_id):
Declare new entry point.
* src/abg-comparison.cc
(function_decl_diff::ensure_lookup_tables_populated): Use the new
function_decl::parameter::get_name_id() for the unique name of the
parameter. Also, fix a little logic error: if a parm is deleted
and inserted, in all cases, consider it as not deleted.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (decl_base::{location_, name_,
qualified_parent_name_, qualified_name_}): Make these data members
protected rather than private.
(decl_base::get_qualified_parent_name): Declare new member
functions.
(decl_base::get_qualified_name): Make the core overload virtual.
Simplify the other overload that calls the core one.
(qualified_type_def::build_name): Declare new protected helper
function.
(qualified_type_def::{get_cv_quals_string_prefix,
get_qualified_name}): Declare new functions.
(pointer_type_def::{get_qualified_name}}): Likewise.
(class_decl::member_type::get_qualified_name): Likewise.
* src/abg-ir.cc (decl_base::get_qualified_parent_name): New
definition.
(decl_base::get_name): Make this out-of-line.
(decl_base::get_qualified_name): The signature of this got
simplified. Make it use the new get_qualified_parent_name.
(qualified_type_def::{build_name, get_qualified_name,
get_cv_quals_string_prefix}): New definitions.
(qualified_type_def::qualified_type_def): Update the constructor
to use the new build_name function above.
(pointer_type_def::get_qualified_name): New definitions.
(reference_type_def::get_qualified_name): Likewise.
(class_decl::member_type::get_qualified_name): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h
(class_decl::member_base::set_access_specifier): Put the setter
for access specifier here, where it belongs ...
(class_decl::member_type::set_access_specifier): ... not here.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (function_type::function_type): In the
constructor that takes a vector of parms, walk the vector and set
the indexes of the parms.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (class_decl::member_type::traverse): Declare new virtual
function.
(ir_node_visitor::visit): Declare new virtual function
* src/abg-ir.cc (class_decl::member_type::traverse): Implement the
traversal of a member type.
(ir_node_visitor::visit): Provide a default implementation for the
visitor of member type.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (class_decl::enum access_specifier): Give the enumerators
the same values as what the DWARF spec says.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (function_decl::parameter::get_type_name): Add
comment.
(function_decl::parameter::get_type_pretty_representation): New
member fn.
* src/abg-comparison.cc (represent): When representing changed
members, use their pretty representation.
(function_decl_diff::{ensure_lookup_tables_populated, report}): Use the
pretty representation of parameters type.
(typedef_diff::report): Enclose the underlying type in "'".
(corpus_diff::report): Add proper spacing.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (decl_base::qualified_name_): New member.
(decl_base::get_qualified_name): Cache the qualified name.
(decl_base::get_type): Return a reference on the shared pointer.
(method_type::get_class_type): Likewise.
(class_decl::get_definition_of_declaration): Likewise.
(class_decl::member_type::get_underlying_type): Likewise.
(class_decl::base_spec::get_base_class): Likewise.
* src/abg-ir.cc (decl_base::get_qualified_name): Implement the
caching.
(class_decl::member_type::get_qualified_name): Return a reference
on the shared pointer.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (function_decl::parameter::get_type_name): New
member function.
* src/abg-comparison.cc
(function_decl_diff::ensure_lookup_tables_populated): Use the new
member function above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>