libabigail
|
This contains the implementation of the comparison engine of libabigail. More...
#include <ctype.h>
#include <libgen.h>
#include <algorithm>
#include <sstream>
#include <set>
#include "abg-comparison-priv.h"
#include "abg-reporter-priv.h"
#include "abg-tools-utils.h"
Go to the source code of this file.
Namespaces | |
namespace | abigail |
Toplevel namespace for libabigail. | |
namespace | abigail::comparison |
utilities to compare abi artifacts | |
Macros | |
#define | do_count_diff_map_changes(diff_map, n_changes, n_filtered) |
#define | SKIP_MEM_FN_IF_VIRTUALITY_DISALLOWED |
Skip the processing of the current member function if its virtual-ness is disallowed by the user. More... | |
Functions | |
void | apply_filters (corpus_diff_sptr diff_tree) |
Apply the diff tree filters that have been associated to the context of the a given corpus_diff tree. As a result, the nodes of the @diff tree are going to be categorized into one of several of the categories of diff_category. More... | |
void | apply_suppressions (const corpus_diff *diff_tree) |
Walk a corpus_diff tree and appply the suppressions carried by the context. If the suppression applies to a given node then categorize the node into the SUPPRESSED_CATEGORY category and propagate that categorization. More... | |
void | apply_suppressions (corpus_diff_sptr diff_tree) |
Walk a diff tree and appply the suppressions carried by the context. If the suppression applies to a given node than categorize the node into the SUPPRESSED_CATEGORY category and propagate that categorization. More... | |
void | apply_suppressions (diff *diff_tree) |
Walk a given diff-sub tree and appply the suppressions carried by the context. If the suppression applies to a given node than categorize the node into the SUPPRESSED_CATEGORY category and propagate that categorization. More... | |
void | apply_suppressions (diff_sptr diff_tree) |
Walk a given diff-sub tree and appply the suppressions carried by the context. If the suppression applies to a given node than categorize the node into the SUPPRESSED_CATEGORY category and propagate that categorization. More... | |
void | categorize_redundancy (corpus_diff *diff_tree) |
Walk a given corpus_diff tree to categorize each of the nodes with respect to the REDUNDANT_CATEGORY. More... | |
void | categorize_redundancy (corpus_diff_sptr diff_tree) |
Walk a given corpus_diff tree to categorize each of the nodes with respect to the REDUNDANT_CATEGORY. More... | |
void | categorize_redundancy (diff *diff_tree) |
Walk a given diff sub-tree to categorize each of the nodes with respect to the REDUNDANT_CATEGORY. More... | |
void | categorize_redundancy (diff_sptr diff_tree) |
Walk a given diff sub-tree to categorize each of the nodes with respect to the REDUNDANT_CATEGORY. More... | |
void | clear_redundancy_categorization (corpus_diff *diff_tree) |
Walk a given corpus_diff tree to clear the REDUNDANT_CATEGORY out of the category of the nodes. More... | |
void | clear_redundancy_categorization (corpus_diff_sptr diff_tree) |
Walk a given corpus_diff tree to clear the REDUNDANT_CATEGORY out of the category of the nodes. More... | |
void | clear_redundancy_categorization (diff *diff_tree) |
Walk a given diff sub-tree to clear the REDUNDANT_CATEGORY out of the category of the nodes. More... | |
void | clear_redundancy_categorization (diff_sptr diff_tree) |
Walk a given diff sub-tree to clear the REDUNDANT_CATEGORY out of the category of the nodes. More... | |
subrange_diff_sptr | compute_diff (array_type_def::subrange_sptr first, array_type_def::subrange_sptr second, diff_context_sptr ctxt) |
Compute the diff between two instances of subrange_diff. More... | |
array_diff_sptr | compute_diff (array_type_def_sptr first, array_type_def_sptr second, diff_context_sptr ctxt) |
Compute the diff between two arrays. More... | |
base_diff_sptr | compute_diff (const class_decl::base_spec_sptr first, const class_decl::base_spec_sptr second, diff_context_sptr ctxt) |
Constructs the diff object representing a diff between two base class specifications. More... | |
class_diff_sptr | compute_diff (const class_decl_sptr first, const class_decl_sptr second, diff_context_sptr ctxt) |
Compute the set of changes between two instances of class_decl. More... | |
corpus_diff_sptr | compute_diff (const corpus_group_sptr &f, const corpus_group_sptr &s, diff_context_sptr ctxt) |
Compute the diff between two instances of corpus_group. More... | |
corpus_diff_sptr | compute_diff (const corpus_sptr f, const corpus_sptr s, diff_context_sptr ctxt) |
Compute the diff between two instances of corpus. More... | |
diff_sptr | compute_diff (const decl_base_sptr first, const decl_base_sptr second, diff_context_sptr ctxt) |
Compute the difference between two decls. The decls can represent either type declarations, or non-type declaration. More... | |
enum_diff_sptr | compute_diff (const enum_type_decl_sptr first, const enum_type_decl_sptr second, diff_context_sptr ctxt) |
Compute the set of changes between two instances of enum_type_decl. More... | |
fn_parm_diff_sptr | compute_diff (const function_decl::parameter_sptr first, const function_decl::parameter_sptr second, diff_context_sptr ctxt) |
Compute the difference between two function_decl::parameter_sptr; that is, between two function parameters. Return a resulting fn_parm_diff_sptr that represents the changes. More... | |
function_decl_diff_sptr | compute_diff (const function_decl_sptr first, const function_decl_sptr second, diff_context_sptr ctxt) |
Compute the diff between two function_decl. More... | |
function_type_diff_sptr | compute_diff (const function_type_sptr first, const function_type_sptr second, diff_context_sptr ctxt) |
Compute the diff between two instances of function_type. More... | |
ptr_to_mbr_diff_sptr | compute_diff (const ptr_to_mbr_type_sptr &first, const ptr_to_mbr_type_sptr &second, diff_context_sptr &ctxt) |
Compute the diff between two ptr_to_mbr_type types. More... | |
qualified_type_diff_sptr | compute_diff (const qualified_type_def_sptr first, const qualified_type_def_sptr second, diff_context_sptr ctxt) |
Compute the diff between two qualified types. More... | |
scope_diff_sptr | compute_diff (const scope_decl_sptr first, const scope_decl_sptr second, scope_diff_sptr d, diff_context_sptr ctxt) |
Compute the diff between two scopes. More... | |
scope_diff_sptr | compute_diff (const scope_decl_sptr first_scope, const scope_decl_sptr second_scope, diff_context_sptr ctxt) |
Compute the diff between two scopes. More... | |
translation_unit_diff_sptr | compute_diff (const translation_unit_sptr first, const translation_unit_sptr second, diff_context_sptr ctxt) |
Compute the diff between two translation_units. More... | |
diff_sptr | compute_diff (const type_base_sptr first, const type_base_sptr second, diff_context_sptr ctxt) |
Compute the difference between two types. More... | |
type_decl_diff_sptr | compute_diff (const type_decl_sptr first, const type_decl_sptr second, diff_context_sptr ctxt) |
Compute a diff between two type_decl. More... | |
typedef_diff_sptr | compute_diff (const typedef_decl_sptr first, const typedef_decl_sptr second, diff_context_sptr ctxt) |
Compute a diff between two typedef_decl. More... | |
union_diff_sptr | compute_diff (const union_decl_sptr first, const union_decl_sptr second, diff_context_sptr ctxt) |
Compute the difference between two union_decl types. More... | |
var_diff_sptr | compute_diff (const var_decl_sptr first, const var_decl_sptr second, diff_context_sptr ctxt) |
Compute the diff between two instances of var_decl. More... | |
pointer_diff_sptr | compute_diff (pointer_type_def_sptr first, pointer_type_def_sptr second, diff_context_sptr ctxt) |
Compute the diff between between two pointers. More... | |
reference_diff_sptr | compute_diff (reference_type_def_sptr first, reference_type_def_sptr second, diff_context_sptr ctxt) |
Compute the diff between two references. More... | |
distinct_diff_sptr | compute_diff_for_distinct_kinds (const type_or_decl_base_sptr first, const type_or_decl_base_sptr second, diff_context_sptr ctxt) |
Try to diff entities that are of distinct kinds. More... | |
diff_category | get_default_harmful_categories_bitmap () |
Getter of a bitmap made of the set of change categories that are considered harmful. More... | |
diff_category | get_default_harmless_categories_bitmap () |
Getter of a bitmap made of the set of change categories that are considered harmless. More... | |
type_base_sptr | get_leaf_type (qualified_type_def_sptr t) |
Return the first underlying type that is not a qualified type. More... | |
string | get_pretty_representation (diff *d) |
Get a copy of the pretty representation of a diff node. More... | |
const diff * | get_typedef_diff_underlying_type_diff (const diff *diff) |
Return the leaf underlying diff node of a typedef_diff node. More... | |
bool | has_basic_type_change_only (const diff *d) |
Test if a diff node is a decl diff that only carries a basic type change on its type diff sub-node. More... | |
const class_or_union_diff * | is_anonymous_class_or_union_diff (const diff *d) |
Test if a diff node is a class_or_union_diff between two anonymous classes or unions. More... | |
const array_diff * | is_array_diff (const diff *diff) |
Test if a diff node is a array_diff node. More... | |
const base_diff * | is_base_diff (const diff *diff) |
Test if a diff node is about differences between two base class specifiers. More... | |
bool | is_child_node_of_base_diff (const diff *diff) |
Test if a diff node is a child node of a base diff node. More... | |
bool | is_child_node_of_function_parm_diff (const diff *diff) |
Test if a diff node is a child node of a function parameter diff node. More... | |
const class_diff * | is_class_diff (const diff *diff) |
Test if a diff node is a class_diff node. More... | |
const class_or_union_diff * | is_class_or_union_diff (const diff *d) |
Test if a diff node is a class_or_union_diff node. More... | |
const corpus_diff * | is_corpus_diff (const diff *diff) |
Test if a diff node is a corpus_diff node. More... | |
const decl_diff_base * | is_decl_diff (const diff *diff) |
Test if a diff node is about differences between declarations. More... | |
const type_decl_diff * | is_diff_of_basic_type (const diff *d) |
Test if a diff node represents a diff between two basic types. More... | |
const type_decl_diff * | is_diff_of_basic_type (const diff *diff, bool allow_indirect_type) |
Test if a diff node represents a diff between two basic types, or between pointers, references or qualified type to basic types. More... | |
const class_or_union_diff * | is_diff_of_class_or_union_type (const diff *d) |
Test if a diff node represents a diff between two class or union types. More... | |
bool | is_diff_of_global_decls (const diff *d) |
Tests if a given diff node is to represent the changes between two gobal decls. More... | |
bool | is_diff_of_variadic_parameter (const diff *d) |
Test if a diff node represents the difference between a variadic parameter and something else. More... | |
bool | is_diff_of_variadic_parameter (const diff_sptr &d) |
Test if a diff node represents the difference between a variadic parameter and something else. More... | |
bool | is_diff_of_variadic_parameter_type (const diff *d) |
Test if a diff node represents the difference between a variadic parameter type and something else. More... | |
bool | is_diff_of_variadic_parameter_type (const diff_sptr &d) |
Test if a diff node represents the difference between a variadic parameter type and something else. More... | |
const distinct_diff * | is_distinct_diff (const diff *diff) |
Test if a diff node is about differences between two diff nodes of different kinds. More... | |
const enum_diff * | is_enum_diff (const diff *diff) |
Test if a diff node is a enum_diff node. More... | |
const fn_parm_diff * | is_fn_parm_diff (const diff *diff) |
Test if a diff node is about differences between two function parameters. More... | |
const function_decl_diff * | is_function_decl_diff (const diff *diff) |
Test if a diff node is about differences between functions. More... | |
const function_type_diff * | is_function_type_diff (const diff *diff) |
Test if a diff node is a function_type_diff node. More... | |
const function_type_diff * | is_function_type_diff_with_local_changes (const diff *diff) |
Test if a given diff node carries a function type change with local changes. More... | |
bool | is_less_than (const function_decl_diff &first, const function_decl_diff &second) |
Compare two function_decl_diff for the purpose of sorting. More... | |
const pointer_diff * | is_pointer_diff (const diff *diff) |
Test if a diff node is about differences between two pointers. More... | |
const qualified_type_diff * | is_qualified_type_diff (const diff *diff) |
Test if a diff node is about differences between two qualified types. More... | |
const reference_diff * | is_reference_diff (const diff *diff) |
Test if a diff node is about differences between two references. More... | |
bool | is_reference_or_ptr_diff_to_non_basic_nor_distinct_types (const diff *diff) |
Test if a diff node is a reference or pointer diff node to a change that is neither basic type change nor distinct type change. More... | |
const subrange_diff * | is_subrange_diff (const diff *diff) |
Test if a diff node is a subrange_diff node. More... | |
const type_diff_base * | is_type_diff (const diff *diff) |
Test if a diff node is about differences between types. More... | |
const typedef_diff * | is_typedef_diff (const diff *diff) |
Test if a diff node is a typedef_diff node. More... | |
const union_diff * | is_union_diff (const diff *diff) |
Test if a diff node is a union_diff node. More... | |
const var_diff * | is_var_diff (const diff *diff) |
Test if a diff node is about differences between variables. More... | |
diff_category | operator& (diff_category c1, diff_category c2) |
visiting_kind | operator& (visiting_kind l, visiting_kind r) |
The overloaded and operator for visiting_kind. More... | |
diff_category & | operator&= (diff_category &c1, diff_category c2) |
ostream & | operator<< (ostream &o, diff_category c) |
Serialize an instance of diff_category to an output stream. More... | |
diff_category | operator^ (diff_category c1, diff_category c2) |
diff_category | operator| (diff_category c1, diff_category c2) |
visiting_kind | operator| (visiting_kind l, visiting_kind r) |
The overloaded or operator for visiting_kind. More... | |
diff_category & | operator|= (diff_category &c1, diff_category c2) |
diff_category | operator~ (diff_category c) |
visiting_kind | operator~ (visiting_kind l) |
The overloaded 'bit inversion' operator for visiting_kind. More... | |
const diff * | peel_fn_parm_diff (const diff *dif) |
If a diff node is about changes between two function parameters get the diff node about changes between the types of the parameters. More... | |
const diff * | peel_pointer_diff (const diff *dif) |
If a diff node is about changes between two pointer types, get the diff node about changes between the underlying (pointed-to) types. More... | |
const diff * | peel_pointer_or_qualified_type_diff (const diff *dif) |
If a diff node is about changes between two pointer, reference or qualified types, get the diff node about changes between the underlying types. More... | |
const diff * | peel_qualified_diff (const diff *dif) |
If a diff node is about changes between two qualified types, get the diff node about changes between the underlying (non-qualified) types. More... | |
const diff * | peel_reference_diff (const diff *dif) |
If a diff node is about changes between two reference types, get the diff node about changes between the underlying (pointed-to) types. More... | |
const diff * | peel_typedef_diff (const diff *dif) |
If a diff node is about changes between two typedef types, get the diff node about changes between the underlying types. More... | |
const diff * | peel_typedef_or_qualified_type_diff (const diff *dif) |
If a diff node is about changes between two typedefs or qualified types, get the diff node about changes between the underlying types. More... | |
const diff * | peel_typedef_qualified_type_or_parameter_diff (const diff *dif) |
If a diff node is about changes between two typedefs or qualified types, get the diff node about changes between the underlying types. More... | |
void | print_diff_tree (corpus_diff *diff_tree, std::ostream &out) |
Emit a textual representation of a corpus_diff tree to an output stream. More... | |
void | print_diff_tree (corpus_diff_sptr diff_tree, std::ostream &o) |
Emit a textual representation of a corpus_diff tree to an output stream. More... | |
void | print_diff_tree (diff *diff_tree, ostream &out) |
Emit a textual representation of a diff sub-tree to an output stream. More... | |
void | print_diff_tree (diff_sptr diff_tree, std::ostream &o) |
Emit a textual representation of a diff sub-tree to an output stream. More... | |
void | propagate_categories (corpus_diff *diff_tree) |
Visit all the nodes of a given corpus tree. For each node that has a particular category set, propagate that category set up to its parent nodes. More... | |
void | propagate_categories (corpus_diff_sptr diff_tree) |
Visit all the nodes of a given corpus tree. For each node that has a particular category set, propagate that category set up to its parent nodes. More... | |
void | propagate_categories (diff *diff_tree) |
Visit all the nodes of a given sub-tree. For each node that has a particular category set, propagate that category set up to its parent nodes. More... | |
void | propagate_categories (diff_sptr diff_tree) |
Visit all the nodes of a given sub-tree. For each node that has a particular category set, propagate that category set up to its parent nodes. More... | |
void | sort_artifacts_set (const artifact_sptr_set_type &set, vector< type_or_decl_base_sptr > &sorted) |
Sort the set of ABI artifacts contained in a artifact_sptr_set_type. More... | |
void | sort_changed_data_members (changed_var_sptrs_type &to_sort) |
Sort (in place) a vector of changed data members. More... | |
void | sort_changed_enumerators (const string_changed_enumerator_map &enumerators_map, changed_enumerators_type &sorted) |
Sort a map of changed enumerators. More... | |
void | sort_data_members (const string_decl_base_sptr_map &data_members, vector< decl_base_sptr > &sorted) |
Sort a map of data members by the offset of their initial value. More... | |
void | sort_enumerators (const string_enumerator_map &enumerators_map, enum_type_decl::enumerators &sorted) |
Sort a map of enumerators by their value. More... | |
void | sort_string_base_diff_sptr_map (const string_base_diff_sptr_map &map, base_diff_sptrs_type &sorted) |
Sort a map of string -> base_diff_sptr into a sorted vector of base_diff_sptr. The base_diff_sptr are sorted by increasing value of their offset in their containing type. More... | |
void | sort_string_base_sptr_map (const string_base_sptr_map &m, class_decl::base_specs &sorted) |
Lexicographically sort base specifications found in instances of string_base_sptr_map. More... | |
void | sort_string_data_member_diff_sptr_map (const string_var_diff_sptr_map &map, var_diff_sptrs_type &sorted) |
Sort the values of a string_var_diff_sptr_map and store the result in a vector of var_diff_sptr. More... | |
void | sort_string_diff_ptr_map (const string_diff_ptr_map &map, diff_ptrs_type &sorted) |
Sort a map ofg string -> diff* into a vector of diff_ptr. The diff_ptr are sorted lexicographically wrt qualified names of their first subjects. More... | |
void | sort_string_diff_sptr_map (const string_diff_sptr_map &map, diff_sptrs_type &sorted) |
Sort a map ofg string -> diff_sptr into a vector of diff_sptr. The diff_sptr are sorted lexicographically wrt qualified names of their first subjects. More... | |
void | sort_string_elf_symbol_map (const string_elf_symbol_map &map, vector< elf_symbol_sptr > &sorted) |
Sort a map of string -> pointer to elf_symbol. More... | |
void | sort_string_fn_parm_diff_sptr_map (const string_fn_parm_diff_sptr_map &map, vector< fn_parm_diff_sptr > &sorted) |
Sort a map of changed function parameters by the indexes of the function parameters. More... | |
void | sort_string_fn_parm_diff_sptr_map (const unsigned_fn_parm_diff_sptr_map &map, vector< fn_parm_diff_sptr > &sorted) |
Sort a map of fn_parm_diff by the indexes of the function parameters. More... | |
void | sort_string_function_decl_diff_sptr_map (const string_function_decl_diff_sptr_map &map, function_decl_diff_sptrs_type &sorted) |
Sort the values of a string_function_decl_diff_sptr_map map and store the result in a vector of function_decl_diff_sptr objects. More... | |
void | sort_string_function_ptr_map (const string_function_ptr_map &map, vector< const function_decl * > &sorted) |
Sort an instance of string_function_ptr_map map and stuff a resulting sorted vector of pointers to function_decl. More... | |
void | sort_string_member_function_sptr_map (const string_member_function_sptr_map &map, class_or_union::member_functions &sorted) |
Sort a map that's an instance of string_member_function_sptr_map and fill a vector of member functions with the sorted result. More... | |
void | sort_string_parm_map (const string_parm_map &map, vector< function_decl::parameter_sptr > &sorted) |
Sort a map of string -> function parameters. More... | |
void | sort_string_type_base_sptr_map (string_type_base_sptr_map &map, vector< type_base_sptr > &sorted) |
Sort a map of string to type_base_sptr entities. More... | |
void | sort_string_var_diff_sptr_map (const string_var_diff_sptr_map &map, var_diff_sptrs_type &sorted) |
Sort of an instance of string_var_diff_sptr_map map. More... | |
void | sort_string_var_ptr_map (const string_var_ptr_map &map, vector< const var_decl * > &sorted) |
Sort a map of string -> pointer to var_decl. More... | |
void | sort_string_virtual_member_function_diff_sptr_map (const string_function_decl_diff_sptr_map &map, function_decl_diff_sptrs_type &sorted) |
Sort an map of string -> virtual member function into a vector of virtual member functions. The virtual member functions are sorted by increasing order of their virtual index. More... | |
void | sort_unsigned_data_member_diff_sptr_map (const unsigned_var_diff_sptr_map map, var_diff_sptrs_type &sorted) |
Sort the values of a unsigned_var_diff_sptr_map map and store the result into a vector of var_diff_sptr. More... | |
template<typename DiffType > | |
diff_sptr | try_to_diff (const type_or_decl_base_sptr first, const type_or_decl_base_sptr second, diff_context_sptr ctxt) |
</distinct_diff> More... | |
template<> | |
diff_sptr | try_to_diff< class_decl > (const type_or_decl_base_sptr first, const type_or_decl_base_sptr second, diff_context_sptr ctxt) |
This is a specialization of try_to_diff() template to diff instances of class_decl. More... | |
This contains the implementation of the comparison engine of libabigail.
Definition in file abg-comparison.cc.
#define do_count_diff_map_changes | ( | diff_map, | |
n_changes, | |||
n_filtered | |||
) |
Definition at line 10470 of file abg-comparison.cc.
#define SKIP_MEM_FN_IF_VIRTUALITY_DISALLOWED |
Skip the processing of the current member function if its virtual-ness is disallowed by the user.
This is to be used in the member functions below that are used to count the number of filtered inserted, deleted and changed member functions.
Definition at line 4901 of file abg-comparison.cc.