15 #include "abg-internal.h"
20 ABG_BEGIN_EXPORT_DECLARATIONS
24 #include "abg-suppression.h"
29 ABG_END_EXPORT_DECLARATIONS
41 using namespace comparison;
43 using std::dynamic_pointer_cast;
61 for (
const char *
const * name = names; name < names + count; ++name)
76 suppression_base::suppression_base(
const string& label)
77 : priv_(new
priv(label))
90 suppression_base::suppression_base(
const string& label,
91 const string& file_name_regex_str,
92 const string& file_name_not_regex_str)
93 : priv_(new
priv(label,
95 file_name_not_regex_str))
106 {
return priv_->drops_artifact_;}
117 {priv_->drops_artifact_ = f;}
128 {
return priv_->is_artificial_;}
138 {priv_->is_artificial_ = f;}
145 {
return priv_->label_;}
152 {priv_->label_ = label;}
164 {priv_->file_name_regex_str_ = regexp;}
176 {
return priv_->file_name_regex_str_;}
189 {priv_->file_name_not_regex_str_ = regexp;}
202 {
return priv_->file_name_not_regex_str_;}
226 {priv_->soname_regex_str_ = regexp;}
238 {
return priv_->soname_regex_str_;}
251 {priv_->soname_not_regex_str_ = regexp;}
264 {
return priv_->soname_not_regex_str_;}
334 result = dynamic_pointer_cast<negated_suppression_base>(s);
355 string first_soname = ctxt.
get_corpus_diff()->first_corpus()->get_soname(),
361 if (!suppr.priv_->matches_soname(first_soname)
362 && !suppr.priv_->matches_soname(second_soname))
381 names_of_binaries_match(
const suppression_base& suppr,
382 const diff_context &ctxt)
385 string first_binary_path = ctxt.get_corpus_diff()->first_corpus()->get_path(),
386 second_binary_path = ctxt.get_corpus_diff()->second_corpus()->get_path();
388 if (!suppr.has_file_name_related_property())
391 if (!suppr.priv_->matches_binary_name(first_binary_path)
392 && !suppr.priv_->matches_binary_name(second_binary_path))
398 suppression_base::~suppression_base()
402 read_type_suppression(
const ini::config::section& section);
405 read_function_suppression(
const ini::config::section& section);
408 read_variable_suppression(
const ini::config::section& section);
411 read_file_suppression(
const ini::config::section& section);
424 read_suppressions(
const ini::config& config,
428 for (ini::config::sections_type::const_iterator i =
429 config.get_sections().begin();
430 i != config.get_sections().end();
432 if ((s = read_type_suppression(**i))
433 || (s = read_function_suppression(**i))
434 || (s = read_variable_suppression(**i))
435 || (s = read_file_suppression(**i)))
436 suppressions.push_back(s);
447 read_suppressions(std::istream& input,
451 read_suppressions(*
config, suppressions);
461 read_suppressions(
const string& file_path,
465 read_suppressions(*
config, suppressions);
487 type_suppression::type_suppression(
const string& label,
488 const string& type_name_regexp,
489 const string& type_name)
491 priv_(new
priv(type_name_regexp,
499 type_suppression::~type_suppression()
511 {priv_->type_name_regex_str_ = name_regex_str;}
522 {
return priv_->type_name_regex_str_;}
533 {priv_->set_type_name_not_regex_str(r);}
544 {
return priv_->get_type_name_not_regex_str();}
552 {priv_->type_name_ = name;}
560 {
return priv_->type_name_;}
568 {
return priv_->consider_type_kind_;}
576 {priv_->consider_type_kind_ = f;}
587 {priv_->type_kind_ = k;}
598 {
return priv_->type_kind_;}
607 {
return priv_->consider_reach_kind_;}
617 {priv_->consider_reach_kind_ = f;}
626 {
return priv_->reach_kind_;}
635 {priv_->reach_kind_ = k;}
642 {
return priv_->has_size_change_;}
649 {priv_->has_size_change_ = flag;}
655 const unordered_set<string>&
657 {
return priv_->potential_data_members_;}
665 (
const string_set_type& s)
const
666 {priv_->potential_data_members_ = s;}
673 {
return priv_->potential_data_members_regex_str_;}
680 (
const string& d)
const
681 {priv_->potential_data_members_regex_str_ = d;}
690 {priv_->insertion_ranges_ = r;}
699 {
return priv_->insertion_ranges_;}
708 {
return priv_->insertion_ranges_;}
715 const unordered_set<string>&
717 {
return priv_->source_locations_to_keep_;}
724 unordered_set<string>&
726 {
return priv_->source_locations_to_keep_;}
734 (
const unordered_set<string>& l)
735 {priv_->source_locations_to_keep_ = l;}
743 {
return priv_->source_location_to_keep_regex_str_;}
751 {priv_->source_location_to_keep_regex_str_ = r;}
759 const vector<string>&
761 {
return priv_->changed_enumerator_names_;}
771 {priv_->changed_enumerator_names_ = n;}
801 if (comparison::filtering::has_virtual_mem_fn_change(d))
822 d =
is_type_diff(ptr_diff->underlying_type_diff().get());
835 d =
is_type_diff(ref_diff->underlying_type_diff().get());
848 d =
is_type_diff(ptr_diff->underlying_type_diff().get());
854 d =
is_type_diff(ref_diff->underlying_type_diff().get());
863 type_base_sptr ft, st;
904 if (!f->find_data_member(var_name))
911 priv_->get_potential_data_member_names_regex())
913 bool data_member_matched =
false;
916 if (
regex::match(data_member_name_regex, dm->get_name()))
918 data_member_matched =
true;
922 if (!data_member_matched)
953 decl_base_sptr member = m.second;
954 bool matched =
false;
959 first_type_decl.get()))
970 decl_base_sptr member = m.second;
971 bool matched =
false;
976 first_type_decl.get()))
994 && (enum_dif->
first_enum()->get_size_in_bits()
1002 bool matched =
true;
1003 for (string_changed_enumerator_map::const_iterator i =
1040 if (!names_of_binaries_match(*
this, *ctxt))
1045 if (!sonames_of_binaries_match(*
this, *ctxt))
1066 const type_base_sptr &type)
1073 bool matches =
true;
1076 case type_suppression::UNKNOWN_TYPE_KIND:
1077 case type_suppression::CLASS_TYPE_KIND:
1081 case type_suppression::STRUCT_TYPE_KIND:
1084 if (!klass || !klass->is_struct())
1088 case type_suppression::UNION_TYPE_KIND:
1092 case type_suppression::ENUM_TYPE_KIND:
1096 case type_suppression::ARRAY_TYPE_KIND:
1100 case type_suppression::TYPEDEF_TYPE_KIND:
1104 case type_suppression::BUILTIN_TYPE_KIND:
1131 const string& type_name)
1134 || s.priv_->get_type_name_regex()
1135 || s.priv_->get_type_name_not_regex())
1151 s.priv_->get_type_name_regex())
1158 s.priv_->get_type_name_not_regex())
1182 const type_base_sptr& type)
1202 string loc_path, loc_path_base;
1203 unsigned loc_line = 0, loc_column = 0;
1204 loc.
expand(loc_path, loc_line, loc_column);
1206 if (
regex_t_sptr regexp = s.priv_->get_source_location_to_keep_regex())
1221 || s.priv_->get_source_location_to_keep_regex())
1241 const type_base_sptr& type)
1259 if (cl->get_is_declaration_only())
1263 ABG_ASSERT(!cl->get_definition_of_declaration());
1272 || s.priv_->get_source_location_to_keep_regex())
1295 const string& type_name,
1315 if (!suppression_matches_type_no_name(*
this, type))
1337 if (!suppression_matches_type_no_name(*
this, type))
1347 struct type_suppression::insertion_range::priv
1376 : priv_(new priv(begin, end))
1386 {
return priv_->begin_;}
1395 {
return priv_->end_;}
1465 value = b->as_integer();
1471 if ((fn_call->get_name() ==
"offset_of"
1472 || fn_call->get_name() ==
"offset_after"
1473 || fn_call->get_name() ==
"offset_of_first_data_member_regexp"
1474 || fn_call->get_name() ==
"offset_of_last_data_member_regexp")
1475 && fn_call->get_arguments().size() == 1)
1477 if (fn_call->get_name() ==
"offset_of"
1478 || fn_call->get_name() ==
"offset_after")
1480 string member_name = fn_call->get_arguments()[0];
1481 for (class_decl::data_members::const_iterator it =
1488 if ((*it)->get_name() == member_name)
1490 if (fn_call->get_name() ==
"offset_of")
1492 else if (fn_call->get_name() ==
"offset_after")
1497 (*it)->get_type()->get_size_in_bits();
1507 else if (fn_call->get_name() ==
"offset_of_first_data_member_regexp"
1508 || fn_call->get_name() ==
"offset_of_last_data_member_regexp")
1510 string name_regexp = fn_call->get_arguments()[0];
1514 if (fn_call->get_name() ==
"offset_of_first_data_member_regexp")
1516 else if (fn_call->get_name() ==
"offset_of_last_data_member_regexp")
1540 return value == std::numeric_limits<uint64_t>::max();
1553 {
return dynamic_pointer_cast<type_suppression::insertion_range::integer_boundary>(b);}
1566 {
return dynamic_pointer_cast<type_suppression::insertion_range::fn_call_expr_boundary>(b);}
1570 struct type_suppression::insertion_range::boundary::priv
1588 struct type_suppression::insertion_range::integer_boundary::priv
1596 priv(uint64_t value)
1605 type_suppression::insertion_range::integer_boundary::integer_boundary(uint64_t value)
1606 : priv_(new priv(value))
1615 {
return priv_->value_;}
1620 type_suppression::insertion_range::integer_boundary::operator uint64_t()
const
1621 {
return as_integer();}
1629 struct type_suppression::insertion_range::fn_call_expr_boundary::priv
1646 type_suppression::insertion_range::fn_call_expr_boundary::
1648 : priv_(new priv(expr))
1656 {
return priv_->expr_;}
1662 {
return as_function_call_expr();}
1679 {
return dynamic_pointer_cast<type_suppression>(suppr);}
1702 const string& type_name_regexp,
1703 const string& type_name)
1737 read_type_kind_string(
const string& input)
1739 if (input ==
"class")
1740 return type_suppression::CLASS_TYPE_KIND;
1741 else if (input ==
"struct")
1742 return type_suppression::STRUCT_TYPE_KIND;
1743 else if (input ==
"union")
1744 return type_suppression::UNION_TYPE_KIND;
1745 else if (input ==
"enum")
1746 return type_suppression::ENUM_TYPE_KIND;
1747 else if (input ==
"array")
1748 return type_suppression::ARRAY_TYPE_KIND;
1749 else if (input ==
"typedef")
1750 return type_suppression::TYPEDEF_TYPE_KIND;
1751 else if (input ==
"builtin")
1752 return type_suppression::BUILTIN_TYPE_KIND;
1754 return type_suppression::UNKNOWN_TYPE_KIND;
1765 read_suppression_reach_kind(
const string& input)
1767 if (input ==
"direct")
1769 else if (input ==
"pointer")
1771 else if (input ==
"reference")
1773 else if (input ==
"reference-or-pointer")
1787 read_type_suppression(
const ini::config::section& section)
1791 if (section.get_name() !=
"suppress_type"
1792 && section.get_name() !=
"allow_type")
1795 static const char *
const sufficient_props[] = {
1797 "file_name_not_regexp",
1799 "soname_not_regexp",
1804 "source_location_not_in",
1805 "source_location_not_regexp",
1808 sizeof(sufficient_props)/
sizeof(
char*),
1817 string drop_artifact_str = drop_artifact
1818 ? drop_artifact->get_value()->as_string()
1824 string has_size_change_str = has_size_change
1825 ? has_size_change->get_value()->as_string()
1830 string label_str = label ? label->get_value()->as_string() :
"";
1834 string file_name_regex_str =
1835 file_name_regex_prop ? file_name_regex_prop->get_value()->as_string() :
"";
1839 string file_name_not_regex_str =
1840 file_name_not_regex_prop
1841 ? file_name_not_regex_prop->get_value()->as_string()
1846 string soname_regex_str =
1847 soname_regex_prop ? soname_regex_prop->get_value()->as_string() :
"";
1851 string soname_not_regex_str =
1852 soname_not_regex_prop
1853 ? soname_not_regex_prop->get_value()->as_string()
1858 string name_regex_str = name_regex_prop
1859 ? name_regex_prop->get_value()->as_string()
1864 string name_not_regex_str = name_not_regex_prop
1865 ? name_not_regex_prop->get_value()->as_string()
1870 string name_str = name_prop
1871 ? name_prop->get_value()->as_string()
1875 section.find_property(
"source_location_not_in");
1876 unordered_set<string> srcloc_not_in;
1877 if (srcloc_not_in_prop)
1880 srcloc_not_in.insert(p->get_value()->as_string());
1887 vector<string>::const_iterator i;
1888 for (i = list_property->get_value()->get_content().begin();
1889 i != list_property->get_value()->get_content().end();
1891 srcloc_not_in.insert(*i);
1898 string srcloc_not_regexp_str;
1899 if (srcloc_not_regexp_prop)
1900 srcloc_not_regexp_str = srcloc_not_regexp_prop->get_value()->as_string();
1902 bool consider_type_kind =
false;
1907 consider_type_kind =
true;
1909 read_type_kind_string(type_kind_prop->get_value()->as_string());
1912 bool consider_reach_kind =
false;
1917 consider_reach_kind =
true;
1919 read_suppression_reach_kind(reach_kind_prop->get_value()->as_string());
1923 string_set_type potential_data_member_names;
1932 tv = prop->get_value();
1935 sv = prop->get_value();
1940 && tv->get_value_items().size() == 1
1953 potential_data_member_names.insert(name);
1956 for (
const string& name : val->get_content())
1957 potential_data_member_names.insert(name);
1961 string name = sv->as_string();
1962 potential_data_member_names.insert(name);
1967 string potential_data_member_names_regexp_str;
1970 potential_data_member_names_regexp_str = prop->get_value()->as_string();
1973 vector<type_suppression::insertion_range_sptr> insert_ranges;
1974 bool consider_data_member_insertion =
false;
1980 string ins_point = prop->get_value()->as_string();
1982 if (ins_point ==
"end")
1984 else if (isdigit(ins_point[0]))
1986 (atoi(ins_point.c_str()));
1995 (
new type_suppression::insertion_range(begin, end));
1996 insert_ranges.push_back(insert_range);
1997 consider_data_member_insertion =
true;
2003 (
"has_data_member_inserted_between")))
2016 && v->get_value_items().size() == 1
2023 string str = val->get_content()[0];
2027 else if (isdigit(str[0]))
2029 (atoi(str.c_str()));
2036 str = val->get_content()[1];
2040 else if (isdigit(str[0]))
2042 (atoi(str.c_str()));
2050 (
new type_suppression::insertion_range(begin, end));
2051 insert_ranges.push_back(insert_range);
2052 consider_data_member_insertion =
true;
2071 (
"has_data_members_inserted_between")))
2073 bool is_well_formed =
true;
2074 for (vector<ini::property_value_sptr>::const_iterator i =
2075 prop->get_value()->get_value_items().begin();
2076 is_well_formed && i != prop->get_value()->get_value_items().end();
2082 || tuple_value->get_value_items().size() != 1
2085 is_well_formed =
false;
2090 if (list_value->get_content().size() != 2)
2092 is_well_formed =
false;
2097 string str = list_value->get_content()[0];
2101 else if (isdigit(str[0]))
2104 (atoi(str.c_str()));
2111 str = list_value->get_content()[1];
2115 else if (isdigit(str[0]))
2117 (atoi(str.c_str()));
2125 (
new type_suppression::insertion_range(begin, end));
2126 insert_ranges.push_back(insert_range);
2127 consider_data_member_insertion =
true;
2129 if (!is_well_formed)
2143 section.find_property(
"changed_enumerators");
2145 vector<string> changed_enumerator_names;
2146 if (changed_enumerators_prop)
2150 changed_enumerator_names =
2151 p->get_value()->get_content();
2154 changed_enumerator_names.push_back(p->get_value()->as_string());
2157 if (section.get_name() ==
"suppress_type")
2158 result.reset(
new type_suppression(label_str, name_regex_str, name_str));
2159 else if (section.get_name() ==
"allow_type")
2160 result.reset(
new negated_type_suppression(label_str, name_regex_str,
2163 if (consider_type_kind)
2165 result->set_consider_type_kind(
true);
2166 result->set_type_kind(type_kind);
2169 if (consider_reach_kind)
2171 result->set_consider_reach_kind(
true);
2172 result->set_reach_kind(reach_kind);
2175 if (!potential_data_member_names.empty())
2176 result->set_potential_data_member_names(potential_data_member_names);
2178 if (!potential_data_member_names_regexp_str.empty())
2179 result->set_potential_data_member_names_regex_str
2180 (potential_data_member_names_regexp_str);
2182 if (consider_data_member_insertion)
2183 result->set_data_member_insertion_ranges(insert_ranges);
2185 if (!name_not_regex_str.empty())
2186 result->set_type_name_not_regex_str(name_not_regex_str);
2188 if (!file_name_regex_str.empty())
2189 result->set_file_name_regex_str(file_name_regex_str);
2191 if (!file_name_not_regex_str.empty())
2192 result->set_file_name_not_regex_str(file_name_not_regex_str);
2194 if (!soname_regex_str.empty())
2195 result->set_soname_regex_str(soname_regex_str);
2197 if (!soname_not_regex_str.empty())
2198 result->set_soname_not_regex_str(soname_not_regex_str);
2200 if (!srcloc_not_in.empty())
2201 result->set_source_locations_to_keep(srcloc_not_in);
2203 if (!srcloc_not_regexp_str.empty())
2204 result->set_source_location_to_keep_regex_str(srcloc_not_regexp_str);
2206 if ((drop_artifact_str ==
"yes" || drop_artifact_str ==
"true")
2207 && ((!name_regex_str.empty()
2208 || !name_str.empty()
2209 || !srcloc_not_regexp_str.empty()
2210 || !srcloc_not_in.empty())))
2211 result->set_drops_artifact_from_ir(
true);
2213 if (has_size_change_str ==
"yes" || has_size_change_str ==
"true")
2214 result->set_has_size_change(
true);
2216 if (result->get_type_kind() == type_suppression::ENUM_TYPE_KIND
2217 && !changed_enumerator_names.empty())
2218 result->set_changed_enumerator_names(changed_enumerator_names);
2236 function_suppression::parameter_spec::parameter_spec(
size_t i,
2238 const string& tn_regex)
2239 : priv_(new
priv(i, tn, tn_regex))
2249 {
return priv_->index_;}
2257 {priv_->index_ = i;}
2264 {
return priv_->type_name_;}
2272 {priv_->type_name_ = tn;}
2285 {
return priv_->type_name_regex_str_;}
2299 (
const string& type_name_regex_str)
2300 {priv_->type_name_regex_str_ = type_name_regex_str;}
2369 const string& ret_tn,
2370 const string& ret_tr,
2372 const string& sym_n,
2373 const string& sym_nr,
2374 const string& sym_v,
2375 const string& sym_vr)
2377 priv_(new
priv(name, nr, ret_tn, ret_tr, ps,
2378 sym_n, sym_nr, sym_v, sym_vr))
2381 function_suppression::~function_suppression()
2394 if (s ==
"function-subtype-change")
2396 else if (s ==
"added-function")
2398 else if (s ==
"deleted-function")
2400 else if (s ==
"all")
2403 return UNDEFINED_CHANGE_KIND;
2411 {
return priv_->change_kind_;}
2418 {priv_->change_kind_ = k;}
2427 {
return priv_->name_;}
2445 {
return priv_->name_regex_str_;}
2454 {priv_->name_regex_str_ = r;}
2464 {
return priv_->name_not_regex_str_;}
2474 {priv_->name_not_regex_str_ = r;}
2483 {
return priv_->return_type_name_;}
2492 {priv_->return_type_name_ = tr;}
2508 {
return priv_->return_type_regex_str_;}
2524 {priv_->return_type_regex_str_ = r;}
2536 {
return priv_->parm_specs_;}
2549 {priv_->parm_specs_ = p;}
2556 {priv_->parm_specs_.push_back(p);}
2567 {
return priv_->symbol_name_;}
2578 {priv_->symbol_name_ = n;}
2594 {
return priv_->symbol_name_regex_str_;}
2610 {priv_->symbol_name_regex_str_ = r;}
2629 {
return priv_->symbol_name_not_regex_str_;}
2649 {priv_->symbol_name_not_regex_str_ = r;}
2660 {
return priv_->symbol_version_;}
2671 {priv_->symbol_version_ = v;}
2686 {
return priv_->symbol_version_regex_str_;}
2701 {priv_->symbol_version_regex_str_ = r;}
2709 {
return priv_->allow_other_aliases_;}
2717 {priv_->allow_other_aliases_ = f;}
2771 if (!names_of_binaries_match(*
this, *ctxt))
2776 if (!sonames_of_binaries_match(*
this, *ctxt))
2791 && fn->
get_symbol()->get_alias_from_name(fname))
2801 symbol_name = sym->get_name();
2802 if (sym->has_aliases() && sym->get_alias_from_name(fname))
2805 a && !a->is_main_symbol();
2806 a = a->get_next_alias())
2807 if (a->get_name() != symbol_name)
2817 const regex_t_sptr name_regex = priv_->get_name_regex();
2825 && fn->
get_symbol()->get_alias_from_name(fname))
2835 symbol_name = sym->get_name();
2836 if (sym->has_aliases())
2839 a && !a->is_main_symbol();
2840 a = a->get_next_alias())
2848 const regex_t_sptr name_not_regex = priv_->get_name_not_regex();
2856 && fn->
get_symbol()->get_alias_from_name(fname))
2866 symbol_name = sym->get_name();
2867 if (sym->has_aliases())
2870 a && !a->is_main_symbol();
2871 a = a->get_next_alias())
2881 string fn_return_type_name = fn->
get_type()->get_return_type()
2882 ?
static_cast<string>
2894 const regex_t_sptr return_type_regex = priv_->get_return_type_regex();
2895 if (return_type_regex
2896 && !
regex::match(return_type_regex, fn_return_type_name))
2902 string fn_sym_name, fn_sym_version;
2906 fn_sym_name = sym->get_name();
2907 fn_sym_version = sym->get_version().str();
2920 if (sym->has_aliases())
2923 a && !a->is_main_symbol();
2924 a = a->get_next_alias())
2925 if (a->get_name() != fn_sym_name)
2932 const regex_t_sptr symbol_name_regex = priv_->get_symbol_name_regex();
2933 if (symbol_name_regex && !
regex::match(symbol_name_regex, fn_sym_name))
2937 priv_->get_symbol_name_not_regex();
2938 if (symbol_name_not_regex
2947 if (sym->has_aliases())
2950 a && !a->is_main_symbol();
2951 a = a->get_next_alias())
2953 if (symbol_name_regex
2957 if (symbol_name_not_regex
2975 priv_->get_symbol_version_regex();
2976 if (symbol_version_regex
2977 && !
regex::match(symbol_version_regex, fn_sym_version))
2985 type_base_sptr parm_type;
2987 for (parameter_specs_type::const_iterator p =
2992 size_t index = (*p)->get_index();
2994 fn_type->get_parm_at_index_from_first_non_implicit_parm(index);
2998 string fn_parm_type_qualified_name;
3001 parm_type = fn_parm->get_type();
3002 fn_parm_type_qualified_name =
3006 const string& tn = (*p)->get_parameter_type_name();
3009 if (tn != fn_parm_type_qualified_name)
3015 (*p)->priv_->get_type_name_regex();
3016 if (parm_type_name_regex)
3019 fn_parm_type_qualified_name))
3084 if (!names_of_binaries_match(*
this, *ctxt))
3090 if (!sonames_of_binaries_match(*
this, *ctxt))
3096 bool no_symbol_name =
false, no_symbol_version =
false;
3106 const regex_t_sptr symbol_name_regex = priv_->get_symbol_name_regex();
3107 if (symbol_name_regex && !
regex::match(symbol_name_regex, sym_name))
3111 no_symbol_name =
true;
3122 priv_->get_symbol_version_regex();
3123 if (symbol_version_regex
3128 no_symbol_version =
true;
3130 if (no_symbol_name && no_symbol_version)
3165 {
return dynamic_pointer_cast<function_suppression>(suppr);}
3180 (
static_cast<unsigned>(l) &
static_cast<unsigned>(r));
3196 (
static_cast<unsigned>(l) |
static_cast<unsigned>(r));
3209 const string& var_name)
3216 else if (
regex_t_sptr regexp = s.priv_->get_name_not_regex())
3221 else if (s.priv_->name_.empty())
3225 if (s.priv_->name_ != var_name)
3243 const string& var_linkage_name)
3245 if (
regex_t_sptr regexp = s.priv_->get_symbol_name_regex())
3251 s.priv_->get_symbol_name_not_regex())
3256 else if (s.priv_->symbol_name_.empty())
3260 if (s.priv_->symbol_name_ != var_linkage_name)
3278 const string& type_name)
3280 if (
regex_t_sptr regexp = s.priv_->get_type_name_regex())
3304 read_parameter_spec_from_string(
const string& str)
3306 string::size_type cur = 0;
3310 for (; cur < str.size(); ++cur)
3311 if (!isspace(str[cur]))
3316 if (str[cur] ==
'\'')
3319 for (; cur < str.size(); ++cur)
3320 if (!isdigit(str[cur]))
3323 index_str += str[cur];
3327 for (; cur < str.size(); ++cur)
3328 if (!isspace(str[cur]))
3331 bool is_regex =
false;
3332 if (str[cur] ==
'/')
3340 for (; cur < str.size(); ++cur)
3341 if (!isspace(str[cur]))
3343 if (is_regex && str[cur] ==
'/')
3345 type_name += str[cur];
3348 if (is_regex && str[cur] ==
'/')
3351 if (!index_str.empty() || !type_name.empty())
3353 std::string type_name_regex;
3356 type_name_regex = type_name;
3359 function_suppression::parameter_spec* p =
3360 new function_suppression::parameter_spec(atoi(index_str.c_str()),
3361 type_name, type_name_regex);
3376 read_function_suppression(
const ini::config::section& section)
3380 if (section.get_name() !=
"suppress_function")
3383 static const char *
const sufficient_props[] = {
3386 "file_name_not_regexp",
3388 "soname_not_regexp",
3394 "return_type_regexp",
3396 "symbol_name_regexp",
3397 "symbol_name_not_regexp",
3399 "symbol_version_regexp",
3402 sizeof(sufficient_props)/
sizeof(
char*),
3411 string drop_artifact_str = drop_artifact
3412 ? drop_artifact->get_value()->as_string()
3417 string change_kind_str = change_kind_prop
3418 ? change_kind_prop->get_value()->as_string()
3423 string label_str = label_prop
3424 ? label_prop->get_value()->as_string()
3429 string file_name_regex_str =
3430 file_name_regex_prop ? file_name_regex_prop->get_value()->as_string() :
"";
3434 string file_name_not_regex_str =
3435 file_name_not_regex_prop
3436 ? file_name_not_regex_prop->get_value()->as_string()
3441 string soname_regex_str =
3442 soname_regex_prop ? soname_regex_prop->get_value()->as_string() :
"";
3446 string soname_not_regex_str =
3447 soname_not_regex_prop
3448 ? soname_not_regex_prop->get_value()->as_string()
3453 string name = name_prop
3454 ? name_prop->get_value()->as_string()
3459 string name_regex_str = name_regex_prop
3460 ? name_regex_prop->get_value()->as_string()
3465 string name_not_regex_str = name_not_regex_prop
3466 ? name_not_regex_prop->get_value()->as_string()
3471 string return_type_name = return_type_name_prop
3472 ? return_type_name_prop->get_value()->as_string()
3477 string return_type_regex_str = return_type_regex_prop
3478 ? return_type_regex_prop->get_value()->as_string()
3483 string sym_name = sym_name_prop
3484 ? sym_name_prop->get_value()->as_string()
3489 string sym_name_regex_str = sym_name_regex_prop
3490 ? sym_name_regex_prop->get_value()->as_string()
3495 string sym_name_not_regex_str = sym_name_not_regex_prop
3496 ? sym_name_not_regex_prop->get_value()->as_string()
3501 string sym_version = sym_ver_prop
3502 ? sym_ver_prop->get_value()->as_string()
3507 string sym_ver_regex_str = sym_ver_regex_prop
3508 ? sym_ver_regex_prop->get_value()->as_string()
3513 string allow_other_aliases = allow_other_aliases_prop
3514 ? allow_other_aliases_prop->get_value()->as_string()
3519 for (ini::config::properties_type::const_iterator p =
3520 section.get_properties().begin();
3521 p != section.get_properties().end();
3523 if ((*p)->get_name() ==
"parameter")
3527 if ((parm = read_parameter_spec_from_string
3528 (prop->get_value()->as_string())))
3529 parms.push_back(parm);
3532 result.reset(
new function_suppression(label_str,
3536 return_type_regex_str,
3541 sym_ver_regex_str));
3543 if ((drop_artifact_str ==
"yes" || drop_artifact_str ==
"true")
3545 || !name_regex_str.empty()
3546 || !name_not_regex_str.empty()
3547 || !sym_name.empty()
3548 || !sym_name_regex_str.empty()
3549 || !sym_name_not_regex_str.empty()))
3550 result->set_drops_artifact_from_ir(
true);
3552 if (!change_kind_str.empty())
3553 result->set_change_kind
3556 if (!allow_other_aliases.empty())
3557 result->set_allow_other_aliases(allow_other_aliases ==
"yes"
3558 || allow_other_aliases ==
"true");
3560 if (!name_not_regex_str.empty())
3561 result->set_name_not_regex_str(name_not_regex_str);
3563 if (!sym_name_not_regex_str.empty())
3564 result->set_symbol_name_not_regex_str(sym_name_not_regex_str);
3566 if (!file_name_regex_str.empty())
3567 result->set_file_name_regex_str(file_name_regex_str);
3569 if (!file_name_not_regex_str.empty())
3570 result->set_file_name_not_regex_str(file_name_not_regex_str);
3572 if (!soname_regex_str.empty())
3573 result->set_soname_regex_str(soname_regex_str);
3575 if (!soname_not_regex_str.empty())
3576 result->set_soname_not_regex_str(soname_not_regex_str);
3638 const string& name_regex_str,
3639 const string& symbol_name,
3640 const string& symbol_name_regex_str,
3641 const string& symbol_version,
3642 const string& symbol_version_regex,
3643 const string& type_name,
3644 const string& type_name_regex_str)
3646 priv_(new
priv(name, name_regex_str,
3647 symbol_name, symbol_name_regex_str,
3648 symbol_version, symbol_version_regex,
3649 type_name, type_name_regex_str))
3667 if (s ==
"variable-subtype-change")
3669 else if (s ==
"added-variable")
3671 else if (s ==
"deleted-variable")
3673 else if (s ==
"all")
3676 return UNDEFINED_CHANGE_KIND;
3684 {
return priv_->change_kind_;}
3691 {priv_->change_kind_ = k;}
3700 {
return priv_->name_;}
3721 {
return priv_->name_regex_str_;}
3733 {priv_->name_regex_str_ = r;}
3740 {
return priv_->name_not_regex_str_;}
3747 {priv_->name_not_regex_str_ = r;}
3758 {
return priv_->symbol_name_;}
3769 {priv_->symbol_name_ = n;}
3782 {
return priv_->symbol_name_regex_str_;}
3795 {priv_->symbol_name_regex_str_ = r;}
3814 {
return priv_->symbol_name_not_regex_str_;}
3834 {priv_->symbol_name_not_regex_str_ = r;}
3843 {
return priv_->symbol_version_;}
3852 {priv_->symbol_version_ = v;}
3864 {
return priv_->symbol_version_regex_str_;}
3876 {priv_->symbol_version_regex_str_ = r;}
3887 {
return priv_->type_name_;}
3898 {priv_->type_name_ = n;}
3911 {
return priv_->type_name_regex_str_;}
3924 {priv_->type_name_regex_str_ = r;}
3979 if (!names_of_binaries_match(*
this, *ctxt))
3985 if (!sonames_of_binaries_match(*
this, *ctxt))
4004 const regex_t_sptr name_regex = priv_->get_name_regex();
4008 const regex_t_sptr name_not_regex = priv_->get_name_not_regex();
4009 if (name_not_regex &&
regex::match(name_not_regex, var_name))
4024 const regex_t_sptr sym_name_regex = priv_->get_symbol_name_regex();
4025 if (sym_name_regex && !
regex::match(sym_name_regex, var_sym_name))
4029 priv_->get_symbol_name_not_regex();
4030 if (sym_name_not_regex &&
regex::match(sym_name_not_regex, var_sym_name))
4035 string var_sym_version =
4045 priv_->get_symbol_version_regex();
4046 if (symbol_version_regex
4047 && !
regex::match(symbol_version_regex, var_sym_version))
4052 string var_type_name =
4064 const regex_t_sptr type_name_regex = priv_->get_type_name_regex();
4065 if (type_name_regex && !
regex::match(type_name_regex, var_type_name))
4128 if (!names_of_binaries_match(*
this, *ctxt))
4133 if (!sonames_of_binaries_match(*
this, *ctxt))
4140 bool no_symbol_name =
false, no_symbol_version =
false;
4155 const regex_t_sptr sym_name_regex = priv_->get_symbol_name_regex();
4156 if (sym_name_regex && !
regex::match(sym_name_regex, sym_name))
4160 no_symbol_name =
true;
4171 priv_->get_symbol_version_regex();
4172 if (symbol_version_regex
4177 no_symbol_version =
true;
4179 if (no_symbol_name && no_symbol_version)
4214 {
return dynamic_pointer_cast<variable_suppression>(s);}
4229 (
static_cast<unsigned>(l) &
static_cast<unsigned>(r));
4245 (
static_cast<unsigned>(l) |
static_cast<unsigned>(r));
4260 if (section.
get_name() !=
"suppress_variable")
4263 static const char *
const sufficient_props[] = {
4266 "file_name_not_regexp",
4268 "soname_not_regexp",
4273 "symbol_name_regexp",
4274 "symbol_name_not_regexp",
4276 "symbol_version_regexp",
4281 sizeof(sufficient_props)/
sizeof(
char*),
4290 string drop_artifact_str = drop_artifact
4291 ? drop_artifact->get_value()->as_string()
4296 string change_kind_str = change_kind_prop
4297 ? change_kind_prop->get_value()->as_string()
4302 string label_str = (label_prop
4303 ? label_prop->get_value()->as_string()
4308 string file_name_regex_str =
4309 file_name_regex_prop ? file_name_regex_prop->get_value()->as_string() :
"";
4313 string file_name_not_regex_str =
4314 file_name_not_regex_prop
4315 ? file_name_not_regex_prop->get_value()->as_string()
4320 string soname_regex_str =
4321 soname_regex_prop ? soname_regex_prop->get_value()->as_string() :
"";
4325 string soname_not_regex_str =
4326 soname_not_regex_prop
4327 ? soname_not_regex_prop->get_value()->as_string()
4332 string name_str = (name_prop
4333 ? name_prop->get_value()->as_string()
4338 string name_regex_str = (name_regex_prop
4339 ? name_regex_prop->get_value()->as_string()
4344 string name_not_regex_str = name_not_regex_prop
4345 ? name_not_regex_prop->get_value()->as_string()
4350 string symbol_name = (sym_name_prop
4351 ? sym_name_prop->get_value()->as_string()
4356 string symbol_name_regex_str = sym_name_regex_prop
4357 ? sym_name_regex_prop->get_value()->as_string()
4362 string symbol_name_not_regex_str = sym_name_not_regex_prop
4363 ? sym_name_not_regex_prop->get_value()->as_string()
4368 string symbol_version = sym_version_prop
4369 ? sym_version_prop->get_value()->as_string()
4374 string symbol_version_regex_str = sym_version_regex_prop
4375 ? sym_version_regex_prop->get_value()->as_string()
4380 string type_name_str = type_name_prop
4381 ? type_name_prop->get_value()->as_string()
4386 string type_name_regex_str = type_name_regex_prop
4387 ? type_name_regex_prop->get_value()->as_string()
4390 result.reset(
new variable_suppression(label_str,
4394 symbol_name_regex_str,
4396 symbol_version_regex_str,
4398 type_name_regex_str));
4400 if ((drop_artifact_str ==
"yes" || drop_artifact_str ==
"true")
4401 && (!name_str.empty()
4402 || !name_regex_str.empty()
4403 || !name_not_regex_str.empty()
4404 || !symbol_name.empty()
4405 || !symbol_name_regex_str.empty()
4406 || !symbol_name_not_regex_str.empty()))
4407 result->set_drops_artifact_from_ir(
true);
4409 if (!name_not_regex_str.empty())
4410 result->set_name_not_regex_str(name_not_regex_str);
4412 if (!symbol_name_not_regex_str.empty())
4413 result->set_symbol_name_not_regex_str(symbol_name_not_regex_str);
4415 if (!change_kind_str.empty())
4416 result->set_change_kind
4419 if (!file_name_regex_str.empty())
4420 result->set_file_name_regex_str(file_name_regex_str);
4422 if (!file_name_not_regex_str.empty())
4423 result->set_file_name_not_regex_str(file_name_not_regex_str);
4425 if (!soname_regex_str.empty())
4426 result->set_soname_regex_str(soname_regex_str);
4428 if (!soname_not_regex_str.empty())
4429 result->set_soname_not_regex_str(soname_not_regex_str);
4452 const string& var_name,
4453 const string& var_linkage_name,
4454 bool require_drop_property)
4456 for (
auto i : supprs)
4459 if (require_drop_property && !i->get_drops_artifact_from_ir())
4461 if (!var_name.empty()
4464 if (!var_linkage_name.empty()
4488 file_suppression::file_suppression(
const string& label,
4489 const string& fname_regex_str,
4490 const string& fname_not_regex_str)
4493 fname_not_regex_str)
4517 if (file_path.empty())
4523 bool has_regexp =
false;
4525 if (
regex_t_sptr regexp = suppression_base::priv_->get_file_name_regex())
4532 if (
regex_t_sptr regexp = suppression_base::priv_->get_file_name_not_regex())
4562 if (section.
get_name() !=
"suppress_file")
4565 static const char *
const sufficient_props[] = {
4567 "file_name_not_regexp",
4569 "soname_not_regexp",
4572 sizeof(sufficient_props)/
sizeof(
char*),
4578 string label_str = (label_prop
4579 ? label_prop->get_value()->as_string()
4584 string file_name_regex_str =
4585 file_name_regex_prop ? file_name_regex_prop->get_value()->as_string() :
"";
4589 string file_name_not_regex_str =
4590 file_name_not_regex_prop
4591 ? file_name_not_regex_prop->get_value()->as_string()
4596 string soname_regex_str =
4597 soname_regex_prop ? soname_regex_prop->get_value()->as_string() :
"";
4601 string soname_not_regex_str =
4602 soname_not_regex_prop
4603 ? soname_not_regex_prop->get_value()->as_string()
4607 file_name_regex_str,
4608 file_name_not_regex_str));
4610 if (!soname_regex_str.empty())
4612 result->set_soname_regex_str(soname_regex_str);
4613 result->set_drops_artifact_from_ir(
true);
4616 if (!soname_not_regex_str.empty())
4618 result->set_soname_not_regex_str(soname_not_regex_str);
4619 result->set_drops_artifact_from_ir(
true);
4635 {
return dynamic_pointer_cast<file_suppression>(s);}
4652 for (suppressions_type::const_iterator i = sprs.begin(); i != sprs.end(); ++i)
4654 if (s->suppresses_file(file_path))
4673 return suppr.priv_->matches_soname(soname);
4689 const string& filename,
4693 || suppr.priv_->matches_binary_name(filename));
4702 static const char *PRIVATE_TYPES_SUPPR_SPEC_NAME =
4703 "Artificial private types suppression specification";
4705 return PRIVATE_TYPES_SUPPR_SPEC_NAME;
4750 if (!s.priv_->matches_soname(fe.
dt_soname()))
4757 if (!s.priv_->matches_binary_name(fe.
corpus_path()))
4781 const string& fn_name)
4796 else if (s.priv_->name_.empty())
4800 if (s.priv_->name_ != fn_name)
4820 suppression_matches_function_sym_name(
const fe_iface& fe,
4822 const string& fn_linkage_name)
4837 else if (s.priv_->symbol_name_.empty())
4841 if (s.priv_->symbol_name_ != fn_linkage_name)
4862 const string& var_name)
4885 const string& var_linkage_name)
4910 const string& type_name,
4939 symbol->get_name());
4942 symbol->get_name());
4962 const string& sym_name,
4994 const string& fn_name,
4995 const string& fn_linkage_name,
4996 bool require_drop_property)
5001 if (require_drop_property && !i->get_drops_artifact_from_ir())
5003 if (!fn_name.empty()
5004 && suppression_matches_function_name(fe, *suppr, fn_name))
5006 if (!fn_linkage_name.empty()
5007 && suppression_matches_function_sym_name(fe, *suppr,
5034 const string& var_name,
5035 const string& var_linkage_name,
5036 bool require_drop_property)
5041 if (require_drop_property && !i->get_drops_artifact_from_ir())
5043 if (!var_name.empty()
5046 if (!var_linkage_name.empty()
5077 const string& type_name,
5079 bool& type_is_private,
5080 bool require_drop_property)
5085 if (require_drop_property && !i->get_drops_artifact_from_ir())
5092 type_is_private =
true;
5098 type_is_private =
false;
5121 uint64_t range_begin = 0, range_end = 0;
5132 if (range_begin > range_end)
5147 if (dm_offset < range_begin || dm_offset > range_end)
This header declares filters for the diff trees resulting from comparing ABI Corpora.
This file contains the declarations for the fe_iface a.k.a "Front End Interface".
#define ABG_ASSERT(cond)
This is a wrapper around the 'assert' glibc call. It allows for its argument to have side effects,...
This file contains the declarations for the ini file reader used in the libabigail library.
This contains the private implementation of the suppression engine of libabigail.
This type abstracts changes for a class_decl.
class_decl_sptr first_class_decl() const
class_decl_sptr second_class_decl() const
Getter of the second class involved in the diff.
This is the base class of class_diff and union_diff.
class_or_union_sptr first_class_or_union() const
const string_decl_base_sptr_map & deleted_data_members() const
Getter for the data members that got deleted.
const string_decl_base_sptr_map & inserted_data_members() const
Getter for the data members that got inserted.
The context of the diff. This type holds various bits of information that is going to be used through...
const corpus_diff_sptr & get_corpus_diff() const
Get the corpus diff for the current context.
The abstraction of a change between two ABI artifacts, a.k.a an artifact change.
type_or_decl_base_sptr second_subject() const
Getter of the second subject of the diff.
type_or_decl_base_sptr first_subject() const
Getter of the first subject of the diff.
const diff_context_sptr context() const
Getter of the context of the current diff.
Abstraction of a diff between two enums.
const string_changed_enumerator_map & changed_enumerators() const
const enum_type_decl_sptr first_enum() const
const string_enumerator_map & deleted_enumerators() const
const enum_type_decl_sptr second_enum() const
Abstraction of a diff between two function_decl.
const function_decl_sptr second_function_decl() const
const function_decl_sptr first_function_decl() const
The abstraction of a diff between two pointers.
The abstraction of a diff between two references.
The base class of diff between types.
Abstracts a diff between two instances of var_decl.
This type abstracts the configuration information of the library.
The base class of all libabigail front-ends: The Front End Interface.
suppr::suppressions_type & suppressions()
Getter of the vector of suppression specifications associated with the current front-end.
const std::string & corpus_path() const
Getter of the path to the file which an ABI corpus is to be created for.
const string & dt_soname() const
Getter for the SONAME of the analyzed binary.
The abstraction of one section of the .ini config.
const string & get_name() const
Get the name of the section.
property_sptr find_property(const string &prop_name) const
Find a property that has a given name.
const vector< string > & get_content() const
Getter of the content of the list_property_value.
virtual const string & as_string() const
Convert the string property value into a string.
The base type of class_decl and union_decl.
const data_members & get_data_members() const
Get the data members of this class_or_union.
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the decl.
const string & str() const
Getter for the version name.
Abstraction of an elf symbol.
bool is_variable() const
Test if the current instance of elf_symbol is a variable symbol or not.
const string & get_name() const
Getter for the name of the elf_symbol.
bool is_function() const
Test if the current instance of elf_symbol is a function symbol or not.
type
The type of a symbol.
version & get_version() const
Getter for the version of the current instanc of elf_symbol.
Abstraction for a function declaration.
shared_ptr< parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
const function_type_sptr get_type() const
Return the type of the current instance of function_decl.
const elf_symbol_sptr & get_symbol() const
Gets the the underlying ELF symbol for the current variable, that was set using function_decl::set_sy...
The source location of a token.
void expand(std::string &path, unsigned &line, unsigned &column) const
Expand the current location into a tripplet file path, line and column number.
A declaration that introduces a scope.
Abstracts a variable declaration.
virtual const interned_string & get_qualified_name(bool internal=false) const
Get the qualified name of a given variable or data member.
const type_base_sptr get_type() const
Getter of the type of the variable.
const elf_symbol_sptr & get_symbol() const
Gets the the underlying ELF symbol for the current variable, that was set using var_decl::set_symbol(...
Abstraction of a suppression specification to avoid loading a file.
virtual ~file_suppression()
Destructor of file_suppression.
bool suppresses_file(const string &file_path)
Test if a instances of this file_suppression suppresses a given file.
virtual bool suppresses_diff(const diff *diff) const
Test if instances of this file_suppression suppresses a certain instance of diff.
const string & get_parameter_type_name() const
Getter for the type name of the parameter designated by this specification.
const string & get_parameter_type_name_regex_str() const
Getter for the regular expression that defines a set of type names for the parameter designated by th...
void set_parameter_type_name_regex_str(const string &)
Setter for the regular expression that defines a set of type names for the parameter designated by th...
void set_parameter_type_name(const string &)
Setter for the type name of the parameter designated by this specification.
void set_index(size_t)
Setter for the index of the parameter designated by this specification.
size_t get_index() const
Getter for the index of the parameter designated by this specification.
Abstraction of a function suppression specification.
void set_name_regex_str(const string &)
Setter for a regular expression for a family of names of functions the user wants the current specifi...
change_kind get_change_kind() const
Getter of the "change-kind" property.
const string & get_symbol_version() const
Getter for the name of the version of the symbol of the function the user wants this specification to...
void set_change_kind(change_kind k)
Setter of the "change-kind" property.
change_kind
The kind of change the current function suppression should apply to.
@ ALL_CHANGE_KIND
This represents all the changes possibly described by this enum. It's a logical 'OR' of all the chang...
@ ADDED_FUNCTION_CHANGE_KIND
The function was added to the second subject of the diff.
@ FUNCTION_SUBTYPE_CHANGE_KIND
A change in a sub-type of the function.
@ DELETED_FUNCTION_CHANGE_KIND
The function was deleted from the second subject of the diff.
const string & get_symbol_version_regex_str() const
Getter for a regular expression for a family of versions of symbols of functions the user wants the c...
bool suppresses_function(const function_decl *fn, change_kind k, const diff_context_sptr ctxt) const
Evaluate the current function suppression specification on a given function_decl and say if a report ...
const string & get_return_type_name() const
Getter for the name of the return type of the function the user wants this specification to designate...
static change_kind parse_change_kind(const string &)
Parses a string containing the content of the "change-kind" property and returns the an instance of f...
bool suppresses_function_symbol(const elf_symbol *sym, change_kind k, const diff_context_sptr ctxt)
Evaluate the current function suppression specification on a given elf_symbol and say if a report abo...
void set_return_type_name(const string &)
Setter for the name of the return type of the function the user wants this specification to designate...
const string & get_name() const
Getter for the name of the function the user wants the current specification to designate....
const string & get_symbol_name() const
Getter for the name of symbol of the function the user wants this specification to designate.
vector< parameter_spec_sptr > parameter_specs_type
Convenience typedef for vector of parameter_spec_sptr.
void set_symbol_name_regex_str(const string &)
Setter for a regular expression for a family of names of symbols of functions the user wants this spe...
const string & get_symbol_name_regex_str() const
Getter for a regular expression for a family of names of symbols of functions the user wants this spe...
void set_symbol_name_not_regex_str(const string &)
Setter for a regular expression for a family of names of symbols of functions the user wants this spe...
void set_name_not_regex_str(const string &)
Setter for a regular expression for a family of names of functions the user wants the current specifi...
void set_symbol_version(const string &)
Setter for the name of the version of the symbol of the function the user wants this specification to...
void set_parameter_specs(parameter_specs_type &)
Setter for a vector of parameter specifications to specify properties of the parameters of the functi...
void set_name(const string &)
Setter for the name of the function the user wants the current specification to designate....
const parameter_specs_type & get_parameter_specs() const
Getter for a vector of parameter specifications to specify properties of the parameters of the functi...
virtual bool suppresses_diff(const diff *diff) const
Evaluate this suppression specification on a given diff node and say if the diff node should be suppr...
void set_return_type_regex_str(const string &r)
Setter for a regular expression for a family of return type names for functions the user wants the cu...
const string & get_name_not_regex_str() const
Getter for a regular expression of a family of names of functions the user wants the current specific...
void set_symbol_name(const string &n)
Setter for the name of symbol of the function the user wants this specification to designate.
const string & get_symbol_name_not_regex_str() const
Getter for a regular expression for a family of names of symbols of functions the user wants this spe...
void append_parameter_specs(const parameter_spec_sptr)
Append a specification of a parameter of the function specification.
void set_allow_other_aliases(bool f)
Setter for the "allow_other_aliases" property of the function suppression specification.
void set_symbol_version_regex_str(const string &)
Setter for a regular expression for a family of versions of symbols of functions the user wants the c...
function_suppression()
Default constructor for the function_suppression type.
const string & get_name_regex_str() const
Getter for a regular expression for a family of names of functions the user wants the current specifi...
bool get_allow_other_aliases() const
Getter for the "allow_other_aliases" property of the function suppression specification.
const string & get_return_type_regex_str() const
Getter for a regular expression for a family of return type names for functions the user wants the cu...
shared_ptr< parameter_spec > parameter_spec_sptr
Convenience typedef for shared_ptr of parameter_spec.
The base class of suppression specifications that are defined by the negation of matching clauses.
virtual ~negated_suppression_base()
Destructor of the negated_suppression_base.
negated_suppression_base()
Constructor of the negated_suppression_base.
negated_type_suppression(const string &label, const string &type_name_regexp, const string &type_name)
Constructor for negated_type_suppression.
virtual bool suppresses_diff(const diff *diff) const
Evaluate this suppression specification on a given diff node and say if the diff node should be suppr...
virtual ~negated_type_suppression()
Destructor of the negated_type_suppression type.
The private data of suppression_base.
Base type of a direct suppression specifications types.
const string & get_file_name_regex_str() const
Getter for the "file_name_regex" property of the current instance of suppression_base.
bool get_drops_artifact_from_ir() const
Tests if the current suppression specification is to avoid adding the matched ABI artifact to the int...
bool get_is_artificial() const
Test is the suppression specification is artificial.
void set_file_name_regex_str(const string ®exp)
Setter for the "file_name_regex" property of the current instance of suppression_base.
void set_soname_not_regex_str(const string ®exp)
Setter of the "soname_not_regex_str property of the current instance of suppression_base.
const string & get_soname_not_regex_str() const
Getter of the "soname_not_regex_str property of the current instance of suppression_base.
const string get_label() const
Getter for the label associated to this suppression specification.
void set_file_name_not_regex_str(const string ®exp)
Setter for the "file_name_not_regex" property of the current instance of suppression_base.
void set_is_artificial(bool)
Set a flag saying if the suppression specification is artificial or not.
const string & get_file_name_not_regex_str() const
Getter for the "file_name_not_regex" property of the current instance of suppression_base.
void set_label(const string &)
Setter for the label associated to this suppression specification.
const string & get_soname_regex_str() const
Getter of the "soname_regex_str property of the current instance of suppression_base.
bool has_soname_related_property() const
Test if the current suppression has a property related to SONAMEs.
void set_soname_regex_str(const string ®exp)
Setter of the "soname_regex_str property of the current instance of suppression_base.
bool has_file_name_related_property() const
Test if the current suppression has a property related to file name.
void set_drops_artifact_from_ir(bool)
Set the flag that says whether the current suppression specification is to avoid adding the matched A...
The abstraction of the boundary of an insertion_range, in the context of a type_suppression.
virtual ~boundary()
Destructor of type_suppression::insertion_range::boundary.
boundary()
Default constructor of type_suppression::insertion_range::boundary.
An insertion_range boundary that is expressed as function call expression. The (integer) value of tha...
~fn_call_expr_boundary()
Destructor of type_suppression::insertion_range::fn_call_expr_boundary.
ini::function_call_expr_sptr as_function_call_expr() const
Returns the function call expression value of the current boundary.
An insertion_range boundary that is expressed as an integer value. That integer value is usually a bi...
~integer_boundary()
Destructor of type_suppression::insertion_range::integer_boundary.
uint64_t as_integer() const
Return the integer value of the current instance of type_suppression::insertion_range::integer_bounda...
static insertion_range::integer_boundary_sptr create_integer_boundary(int value)
Create an integer boundary.
static insertion_range::fn_call_expr_boundary_sptr create_fn_call_expr_boundary(ini::function_call_expr_sptr)
Create a function call expression boundary.
shared_ptr< fn_call_expr_boundary > fn_call_expr_boundary_sptr
Convenience typedef for a shared_ptr to a fn_call_expr_boundary.
boundary_sptr end() const
Getter for the end of the range.
static bool boundary_value_is_end(uint64_t value)
Test if a given value supposed to be inside an insertion range represents the end of the range.
shared_ptr< integer_boundary > integer_boundary_sptr
Convenience typedef for a shared_ptr to a integer_boundary.
static bool eval_boundary(const boundary_sptr boundary, const class_or_union *context, uint64_t &value)
Evaluate an insertion range boundary to get a resulting integer value.
shared_ptr< boundary > boundary_sptr
Convenience typedef for a shared_ptr to boundary.
boundary_sptr begin() const
Getter for the beginning of the range.
insertion_range()
Default Constructor of type_suppression::insertion_range.
The private data for type_suppression.
Abstraction of a type suppression specification.
void set_type_name_not_regex_str(const string &name_regex_str)
Setter for the "type_name_not_regex_str" property of the type suppression specification.
const vector< string > & get_changed_enumerator_names() const
Getter of the vector of the changed enumerators that are supposed to be suppressed....
void set_type_name_regex_str(const string &name_regex_str)
Setter for the "type_name_regex" property of the type suppression specification.
void set_type_name(const string &name)
Setter for the name of the type about which diff reports should be suppressed.
void set_consider_type_kind(bool f)
Setter of the property that says whether to consider the kind of type this suppression is about.
reach_kind get_reach_kind() const
Getter of the way the diff node matching the current suppression specification is to be reached.
const string & get_source_location_to_keep_regex_str() const
Getter of the regular expression string that designates the source location paths of types that shoul...
vector< insertion_range_sptr > insertion_ranges
A convenience typedef for a vector of insertion_range_sptr.
void set_changed_enumerator_names(const vector< string > &)
Setter of the vector of changed enumerators that are supposed to be suppressed. Note that this will b...
void set_source_location_to_keep_regex_str(const string &)
Setter of the regular expression string that designates the source location paths of types that shoul...
void set_source_locations_to_keep(const unordered_set< string > &)
Setter for the array of source location paths of types that should *NOT* be suppressed.
bool get_consider_type_kind() const
Getter of the property that says whether to consider the kind of type this suppression is about.
type_kind
The kind of the type the current type suppression is supposed to be about.
const string & get_type_name_regex_str() const
Getter for the "type_name_regex" property of the type suppression specification.
void set_consider_reach_kind(bool f)
Set a flag saying if the current type suppression specification suggests to consider how the matching...
type_kind get_type_kind() const
Getter of the kind of type this suppression is about.
void set_type_kind(type_kind k)
Setter of the kind of type this suppression is about.
const insertion_ranges & get_data_member_insertion_ranges() const
Getter for the vector of data member insertion range that specifiers where a data member is inserted ...
const string_set_type & get_potential_data_member_names() const
Getter of the "potential_data_member_names" property.
reach_kind
The different ways through which the type diff has been reached.
@ REFERENCE_REACH_KIND
The type diff has been reached (from a function or variable change) through a reference; you know,...
@ POINTER_REACH_KIND
The type diff has been reached (from a function or variable change) through a pointer.
@ REFERENCE_OR_POINTER_REACH_KIND
The type diff has been reached (from a function or variable change) through either a reference or a p...
@ DIRECT_REACH_KIND
The type diff has been reached (from a function or variable change) directly.
bool get_consider_reach_kind() const
Test if the current type suppression specification suggests to consider how the matching diff node is...
const unordered_set< string > & get_source_locations_to_keep() const
Getter for the array of source location paths of types that should *NOT* be suppressed.
const string & get_type_name_not_regex_str() const
Getter for the "type_name_not_regex_str" property of the type suppression specification.
virtual bool suppresses_diff(const diff *diff) const
Evaluate this suppression specification on a given diff node and say if the diff node should be suppr...
bool suppresses_type(const type_base_sptr &type, const diff_context_sptr &ctxt) const
Test if the current instance of type_suppression suppresses a change reports about a given type.
void set_has_size_change(bool flag)
Setter of the "has_size_change" property.
void set_reach_kind(reach_kind k)
Setter of the way the diff node matching the current suppression specification is to be reached.
void set_potential_data_member_names(const string_set_type &) const
Setter of the "potential_data_member_names" property.
bool get_has_size_change() const
Getter of the "has_size_change" property.
const string & get_potential_data_member_names_regex_str() const
Getter of the "potential_data_member_names_regex" string.
const string & get_type_name() const
Getter for the name of the type about which diff reports should be suppressed.
void set_data_member_insertion_ranges(const insertion_ranges &r)
Setter for the vector of data member insertion ranges that specifies where a data member is inserted ...
void set_potential_data_member_names_regex_str(const string &) const
Setter of the "potential_data_member_names_regex" string.
shared_ptr< insertion_range > insertion_range_sptr
A convenience typedef for a shared pointer to insertion_range.
The abstraction of a variable suppression specification.
void set_symbol_name(const string &)
Setter for the name of the symbol of the variable the user wants the current specification to designa...
void set_name_regex_str(const string &)
Setter for the regular expression for a family of names of variables the user wants the current speci...
virtual ~variable_suppression()
Virtual destructor for the @erf variable_suppression type. variable_suppression type.
const string & get_symbol_version() const
Getter for the version of the symbol of the variable the user wants the current specification to desi...
variable_suppression(const string &label="", const string &name="", const string &name_regex_str="", const string &symbol_name="", const string &symbol_name_regex_str="", const string &symbol_version="", const string &symbol_version_regex_str="", const string &type_name="", const string &type_name_regex_str="")
Constructor for the variable_suppression type.
void set_change_kind(change_kind k)
Setter of the "change_kind" property.
static change_kind parse_change_kind(const string &)
Parses a string containing the content of the "change-kind" property and returns the an instance of v...
change_kind
The kind of change the current variable suppression should apply to.
@ ADDED_VARIABLE_CHANGE_KIND
The variable was added to the second second subject of the diff.
@ ALL_CHANGE_KIND
This represents all the changes possibly described by this enum. It's a logical 'OR' of all the chang...
@ DELETED_VARIABLE_CHANGE_KIND
The variable was deleted from the second subject of the diff.
@ VARIABLE_SUBTYPE_CHANGE_KIND
A change in a sub-type of the variable.
const string & get_symbol_version_regex_str() const
Getter of the regular expression for a family of versions of symbol for the variables the user wants ...
const string & get_name() const
Getter for the name of the variable the user wants the current specification to designate....
const string & get_symbol_name() const
Getter for the name of the symbol of the variable the user wants the current specification to designa...
void set_symbol_name_regex_str(const string &)
Setter of the regular expression for a family of symbol names of the variables this specification is ...
const string & get_symbol_name_regex_str() const
Getter of the regular expression for a family of symbol names of the variables this specification is ...
const string & get_type_name_regex_str() const
Getter for the regular expression for a family of type names of variables the user wants the current ...
void set_symbol_name_not_regex_str(const string &)
Setter for a regular expression for a family of names of symbols of variables the user wants this spe...
void set_type_name(const string &)
Setter for the name of the type of the variable the user wants the current specification to designate...
change_kind get_change_kind() const
Getter of the "change_king" property.
void set_name_not_regex_str(const string &)
Setter for the "name_not_regexp" property of the specification.
void set_symbol_version(const string &)
Setter for the version of the symbol of the variable the user wants the current specification to desi...
bool suppresses_variable(const var_decl *var, change_kind k, const diff_context_sptr cxt) const
Evaluate the current variable suppression specification on a given var_decl and say if a report about...
void set_name(const string &)
Setter for the name of the variable the user wants the current specification to designate....
const string & get_name_not_regex_str() const
Getter for the "name_not_regexp" property of the specification.
const string & get_symbol_name_not_regex_str() const
Getter for a regular expression for a family of names of symbols of variables the user wants this spe...
void set_type_name_regex_str(const string &)
Setter for the regular expression for a family of type names of variables the user wants the current ...
void set_symbol_version_regex_str(const string &)
Setter of the regular expression for a family of versions of symbol for the variables the user wants ...
const string & get_type_name() const
Getter for the name of the type of the variable the user wants the current specification to designate...
bool suppresses_diff(const diff *d) const
Evaluate this suppression specification on a given diff node and say if the diff node should be suppr...
const string & get_name_regex_str() const
Getter for the regular expression for a family of names of variables the user wants the current speci...
bool suppresses_variable_symbol(const elf_symbol *sym, change_kind k, const diff_context_sptr cxt) const
Evaluate the current variable suppression specification on a given elf_symbol and say if a report abo...
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 ...
const pointer_diff * is_pointer_diff(const diff *diff)
Test if a diff node is about differences between two pointers.
shared_ptr< diff_context > diff_context_sptr
Convenience typedef for a shared pointer of diff_context.
const function_decl_diff * is_function_decl_diff(const diff *diff)
Test if a diff node is about differences between functions.
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.
const diff * get_typedef_diff_underlying_type_diff(const diff *diff)
Return the leaf underlying diff node of a typedef_diff node.
const var_diff * is_var_diff(const diff *diff)
Test if a diff node is about differences between variables.
const type_diff_base * is_type_diff(const diff *diff)
Test if a diff node is about differences between types.
const reference_diff * is_reference_diff(const diff *diff)
Test if a diff node is about differences between two references.
shared_ptr< list_property_value > list_property_value_sptr
A convenience typedef for a shared_ptr to list_property_value.
bool read_config(istream &input, config &conf)
Parse an ini config file from an input stream.
bool read_function_call_expr(std::istream &input, function_call_expr_sptr &expr)
Read a function call expression and build its representation.
list_property * is_list_property(const property *p)
Test if an instance of a property is actually an instance of list_property.
shared_ptr< property > property_sptr
Convenience typefef for shared_ptr to property.
shared_ptr< list_property > list_property_sptr
A convenience typedef for a shared_ptr to a list_property.
shared_ptr< config > config_sptr
A convenience typedef for a shared pointer to config.
list_property_value * is_list_property_value(const property_value *v)
Test if an instance of @property_value is a list_property_value.
shared_ptr< tuple_property > tuple_property_sptr
Convenience typedef for a shared_ptr of tuple_property.
shared_ptr< simple_property > simple_property_sptr
Convenience typedef for a shared_ptr to an simple_property.
shared_ptr< function_call_expr > function_call_expr_sptr
Convenience typedef for a shared pointer to function_call_expr.
shared_ptr< string_property_value > string_property_value_sptr
A convenience typedef for a shared_ptr to string_property_value.
string_property_value * is_string_property_value(const property_value *v)
Test if a given property value is a string property value.
tuple_property * is_tuple_property(const property *p)
Test if an instance of property is an instance of tuple_property.
shared_ptr< tuple_property_value > tuple_property_value_sptr
Convenience typedef for a shared_ptr to a tuple_property_value.
simple_property * is_simple_property(const property *p)
Tests if a property is a simple property.
tuple_property_value * is_tuple_property_value(const property_value *v)
Test if a given instance of property_value is an instance of tuple_property_value too.
var_decl_sptr get_last_data_member(const class_or_union &klass)
Get the last data member of a class type.
shared_ptr< function_decl > function_decl_sptr
Convenience typedef for a shared pointer on a function_decl.
bool is_type(const type_or_decl_base &tod)
Test whether a declaration is a type.
shared_ptr< elf_symbol > elf_symbol_sptr
A convenience typedef for a shared pointer to elf_symbol.
var_decl_sptr find_last_data_member_matching_regexp(const class_or_union &t, const regex::regex_t_sptr ®ex)
Find the last data member of a class or union which name matches a regular expression.
bool is_class_type(const type_or_decl_base &t)
Test whether a type is a class.
array_type_def * is_array_type(const type_or_decl_base *type)
Test if a type is an array_type_def.
shared_ptr< class_decl > class_decl_sptr
Convenience typedef for a shared pointer on a class_decl.
const type_decl * is_type_decl(const type_or_decl_base *t)
Test whether a type is a type_decl (a builtin type).
string get_name(const type_or_decl_base *tod, bool qualified)
Build and return a copy of the name of an ABI artifact that is either a type or a decl.
typedef_decl_sptr is_typedef(const type_or_decl_base_sptr t)
Test whether a type is a typedef.
shared_ptr< function_type > function_type_sptr
Convenience typedef for a shared pointer on a function_type.
bool elf_symbol_is_function(elf_symbol::type t)
Test if the type of an ELF symbol denotes a function symbol.
const enum_type_decl * is_enum_type(const type_or_decl_base *d)
Test if a decl is an enum_type_decl.
shared_ptr< var_decl > var_decl_sptr
Convenience typedef for a shared pointer on a var_decl.
bool get_data_member_is_laid_out(const var_decl &m)
Test whether a data member is laid out.
bool get_next_data_member_offset(const class_or_union *klass, const var_decl_sptr &dm, uint64_t &offset)
Get the offset of the non-static data member that comes after a given one.
var_decl * is_var_decl(const type_or_decl_base *tod)
Tests if a declaration is a variable declaration.
decl_base * is_decl(const type_or_decl_base *d)
Test if an ABI artifact is a declaration.
uint64_t get_data_member_offset(const var_decl &m)
Get the offset of a data member.
location get_location(const type_base_sptr &type)
Get the location of the declaration of a given type.
bool is_union_type(const type_or_decl_base &t)
Test if a type is a union_decl.
type_base_sptr peel_typedef_type(const type_base_sptr &type)
Return the leaf underlying type node of a typedef_decl node.
var_decl_sptr find_first_data_member_matching_regexp(const class_or_union &t, const regex::regex_t_sptr &r)
Find the first data member of a class or union which name matches a regular expression.
const decl_base * get_type_declaration(const type_base *t)
Get the declaration for a given type.
function_decl * is_function_decl(const type_or_decl_base *d)
Test whether a declaration is a function_decl.
bool elf_symbol_is_variable(elf_symbol::type t)
Test if the type of an ELF symbol denotes a function symbol.
method_type_sptr is_method_type(const type_or_decl_base_sptr &t)
Test whether a type is a method_type.
string build_qualified_name(const scope_decl *scope, const string &name)
Build and return a qualified name from a name and its scope.
bool match(const regex_t_sptr &r, const std::string &str)
See if a string matches a regex.
regex_t_sptr compile(const std::string &str)
Compile a regex from a string.
std::shared_ptr< regex_t > regex_t_sptr
A convenience typedef for a shared pointer of regex_t.
type_suppression::insertion_range::fn_call_expr_boundary_sptr is_fn_call_expr_boundary(type_suppression::insertion_range::boundary_sptr b)
Tests if a given instance of type_suppression::insertion_range::boundary is actually an function call...
bool check_sufficient_props(const char *const *names, size_t count, const ini::config::section §ion)
Check if a section has at least one of the given properties.
function_suppression::change_kind operator|(function_suppression::change_kind l, function_suppression::change_kind r)
The bitwise 'or' operator for the enum function_suppression::change_kind.
type_suppression::insertion_range::integer_boundary_sptr is_integer_boundary(type_suppression::insertion_range::boundary_sptr b)
Tests if a given instance of type_suppression::insertion_range::boundary is actually an integer bound...
shared_ptr< variable_suppression > variable_suppression_sptr
A convenience typedef for a shared pointer to variable_suppression.
shared_ptr< negated_suppression_base > negated_suppression_sptr
A convenience typedef for a shared pointer to negated_suppression_base.
shared_ptr< file_suppression > file_suppression_sptr
A convenience typedef for a shared_ptr to file_suppression.
vector< suppression_sptr > suppressions_type
Convenience typedef for a vector of suppression_sptr.
shared_ptr< function_suppression > function_suppression_sptr
Convenience typedef for a shared pointer to function_suppression.
variable_suppression_sptr is_variable_suppression(const suppression_sptr s)
Test if an instance of suppression is an instance of variable_suppression.
const char * get_private_types_suppr_spec_label()
bool is_private_type_suppr_spec(const type_suppression &s)
Test if a type suppression specification represents a private type suppression automatically generate...
bool suppression_matches_type(const suppr::type_suppression &s, const string &type_name)
Test if a type suppression matches a type designated by its fully qualified name.
bool suppression_can_match(const fe_iface &fe, const suppression_base &s)
Test if a given suppression specification can match an ABI artifact coming from the corpus being anal...
file_suppression_sptr is_file_suppression(const suppression_sptr s)
Test if a given suppression specification is a file suppression specification.
bool is_elf_symbol_suppressed(const fe_iface &fe, const elf_symbol_sptr &symbol)
Test if an ELF symbol is suppressed by at least one of the suppression specifications associated with...
bool suppression_matches_type_name(const suppr::type_suppression &s, const string &type_name)
Test if a type suppression specification matches a type name.
shared_ptr< type_suppression > type_suppression_sptr
Convenience typedef for a shared pointer to type_suppression.
function_suppression_sptr is_function_suppression(const suppression_sptr suppr)
Test if an instance of suppression is an instance of function_suppression.
bool suppression_matches_variable_name(const suppr::variable_suppression &s, const string &var_name)
Test if a variable suppression matches a variable denoted by its name.
bool suppression_matches_soname_or_filename(const string &soname, const string &filename, const suppression_base &suppr)
Test if a given SONAME or file name is matched by a given suppression specification.
type_suppression_sptr is_type_suppression(suppression_sptr suppr)
Test if an instance of suppression is an instance of type_suppression.
bool is_type_suppressed(const fe_iface &fe, const string &type_name, const location &type_location, bool &type_is_private, bool require_drop_property)
Test if a type is matched by at least one suppression specification associated with a given front-end...
bool suppression_matches_type_name_or_location(const type_suppression &s, const string &type_name, const location &type_location)
Test if a type suppression matches a type name and location.
function_suppression::change_kind operator&(function_suppression::change_kind l, function_suppression::change_kind r)
The bitwise 'and' operator for the enum function_suppression::change_kind.
bool suppression_matches_type_location(const type_suppression &s, const location &loc)
Test if a type suppression matches a source location.
bool variable_is_suppressed(const suppr::suppressions_type &supprs, const string &var_name, const string &var_linkage_name, bool require_drop_property)
Test if a given variable is suppressed by at least one suppression specification among a vector of su...
bool is_data_member_offset_in_range(const var_decl_sptr &dm, const type_suppression::insertion_range_sptr &range, const class_or_union *context)
Test if a data memer offset is in a given insertion range.
bool is_function_suppressed(const fe_iface &fe, const string &fn_name, const string &fn_linkage_name, bool require_drop_property)
Test if a function is matched by at least one suppression specification associated with a given front...
bool suppression_matches_soname(const string &soname, const suppression_base &suppr)
Test if a given SONAME is matched by a given suppression specification.
shared_ptr< suppression_base > suppression_sptr
Convenience typedef for a shared pointer to a suppression.
bool is_negated_suppression(const suppression_base &s)
Test if a suppression specification is a negated suppression.
bool suppression_matches_variable_sym_name(const suppr::variable_suppression &s, const string &var_linkage_name)
Test if a variable suppression matches a variable denoted by its symbol name.
file_suppression_sptr file_is_suppressed(const string &file_path, const suppressions_type &sprs)
Test if a given file path is "suppressed" by at least one file suppression specification among a vect...
bool is_variable_suppressed(const fe_iface &fe, const string &var_name, const string &var_linkage_name, bool require_drop_property)
Test if a variable is matched by at least one suppression specification associated with a given front...
Toplevel namespace for libabigail.
The type of the private data of the function_suppression type.
The type of the private data of the variable_suppression type.