21 #include <unordered_map>
25 #include "abg-internal.h"
27 ABG_BEGIN_EXPORT_DECLARATIONS
34 ABG_END_EXPORT_DECLARATIONS
70 using std::unordered_map;
71 using std::dynamic_pointer_cast;
72 using std::static_pointer_cast;
79 struct interned_string_pool::priv
99 {
return priv_->map.find(s) != priv_->map.end();}
110 unordered_map<string, string*>::const_iterator i =
112 if (i == priv_->map.end())
115 return i->second->c_str();
127 string*& result = priv_->map[str_value];
128 if (!result && !str_value.empty())
129 result =
new string(str_value);
136 for (pool_map_type::iterator i = priv_->map.begin();
137 i != priv_->map.end();
154 {
return r.operator==(l);}
157 operator!=(
const std::string& l,
const interned_string& r)
172 o << static_cast<std::string>(s);
188 {
return static_cast<std::string
>(s1) + s2;}
202 {
return s1 +
static_cast<std::string
>(s2);}
208 hash_as_canonical_type_or_constant(
const type_base *t);
211 has_generic_anonymous_internal_type_name(
const decl_base *d);
213 static interned_string
214 get_generic_anonymous_internal_type_name(
const decl_base *d);
217 get_internal_integral_type_name(
const type_base*);
220 update_qualified_name(decl_base * d);
223 update_qualified_name(decl_base_sptr d);
225 static interned_string
226 pointer_declaration_name(
const type_base* ptr,
227 const string& variable_name,
228 bool qualified,
bool internal);
230 static interned_string
231 pointer_declaration_name(
const type_base_sptr& ptr,
232 const string& variable_name,
233 bool qualified,
bool internal);
235 static interned_string
236 ptr_to_mbr_declaration_name(
const ptr_to_mbr_type* ptr,
237 const string& variable_name,
238 bool qualified,
bool internal);
240 static interned_string
242 const string& variable_name,
243 bool qualified,
bool internal);
245 static interned_string
246 array_declaration_name(
const array_type_def* array,
247 const string& variable_name,
248 bool qualified,
bool internal);
250 static interned_string
252 const string& variable_name,
253 bool qualified,
bool internal);
256 stream_pretty_representation_of_fn_parms(
const function_type& fn_type,
257 ostream& o,
bool qualified,
260 add_outer_pointer_to_fn_type_expr(
const type_base* pointer_to_fn,
261 const string& input,
bool qualified,
265 add_outer_pointer_to_fn_type_expr(
const type_base_sptr& pointer_to_fn,
266 const string& input,
bool qualified,
270 add_outer_pointer_to_array_type_expr(
const type_base* pointer_to_ar,
271 const string& input,
bool qualified,
275 add_outer_pointer_to_array_type_expr(
const type_base_sptr& pointer_to_ar,
276 const string& input,
bool qualified,
280 add_outer_ptr_to_mbr_type_expr(
const ptr_to_mbr_type* p,
281 const string& input,
bool qualified,
286 const string& input,
bool qualified,
290 add_outer_pointer_to_ptr_to_mbr_type_expr(
const type_base* p,
292 bool qualified,
bool internal);
296 const type_base& right);
300 const type_base& right);
319 env.priv_->push_composite_type_comparison_operands(&left, &right);
340 env.priv_->pop_composite_type_comparison_operands(&left, &right);
404 return env.priv_->mark_dependant_types_compared_until(&r);
411 class expanded_location
423 expanded_location(
const string& path,
unsigned line,
unsigned column)
424 : path_(path), line_(line), column_(column)
430 return (path_ == l.path_
432 && column_ && l.column_);
436 operator<(
const expanded_location& l)
const
440 else if (path_ > l.path_)
445 else if (line_ > l.line_)
448 return column_ < l.column_;
465 if (!get_location_manager())
486 unsigned line = 0, column = 0;
487 expand(path, line, column);
489 std::ostringstream o;
490 o << path <<
":" << line <<
":" << column;
494 struct location_manager::priv
500 std::vector<expanded_location> locs;
503 location_manager::location_manager()
507 location_manager::~location_manager() =
default;
522 expanded_location l(file_path, line, col);
526 priv_->locs.push_back(l);
527 return location(priv_->locs.size(),
this);
544 unsigned& column)
const
548 expanded_location &l = priv_->locs[
location.value_ - 1];
561 struct type_maps::priv
575 mutable vector<type_base_wptr> sorted_types_;
578 type_maps::type_maps()
582 type_maps::~type_maps() =
default;
607 {
return priv_->basic_types_;}
614 {
return priv_->basic_types_;}
621 {
return priv_->class_types_;}
628 {
return priv_->class_types_;}
635 {
return priv_->union_types_;}
642 {
return priv_->union_types_;}
649 {
return priv_->enum_types_;}
656 {
return priv_->enum_types_;}
663 {
return priv_->typedef_types_;}
670 {
return priv_->typedef_types_;}
676 {
return priv_->qualified_types_;}
682 {
return priv_->qualified_types_;}
689 {
return priv_->pointer_types_;}
696 {
return priv_->ptr_to_mbr_types_;}
703 {
return priv_->ptr_to_mbr_types_;}
710 {
return priv_->pointer_types_;}
717 {
return priv_->reference_types_;}
724 {
return priv_->reference_types_;}
731 {
return priv_->array_types_;}
738 {
return priv_->array_types_;}
745 {
return priv_->subrange_types_;}
752 {
return priv_->subrange_types_;}
759 {
return priv_->function_types_;}
766 {
return priv_->function_types_;}
770 struct type_name_comp
785 if (l == 0 && r == 0)
790 return l_repr < r_repr;
804 operator()(
const type_base_sptr &l,
const type_base_sptr &r)
const
805 {
return operator()(l.get(), r.get());}
819 {
return operator()(type_base_sptr(l), type_base_sptr(r));}
822 #ifdef WITH_DEBUG_SELF_COMPARISON
838 notify_equality_failed(
const type_or_decl_base &l __attribute__((unused)),
839 const type_or_decl_base &r __attribute__((unused)))
856 notify_equality_failed(
const type_or_decl_base *l __attribute__((unused)),
857 const type_or_decl_base *r __attribute__((unused)))
860 #define ABG_RETURN_EQUAL(l, r) \
864 notify_equality_failed(l, r); \
870 #define ABG_RETURN_FALSE \
873 notify_equality_failed(l, r); \
877 #define ABG_RETURN(value) \
880 if (value == false) \
881 notify_equality_failed(l, r); \
887 #define ABG_RETURN_FALSE return false
888 #define ABG_RETURN(value) return (value)
889 #define ABG_RETURN_EQUAL(l, r) return ((l) == (r));
905 #if WITH_DEBUG_TYPE_CANONICALIZATION
925 if (env.priv_->use_canonical_type_comparison_)
929 ABG_RETURN_EQUAL(lc, rc);
935 ABG_RETURN_EQUAL(lc, rc);
954 bool result = l.priv_->comparison_started(l, r);
994 #define RETURN_TRUE_IF_COMPARISON_CYCLE_DETECTED(l, r) \
997 if (is_comparison_cycle_detected(l, r)) \
999 mark_dependant_types_compared_until(r); \
1014 template<
typename T>
1018 l.priv_->mark_as_being_compared(l, r);
1049 template<
typename T>
1053 l.priv_->unmark_as_being_compared(l, r);
1099 template<
typename T>
1102 bool propagate_canonical_type =
true)
1104 if (propagate_canonical_type && (value ==
true))
1105 maybe_propagate_canonical_type(l, r);
1118 && (
is_type(&r)->priv_->depends_on_recursive_type()
1119 || env.priv_->is_recursive_type(&r))
1120 &&
is_type(&r)->priv_->canonical_type_propagated()
1121 && !
is_type(&r)->priv_->propagated_canonical_type_confirmed()
1122 && !env.priv_->right_type_comp_operands_.empty())
1127 env.priv_->add_to_types_with_non_confirmed_propagated_ct(
is_type(&r));
1129 else if (value ==
true
1130 && env.priv_->right_type_comp_operands_.empty()
1131 &&
is_type(&r)->priv_->canonical_type_propagated()
1132 && !
is_type(&r)->priv_->propagated_canonical_type_confirmed())
1141 env.priv_->confirm_ct_propagation(&r);
1143 else if (value ==
true
1144 &&
is_type(&r)->priv_->canonical_type_propagated()
1145 && !
is_type(&r)->priv_->propagated_canonical_type_confirmed())
1148 env.priv_->add_to_types_with_non_confirmed_propagated_ct(
is_type(&r));
1149 else if (value ==
false)
1156 env.priv_->cancel_all_non_confirmed_propagated_canonical_types();
1168 && env.priv_->right_type_comp_operands_.empty()
1169 && !env.priv_->types_with_non_confirmed_propagated_ct_.empty())
1174 env.priv_->confirm_ct_propagation();
1176 #ifdef WITH_DEBUG_SELF_COMPARISON
1177 if (value ==
false && env.priv_->right_type_comp_operands_.empty())
1179 for (
const auto i : env.priv_->types_with_non_confirmed_propagated_ct_)
1182 env.priv_->check_abixml_canonical_type_propagation_during_self_comp(t);
1190 #define CACHE_AND_RETURN_COMPARISON_RESULT(value) \
1193 bool res = return_comparison_result(l, r, value); \
1194 l.get_environment().priv_->cache_type_comparison_result(l, r, res); \
1202 #define CACHE_COMPARISON_RESULT_AND_RETURN(value) \
1205 l.get_environment().priv_->cache_type_comparison_result(l, r, value); \
1213 const vector<type_base_wptr>&
1216 if (priv_->sorted_types_.empty())
1218 istring_type_base_wptrs_map_type::const_iterator i;
1219 vector<type_base_wptr>::const_iterator j;
1222 for (j = i->second.begin(); j != i->second.end(); ++j)
1223 priv_->sorted_types_.push_back(*j);
1226 for (j = i->second.begin(); j != i->second.end(); ++j)
1227 priv_->sorted_types_.push_back(*j);
1230 for (j = i->second.begin(); j != i->second.end(); ++j)
1231 priv_->sorted_types_.push_back(*j);
1234 for (j = i->second.begin(); j != i->second.end(); ++j)
1235 priv_->sorted_types_.push_back(*j);
1238 for (j = i->second.begin(); j != i->second.end(); ++j)
1239 priv_->sorted_types_.push_back(*j);
1241 type_name_comp comp;
1242 sort(priv_->sorted_types_.begin(), priv_->sorted_types_.end(), comp);
1245 return priv_->sorted_types_;
1264 const std::string& path,
1266 : priv_(new
priv(env))
1268 priv_->path_ = path;
1269 priv_->address_size_ = address_size;
1291 if (!priv_->global_scope_)
1293 priv_->global_scope_.reset
1295 priv_->global_scope_->set_translation_unit
1298 return priv_->global_scope_;
1306 {
return priv_->types_;}
1313 {
return priv_->types_;}
1320 const vector<function_type_sptr>&
1322 {
return priv_->live_fn_types_;}
1329 {
return priv_->env_;}
1336 {
return priv_->language_;}
1343 {priv_->language_ = l;}
1356 {
return priv_->path_;}
1367 {priv_->path_ = a_path;}
1380 {
return priv_->comp_dir_path_;}
1391 {priv_->comp_dir_path_ = d;}
1400 if (priv_->abs_path_.empty())
1403 if (!priv_->path_.empty())
1405 if (!priv_->comp_dir_path_.empty())
1407 path = priv_->comp_dir_path_;
1410 path += priv_->path_;
1412 priv_->abs_path_ = path;
1415 return priv_->abs_path_;
1434 {
return priv_->corp;}
1450 {
return priv_->loc_mgr_;}
1458 {
return priv_->loc_mgr_;}
1467 if (!priv_->global_scope_)
1477 {
return priv_->address_size_;}
1484 {priv_->address_size_= a;}
1500 {
return priv_->is_constructed_;}
1516 {priv_->is_constructed_ = f;}
1555 const_cast<translation_unit*
>(
this)->priv_->live_fn_types_.push_back(ftype);
1588 translation_unit::~translation_unit()
1601 case translation_unit::LANG_UNKNOWN:
1602 return "LANG_UNKNOWN";
1603 case translation_unit::LANG_Cobol74:
1604 return "LANG_Cobol74";
1605 case translation_unit::LANG_Cobol85:
1606 return "LANG_Cobol85";
1607 case translation_unit::LANG_C89:
1609 case translation_unit::LANG_C99:
1611 case translation_unit::LANG_C11:
1613 case translation_unit::LANG_C:
1615 case translation_unit::LANG_C_plus_plus_11:
1616 return "LANG_C_plus_plus_11";
1617 case translation_unit::LANG_C_plus_plus_14:
1618 return "LANG_C_plus_plus_14";
1619 case translation_unit::LANG_C_plus_plus:
1620 return "LANG_C_plus_plus";
1621 case translation_unit::LANG_ObjC:
1623 case translation_unit::LANG_ObjC_plus_plus:
1624 return "LANG_ObjC_plus_plus";
1625 case translation_unit::LANG_Fortran77:
1626 return "LANG_Fortran77";
1627 case translation_unit::LANG_Fortran90:
1628 return "LANG_Fortran90";
1629 case translation_unit::LANG_Fortran95:
1630 return "LANG_Fortran95";
1631 case translation_unit::LANG_Ada83:
1632 return "LANG_Ada83";
1633 case translation_unit::LANG_Ada95:
1634 return "LANG_Ada95";
1635 case translation_unit::LANG_Pascal83:
1636 return "LANG_Pascal83";
1637 case translation_unit::LANG_Modula2:
1638 return "LANG_Modula2";
1639 case translation_unit::LANG_Java:
1641 case translation_unit::LANG_PLI:
1643 case translation_unit::LANG_UPC:
1645 case translation_unit::LANG_D:
1647 case translation_unit::LANG_Python:
1648 return "LANG_Python";
1649 case translation_unit::LANG_Go:
1651 case translation_unit::LANG_Mips_Assembler:
1652 return "LANG_Mips_Assembler";
1654 return "LANG_UNKNOWN";
1657 return "LANG_UNKNOWN";
1669 if (l ==
"LANG_Cobol74")
1670 return translation_unit::LANG_Cobol74;
1671 else if (l ==
"LANG_Cobol85")
1672 return translation_unit::LANG_Cobol85;
1673 else if (l ==
"LANG_C89")
1674 return translation_unit::LANG_C89;
1675 else if (l ==
"LANG_C99")
1676 return translation_unit::LANG_C99;
1677 else if (l ==
"LANG_C11")
1678 return translation_unit::LANG_C11;
1679 else if (l ==
"LANG_C")
1680 return translation_unit::LANG_C;
1681 else if (l ==
"LANG_C_plus_plus_11")
1682 return translation_unit::LANG_C_plus_plus_11;
1683 else if (l ==
"LANG_C_plus_plus_14")
1684 return translation_unit::LANG_C_plus_plus_14;
1685 else if (l ==
"LANG_C_plus_plus")
1686 return translation_unit::LANG_C_plus_plus;
1687 else if (l ==
"LANG_ObjC")
1688 return translation_unit::LANG_ObjC;
1689 else if (l ==
"LANG_ObjC_plus_plus")
1690 return translation_unit::LANG_ObjC_plus_plus;
1691 else if (l ==
"LANG_Fortran77")
1692 return translation_unit::LANG_Fortran77;
1693 else if (l ==
"LANG_Fortran90")
1694 return translation_unit::LANG_Fortran90;
1695 else if (l ==
"LANG_Fortran95")
1696 return translation_unit::LANG_Fortran95;
1697 else if (l ==
"LANG_Ada83")
1698 return translation_unit::LANG_Ada83;
1699 else if (l ==
"LANG_Ada95")
1700 return translation_unit::LANG_Ada95;
1701 else if (l ==
"LANG_Pascal83")
1702 return translation_unit::LANG_Pascal83;
1703 else if (l ==
"LANG_Modula2")
1704 return translation_unit::LANG_Modula2;
1705 else if (l ==
"LANG_Java")
1706 return translation_unit::LANG_Java;
1707 else if (l ==
"LANG_PLI")
1708 return translation_unit::LANG_PLI;
1709 else if (l ==
"LANG_UPC")
1710 return translation_unit::LANG_UPC;
1711 else if (l ==
"LANG_D")
1712 return translation_unit::LANG_D;
1713 else if (l ==
"LANG_Python")
1714 return translation_unit::LANG_Python;
1715 else if (l ==
"LANG_Go")
1716 return translation_unit::LANG_Go;
1717 else if (l ==
"LANG_Mips_Assembler")
1718 return translation_unit::LANG_Mips_Assembler;
1720 return translation_unit::LANG_UNKNOWN;
1731 return (l == translation_unit::LANG_C89
1732 || l == translation_unit::LANG_C99
1733 || l == translation_unit::LANG_C11
1734 || l == translation_unit::LANG_C);
1745 return (l == translation_unit::LANG_C_plus_plus_03
1746 || l == translation_unit::LANG_C_plus_plus_11
1747 || l == translation_unit::LANG_C_plus_plus_14
1748 || l == translation_unit::LANG_C_plus_plus);
1758 {
return l == translation_unit::LANG_Java;}
1768 return (l == translation_unit::LANG_Ada83
1769 || l == translation_unit::LANG_Ada95);
1782 if (l.get() == r.get())
1805 struct elf_symbol::priv
1845 bool is_in_ksymtab_;
1848 bool is_suppressed_;
1863 is_in_ksymtab_(false),
1866 is_suppressed_(false)
1869 priv(
const environment& e,
1877 const elf_symbol::version& ve,
1899 is_common_ = type_ == COMMON_TYPE;
1933 elf_symbol::elf_symbol(
const environment& e,
2009 elf_symbol_sptr sym(
new elf_symbol(e, i, s, n, t, b, d, c, ve, vi,
2011 sym->priv_->main_symbol_ = sym;
2051 {
return priv_->env_;}
2058 {
return priv_->index_;}
2065 {priv_->index_ = s;}
2072 {
return priv_->name_;}
2081 priv_->id_string_.clear();
2089 {
return priv_->type_;}
2103 {
return priv_->size_;}
2110 {priv_->size_ = size;}
2117 {
return priv_->binding_;}
2124 {priv_->binding_ = b;}
2131 {
return priv_->version_;}
2139 priv_->version_ = v;
2140 priv_->id_string_.clear();
2149 {priv_->visibility_ = v;}
2157 {
return priv_->visibility_;}
2165 {
return priv_->is_defined_;}
2173 {priv_->is_defined_ = d;}
2226 {
return priv_->is_in_ksymtab_;}
2241 {
return priv_->crc_;}
2248 {priv_->crc_ = crc;}
2255 {
return priv_->namespace_;}
2262 {priv_->namespace_ = ns;}
2271 {
return priv_->is_suppressed_;}
2310 {
return priv_->main_symbol_.lock();}
2317 {
return priv_->main_symbol_.lock();}
2331 {
return priv_->next_alias_.lock();}
2351 a = a->get_next_alias())
2374 a && !a->is_main_symbol();
2375 a = a->get_next_alias())
2377 if (a->get_next_alias()->is_main_symbol())
2385 last_alias->priv_->next_alias_ = alias;
2388 priv_->next_alias_ = alias;
2418 a = a->get_next_alias())
2419 if (a->get_name() == name)
2429 priv_->main_symbol_ = new_main;
2431 a = a->get_next_alias())
2432 a->priv_->main_symbol_ = new_main;
2442 {
return priv_->is_common_;}
2473 {
return priv_->next_common_instance_.lock();}
2488 ABG_ASSERT(!common->has_other_common_instances());
2497 c = c->get_next_common_instance())
2502 last_common_instance = c;
2507 last_common_instance->priv_->next_common_instance_ = common;
2510 priv_->next_common_instance_ = common;
2530 if (priv_->id_string_.empty())
2542 priv_->id_string_ = s;
2545 return priv_->id_string_;
2562 a = a->get_next_alias())
2563 if (a->get_name() == name)
2580 a && a.get() != a->get_main_symbol().get();
2581 a = a->get_next_alias())
2582 if (textually_equals(*
this, *a))
2599 bool include_symbol_itself)
const
2603 if (include_symbol_itself)
2606 vector<elf_symbol_sptr> aliases;
2607 compute_aliases_for_elf_symbol(*
this, syms, aliases);
2608 if (!aliases.empty() && include_symbol_itself)
2611 for (vector<elf_symbol_sptr>::const_iterator i = aliases.begin();
2615 if (i != aliases.begin())
2617 result += (*i)->get_id_string();
2632 vector<elf_symbol_sptr> aliases;
2633 if (include_symbol_itself)
2638 a = a->get_next_alias())
2639 aliases.push_back(a);
2642 for (vector<elf_symbol_sptr>::const_iterator i = aliases.begin();
2646 if (i != aliases.begin())
2648 result += (*i)->get_id_string();
2668 name.clear(), ver.clear();
2670 string::size_type i =
id.find(
'@');
2671 if (i == string::npos)
2677 name =
id.substr(0, i);
2683 string::size_type j =
id.find(
'@', i);
2684 if (j == string::npos)
2711 bool are_equal = textually_equals(*
this, other);
2732 a && !a->is_main_symbol();
2733 a = a->get_next_alias())
2757 return *lhs == *rhs;
2783 compute_aliases_for_elf_symbol(
const elf_symbol& sym,
2785 vector<elf_symbol_sptr>& aliases)
2789 for (; a && !a->is_main_symbol(); a = a->get_next_alias())
2790 aliases.push_back(a);
2792 for (string_elf_symbols_map_type::const_iterator i = symtab.begin();
2795 for (elf_symbols::const_iterator j = i->second.begin();
2796 j != i->second.end();
2801 s && !s->is_main_symbol();
2802 s = s->get_next_alias())
2803 aliases.push_back(s);
2806 s && !s->is_main_symbol();
2807 s = s->get_next_alias())
2809 aliases.push_back(*j);
2854 case elf_symbol::NOTYPE_TYPE:
2855 repr =
"unspecified symbol type";
2857 case elf_symbol::OBJECT_TYPE:
2858 repr =
"variable symbol type";
2860 case elf_symbol::FUNC_TYPE:
2861 repr =
"function symbol type";
2863 case elf_symbol::SECTION_TYPE:
2864 repr =
"section symbol type";
2866 case elf_symbol::FILE_TYPE:
2867 repr =
"file symbol type";
2869 case elf_symbol::COMMON_TYPE:
2870 repr =
"common data object symbol type";
2872 case elf_symbol::TLS_TYPE:
2873 repr =
"thread local data object symbol type";
2875 case elf_symbol::GNU_IFUNC_TYPE:
2876 repr =
"indirect function symbol type";
2880 std::ostringstream s;
2881 s <<
"unknown symbol type (" << (char)t <<
')';
2904 case elf_symbol::LOCAL_BINDING:
2905 repr =
"local binding";
2907 case elf_symbol::GLOBAL_BINDING:
2908 repr =
"global binding";
2910 case elf_symbol::WEAK_BINDING:
2911 repr =
"weak binding";
2913 case elf_symbol::GNU_UNIQUE_BINDING:
2914 repr =
"GNU unique binding";
2918 std::ostringstream s;
2919 s <<
"unknown binding (" << (
unsigned char) b <<
")";
2942 case elf_symbol::DEFAULT_VISIBILITY:
2943 repr =
"default visibility";
2945 case elf_symbol::PROTECTED_VISIBILITY:
2946 repr =
"protected visibility";
2948 case elf_symbol::HIDDEN_VISIBILITY:
2949 repr =
"hidden visibility";
2951 case elf_symbol::INTERNAL_VISIBILITY:
2952 repr =
"internal visibility";
2956 std::ostringstream s;
2957 s <<
"unknown visibility (" << (
unsigned char) v <<
")";
2979 t = elf_symbol::NOTYPE_TYPE;
2980 else if (s ==
"object-type")
2981 t = elf_symbol::OBJECT_TYPE;
2982 else if (s ==
"func-type")
2983 t = elf_symbol::FUNC_TYPE;
2984 else if (s ==
"section-type")
2985 t = elf_symbol::SECTION_TYPE;
2986 else if (s ==
"file-type")
2987 t = elf_symbol::FILE_TYPE;
2988 else if (s ==
"common-type")
2989 t = elf_symbol::COMMON_TYPE;
2990 else if (s ==
"tls-type")
2991 t = elf_symbol::TLS_TYPE;
2992 else if (s ==
"gnu-ifunc-type")
2993 t = elf_symbol::GNU_IFUNC_TYPE;
3011 if (s ==
"local-binding")
3012 b = elf_symbol::LOCAL_BINDING;
3013 else if (s ==
"global-binding")
3014 b = elf_symbol::GLOBAL_BINDING;
3015 else if (s ==
"weak-binding")
3016 b = elf_symbol::WEAK_BINDING;
3017 else if (s ==
"gnu-unique-binding")
3018 b = elf_symbol::GNU_UNIQUE_BINDING;
3036 if (s ==
"default-visibility")
3037 v = elf_symbol::DEFAULT_VISIBILITY;
3038 else if (s ==
"protected-visibility")
3039 v = elf_symbol::PROTECTED_VISIBILITY;
3040 else if (s ==
"hidden-visibility")
3041 v = elf_symbol::HIDDEN_VISIBILITY;
3042 else if (s ==
"internal-visibility")
3043 v = elf_symbol::INTERNAL_VISIBILITY;
3058 {
return t == elf_symbol::FUNC_TYPE;}
3068 {
return t == elf_symbol::OBJECT_TYPE;}
3072 struct elf_symbol::version::priv
3078 : is_default_(false)
3081 priv(
const string& v,
3088 elf_symbol::version::version()
3095 elf_symbol::version::version(
const string& v,
3097 : priv_(new priv(v, is_default))
3101 : priv_(new priv(v.str(), v.is_default()))
3105 elf_symbol::version::~version() =
default;
3110 elf_symbol::version::operator
const string&()
const
3111 {
return priv_->version_;}
3118 {
return priv_->version_;}
3125 {priv_->version_ = s;}
3132 {
return priv_->is_default_;}
3139 {priv_->is_default_ = f;}
3142 elf_symbol::version::is_empty()
const
3143 {
return str().empty();}
3152 {
return str() == o.
str();}
3181 struct dm_context_rel::priv
3184 size_t offset_in_bits_;
3187 priv(
bool is_static =
false)
3188 : is_laid_out_(!is_static),
3190 anonymous_data_member_()
3193 priv(
bool is_laid_out,
size_t offset_in_bits)
3194 : is_laid_out_(is_laid_out),
3195 offset_in_bits_(offset_in_bits),
3196 anonymous_data_member_()
3200 dm_context_rel::dm_context_rel()
3205 dm_context_rel::dm_context_rel(scope_decl* s,
3207 size_t offset_in_bits,
3210 : context_rel(s, a, is_static),
3211 priv_(new priv(is_laid_out, offset_in_bits))
3214 dm_context_rel::dm_context_rel(scope_decl* s)
3220 dm_context_rel::get_is_laid_out()
const
3221 {
return priv_->is_laid_out_;}
3224 dm_context_rel::set_is_laid_out(
bool f)
3225 {priv_->is_laid_out_ = f;}
3228 dm_context_rel::get_offset_in_bits()
const
3229 {
return priv_->offset_in_bits_;}
3232 dm_context_rel::set_offset_in_bits(
size_t o)
3233 {priv_->offset_in_bits_ = o;}
3236 dm_context_rel::operator==(
const dm_context_rel& o)
const
3238 if (!context_rel::operator==(o))
3241 return (priv_->is_laid_out_ == o.priv_->is_laid_out_
3242 && priv_->offset_in_bits_ == o.priv_->offset_in_bits_);
3246 dm_context_rel::operator!=(
const dm_context_rel& o)
const
3257 {
return priv_->anonymous_data_member_;}
3267 {priv_->anonymous_data_member_ = anon_dm;}
3269 dm_context_rel::~dm_context_rel()
3295 {
return priv_->canonical_types_;}
3308 is_ptr_ref_or_qual_type(
const type_base *t)
3325 compare_using_locations(
const decl_base *f,
3339 unsigned l1 = 0, l2 = 0, c1 = 0, c2 = 0;
3362 struct decl_topo_comp
3373 operator()(
const decl_base *f,
3392 if ((!f->get_corpus() && !s->get_corpus())
3393 || (f->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN
3394 && s->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN))
3395 return compare_using_locations(f, s);
3402 if (fl.get_value() && sl.get_value())
3403 return compare_using_locations(f, s);
3404 else if (!!fl != !!sl)
3411 if (f->get_is_anonymous()
3412 && s->get_is_anonymous()
3415 return f->get_name() < s->get_name();
3429 operator()(
const decl_base_sptr &f,
3430 const decl_base_sptr &s)
3431 {
return operator()(f.get(), s.get());}
3442 struct type_topo_comp
3450 has_artificial_or_natural_location(
const decl_base* d)
3459 has_artificial_or_natural_location(
const type_base* t)
3461 if (decl_base *d =
is_decl(t))
3462 return has_artificial_or_natural_location(d);
3474 operator()(
const type_base_sptr &f,
3475 const type_base_sptr &s)
3476 {
return operator()(f.get(), s.get());}
3486 operator()(
const type_base *f,
3491 if ((!f->get_corpus() && !s->get_corpus())
3492 || (f->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN
3493 && s->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN))
3496 bool f_is_ptr_ref_or_qual = is_ptr_ref_or_qual_type(f);
3497 bool s_is_ptr_ref_or_qual = is_ptr_ref_or_qual_type(s);
3499 if (f_is_ptr_ref_or_qual != s_is_ptr_ref_or_qual)
3500 return !f_is_ptr_ref_or_qual && s_is_ptr_ref_or_qual;
3502 if (f_is_ptr_ref_or_qual && s_is_ptr_ref_or_qual
3503 && !has_artificial_or_natural_location(f)
3504 && !has_artificial_or_natural_location(s))
3512 if (q->get_cv_quals() == qualified_type_def::CV_NONE)
3544 type_base *peeled_f =
3546 type_base *peeled_s =
3603 decl_topo_comp decl_comp;
3604 return decl_comp(fd, sd);
3615 vector<type_base_sptr>& result)
3618 result.push_back(t);
3620 type_topo_comp comp;
3621 std::stable_sort(result.begin(), result.end(), comp);
3633 const type_base_sptr&
3636 if (!priv_->void_type_)
3637 priv_->void_type_.reset(
new type_decl(*
this,
3640 return priv_->void_type_;
3652 const type_base_sptr&
3655 if (!priv_->void_pointer_type_)
3658 return priv_->void_pointer_type_;
3671 const type_base_sptr&
3674 if (!priv_->variadic_marker_type_)
3675 priv_->variadic_marker_type_.
3678 return priv_->variadic_marker_type_;
3687 static string variadic_parameter_type_name =
"variadic parameter type";
3688 return variadic_parameter_type_name;
3698 {
return priv_->canonicalization_is_done_;}
3712 {priv_->canonicalization_is_done_ = f;}
3721 {
return priv_->do_on_the_fly_canonicalization_;}
3730 {priv_->do_on_the_fly_canonicalization_ = f;}
3754 {
return priv_->decl_only_class_equals_definition_;}
3779 {priv_->decl_only_class_equals_definition_ = f;}
3884 {
return const_cast<environment*
>(
this)->priv_->string_pool_.create_string(s);}
3891 {
return priv_->config_;}
3901 {
return priv_->analyze_exported_interfaces_only_.has_value();}
3914 {priv_->analyze_exported_interfaces_only_ = f;}
3927 {
return priv_->analyze_exported_interfaces_only_.value_or(
false);}
3929 #ifdef WITH_DEBUG_SELF_COMPARISON
3942 environment::set_self_comparison_debug_input(
const corpus_sptr& c)
3944 self_comparison_debug_is_on(
true);
3945 if (priv_->first_self_comparison_corpus_.expired())
3946 priv_->first_self_comparison_corpus_ = c;
3947 else if (priv_->second_self_comparison_corpus_.expired()
3948 && c.get() != corpus_sptr(priv_->first_self_comparison_corpus_).get())
3949 priv_->second_self_comparison_corpus_ = c;
3962 environment::get_self_comparison_debug_inputs(corpus_sptr& first_corpus,
3963 corpus_sptr& second_corpus)
3965 first_corpus = priv_->first_self_comparison_corpus_.lock();
3966 second_corpus = priv_->second_self_comparison_corpus_.lock();
3973 environment::self_comparison_debug_is_on(
bool f)
3974 {priv_->self_comparison_debug_on_ = f;}
3981 environment::self_comparison_debug_is_on()
const
3982 {
return priv_->self_comparison_debug_on_;}
3985 #ifdef WITH_DEBUG_TYPE_CANONICALIZATION
3992 environment::debug_type_canonicalization_is_on(
bool flag)
3993 {priv_->debug_type_canonicalization_ = flag;}
4001 environment::debug_type_canonicalization_is_on()
const
4002 {
return priv_->debug_type_canonicalization_;}
4010 environment::debug_die_canonicalization_is_on(
bool flag)
4011 {priv_->debug_die_canonicalization_ = flag;}
4019 environment::debug_die_canonicalization_is_on()
const
4020 {
return priv_->debug_die_canonicalization_;}
4036 vector<type_base_sptr>*
4063 if (!types ||index >= types->size())
4065 return (*types)[index].get();
4068 #ifdef WITH_DEBUG_SELF_COMPARISON
4078 const unordered_map<string, uintptr_t>&
4079 environment::get_type_id_canonical_type_map()
const
4080 {
return priv_->get_type_id_canonical_type_map();}
4091 unordered_map<string, uintptr_t>&
4092 environment::get_type_id_canonical_type_map()
4093 {
return priv_->get_type_id_canonical_type_map();}
4108 const unordered_map<uintptr_t, string>&
4109 environment::get_pointer_type_id_map()
const
4110 {
return priv_->get_pointer_type_id_map();}
4125 unordered_map<uintptr_t, string>&
4126 environment::get_pointer_type_id_map()
4127 {
return priv_->get_pointer_type_id_map();}
4145 environment::get_type_id_from_pointer(uintptr_t ptr)
const
4146 {
return priv_->get_type_id_from_pointer(ptr);}
4164 environment::get_type_id_from_type(
const type_base *t)
const
4165 {
return priv_->get_type_id_from_type(t);}
4182 environment::get_canonical_type_from_type_id(
const char* type_id)
const
4183 {
return priv_->get_canonical_type_from_type_id(type_id);}
4191 struct type_or_decl_base::priv
4209 void* type_or_decl_ptr_;
4210 bool hashing_started_;
4211 const environment& env_;
4212 translation_unit* translation_unit_;
4217 location artificial_location_;
4221 bool is_artificial_;
4229 priv(
const environment& e,
4233 type_or_decl_ptr_(),
4236 translation_unit_(),
4256 (
static_cast<unsigned>(l) |
static_cast<unsigned>(r));
4276 (
static_cast<unsigned>(l) &
static_cast<unsigned>(r));
4297 :priv_(new priv(e, k))
4313 {
return priv_->is_artificial_;}
4325 {priv_->is_artificial_ = f;}
4336 {
return priv_->kind();}
4356 {
return priv_->rtti_;}
4365 {
return priv_->rtti_;}
4377 priv_->type_or_decl_ptr_ = t;
4379 priv_->type_or_decl_ptr_ = d;
4402 {
return priv_->type_or_decl_ptr_;}
4409 {
return priv_->hashing_started_;}
4416 {priv_->hashing_started_ = b;}
4423 {
return priv_->env_;}
4441 {priv_->artificial_location_ = l;}
4459 {
return priv_->artificial_location_;}
4467 return (priv_->artificial_location_
4468 && priv_->artificial_location_.get_is_artificial());
4499 {priv_->translation_unit_ = tu;}
4508 {
return priv_->translation_unit_;}
4540 *dr =
dynamic_cast<const decl_base*
>(r);
4549 *tr =
dynamic_cast<const type_base*
>(r);
4594 struct decl_base::priv
4596 bool in_pub_sym_tab_;
4622 decl_base_sptr declaration_;
4624 decl_base* naked_definition_of_declaration_;
4625 bool is_declaration_only_;
4629 : in_pub_sym_tab_(false),
4630 is_anonymous_(true),
4632 visibility_(VISIBILITY_DEFAULT),
4633 naked_definition_of_declaration_(),
4634 is_declaration_only_(false)
4637 priv(interned_string name, interned_string linkage_name,
visibility vis)
4638 : in_pub_sym_tab_(false),
4641 qualified_name_(name),
4642 linkage_name_(linkage_name),
4644 naked_definition_of_declaration_(),
4645 is_declaration_only_(false)
4647 is_anonymous_ = name_.
empty();
4672 const string& linkage_name,
4675 priv_(new priv(e.intern(name), e.intern(linkage_name), vis))
4699 priv_(new priv(name, linkage_name, vis))
4726 {
return priv_->qualified_name_;}
4735 {priv_->qualified_name_.clear();}
4742 {priv_->qualified_name_ = n;}
4755 {
return priv_->temporary_qualified_name_;}
4769 {priv_->temporary_qualified_name_ = n;}
4776 {
return priv_->context_;}
4783 {
return priv_->context_;}
4787 {priv_->context_ = c;}
4818 {
return priv_->in_pub_sym_tab_;}
4826 {priv_->in_pub_sym_tab_ = f;}
4846 {
return priv_->location_;}
4888 priv_->location_ = l;
4898 priv_->is_anonymous_ = n.empty();
4909 {
return priv_->is_anonymous_;}
4919 {priv_->is_anonymous_ = f;}
4956 {
return priv_->naming_typedef_;}
4984 &&
is_type(
this)->get_naked_canonical_type() ==
nullptr);
4986 priv_->naming_typedef_ = t;
4993 update_qualified_name(
this);
5001 {
return priv_->linkage_name_;}
5010 priv_->linkage_name_ = env.
intern(m);
5018 {
return priv_->visibility_;}
5025 {priv_->visibility_ = v;}
5034 if (priv_->context_)
5035 return priv_->context_->get_scope();
5045 {
return priv_->qualified_parent_name_;}
5052 {
return priv_->name_;}
5087 bool qualified_name)
const
5091 && has_generic_anonymous_internal_type_name(
this))
5102 string name = get_generic_anonymous_internal_type_name(
this);
5130 {
return priv_->qualified_name_;}
5144 {
return priv_->scoped_name_;}
5150 const decl_base_sptr
5152 {
return priv_->declaration_;}
5161 if (d && d->get_is_declaration_only())
5162 priv_->declaration_ = d;
5170 const decl_base_sptr
5172 {
return priv_->definition_of_declaration_.lock();}
5188 {
return priv_->naked_definition_of_declaration_;}
5195 {
return priv_->is_declaration_only_;}
5205 bool update_types_lookup_map = !f && priv_->is_declaration_only_;
5207 priv_->is_declaration_only_ = f;
5209 if (update_types_lookup_map)
5212 scope_decl::declarations::iterator i;
5213 if (s->find_iterator_for_member(
this, i))
5223 return static_cast<change_kind>(
static_cast<unsigned>(l)
5224 |
static_cast<unsigned>(r));
5230 return static_cast<change_kind>(
static_cast<unsigned>(l)
5231 &
static_cast<unsigned>(r));
5278 bool member_types_or_functions =
5282 if (member_types_or_functions)
5291 la = r1->get_access_specifier();
5292 ra = r2->get_access_specifier();
5293 r1->set_access_specifier(no_access);
5294 r2->set_access_specifier(no_access);
5297 bool rels_are_different = *r1 != *r2;
5299 if (member_types_or_functions)
5302 r1->set_access_specifier(la);
5303 r2->set_access_specifier(ra);
5306 if (rels_are_different)
5327 get_decl_name_for_comparison(
const decl_base &d)
5329 if (has_generic_anonymous_internal_type_name(&d)
5335 r += get_generic_anonymous_internal_type_name(&d);
5372 if (!l_linkage_name.
empty() && !r_linkage_name.
empty())
5374 if (l_linkage_name != r_linkage_name)
5409 bool decls_are_same = (ln == rn);
5418 decls_are_same =
true;
5428 if (!decls_are_same)
5451 {
return equals(*
this, other, 0);}
5490 if (!priv_->context_)
5493 priv_->context_->set_scope(scope);
5511 case decl_base::VISIBILITY_NONE:
5514 case decl_base::VISIBILITY_DEFAULT:
5517 case decl_base::VISIBILITY_PROTECTED:
5520 case decl_base::VISIBILITY_HIDDEN:
5523 case decl_base::VISIBILITY_INTERNAL:
5543 case decl_base::BINDING_NONE:
5546 case decl_base::BINDING_LOCAL:
5549 case decl_base::BINDING_GLOBAL:
5552 case decl_base::BINDING_WEAK:
5575 if (l.get() == r.get())
5611 if (l.get() == r.get())
5697 {
return dynamic_pointer_cast<scope_decl>(d);}
5763 return c->get_access_specifier();
5793 c->set_access_specifier(a);
5823 return c->get_is_static();
5965 var_decl_sptr first = *klass->get_non_static_data_members().begin();
5986 if (!klass ||!data_member)
5989 for (class_or_union::data_members::const_iterator it =
5993 if (**it == *data_member)
6062 bool result =
false;
6080 dms[member->get_name()] = member;
6289 return class_or_union_sptr();
6298 const class_or_union_sptr
6303 if (cou->get_is_anonymous())
6306 return class_or_union_sptr();
6315 const class_or_union_sptr
6320 return class_or_union_sptr();
6329 const class_or_union_sptr
6344 return class_or_union_sptr();
6369 for (
auto anon_dm_m : cl->get_non_static_data_members())
6416 ctxt_rel->set_offset_in_bits(o);
6431 return ctxt_rel->get_offset_in_bits();
6521 const var_decl *containing_anonymous_data_member =
6524 uint64_t containing_anonymous_data_member_offset = 0;
6525 if (containing_anonymous_data_member)
6526 containing_anonymous_data_member_offset =
6529 return (ctxt_rel->get_offset_in_bits()
6531 containing_anonymous_data_member_offset);
6559 type_base_sptr t = v->get_type();
6562 return t->get_size_in_bits();
6576 ctxt_rel->set_is_laid_out(l);
6591 return ctxt_rel->get_is_laid_out();
6893 return ctxt->is_virtual();
6930 ctxt->is_virtual(is_virtual);
6945 (dynamic_pointer_cast<method_decl>(fn));
6983 if (!cl->get_canonical_type())
6989 type_base_sptr t = type;
7000 ty->get_size_in_bits(),
7001 ty->get_alignment_in_bits(),
7002 ty->get_location()));
7010 ty->get_size_in_bits(),
7011 ty->get_alignment_in_bits(),
7012 ty->get_location()));
7021 ty->get_location()));
7027 t.reset(
new array_type_def(p, ty->get_subranges(), ty->get_location()));
7032 for (function_decl::parameters::const_iterator i =
7033 ty->get_parameters().begin();
7034 i != ty->get_parameters().end();
7045 p->get_variadic_marker(),
7046 p->get_is_artificial()));
7047 parm.push_back(stripped);
7052 parm, ty->get_is_const(),
7053 ty->get_size_in_bits(),
7054 ty->get_alignment_in_bits()));
7059 for (function_decl::parameters::const_iterator i =
7060 ty->get_parameters().begin();
7061 i != ty->get_parameters().end();
7072 p->get_variadic_marker(),
7073 p->get_is_artificial()));
7074 parm.push_back(stripped);
7079 ty->get_size_in_bits(),
7080 ty->get_alignment_in_bits()));
7083 if (!t->get_translation_unit())
7084 t->set_translation_unit(type->get_translation_unit());
7089 return t->get_canonical_type() ? t->get_canonical_type() : t;
7112 decl_base_sptr result = t;
7113 type_base_sptr u = t->get_underlying_type();
7116 if ((t->get_cv_quals() & qualified_type_def::CV_CONST
7118 || (t->get_cv_quals() & qualified_type_def::CV_CONST
7120 || t->get_cv_quals() == qualified_type_def::CV_NONE)
7166 static qualified_type_def_sptr
7167 strip_redundant_quals_from_underyling_types(
const qualified_type_def_sptr& t,
7176 qualified_type_def_sptr underlying_qualified_type =
7184 currated_quals &= ~redundant_quals;
7185 t->set_cv_quals(currated_quals);
7189 redundant_quals |= currated_quals;
7191 qualified_type_def_sptr result = t;
7192 if (underlying_qualified_type)
7196 strip_redundant_quals_from_underyling_types(underlying_qualified_type,
7230 strip_redundant_quals_from_underyling_types(
const qualified_type_def_sptr& t)
7236 strip_redundant_quals_from_underyling_types(t, redundant_quals);
7263 return t->get_underlying_type();
7317 return t->get_pointed_to_type();
7373 return t->get_pointed_to_type();
7413 const type_base_sptr
7477 const type_base_sptr
7498 if (t->get_cv_quals() == qualified_type_def::CV_CONST)
7531 return q->get_underlying_type();
7580 type_base_sptr type = t;
7603 type_base_sptr typ = type;
7665 bool peel_qual_type)
7704 bool peel_qual_type)
7742 vector<array_type_def::subrange_sptr> subranges;
7744 for (vector<array_type_def::subrange_sptr>::const_iterator i =
7745 array->get_subranges().begin();
7746 i != array->get_subranges().end();
7752 (*i)->get_lower_bound(),
7753 (*i)->get_upper_bound(),
7754 (*i)->get_underlying_type(),
7755 (*i)->get_location(),
7756 (*i)->get_language()));
7757 subrange->is_non_finite((*i)->is_non_finite());
7760 subranges.push_back(subrange);
7765 subranges, array->get_location()));
7788 (
new typedef_decl(t->get_name(), t->get_underlying_type(),
7789 t->get_location(), t->get_linkage_name(),
7790 t->get_visibility()));
7806 qualified_type_def_sptr
7812 qualified_type_def_sptr result
7814 t->get_cv_quals(), t->get_location()));
7826 static type_base_sptr
7827 clone_typedef_array_qualified_type(type_base_sptr type)
7833 type_base_sptr result;
7842 return type_base_sptr();
7865 type_base_sptr result = clone_typedef_array_qualified_type(t);
7868 type_base_sptr subtree;
7872 clone_typedef_array_qualified_type(type->get_underlying_type());
7876 type->set_underlying_type(subtree);
7882 clone_typedef_array_qualified_type(type->get_element_type());
7886 type->set_element_type(subtree);
7896 clone_typedef_array_qualified_type(t->get_underlying_type());
7903 t->set_underlying_type (s);
7912 clone_typedef_array_qualified_type(t->get_underlying_type());
7919 t->set_underlying_type(s);
7927 type_base_sptr e = t->get_element_type();
7931 clone_typedef_array_qualified_type(e);
7937 t->set_element_type(s);
7956 ::qualified_name_setter setter;
7964 update_qualified_name(decl_base_sptr d)
7965 {
return update_qualified_name(d.get());}
7985 {
return reinterpret_cast<size_t>(l);}
7987 struct scope_decl::priv
8032 {
return priv_->canonical_types_;}
8050 if (priv_->sorted_canonical_types_.empty())
8052 for (canonical_type_sptr_set_type::const_iterator e =
8056 priv_->sorted_canonical_types_.push_back(*e);
8058 type_topo_comp comp;
8059 std::stable_sort(priv_->sorted_canonical_types_.begin(),
8060 priv_->sorted_canonical_types_.end(),
8063 return priv_->sorted_canonical_types_;
8073 {
return priv_->members_;}
8082 {
return priv_->members_;}
8092 decl_topo_comp comp;
8093 if (priv_->sorted_members_.empty())
8098 priv_->sorted_members_.push_back(*i);
8100 std::stable_sort(priv_->sorted_members_.begin(),
8101 priv_->sorted_members_.end(),
8104 return priv_->sorted_members_;
8119 if (t->get_is_anonymous())
8137 if (t->get_is_anonymous())
8155 if (t->get_is_anonymous())
8166 {
return priv_->member_scopes_;}
8173 {
return priv_->member_scopes_;}
8195 maybe_set_translation_unit(
const decl_base_sptr& decl,
8210 decl->set_translation_unit(tu);
8227 member->set_scope(
this);
8228 priv_->members_.push_back(member);
8230 priv_->member_types_.push_back(
is_type(member));
8233 priv_->member_scopes_.push_back(m);
8235 update_qualified_name(member);
8238 maybe_set_translation_unit(member, tu);
8250 {
return priv_->member_types_;}
8265 return type_base_sptr();
8275 declarations::iterator before)
8281 priv_->member_types_.push_back(t);
8317 for (
auto i = priv_->member_types_.begin();
8318 i != priv_->member_types_.end();
8323 priv_->member_types_.erase(i);
8336 if (priv_->sorted_member_types_.empty())
8339 priv_->sorted_member_types_.push_back(t);
8341 type_topo_comp comp;
8342 std::stable_sort(priv_->sorted_member_types_.begin(),
8343 priv_->sorted_member_types_.end(),
8346 return priv_->sorted_member_types_;
8362 declarations::iterator before)
8366 member->set_scope(
this);
8367 priv_->members_.insert(before, member);
8370 priv_-> member_scopes_.push_back(m);
8372 update_qualified_name(member);
8375 maybe_set_translation_unit(member, tu);
8388 for (declarations::iterator i = priv_->members_.begin();
8389 i != priv_->members_.end();
8394 priv_->members_.erase(i);
8404 for (scopes::iterator i = priv_->member_scopes_.begin();
8405 i != priv_->member_scopes_.end();
8410 priv_->member_scopes_.erase(i);
8416 member->set_scope(
nullptr);
8417 member->set_translation_unit(
nullptr);
8429 return hash_scope(
this);
8456 if (!l.decl_base::operator==(r))
8465 scope_decl::declarations::const_iterator i, j;
8507 return equals(*
this, *other, 0);
8522 if (l.get() == r.get())
8548 declarations::iterator& i)
8563 if ((*it).get() == decl)
8583 declarations::iterator& i)
8600 if (v.visit_begin(
this))
8603 for (scope_decl::declarations::const_iterator i =
8607 if (!(*i)->traverse(v))
8611 return v.visit_end(
this);
8614 scope_decl::~scope_decl()
8629 if (scope && decl && !decl->
get_scope())
8669 scope_decl::declarations::iterator before,
8672 if (scope && decl && !decl->
get_scope())
8691 scope_decl::declarations::iterator before,
8701 | ABSTRACT_DECL_BASE
8702 | ABSTRACT_SCOPE_DECL),
8705 translation_unit_(tu)
8707 runtime_type_instance(
this);
8726 return scope ?
dynamic_cast<global_scope*
> (scope) : 0;
8833 if (cv_quals & qualified_type_def::CV_RESTRICT)
8835 if (cv_quals & qualified_type_def::CV_CONST)
8841 if (cv_quals & qualified_type_def::CV_VOLATILE)
8893 {
return get_name(tod.get(), qualified);}
8911 string qualified_name;
8915 if (qualified_name.empty())
8916 qualified_name = name;
8918 qualified_name = qualified_name +
"::" + name;
8920 return qualified_name;
8955 location loc = decl->get_location();
8959 if (c->get_is_declaration_only() && c->get_definition_of_declaration())
8962 loc = c->get_location();
9020 has_generic_anonymous_internal_type_name(
const decl_base *d)
9037 static interned_string
9038 get_generic_anonymous_internal_type_name(
const decl_base *d)
9040 ABG_ASSERT(has_generic_anonymous_internal_type_name(d));
9042 const environment&env = d->get_environment();
9044 interned_string result;
9077 get_internal_integral_type_name(
const type_base* t)
9085 integral_type int_type;
9087 name = int_type.to_string(
true);
9127 r += get_generic_anonymous_internal_type_name(d);
9137 return env.
intern(get_internal_integral_type_name(t));
9146 internal, qualified));
9185 bool qualified,
bool internal)
9188 string tn =
get_type_name(pointed_to_type, qualified,
internal);
9207 bool lvalue_reference,
9208 bool qualified,
bool internal)
9212 string name =
get_type_name(pointed_to_type, qualified,
internal);
9213 if (lvalue_reference)
9238 bool qualified,
bool internal)
9240 const environment& env = underlying_type->get_environment();
9243 string name =
get_type_name(underlying_type, qualified,
internal);
9245 if (quals_repr.empty() &&
internal)
9257 if (!quals_repr.empty())
9266 name = quals_repr +
" " + name;
9323 std::ostringstream o;
9328 type_base_sptr return_type =
9335 stream_pretty_representation_of_fn_parms(fn_type, o,
9338 return env.
intern(o.str());
9357 c->get_exported_decls_builder();
9358 if (b->fn_id_maps_to_several_fns(fn))
9414 std::ostringstream o;
9419 type_base_sptr return_type =
9426 o << return_type->get_cached_pretty_representation(
internal);
9435 o <<
" (" << class_type->get_qualified_name(
internal) <<
"::*) ";
9436 stream_pretty_representation_of_fn_parms(fn_type, o,
9440 return env.
intern(o.str());
9606 std::ostringstream o;
9624 std::ostringstream o;
9679 const string& indent,
9682 bool qualified_names)
9685 string local_indent =
" ";
9690 if (!
internal && clazz->is_struct())
9696 repr = indent +
"union";
9714 for (class_or_union::data_members::const_iterator dm = dmems.begin();
9718 if (dm != dmems.begin())
9723 real_indent =
"\n" + indent + local_indent;
9730 real_indent, one_line,
internal, qualified_names);
9735 if (dm != dmems.begin())
9736 repr += real_indent;
9737 repr += (*dm)->get_pretty_representation(
internal,
9742 real_indent+ (*dm)->get_pretty_representation(
internal,
9751 repr += indent +
"}";
9774 const string& indent,
9777 bool qualified_names)
9781 internal, qualified_names);
9803 const string& indent,
9806 bool qualified_names)
9835 const string& indent,
bool one_line,
9836 bool qualified_names)
9839 std::ostringstream o;
9840 string local_indent =
" ";
9842 repr = indent +
"enum ";
9845 o << (qualified_names
9859 o << enumerator.get_name() +
"=" << enumerator.get_value() <<
", ";
9863 o <<
"\n" + indent <<
"}";
9894 const string& indent,
bool one_line,
9895 bool qualified_names)
9901 one_line, qualified_names);
9926 const string& indent,
bool one_line,
9927 bool qualified_names)
9956 const string& indent,
9959 bool qualified_name)
9965 internal, qualified_name);
9993 std::ostringstream o;
10008 o <<
" :" << std::endl;
10012 if (b->get_is_virtual())
10014 o << b->get_base_class()->get_qualified_name()
10024 <<
" // @: " << std::hex <<
is_type(c)
10030 type_base_sptr t = m->get_type();
10034 << m->get_pretty_representation(
false,
10038 if (t && t->get_canonical_type())
10039 o <<
" // uses canonical type '@"
10040 << std::hex << t->get_canonical_type().get() << std::dec;
10042 o <<
"'" << std::endl;
10047 o <<
" // virtual member functions\n\n";
10049 o <<
" " << f->get_pretty_representation(
false,
10051 <<
";" << std::endl;
10054 o <<
"};" << std::endl;
10060 string name = e->get_qualified_name();
10061 std::ostringstream o;
10062 o <<
"enum " << name
10064 << e->get_underlying_type()->get_pretty_representation(
false,
10068 <<
" // size in bits: " << e->get_size_in_bits() <<
"\n"
10069 <<
" // is-declaration-only: " << e->get_is_declaration_only() <<
"\n"
10071 <<
" // translation unit: "
10072 << e->get_translation_unit()->get_absolute_path() <<
"\n"
10073 <<
" // @: " << std::hex <<
is_type(e)
10074 <<
", @canonical: " << e->get_canonical_type().get() << std::dec
10077 for (
const auto &enom : e->get_enumerators())
10078 o <<
" " << enom.get_name() <<
" = " << enom.get_value() <<
",\n";
10084 return artifact->get_pretty_representation(
true,
10183 return const_cast<type_base*
>(artifact);
10200 return const_cast<decl_base*
>(artifact);
10230 debug_comp_vec(
const vector<const type_base*>& vect, std::ostringstream& o)
10232 for (
auto t : vect)
10234 o <<
"|" << t->get_pretty_representation()
10235 <<
"@" << std::hex << t << std::dec;
10247 print_comp_stack(
const environment& env)
10249 std::ostringstream o;
10250 o <<
"left-operands: ";
10251 debug_comp_vec(env.priv_->left_type_comp_operands_, o);
10252 o <<
"\n" <<
"right-operands: ";
10253 debug_comp_vec(env.priv_->right_type_comp_operands_, o);
10266 std::cerr << print_comp_stack(env);
10267 std::cerr << std::endl;
10299 {
return dynamic_cast<const decl_base*
>(t);}
10317 {
return dynamic_pointer_cast<decl_base>(t);}
10333 const type_base_sptr type2)
10335 if (!type1 || !type2)
10338 if (type1 == type2)
10371 const decl_base_sptr d2)
10509 const string& name)
10514 if (!containing_class_or_union)
10531 {
return (decl &&
dynamic_cast<template_decl*
>(decl->get_scope()));}
10541 return (decl && (dynamic_pointer_cast<type_tparameter>(decl)
10542 || dynamic_pointer_cast<non_type_tparameter>(decl)
10543 || dynamic_pointer_cast<template_tparameter>(decl)));
10573 {
return dynamic_pointer_cast<function_decl>(d);}
10596 {
return dynamic_pointer_cast<function_decl::parameter>(tod);}
10607 if (d && (d->
kind() & type_or_decl_base::ABSTRACT_DECL_BASE))
10609 if (!(d->
kind() & type_or_decl_base::ABSTRACT_TYPE_BASE))
10635 {
return dynamic_pointer_cast<decl_base>(d);}
10657 {
return dynamic_pointer_cast<decl_base>(t);}
10667 if (
dynamic_cast<const type_base*
>(&tod))
10680 if (t && (t->
kind() & type_or_decl_base::ABSTRACT_TYPE_BASE))
10694 {
return dynamic_pointer_cast<type_base>(tod);}
10726 if (!cou->get_naming_typedef())
10768 {
return dynamic_cast<const type_decl*
>(t);}
10776 {
return dynamic_pointer_cast<type_decl>(t);}
10826 {
return dynamic_pointer_cast<typedef_decl>(t);}
10907 {
return dynamic_pointer_cast<enum_type_decl>(d);}
10961 if (t->
kind() & type_or_decl_base::CLASS_TYPE)
10975 {
return dynamic_pointer_cast<class_decl>(d);}
10997 if (array->is_non_finite())
11067 if (array->get_subranges().size() == 1
11068 && array->get_subranges()[0]->get_length() == 1)
11138 return klass->get_is_declaration_only();
11187 shared_ptr<class_or_union>
11189 {
return dynamic_pointer_cast<class_or_union>(t);}
11218 const class_or_union_sptr& second)
11248 {
return dynamic_pointer_cast<union_decl>(t);}
11262 bool look_through_qualifiers)
11268 if (look_through_qualifiers)
11286 bool look_through_qualifiers)
11288 type_base_sptr type =
is_type(t);
11289 if (look_through_qualifiers)
11291 return dynamic_pointer_cast<pointer_type_def>(type);
11434 bool look_through_qualifiers)
11440 if (look_through_qualifiers)
11457 bool look_through_qualifiers)
11461 if (look_through_qualifiers)
11478 bool look_through_qualifiers)
11480 type_base_sptr type =
is_type(t);
11481 if (look_through_qualifiers)
11483 return dynamic_pointer_cast<reference_type_def>(type);
11494 bool look_through_qualifiers)
11497 if (look_through_qualifiers)
11514 bool look_through_qualifiers)
11516 type_base_sptr type =
is_type(t);
11517 if (look_through_qualifiers)
11519 return dynamic_pointer_cast<ptr_to_mbr_type>(type);
11593 const type_base_sptr
11596 type_base_sptr nil;
11600 if (t->get_environment().get_void_pointer_type().get() == t.get())
11629 qualified_type_def_sptr
11631 {
return dynamic_pointer_cast<qualified_type_def>(t);}
11641 {
return dynamic_pointer_cast<function_type>(t);}
11671 {
return dynamic_pointer_cast<method_type>(t);}
11709 class_or_union_sptr
11719 class_or_union_sptr
11751 decl_base_sptr decl;
11758 while (decl->get_is_declaration_only()
11759 && decl->get_definition_of_declaration())
11760 decl = decl->get_definition_of_declaration();
11827 decl_base_sptr d =
is_decl(t);
11852 {
return dynamic_pointer_cast<var_decl>(decl);}
11861 {
return dynamic_pointer_cast<namespace_decl>(d);}
11895 && dynamic_pointer_cast<function_decl>(decl)
11906 bool look_through_qualifiers)
11910 if (look_through_qualifiers)
11922 bool look_through_qualifiers)
11924 type_base_sptr t =
is_type(type);
11926 if (look_through_qualifiers)
11928 return dynamic_pointer_cast<array_type_def>(t);
11937 qualified_type_def_sptr
11941 return qualified_type_def_sptr();
11996 array_type_def::subrange_type*
12011 {
return dynamic_pointer_cast<array_type_def::subrange_type>(type);}
12021 {
return decl && dynamic_pointer_cast<template_decl>(decl);}
12027 LOOKUP_ENTITY_TYPE,
12059 find_next_delim_in_cplus_type(
const string& fqn,
12063 int angle_count = 0;
12064 bool found =
false;
12066 for (; i < fqn.size(); ++i)
12070 else if (fqn[i] ==
'>')
12072 else if (i + 1 < fqn.size()
12075 && fqn[i+1] ==
':')
12092 list<string>& comps)
12094 string::size_type fqn_size = fqn.size(), comp_begin = 0, comp_end = fqn_size;
12097 if (!find_next_delim_in_cplus_type(fqn, comp_begin, comp_end))
12098 comp_end = fqn_size;
12100 string comp = fqn.substr(comp_begin, comp_end - comp_begin);
12101 comps.push_back(comp);
12103 comp_begin = comp_end + 2;
12104 if (comp_begin >= fqn_size)
12120 for (list<string>::const_iterator c = comps.begin();
12123 if (c == comps.begin())
12126 result +=
"::" + *c;
12141 template<
typename T>
12143 iterator_is_last(T& container,
12144 typename T::const_iterator i)
12146 typename T::const_iterator next = i;
12148 return (next == container.end());
12165 lookup_types_in_map(
const interned_string& type_name,
12168 istring_type_base_wptrs_map_type::const_iterator i = type_map.find(type_name);
12169 if (i != type_map.end())
12190 template <
class TypeKind>
12191 static shared_ptr<TypeKind>
12192 lookup_type_in_map(
const interned_string& type_name,
12195 istring_type_base_wptrs_map_type::const_iterator i = type_map.find(type_name);
12196 if (i != type_map.end())
12200 for (
auto j : i->second)
12202 type_base_sptr t(j);
12203 decl_base_sptr d =
is_decl(t);
12204 if (d && !d->get_is_declaration_only())
12205 return dynamic_pointer_cast<TypeKind>(type_base_sptr(j));
12210 return dynamic_pointer_cast<TypeKind>(type_base_sptr(i->second.back()));
12212 return shared_ptr<TypeKind>();
12229 return lookup_type_in_map<type_decl>(type_name,
12288 return lookup_type_in_map<class_decl>(type_name,
12306 return lookup_type_in_map<union_decl>(type_name,
12341 union_decl_sptr result = lookup_type_in_map<union_decl>(loc, m);
12374 return lookup_type_in_map<enum_type_decl>(type_name,
12413 return lookup_type_in_map<typedef_decl>(type_name,
12449 qualified_type_def_sptr
12454 return lookup_type_in_map<qualified_type_def>(type_name,
12473 qualified_type_def_sptr
12500 return lookup_type_in_map<pointer_type_def>(type_name,
12562 return lookup_type_in_map<reference_type_def>(type_name,
12581 bool lvalue_reference,
12606 return lookup_type_in_map<array_type_def>(type_name,
12626 return lookup_type_in_map<function_type>(type_name,
12672 const type_base_sptr
12676 type_base_sptr result;
12715 const type_base_sptr
12739 const type_base_sptr
12743 list<string> comps;
12756 const decl_base_sptr
12760 list<string> comps;
12776 template<
typename NodeKind>
12788 {
return node->get_name();}
12808 {
return node->get_name();}
12817 template<
typename NodeKind>
12818 static decl_base_sptr
12819 convert_node_to_decl(shared_ptr<NodeKind> node);
12832 template<
typename NodeKind>
12834 lookup_node_in_scope(
const list<string>& fqn,
12838 shared_ptr<NodeKind> node;
12839 bool it_is_last =
false;
12842 for (list<string>::const_iterator c = fqn.begin(); c != fqn.end(); ++c)
12845 it_is_last = iterator_is_last(fqn, c);
12846 for (scope_decl::declarations::const_iterator m =
12847 cur_scope->get_member_decls().begin();
12848 m != cur_scope->get_member_decls().end();
12854 scope = dynamic_pointer_cast<scope_decl>(*m);
12855 if (scope && scope->get_name() == *c)
12864 node = dynamic_pointer_cast<NodeKind>(*m);
12868 dynamic_pointer_cast<class_decl>(node))
12869 if (cl->get_is_declaration_only()
12870 && !cl->get_definition_of_declaration())
12872 resulting_decl = node;
12877 if (!new_scope && !resulting_decl)
12878 return decl_base_sptr();
12879 cur_scope = new_scope;
12882 return resulting_decl;
12903 const type_base_sptr
12906 {
return is_type(lookup_node_in_scope<type_base>(comps, scope));}
12930 static const type_base_sptr
12932 const vector<scope_decl*>& access_path,
12935 vector<scope_decl*> a = access_path;
12936 type_base_sptr result;
12941 first_scope = a.back();
12949 for (scope_decl::declarations::const_iterator i =
12953 if (
is_type(*i) && (*i)->get_name() == n)
12961 first_scope = a.back();
12962 interned_string scope_name, cur_scope_name = first_scope->
get_name();
12963 for (scope_decl::scopes::const_iterator i =
12968 scope_name = (*i)->get_name();
12969 if (scope_name == cur_scope_name)
12995 static const type_base_sptr
12997 const scope_decl* scope)
13000 return type_base_sptr();
13004 vector<scope_decl*> access_path;
13005 for (scope_decl* s = type_decl->get_scope(); s != 0; s = s->get_scope())
13007 access_path.push_back(s);
13033 const type_base_sptr
13048 const decl_base_sptr
13051 {
return is_var_decl(lookup_node_in_scope<var_decl>(comps, skope));}
13064 template<
typename NodeKind>
13066 lookup_node_in_translation_unit(
const list<string>& fqn,
13084 {
return is_type(lookup_node_in_translation_unit<type_base>(fqn, tu));}
13104 {
return is_class_type(lookup_node_in_translation_unit<class_decl>(fqn, tu));}
13117 lookup_basic_type_through_translation_units(
const interned_string& type_name,
13118 const corpus& abi_corpus)
13122 for (translation_units::const_iterator tu =
13142 static union_decl_sptr
13143 lookup_union_type_through_translation_units(
const interned_string& type_name,
13144 const corpus & abi_corpus)
13146 union_decl_sptr result;
13148 for (translation_units::const_iterator tu =
13149 abi_corpus.get_translation_units().begin();
13150 tu != abi_corpus.get_translation_units().end();
13169 lookup_enum_type_through_translation_units(
const interned_string& type_name,
13170 const corpus & abi_corpus)
13174 for (translation_units::const_iterator tu =
13175 abi_corpus.get_translation_units().begin();
13176 tu != abi_corpus.get_translation_units().end();
13193 lookup_typedef_type_through_translation_units(
const interned_string& type_name,
13194 const corpus & abi_corpus)
13198 for (translation_units::const_iterator tu =
13199 abi_corpus.get_translation_units().begin();
13200 tu != abi_corpus.get_translation_units().end();
13217 static qualified_type_def_sptr
13218 lookup_qualified_type_through_translation_units(
const interned_string& t_name,
13219 const corpus & abi_corpus)
13221 qualified_type_def_sptr result;
13223 for (translation_units::const_iterator tu =
13224 abi_corpus.get_translation_units().begin();
13225 tu != abi_corpus.get_translation_units().end();
13243 lookup_pointer_type_through_translation_units(
const interned_string& type_name,
13244 const corpus & abi_corpus)
13248 for (translation_units::const_iterator tu =
13249 abi_corpus.get_translation_units().begin();
13250 tu != abi_corpus.get_translation_units().end();
13268 lookup_reference_type_through_translation_units(
const interned_string& t_name,
13269 const corpus & abi_corpus)
13273 for (translation_units::const_iterator tu =
13274 abi_corpus.get_translation_units().begin();
13275 tu != abi_corpus.get_translation_units().end();
13293 lookup_array_type_through_translation_units(
const interned_string& type_name,
13294 const corpus & abi_corpus)
13298 for (translation_units::const_iterator tu =
13299 abi_corpus.get_translation_units().begin();
13300 tu != abi_corpus.get_translation_units().end();
13318 lookup_function_type_through_translation_units(
const interned_string& type_name,
13319 const corpus & abi_corpus)
13323 for (translation_units::const_iterator tu =
13324 abi_corpus.get_translation_units().begin();
13325 tu != abi_corpus.get_translation_units().end();
13343 const corpus& abi_corpus)
13345 type_base_sptr result;
13347 for (translation_units::const_iterator tu =
13368 const string& tu_path,
13371 string_tu_map_type::const_iterator i = corp.priv_->path_tu_map.find(tu_path);
13372 if (i == corp.priv_->path_tu_map.end())
13373 return type_base_sptr();
13402 for (translation_units::const_iterator i =
13448 result = lookup_type_in_map<type_decl>(qualified_name, m);
13450 result = lookup_basic_type_through_translation_units(qualified_name, corp);
13470 result = lookup_type_in_map<type_decl>(loc, m);
13561 class_decl_sptr result = lookup_type_in_map<class_decl>(qualified_name, m);
13579 return lookup_types_in_map(qualified_name, m);
13605 for (
auto type : *v)
13607 type_base_sptr t(type);
13609 if (c->get_is_declaration_only()
13610 && !c->get_definition_of_declaration())
13611 result.push_back(type);
13614 return !result.empty();
13630 return lookup_types_in_map(qualified_name, m);
13711 union_decl_sptr result = lookup_type_in_map<union_decl>(type_name, m);
13713 result = lookup_union_type_through_translation_units(type_name, corp);
13792 lookup_type_in_map<enum_type_decl>(qualified_name, m);
13794 result = lookup_enum_type_through_translation_units(qualified_name, corp);
13812 return lookup_types_in_map(qualified_name, m);
13917 lookup_type_in_map<typedef_decl>(qualified_name, m);
13919 result = lookup_typedef_type_through_translation_units(qualified_name,
14014 qualified_type_def_sptr
14029 qualified_type_def_sptr
14035 qualified_type_def_sptr result =
14036 lookup_type_in_map<qualified_type_def>(qualified_name, m);
14039 result = lookup_qualified_type_through_translation_units(qualified_name,
14081 lookup_type_in_map<pointer_type_def>(qualified_name, m);
14083 result = lookup_pointer_type_through_translation_units(qualified_name,
14131 lookup_type_in_map<reference_type_def>(qualified_name, m);
14133 result = lookup_reference_type_through_translation_units(qualified_name,
14180 lookup_type_in_map<array_type_def>(qualified_name, m);
14182 result = lookup_array_type_through_translation_units(qualified_name, corp);
14251 lookup_type_in_map<function_type>(qualified_name, m);
14253 result = lookup_function_type_through_translation_units(qualified_name,
14276 type_base_sptr result;
14309 type_base_sptr result;
14357 return type_base_sptr();
14374 template<
typename TypeKind>
14378 bool use_type_name_as_key =
true)
14382 if (use_type_name_as_key)
14384 else if (
location l = type->get_location())
14386 string str = l.expand();
14387 s = type->get_environment().intern(str);
14390 istring_type_base_wptrs_map_type::iterator i = types_map.find(s);
14391 bool result =
false;
14393 if (i == types_map.end())
14395 types_map[s].push_back(type);
14399 i->second.push_back(type);
14420 bool use_type_name_as_key)
14424 bool update_qname_map =
true;
14425 if (type->get_is_declaration_only())
14431 is_class_type(class_type->get_definition_of_declaration()))
14435 if (!update_qname_map)
14439 if (use_type_name_as_key)
14441 string qname = type->get_qualified_name();
14442 s = type->get_environment().intern(qname);
14444 else if (
location l = type->get_location())
14446 string str = l.expand();
14447 s = type->get_environment().intern(str);
14450 bool result =
false;
14451 istring_type_base_wptrs_map_type::iterator i = map.find(s);
14452 if (i == map.end())
14454 map[s].push_back(type);
14458 i->second.push_back(type);
14484 bool result =
false;
14486 istring_type_base_wptrs_map_type::iterator i = types_map.find(s);
14487 if (i == types_map.end())
14489 types_map[s].push_back(type);
14493 i->second.push_back(type);
14513 maybe_update_types_lookup_map<type_decl>
14516 if (
corpus *type_corpus = basic_type->get_corpus())
14518 maybe_update_types_lookup_map<type_decl>
14520 type_corpus->priv_->get_types().basic_types());
14522 maybe_update_types_lookup_map<type_decl>
14524 type_corpus->get_type_per_loc_map().basic_types(),
14529 maybe_update_types_lookup_map<type_decl>
14531 group->priv_->get_types().basic_types());
14533 maybe_update_types_lookup_map<type_decl>
14535 group->get_type_per_loc_map().basic_types(),
14560 if (
corpus *type_corpus = class_type->get_corpus())
14564 type_corpus->priv_->get_types().class_types());
14568 type_corpus->get_type_per_loc_map().class_types(),
14575 group->priv_->get_types().class_types());
14579 group->get_type_per_loc_map().class_types(),
14600 maybe_update_types_lookup_map<union_decl>
14603 if (
corpus *type_corpus = union_type->get_corpus())
14605 maybe_update_types_lookup_map<union_decl>
14607 type_corpus->priv_->get_types().union_types());
14609 maybe_update_types_lookup_map<union_decl>
14611 type_corpus->get_type_per_loc_map().union_types(),
14616 maybe_update_types_lookup_map<union_decl>
14618 group->priv_->get_types().union_types());
14620 maybe_update_types_lookup_map<union_decl>
14622 group->get_type_per_loc_map().union_types(),
14643 maybe_update_types_lookup_map<enum_type_decl>
14646 if (
corpus *type_corpus = enum_type->get_corpus())
14648 maybe_update_types_lookup_map<enum_type_decl>
14650 type_corpus->priv_->get_types().enum_types());
14652 maybe_update_types_lookup_map<enum_type_decl>
14654 type_corpus->get_type_per_loc_map().enum_types(),
14659 maybe_update_types_lookup_map<enum_type_decl>
14661 group->priv_->get_types().enum_types());
14663 maybe_update_types_lookup_map<enum_type_decl>
14665 group->get_type_per_loc_map().enum_types(),
14687 maybe_update_types_lookup_map<typedef_decl>
14690 if (
corpus *type_corpus = typedef_type->get_corpus())
14692 maybe_update_types_lookup_map<typedef_decl>
14694 type_corpus->priv_->get_types().typedef_types());
14696 maybe_update_types_lookup_map<typedef_decl>
14698 type_corpus->get_type_per_loc_map().typedef_types(),
14703 maybe_update_types_lookup_map<typedef_decl>
14705 group->priv_->get_types().typedef_types());
14707 maybe_update_types_lookup_map<typedef_decl>
14709 group->get_type_per_loc_map().typedef_types(),
14730 maybe_update_types_lookup_map<qualified_type_def>
14733 if (
corpus *type_corpus = qualified_type->get_corpus())
14735 maybe_update_types_lookup_map<qualified_type_def>
14737 type_corpus->priv_->get_types().qualified_types());
14741 maybe_update_types_lookup_map<qualified_type_def>
14743 group->priv_->get_types().qualified_types());
14763 maybe_update_types_lookup_map<pointer_type_def>
14766 if (
corpus *type_corpus = pointer_type->get_corpus())
14768 maybe_update_types_lookup_map<pointer_type_def>
14770 type_corpus->priv_->get_types().pointer_types());
14774 maybe_update_types_lookup_map<pointer_type_def>
14776 group->priv_->get_types().pointer_types());
14796 maybe_update_types_lookup_map<ptr_to_mbr_type>
14799 if (
corpus *type_corpus = ptr_to_member->get_corpus())
14801 maybe_update_types_lookup_map<ptr_to_mbr_type>
14803 type_corpus->priv_->get_types().ptr_to_mbr_types());
14807 maybe_update_types_lookup_map<ptr_to_mbr_type>
14809 group->priv_->get_types().ptr_to_mbr_types());
14829 maybe_update_types_lookup_map<reference_type_def>
14832 if (
corpus *type_corpus = reference_type->get_corpus())
14834 maybe_update_types_lookup_map<reference_type_def>
14836 type_corpus->priv_->get_types().reference_types());
14840 maybe_update_types_lookup_map<reference_type_def>
14842 group->priv_->get_types().reference_types());
14862 maybe_update_types_lookup_map<array_type_def>
14865 if (
corpus *type_corpus = array_type->get_corpus())
14867 maybe_update_types_lookup_map<array_type_def>
14869 type_corpus->priv_->get_types().array_types());
14871 maybe_update_types_lookup_map<array_type_def>
14873 type_corpus->get_type_per_loc_map().array_types(),
14878 maybe_update_types_lookup_map<array_type_def>
14880 group->priv_->get_types().array_types());
14882 maybe_update_types_lookup_map<array_type_def>
14884 group->get_type_per_loc_map().array_types(),
14906 maybe_update_types_lookup_map<array_type_def::subrange_type>
14909 if (
corpus *type_corpus = subrange_type->get_corpus())
14911 maybe_update_types_lookup_map<array_type_def::subrange_type>
14913 type_corpus->priv_->get_types().subrange_types());
14915 maybe_update_types_lookup_map<array_type_def::subrange_type>
14917 type_corpus->get_type_per_loc_map().subrange_types(),
14920 if (
corpus *group = subrange_type->get_corpus())
14922 maybe_update_types_lookup_map<array_type_def::subrange_type>
14924 group->priv_->get_types().subrange_types());
14926 maybe_update_types_lookup_map<array_type_def::subrange_type>
14928 group->get_type_per_loc_map().subrange_types(),
14953 if (
corpus *type_corpus = fn_type->get_corpus())
14957 type_corpus->priv_->get_types().function_types());
14959 if (
corpus *group = fn_type->get_corpus())
14963 group->priv_->get_types().function_types());
15056 type_base_sptr result;
15064 type_base_sptr underlying_type =
15067 if (underlying_type)
15070 qual->get_cv_quals(),
15071 qual->get_location()));
15076 type_base_sptr pointed_to_type =
15079 if (pointed_to_type)
15082 p->get_size_in_bits(),
15083 p->get_alignment_in_bits(),
15084 p->get_location()));
15089 type_base_sptr pointed_to_type =
15091 if (pointed_to_type)
15095 r->get_size_in_bits(),
15096 r->get_alignment_in_bits(),
15097 r->get_location()));
15111 tu.priv_->synthesized_types_.push_back(result);
15144 type_base_sptr result_return_type;
15149 if (!result_return_type)
15153 type_base_sptr parm_type;
15155 for (function_type::parameters::const_iterator i =
15160 type_base_sptr t = (*i)->get_type();
15167 (*i)->get_location(),
15168 (*i)->get_variadic_marker(),
15169 (*i)->get_is_artificial()));
15170 parms.push_back(parm);
15173 class_or_union_sptr class_type;
15185 result_fn_type.reset(
new method_type(result_return_type,
15197 tu.priv_->synthesized_types_.push_back(result_fn_type);
15201 return result_fn_type;
15212 if (mangled_name.empty())
15217 char * str = abi::__cxa_demangle(mangled_name.c_str(),
15218 NULL, &l, &status);
15219 string demangled_name = mangled_name;
15223 demangled_name = str;
15227 return demangled_name;
15252 global_scope::~global_scope()
15257 maybe_propagate_canonical_type(
const type_base& lhs_type,
15258 const type_base& rhs_type);
15277 types_defined_same_linux_kernel_corpus_public(
const type_base& t1,
15278 const type_base& t2)
15280 const corpus *t1_corpus = t1.get_corpus(), *t2_corpus = t2.get_corpus();
15281 string t1_file_path, t2_file_path;
15285 if (!(t1_corpus && t2_corpus
15286 && t1_corpus == t2_corpus
15287 && (t1_corpus->get_origin() & corpus::LINUX_KERNEL_BINARY_ORIGIN)
15292 class_or_union *c1 = 0, *c2 = 0;
15298 if ((c1 && c1->get_is_anonymous() && !c1->get_naming_typedef())
15299 || (c2 && c2->get_is_anonymous() && !c2->get_naming_typedef()))
15306 && c1->get_is_anonymous() && c1->get_naming_typedef()
15307 && c2->get_is_anonymous() && c2->get_naming_typedef())
15308 if (c1->get_naming_typedef()->get_name()
15309 != c2->get_naming_typedef()->get_name())
15315 if (e1->get_is_anonymous() || e2->get_is_anonymous())
15325 if (c1->get_is_declaration_only() != c2->get_is_declaration_only())
15327 if (c1->get_environment().decl_only_class_equals_definition())
15337 if (t1.get_size_in_bits() != t2.get_size_in_bits())
15346 l = c1->get_location();
15348 l =
dynamic_cast<const decl_base&
>(t1).
get_location();
15350 unsigned line = 0, col = 0;
15352 l.
expand(t1_file_path, line, col);
15354 l = c2->get_location();
15356 l =
dynamic_cast<const decl_base&
>(t2).
get_location();
15358 l.
expand(t2_file_path, line, col);
15361 if (t1_file_path.empty() || t2_file_path.empty())
15364 if (t1_file_path == t2_file_path)
15400 compare_types_during_canonicalization(
const type_base& canonical_type,
15401 const type_base& candidate_type)
15403 #ifdef WITH_DEBUG_TYPE_CANONICALIZATION
15404 const environment& env = canonical_type.get_environment();
15405 if (env.debug_type_canonicalization_is_on())
15407 bool canonical_equality =
false, structural_equality =
false;
15408 env.priv_->use_canonical_type_comparison_ =
false;
15409 structural_equality = canonical_type == candidate_type;
15410 env.priv_->use_canonical_type_comparison_ =
true;
15411 canonical_equality = canonical_type == candidate_type;
15412 if (canonical_equality != structural_equality)
15414 std::cerr <<
"structural & canonical equality different for type: "
15415 << canonical_type.get_pretty_representation(
true,
true)
15419 return structural_equality;
15422 return canonical_type == candidate_type;
15446 compare_canonical_type_against_candidate(
const type_base& canonical_type,
15447 const type_base& candidate_type)
15449 environment& env =
const_cast<environment&
>(canonical_type.get_environment());
15467 bool saved_decl_only_class_equals_definition =
15468 env.decl_only_class_equals_definition();
15469 env.do_on_the_fly_canonicalization(
true);
15472 env.decl_only_class_equals_definition(
false);
15473 env.priv_->allow_type_comparison_results_caching(
true);
15474 bool equal = (types_defined_same_linux_kernel_corpus_public(canonical_type,
15476 || compare_types_during_canonicalization(canonical_type,
15481 env.priv_->clear_type_comparison_results_cache();
15482 env.priv_->allow_type_comparison_results_caching(
false);
15483 env.do_on_the_fly_canonicalization(
false);
15484 env.decl_only_class_equals_definition
15485 (saved_decl_only_class_equals_definition);
15510 compare_canonical_type_against_candidate(
const type_base* canonical_type,
15511 const type_base* candidate_type)
15513 return compare_canonical_type_against_candidate(*canonical_type,
15538 compare_canonical_type_against_candidate(
const type_base_sptr& canonical_type,
15539 const type_base_sptr& candidate_type)
15541 return compare_canonical_type_against_candidate(canonical_type.get(),
15542 candidate_type.get());
15568 type_base::get_canonical_type_for(type_base_sptr t)
15573 environment& env =
const_cast<environment&
>(t->get_environment());
15577 return type_base_sptr();
15583 bool decl_only_class_equals_definition =
15596 if (decl_only_class_equals_definition)
15597 if (class_or_union)
15598 if (class_or_union->get_is_declaration_only())
15599 return type_base_sptr();
15602 if (t->get_canonical_type())
15603 return t->get_canonical_type();
15611 || !class_or_union->get_is_anonymous()
15612 || class_or_union->get_linkage_name().empty());
15624 string repr = t->get_cached_pretty_representation(
true);
15629 type_base_sptr canonical_type_present_in_corpus;
15631 env.get_canonical_types_map();
15633 type_base_sptr result;
15634 environment::canonical_types_map_type::iterator i = types.find(repr);
15635 if (i == types.end())
15637 vector<type_base_sptr> v;
15644 vector<type_base_sptr> &v = i->second;
15651 for (vector<type_base_sptr>::const_reverse_iterator it = v.rbegin();
15655 bool equal = compare_canonical_type_against_candidate(*it, t);
15662 #ifdef WITH_DEBUG_SELF_COMPARISON
15663 if (env.self_comparison_debug_is_on())
15667 corpus_sptr corp1, corp2;
15668 env.get_self_comparison_debug_inputs(corp1, corp2);
15669 if (corp1 && corp2 && t->get_corpus() == corp2.get())
15680 check_canonical_type_from_abixml_during_self_comp(t,
15686 uintptr_t should_have_canonical_type = 0;
15687 string type_id = env.get_type_id_from_type(t.get());
15688 if (type_id.empty())
15689 type_id =
"type-id-<not-found>";
15691 should_have_canonical_type =
15692 env.get_canonical_type_from_type_id(type_id.c_str());
15693 std::cerr <<
"error: wrong canonical type for '"
15702 <<
"'. Should have had canonical type: "
15704 << should_have_canonical_type
15710 uintptr_t ptr_val =
reinterpret_cast<uintptr_t
>(t.get());
15711 string type_id = env.get_type_id_from_pointer(ptr_val);
15712 if (type_id.empty())
15713 type_id =
"type-id-<not-found>";
15730 std::cerr <<
"error: wrong induced canonical type for '"
15732 <<
"' from second corpus"
15733 <<
", ptr: " << std::hex << t.get()
15734 <<
" type-id: " << type_id
15773 maybe_adjust_canonical_type(
const type_base_sptr& canonical,
15774 const type_base_sptr& type)
15776 if (type->get_naked_canonical_type())
15783 if (canonical_class
15784 && canonical_class.get() != cl.get())
15788 for (class_decl::member_functions::const_iterator i =
15789 cl->get_member_functions().begin();
15790 i != cl->get_member_functions().end();
15792 if ((*i)->get_symbol())
15795 find_member_function((*i)->get_linkage_name()))
15798 if (s1 && !m->get_symbol())
15811 method_decl_sptr method =
15830 canonical_class = cl;
15833 if (canonical_class)
15835 if (
auto abi_corpus = canonical_class->get_corpus())
15837 for (
auto& fn : canonical_class->get_member_functions())
15843 fn->set_is_in_public_symbol_table(
true);
15844 auto b = abi_corpus->get_exported_decls_builder();
15845 b->maybe_add_fn_to_exported_fns(fn.get());
15848 abi_corpus->get_undefined_functions().insert(fn.get());
15860 if (type->get_is_artificial() != canonical->get_is_artificial())
15861 canonical->set_is_artificial(
false);
15885 if (t->get_canonical_type())
15886 return t->get_canonical_type();
15888 if (t->get_environment().priv_->do_log())
15889 std::cerr <<
"Canonicalization of type '"
15890 << t->get_pretty_representation(
true,
true)
15891 <<
"/@#" << std::hex << t.get() <<
": ";
15895 if (t->get_environment().priv_->do_log())
15897 type_base_sptr canonical = type_base::get_canonical_type_for(t);
15899 if (t->get_environment().priv_->do_log())
15902 if (t->get_environment().priv_->do_log())
15903 std::cerr << tmr <<
"\n";
15905 maybe_adjust_canonical_type(canonical, t);
15907 t->priv_->canonical_type = canonical;
15908 t->priv_->naked_canonical_type = canonical.get();
15922 ABG_ASSERT(!t->priv_->canonical_type_propagated()
15923 || t->priv_->propagated_canonical_type_confirmed());
15926 if (type_base_sptr d =
is_type(cl->get_earlier_declaration()))
15927 if ((canonical = d->get_canonical_type()))
15929 d->priv_->canonical_type = canonical;
15930 d->priv_->naked_canonical_type = canonical.get();
15947 if (type_base_sptr c =
is_type(scope)->get_canonical_type())
15961 #ifdef WITH_DEBUG_CT_PROPAGATION
15970 env.priv_->erase_type_with_cleared_propagated_canonical_type(t.get());
15974 t->on_canonical_type_set();
15985 priv_->definition_of_declaration_ = d;
15987 if (type_base_sptr canonical_type =
is_type(d)->get_canonical_type())
15988 t->priv_->canonical_type = canonical_type;
15990 priv_->naked_definition_of_declaration_ =
const_cast<decl_base*
>(d.get());
16000 priv_(new
priv(s, a))
16012 {
return priv_->canonical_type.lock();}
16028 {
return priv_->naked_canonical_type;}
16053 return priv_->internal_cached_repr_;
16062 return priv_->cached_repr_;
16100 {
return equals(*
this, other, 0);}
16117 {priv_->size_in_bits = s;}
16124 {
return priv_->size_in_bits;}
16131 {priv_->alignment_in_bits = a;}
16138 {
return priv_->alignment_in_bits;}
16154 v.visit_begin(
this);
16155 bool result = v.visit_end(
this);
16161 type_base::~type_base()
16180 static_cast<unsigned>(r));
16195 static_cast<unsigned>(r));
16252 parse_integral_type_modifier(
const string& word,
16255 if (word ==
"signed")
16257 else if (word ==
"unsigned")
16259 else if (word ==
"short")
16261 else if (word ==
"long")
16263 else if (word ==
"long long")
16281 parse_base_integral_type(
const string& type_name,
16284 if (type_name ==
"int")
16286 else if (type_name ==
"char")
16288 else if (type_name ==
"bool" || type_name ==
"_Bool")
16290 else if (type_name ==
"double")
16292 else if (type_name ==
"float")
16294 else if (type_name ==
"char16_t")
16296 else if (type_name ==
"char32_t")
16298 else if (type_name ==
"wchar_t")
16323 string input = type_name;
16324 string::size_type len = input.length();
16325 string::size_type cur_pos = 0, prev_pos = 0;
16326 string cur_word, prev_word;
16329 while (cur_pos < len)
16331 if (cur_pos < len && isspace(input[cur_pos]))
16334 while (cur_pos < len && isspace(input[cur_pos]));
16336 prev_pos = cur_pos;
16337 cur_pos = input.find(
' ', prev_pos);
16338 prev_word = cur_word;
16339 cur_word = input.substr(prev_pos, cur_pos - prev_pos);
16342 && cur_word ==
"long"
16343 && prev_word !=
"long")
16345 if (cur_pos < len && isspace(input[cur_pos]))
16348 while (cur_pos < len && isspace(input[cur_pos]));
16349 prev_pos = cur_pos;
16351 cur_pos = input.find(
' ', prev_pos);
16352 string saved_prev_word = prev_word;
16353 prev_word = cur_word;
16354 cur_word = input.substr(prev_pos, cur_pos - prev_pos);
16355 if (cur_word ==
"long")
16356 cur_word =
"long long";
16359 cur_pos = prev_pos;
16360 cur_word = prev_word;
16361 prev_word = saved_prev_word;
16365 if (!parse_integral_type_modifier(cur_word, modifiers))
16367 if (!parse_base_integral_type(cur_word, base))
16405 : base_(INT_BASE_TYPE),
16406 modifiers_(NO_MODIFIER)
16415 : base_(b), modifiers_(m)
16423 : base_(INT_BASE_TYPE),
16424 modifiers_(NO_MODIFIER)
16442 {
return modifiers_;}
16459 {
return base_ == other.base_ && modifiers_ == other.modifiers_;}
16477 result +=
"signed ";
16479 result +=
"unsigned ";
16490 result +=
"short ";
16494 result +=
"long long ";
16505 result +=
"double";
16509 result +=
"char16_t";
16511 result +=
"char32_t";
16513 result +=
"wchar_t";
16523 integral_type::operator string()
const
16524 {
return to_string();}
16547 const string& name,
16548 size_t size_in_bits,
16549 size_t alignment_in_bits,
16551 const string& linkage_name,
16556 | ABSTRACT_TYPE_BASE
16557 | ABSTRACT_DECL_BASE),
16558 decl_base(env, name, locus, linkage_name, vis),
16559 type_base(env, size_in_bits, alignment_in_bits)
16570 string integral_type_name = int_type;
16604 bool result =
false;
16635 return *
this == *other;
16663 return *
this == other;
16709 if (l.get() == r.get())
16737 bool internal)
const
16761 if (decl_base::priv_->internal_qualified_name_.
empty())
16762 decl_base::priv_->internal_qualified_name_ =
16763 env.
intern(get_internal_integral_type_name(
this));
16764 return decl_base::priv_->internal_qualified_name_;
16768 decl_base::priv_->temporary_internal_qualified_name_ =
16769 env.
intern(get_internal_integral_type_name(
this));
16770 return decl_base::priv_->temporary_internal_qualified_name_;
16796 bool qualified_name)
const
16800 return get_internal_integral_type_name(
this);
16802 if (qualified_name)
16820 v.visit_begin(
this);
16821 bool result = v.visit_end(
this);
16827 type_decl::~type_decl()
16847 const string& name,
16848 size_t size_in_bits,
16849 size_t alignment_in_bits,
16853 ABSTRACT_SCOPE_TYPE_DECL
16854 | ABSTRACT_TYPE_BASE
16855 | ABSTRACT_DECL_BASE),
16857 type_base(env, size_in_bits, alignment_in_bits),
16926 return *
this == *other;
16950 if (v.visit_begin(
this))
16953 for (scope_decl::declarations::const_iterator i =
16957 if (!(*i)->traverse(v))
16962 bool result = v.visit_end(
this);
16968 scope_type_decl::~scope_type_decl()
16984 const string& name,
16995 | ABSTRACT_DECL_BASE
16996 | ABSTRACT_SCOPE_DECL),
17022 bool qualified_name)
const
17064 if (!ns->is_empty_or_has_empty_sub_namespaces())
17085 if (v.visit_begin(
this))
17088 scope_decl::declarations::const_iterator i;
17094 dynamic_pointer_cast<ir_traversable_base>(*i);
17096 if (!t->traverse (v))
17101 return v.visit_end(
this);
17104 namespace_decl::~namespace_decl()
17113 class qualified_type_def::priv
17124 weak_ptr<type_base> underlying_type_;
17127 : cv_quals_(CV_NONE)
17132 : cv_quals_(quals),
17133 underlying_type_(t)
17185 qualified_type_def::qualified_type_def(type_base_sptr type,
17190 | ABSTRACT_TYPE_BASE
17191 | ABSTRACT_DECL_BASE),
17192 type_base(type->get_environment(), type->get_size_in_bits(),
17193 type->get_alignment_in_bits()),
17194 decl_base(type->get_environment(),
"", locus,
"",
17195 dynamic_pointer_cast<
decl_base>(type)->get_visibility()),
17196 priv_(new priv(quals, type))
17215 | ABSTRACT_TYPE_BASE
17216 | ABSTRACT_DECL_BASE),
17220 priv_(new priv(quals))
17243 s = ut->get_size_in_bits();
17272 bool result =
true;
17339 return *
this == *other;
17357 return *
this == *other;
17372 bool internal)
const
17400 if (priv_->temporary_internal_name_.empty())
17401 priv_->temporary_internal_name_ =
17403 return priv_->temporary_internal_name_;
17419 if (priv_->internal_name_.empty())
17420 priv_->internal_name_ =
17423 return priv_->internal_name_;
17452 if (v.visit_begin(
this))
17459 bool result = v.visit_end(
this);
17464 qualified_type_def::~qualified_type_def()
17471 {
return priv_->cv_quals_;}
17476 {priv_->cv_quals_ = cv_quals;}
17490 {
return priv_->underlying_type_.lock();}
17499 priv_->underlying_type_ = t;
17509 scope_decl::declarations::iterator i;
17510 if (s->find_iterator_for_member(
this, i))
17525 operator==(
const qualified_type_def_sptr& l,
const qualified_type_def_sptr& r)
17527 if (l.get() == r.get())
17543 operator!=(
const qualified_type_def_sptr& l,
const qualified_type_def_sptr& r)
17551 (
static_cast<unsigned>(lhs) |
static_cast<unsigned>(rhs));
17575 (
static_cast<unsigned>(lhs) &
static_cast<unsigned>(rhs));
17597 case qualified_type_def::CV_NONE:
17600 case qualified_type_def::CV_CONST:
17603 case qualified_type_def::CV_VOLATILE:
17606 case qualified_type_def::CV_RESTRICT:
17620 struct pointer_type_def::priv
17627 priv(
const type_base_sptr& t)
17629 naked_pointed_to_type_(t.get())
17633 : naked_pointed_to_type_()
17658 pointer_type_def::pointer_type_def(
const type_base_sptr& pointed_to,
17659 size_t size_in_bits,
17660 size_t align_in_bits,
17664 | ABSTRACT_TYPE_BASE
17665 | ABSTRACT_DECL_BASE),
17666 type_base(pointed_to->get_environment(), size_in_bits, align_in_bits),
17667 decl_base(pointed_to->get_environment(),
"", locus,
""),
17668 priv_(new priv(pointed_to))
17674 const environment& env = pointed_to->get_environment();
17675 decl_base_sptr pto = dynamic_pointer_cast<decl_base>(pointed_to);
17676 string name = (pto ? pto->get_name() : string(
"void")) +
"*";
17694 pointer_type_def::pointer_type_def(
const environment& env,
size_t size_in_bits,
17695 size_t alignment_in_bits,
17699 | ABSTRACT_TYPE_BASE
17700 | ABSTRACT_DECL_BASE),
17701 type_base(env, size_in_bits, alignment_in_bits),
17706 string name = string(
"void") +
"*";
17717 priv_->pointed_to_type_ = t;
17718 priv_->naked_pointed_to_type_ = t.get();
17723 decl_base_sptr pto = dynamic_pointer_cast<decl_base>(t);
17724 string name = (pto ? pto->get_name() : string(
"void")) +
"*";
17807 return *
this == *o;
17828 const type_base_sptr
17830 {
return priv_->pointed_to_type_.lock();}
17837 {
return priv_->naked_pointed_to_type_;}
17875 if (priv_->internal_qualified_name_.empty())
17876 if (pointed_to_type)
17877 priv_->internal_qualified_name_ =
17878 pointer_declaration_name(
this,
17885 return priv_->internal_qualified_name_;
17893 if (pointed_to_type)
17894 if (priv_->temp_internal_qualified_name_.empty())
17895 priv_->temp_internal_qualified_name_ =
17896 pointer_declaration_name(
this,
17903 return priv_->temp_internal_qualified_name_;
17912 (pointer_declaration_name(
this,
17924 if (pointed_to_type)
17926 (pointer_declaration_name(
this,
17951 if (v.visit_begin(
this))
17959 bool result = v.visit_end(
this);
17964 pointer_type_def::~pointer_type_def()
17981 if (l.get() == r.get())
18009 struct reference_type_def::priv
18017 priv(
const type_base_sptr& t,
bool is_lvalue)
18019 is_lvalue_(is_lvalue)
18022 priv(
bool is_lvalue)
18023 : is_lvalue_(is_lvalue)
18052 reference_type_def::reference_type_def(
const type_base_sptr pointed_to,
18054 size_t size_in_bits,
18055 size_t align_in_bits,
18059 | ABSTRACT_TYPE_BASE
18060 | ABSTRACT_DECL_BASE),
18061 type_base(pointed_to->get_environment(), size_in_bits, align_in_bits),
18062 decl_base(pointed_to->get_environment(),
"", locus,
""),
18063 priv_(new priv(pointed_to, lvalue))
18069 decl_base_sptr pto = dynamic_pointer_cast<decl_base>(pointed_to);
18074 name = string(pto->get_name()) +
"&";
18082 const environment& env = pointed_to->get_environment();
18106 reference_type_def::reference_type_def(
const environment& env,
bool lvalue,
18107 size_t size_in_bits,
18108 size_t alignment_in_bits,
18112 | ABSTRACT_TYPE_BASE
18113 | ABSTRACT_DECL_BASE),
18114 type_base(env, size_in_bits, alignment_in_bits),
18116 priv_(new priv(lvalue))
18119 string name =
"void&";
18134 priv_->pointed_to_type_ = pointed_to_type;
18136 decl_base_sptr pto;
18138 {pto = dynamic_pointer_cast<decl_base>(pointed_to_type);}
18145 string name = string(pto->get_name()) +
"&";
18175 if (l.is_lvalue() != r.is_lvalue())
18183 bool result = (l.get_pointed_to_type() == r.get_pointed_to_type());
18222 return *
this == *other;
18237 return *
this == *other;
18241 reference_type_def::get_pointed_to_type()
const
18242 {
return priv_->pointed_to_type_.lock();}
18245 reference_type_def::is_lvalue()
const
18246 {
return priv_->is_lvalue_;}
18276 type_base_sptr pointed_to_type = get_pointed_to_type();
18283 if (priv_->internal_qualified_name_.empty())
18284 if (pointed_to_type)
18285 priv_->internal_qualified_name_ =
18293 return priv_->internal_qualified_name_;
18301 if (pointed_to_type)
18302 if (priv_->temp_internal_qualified_name_.empty())
18303 priv_->temp_internal_qualified_name_ =
18311 return priv_->temp_internal_qualified_name_;
18331 if (pointed_to_type)
18361 bool qualified_name)
const
18365 (get_pointed_to_type()),
18389 if (v.visit_begin(
this))
18392 if (type_base_sptr t = get_pointed_to_type())
18397 bool result = v.visit_end(
this);
18402 reference_type_def::~reference_type_def()
18419 if (l.get() == r.get())
18447 struct ptr_to_mbr_type::priv
18451 type_base_sptr dm_type_;
18454 type_base_sptr containing_type_;
18461 priv(
const type_base_sptr& dm_type,
const type_base_sptr& containing_type)
18462 : dm_type_(dm_type),
18463 containing_type_(containing_type)
18485 const type_base_sptr& member_type,
18486 const type_base_sptr& containing_type,
18487 size_t size_in_bits,
18488 size_t alignment_in_bits,
18491 POINTER_TO_MEMBER_TYPE
18492 | ABSTRACT_TYPE_BASE
18493 | ABSTRACT_DECL_BASE),
18494 type_base(env, size_in_bits, alignment_in_bits),
18496 priv_(new priv(member_type, containing_type))
18511 const type_base_sptr&
18513 {
return priv_->dm_type_;}
18520 const type_base_sptr&
18522 {
return priv_->containing_type_;}
18552 return *
this == *other;
18567 return *
this == *other;
18579 bool internal)
const
18598 if (priv_->internal_qualified_name_.empty())
18599 priv_->internal_qualified_name_ =
18600 ptr_to_mbr_declaration_name(
this,
"",
18603 return priv_->internal_qualified_name_;
18607 priv_->temp_internal_qualified_name_ =
18608 ptr_to_mbr_declaration_name(
this,
"",
true,
internal);
18609 return priv_->temp_internal_qualified_name_;
18615 (ptr_to_mbr_declaration_name(
this,
"",
true,
18637 if (v.visit_begin(
this))
18648 bool result = v.visit_end(
this);
18680 bool result =
true;
18682 if (!(l.decl_base::operator==(r)))
18721 array_type_def::subrange_type::~subrange_type() =
default;
18730 : s_(UNSIGNED_SIGNEDNESS)
18739 : s_(UNSIGNED_SIGNEDNESS)
18748 : s_(SIGNED_SIGNEDNESS)
18756 enum array_type_def::subrange_type::bound_value::signedness
18772 {
return v_.signed_;
18780 {
return v_.unsigned_;}
18788 s_ = UNSIGNED_SIGNEDNESS;
18798 s_ = SIGNED_SIGNEDNESS;
18810 return s_ == v.s_ && v_.unsigned_ == v.v_.unsigned_;
18815 struct array_type_def::subrange_type::priv
18825 : upper_bound_(ub), language_(l), infinite_(false)
18828 priv(bound_value lb, bound_value ub,
18830 : lower_bound_(lb), upper_bound_(ub),
18831 language_(l), infinite_(false)
18834 priv(bound_value lb, bound_value ub,
const type_base_sptr &u,
18836 : lower_bound_(lb), upper_bound_(ub), underlying_type_(u),
18837 language_(l), infinite_(false)
18856 const string& name,
18859 const type_base_sptr& utype,
18862 :
type_or_decl_base(env, SUBRANGE_TYPE | ABSTRACT_TYPE_BASE | ABSTRACT_DECL_BASE),
18864 upper_bound.get_unsigned_value()
18865 - lower_bound.get_unsigned_value(),
18868 priv_(new priv(lower_bound, upper_bound, utype, l))
18888 const string& name,
18893 :
type_or_decl_base(env, SUBRANGE_TYPE | ABSTRACT_TYPE_BASE | ABSTRACT_DECL_BASE),
18895 upper_bound.get_unsigned_value()
18896 - lower_bound.get_unsigned_value(), 0),
18898 priv_(new priv(lower_bound, upper_bound, l))
18916 const string& name,
18920 :
type_or_decl_base(env, SUBRANGE_TYPE | ABSTRACT_TYPE_BASE | ABSTRACT_DECL_BASE),
18921 type_base(env, upper_bound.get_unsigned_value(), 0),
18923 priv_(new priv(upper_bound, l))
18934 {
return priv_->underlying_type_.lock();}
18943 ABG_ASSERT(priv_->underlying_type_.expired());
18944 priv_->underlying_type_ = u;
18952 {
return priv_->upper_bound_.get_signed_value();}
18959 {
return priv_->lower_bound_.get_signed_value();}
18966 {priv_->upper_bound_ = ub;}
18973 {priv_->lower_bound_ = lb;}
18990 if (get_upper_bound() >= get_lower_bound())
18991 return get_upper_bound() - get_lower_bound() + 1;
19000 {
return priv_->infinite_;}
19008 {priv_->infinite_ = f;}
19015 {
return priv_->language_;}
19023 std::ostringstream o;
19027 type_base_sptr underlying_type = get_underlying_type();
19028 if (underlying_type)
19030 o <<
"range "<< get_lower_bound() <<
" .. " << get_upper_bound();
19035 o <<
"[" << get_length() <<
"]";
19050 for (vector<subrange_sptr>::const_iterator i = v.begin();
19053 r += (*i)->as_string();
19082 bool result =
true;
19126 return *
this == *other;
19194 repr +=
"<anonymous range>";
19196 repr +=
"<range " +
get_name() +
">";
19197 repr += as_string();
19215 if (v.visit_begin(
this))
19218 if (type_base_sptr u = get_underlying_type())
19223 bool result = v.visit_end(
this);
19230 struct array_type_def::priv
19237 priv(type_base_sptr t)
19242 : element_type_(t), subranges_(subs)
19262 array_type_def::array_type_def(
const type_base_sptr e_type,
19263 const std::vector<subrange_sptr>& subs,
19267 | ABSTRACT_TYPE_BASE
19268 | ABSTRACT_DECL_BASE),
19271 priv_(new priv(e_type))
19295 const std::vector<subrange_sptr>& subs,
19299 | ABSTRACT_TYPE_BASE
19300 | ABSTRACT_DECL_BASE),
19314 array_type_def::update_size()
19316 type_base_sptr e = priv_->element_type_.lock();
19319 size_t s = e->get_size_in_bits();
19323 s *= sub->get_length();
19331 array_type_def::get_subrange_representation()
const
19357 bool qualified_name)
const
19359 return array_declaration_name(
this,
"",
19360 qualified_name,
internal);
19385 std::vector<array_type_def::subrange_sptr > this_subs = l.
get_subranges();
19386 std::vector<array_type_def::subrange_sptr > other_subs = r.
get_subranges();
19388 bool result =
true;
19389 if (this_subs.size() != other_subs.size())
19398 std::vector<array_type_def::subrange_sptr >::const_iterator i,j;
19399 for (i = this_subs.begin(), j = other_subs.begin();
19400 i != this_subs.end() && j != other_subs.end();
19447 std::vector<array_type_def::subrange_sptr > this_subs = l->
get_subranges();
19448 std::vector<array_type_def::subrange_sptr > other_subs = r->
get_subranges();
19450 if (this_subs.size() != other_subs.size())
19453 std::vector<array_type_def::subrange_sptr >::const_iterator i,j;
19454 for (i = this_subs.begin(), j = other_subs.begin();
19455 i != this_subs.end() && j != other_subs.end();
19465 if (*first_element_type != *second_element_type)
19477 const std::vector<subrange_sptr>& subranges =
19480 if (subranges.empty())
19481 return translation_unit::LANG_C11;
19482 return subranges.front()->get_language();
19501 return *
this == *other;
19507 const type_base_sptr
19509 {
return priv_->element_type_.lock();}
19525 priv_->element_type_ = element_type;
19536 for (
const auto &sub : subs)
19537 priv_->subranges_.push_back(sub);
19549 if (priv_->subranges_.empty())
19552 for (std::vector<shared_ptr<subrange_type> >::const_iterator i =
19553 priv_->subranges_.begin();
19554 i != priv_->subranges_.end();
19556 if ((*i)->is_non_finite())
19563 array_type_def::get_dimension_count()
const
19564 {
return priv_->subranges_.size();}
19595 if (priv_->internal_qualified_name_.empty())
19596 priv_->internal_qualified_name_ =
19597 array_declaration_name(
this,
"",
19600 return priv_->internal_qualified_name_;
19604 priv_->temp_internal_qualified_name_ =
19605 array_declaration_name(
this,
"",
19607 return priv_->temp_internal_qualified_name_;
19624 (array_declaration_name(
this,
"",
19648 if (v.visit_begin(
this))
19656 bool result = v.visit_end(
this);
19662 array_type_def::get_location()
const
19666 const std::vector<array_type_def::subrange_sptr>&
19668 {
return priv_->subranges_;}
19670 array_type_def::~array_type_def()
19677 class enum_type_decl::priv
19679 type_base_sptr underlying_type_;
19688 priv(type_base_sptr underlying_type,
19690 : underlying_type_(underlying_type),
19708 enum_type_decl::enum_type_decl(
const string& name,
19710 type_base_sptr underlying_type,
19712 const string& linkage_name,
19716 | ABSTRACT_TYPE_BASE
19717 | ABSTRACT_DECL_BASE),
19718 type_base(underlying_type->get_environment(),
19719 underlying_type->get_size_in_bits(),
19720 underlying_type->get_alignment_in_bits()),
19721 decl_base(underlying_type->get_environment(),
19722 name, locus, linkage_name, vis),
19723 priv_(new priv(underlying_type, enums))
19729 e->set_enum_type(
this);
19735 {
return priv_->underlying_type_;}
19740 {
return priv_->enumerators_;}
19745 {
return priv_->enumerators_;}
19753 if (priv_->sorted_enumerators_.empty())
19758 priv_->sorted_enumerators_.push_back(*e);
19760 std::sort(priv_->sorted_enumerators_.begin(),
19761 priv_->sorted_enumerators_.end(),
19765 if (l.get_name() == r.get_name())
19766 return l.get_value() < r.get_value();
19767 return (l.get_name() < r.get_name());
19771 return priv_->sorted_enumerators_;
19793 bool qualified_name)
const
19795 string r =
"enum ";
19825 if (v.visit_begin(
this))
19833 bool result = v.visit_end(
this);
19855 bool result =
false;
19865 enum_type_decl::enumerators::const_iterator i, j;
19898 if (!(l.decl_base::operator==(r) && l.type_base::operator==(r)))
19903 if (!l.decl_base::operator==(r))
19905 if (!l.type_base::operator==(r))
19952 enumerators_values_are_equal(
const enum_type_decl::enumerator &enr,
19953 const enum_type_decl::enumerator &enl)
19954 {
return enr.get_value() == enl.get_value();}
19977 is_enumerator_value_present_in_enum(
const enum_type_decl::enumerator &enr,
19978 const enum_type_decl &enom,
19979 vector<enum_type_decl::enumerator>& redundant_enrs)
19981 bool found =
false;
19982 for (
const auto &e : enom.get_enumerators())
19983 if (enumerators_values_are_equal(e, enr))
19987 redundant_enrs.push_back(e);
20005 is_enumerator_value_redundant(
const enum_type_decl::enumerator &enr,
20006 const enum_type_decl &enom)
20008 vector<enum_type_decl::enumerator> redundant_enrs;
20009 if (is_enumerator_value_present_in_enum(enr, enom, redundant_enrs))
20011 if (!redundant_enrs.empty())
20039 bool result =
true;
20055 if (!!def1 != !!def2)
20085 if (!(def1->decl_base::operator==(*def2)
20086 && def1->type_base::operator==(*def2)))
20091 if (!def1->decl_base::operator==(*def2))
20093 if (!def1->type_base::operator==(*def2))
20144 && (!is_enumerator_value_redundant(e, *def2)
20145 || !is_enumerator_value_redundant(e, *def1)))
20159 && (!is_enumerator_value_redundant(e, *def1)
20160 || !is_enumerator_value_redundant(e, *def2)))
20202 return *
this == *other;
20217 if (l.get() == r.get())
20219 decl_base_sptr o = r;
20236 class enum_type_decl::enumerator::priv
20240 string qualified_name_;
20243 friend class enum_type_decl::enumerator;
20251 priv(
const string& name,
20253 enum_type_decl* e = 0)
20265 enum_type_decl::enumerator::~enumerator() =
default;
20276 : priv_(new priv(name, value))
20283 : priv_(new priv(other.
get_name(),
20285 other.get_enum_type()))
20310 bool names_equal =
true;
20312 return names_equal && (get_value() == other.
get_value());
20331 {
return priv_->name_;}
20349 if (priv_->qualified_name_.empty())
20351 priv_->qualified_name_ =
20352 get_enum_type()->get_qualified_name(
internal)
20356 return priv_->qualified_name_;
20364 {priv_->name_ = n;}
20372 {
return priv_->value_;}
20379 {priv_->value_= v;}
20386 {
return priv_->enum_type_;}
20393 {priv_->enum_type_ = e;}
20399 struct typedef_decl::priv
20403 priv(
const type_base_sptr& t)
20404 : underlying_type_(t)
20419 typedef_decl::typedef_decl(
const string& name,
20420 const type_base_sptr underlying_type,
20422 const string& linkage_name,
20426 | ABSTRACT_TYPE_BASE
20427 | ABSTRACT_DECL_BASE),
20432 name, locus, linkage_name, vis),
20433 priv_(new priv(underlying_type))
20449 typedef_decl::typedef_decl(
const string& name,
20452 const string& mangled_name,
20456 | ABSTRACT_TYPE_BASE
20457 | ABSTRACT_DECL_BASE),
20460 decl_base(env, name, locus, mangled_name, vis),
20461 priv_(new priv(nullptr))
20522 bool result =
true;
20526 if (!(l.decl_base::operator==(r)))
20573 return *
this == *other;
20595 bool qualified_name)
const
20598 string result =
"typedef ";
20603 if (qualified_name)
20617 {
return priv_->underlying_type_.lock();}
20625 priv_->underlying_type_ = t;
20639 bool internal)
const
20657 return decl_base::priv_->internal_qualified_name_;
20659 return decl_base::priv_->qualified_name_;
20678 if (v.visit_begin(
this))
20686 bool result = v.visit_end(
this);
20691 typedef_decl::~typedef_decl()
20697 struct var_decl::priv
20710 priv(type_base_sptr t,
20713 naked_type_(t.get()),
20724 naked_type_ = t.get();
20741 var_decl::var_decl(
const string& name,
20742 type_base_sptr type,
20744 const string& linkage_name,
20748 VAR_DECL | ABSTRACT_DECL_BASE),
20749 decl_base(type->get_environment(), name, locus, linkage_name, vis),
20750 priv_(new priv(type, bind))
20758 const type_base_sptr
20760 {
return priv_->type_.lock();}
20767 {priv_->set_type(t);}
20778 {
return priv_->naked_type_;}
20785 {
return priv_->binding_;}
20792 {priv_->binding_ = b;}
20808 priv_->symbol_ = sym;
20823 {
return priv_->symbol_;}
20892 bool result =
true;
20905 else if (s0 && s0 != s1)
20913 bool symbols_are_equal = (s0 && s1 && result);
20915 if (symbols_are_equal)
20924 bool decl_bases_different = !l.decl_base::operator==(r);
20925 const_cast<var_decl&
>(l).set_qualified_name(n1);
20926 const_cast<var_decl&
>(r).set_qualified_name(n2);
20928 if (decl_bases_different)
20938 if (!l.decl_base::operator==(r))
20987 bool result =
true;
21023 return equals(*
this, *other, 0);
21038 if (priv_->id_.empty())
21043 sym_str = s->get_id_string();
21048 priv_->id_ = env.
intern(repr);
21049 if (!sym_str.empty())
21050 priv_->id_ = env.
intern(priv_->id_ +
"{" + sym_str +
"}");
21062 return hash_var(
this);
21127 result =
"static ";
21131 bool member_of_anonymous_class =
false;
21134 member_of_anonymous_class =
true;
21143 if (member_of_anonymous_class || !qualified_name)
21150 string quals_repr =
21152 if (!quals_repr.empty())
21153 name = quals_repr +
" " + name;
21157 name = string(
" ") + name;
21159 result += array_declaration_name(t, name, qualified_name,
internal);
21161 result += pointer_declaration_name(t, name, qualified_name,
internal);
21163 result += pointer_declaration_name(t, name, qualified_name,
internal);
21165 result += ptr_to_mbr_declaration_name(t, name,
21180 "",
true,
internal);
21186 "",
true,
internal);
21189 && (member_of_anonymous_class || !qualified_name))
21205 && (member_of_anonymous_class || !qualified_name))
21259 if (v.visit_begin(
this))
21262 if (type_base_sptr t =
get_type())
21266 return v.visit_end(
this);
21269 var_decl::~var_decl()
21284 priv_->cached_name_.clear();
21285 priv_->internal_cached_name_.clear();
21305 function_type::function_type(type_base_sptr return_type,
21307 size_t size_in_bits,
21308 size_t alignment_in_bits)
21310 FUNCTION_TYPE | ABSTRACT_TYPE_BASE),
21311 type_base(return_type->get_environment(), size_in_bits, alignment_in_bits),
21312 priv_(new
priv(parms, return_type))
21316 for (parameters::size_type i = 0, j = 1;
21317 i < priv_->parms_.size();
21320 if (i == 0 && priv_->parms_[i]->get_is_artificial())
21327 priv_->parms_[i]->set_index(j);
21338 function_type::function_type(type_base_sptr return_type,
21339 size_t size_in_bits,
size_t alignment_in_bits)
21341 FUNCTION_TYPE | ABSTRACT_TYPE_BASE),
21342 type_base(return_type->get_environment(), size_in_bits, alignment_in_bits),
21343 priv_(new
priv(return_type))
21358 size_t size_in_bits,
21359 size_t alignment_in_bits)
21361 type_base(env, size_in_bits, alignment_in_bits),
21373 {
return priv_->return_type_.lock();}
21381 {priv_->return_type_ = t;}
21390 {
return priv_->parms_;}
21433 for (parameters::size_type i = 0, j = 1;
21434 i < priv_->parms_.size();
21437 if (i == 0 && priv_->parms_[i]->get_is_artificial())
21444 priv_->parms_[i]->set_index(j);
21455 parm->set_index(priv_->parms_.size());
21456 priv_->parms_.push_back(parm);
21470 return (!priv_->parms_.empty()
21471 && priv_->parms_.back()->get_variadic_marker());
21503 #define RETURN(value) CACHE_AND_RETURN_COMPARISON_RESULT(value)
21512 bool cached_result =
false;
21520 bool result =
true;
21522 if (!l.type_base::operator==(r))
21533 l_class = m->get_class_type().get();
21536 r_class = m->get_class_type().get();
21540 if (!!l_class != !!r_class)
21550 != r_class->get_qualified_name()))
21567 bool compare_result_types =
true;
21568 string l_rt_name = l_return_type_decl
21571 string r_rt_name = r_return_type_decl
21577 (r_class && (r_class->get_qualified_name() == r_rt_name)))
21578 compare_result_types =
false;
21580 if (compare_result_types)
21606 if (l_rt_name != r_rt_name)
21615 vector<shared_ptr<function_decl::parameter> >::const_iterator i,j;
21656 function_type::parameters::const_iterator
21662 bool is_method =
dynamic_cast<const method_type*
>(
this);
21678 function_type::parameters::const_iterator
21705 if (priv_->internal_cached_name_.empty())
21706 priv_->internal_cached_name_ =
21708 return priv_->internal_cached_name_;
21712 if (priv_->temp_internal_cached_name_.empty())
21713 priv_->temp_internal_cached_name_ =
21715 return priv_->temp_internal_cached_name_;
21722 if (priv_->cached_name_.empty())
21723 priv_->cached_name_ =
21725 return priv_->cached_name_;
21729 priv_->cached_name_ =
21731 return priv_->cached_name_;
21792 if (v.visit_begin(
this))
21795 bool keep_going =
true;
21799 if (!t->traverse(v))
21800 keep_going =
false;
21807 if (type_base_sptr parm_type = (*i)->get_type())
21808 if (!parm_type->traverse(v))
21813 return v.visit_end(
this);
21816 function_type::~function_type()
21822 struct method_type::priv
21824 class_or_union_wptr class_type_;
21852 method_type::method_type (type_base_sptr return_type,
21853 class_or_union_sptr class_type,
21854 const std::vector<function_decl::parameter_sptr>& p,
21856 size_t size_in_bits,
21857 size_t alignment_in_bits)
21859 METHOD_TYPE | ABSTRACT_TYPE_BASE | FUNCTION_TYPE),
21860 type_base(class_type->get_environment(), size_in_bits, alignment_in_bits),
21861 function_type(return_type, p, size_in_bits, alignment_in_bits),
21892 method_type::method_type(type_base_sptr return_type,
21893 type_base_sptr class_type,
21894 const std::vector<function_decl::parameter_sptr>& p,
21896 size_t size_in_bits,
21897 size_t alignment_in_bits)
21899 METHOD_TYPE | ABSTRACT_TYPE_BASE | FUNCTION_TYPE),
21900 type_base(class_type->get_environment(), size_in_bits, alignment_in_bits),
21901 function_type(return_type, p, size_in_bits, alignment_in_bits),
21917 size_t size_in_bits,
21918 size_t alignment_in_bits)
21920 type_base(env, size_in_bits, alignment_in_bits),
21940 method_type::method_type(class_or_union_sptr class_type,
21942 size_t size_in_bits,
21943 size_t alignment_in_bits)
21945 METHOD_TYPE | ABSTRACT_TYPE_BASE | FUNCTION_TYPE),
21946 type_base(class_type->get_environment(), size_in_bits, alignment_in_bits),
21949 alignment_in_bits),
21960 class_or_union_sptr
21962 {
return class_or_union_sptr(priv_->class_type_);}
21975 priv_->class_type_ = t;
22003 {priv_->is_const = f;}
22010 {
return priv_->is_const;}
22020 struct function_decl::priv
22022 bool declared_inline_;
22030 : declared_inline_(false),
22036 bool declared_inline,
22038 : declared_inline_(declared_inline),
22041 naked_type_(t.get())
22045 bool declared_inline,
22048 : declared_inline_(declared_inline),
22051 naked_type_(t.get()),
22073 bool declared_inline,
22075 const string& mangled_name,
22079 FUNCTION_DECL | ABSTRACT_DECL_BASE),
22110 type_base_sptr fn_type,
22111 bool declared_inline,
22113 const string& linkage_name,
22117 FUNCTION_DECL | ABSTRACT_DECL_BASE),
22118 decl_base(fn_type->get_environment(), name, locus, linkage_name, vis),
22119 priv_(new priv(dynamic_pointer_cast<
function_type>(fn_type),
22141 bool qualified_name)
const
22146 string fn_prefix = mem_fn ?
"method ":
"function ";
22152 fn_prefix +=
"virtual ";
22154 decl_base_sptr return_type;
22161 return_type = mem_fn
22172 internal) +
" " + result;
22175 result = add_outer_pointer_to_fn_type_expr(p, result,
22180 result = add_outer_pointer_to_array_type_expr(p, result,
22187 return fn_prefix + result;
22217 result += mem_fn->
get_type()->get_class_type()->get_qualified_name()
22223 std::ostringstream fn_parms;
22224 stream_pretty_representation_of_fn_parms(*
get_type(),
22228 result += fn_parms.str();
22233 result +=
" const";
22244 function_decl::parameters::const_iterator
22250 bool is_method =
dynamic_cast<const method_decl*
>(
this);
22263 const shared_ptr<function_type>
22265 {
return priv_->type_.lock();}
22280 {
return priv_->naked_type_;}
22285 priv_->type_ = fn_type;
22286 priv_->naked_type_ = fn_type.get();
22303 priv_->symbol_ = sym;
22318 {
return priv_->symbol_;}
22325 {
return priv_->declared_inline_;}
22332 {priv_->declared_inline_ = value;}
22335 function_decl::get_binding()
const
22336 {
return priv_->binding_;}
22339 const shared_ptr<type_base>
22341 {
return get_type()->get_return_type();}
22344 const std::vector<shared_ptr<function_decl::parameter> >&
22346 {
return get_type()->get_parameters();}
22353 {
get_type()->append_parameter(parm);}
22361 for (std::vector<shared_ptr<parameter> >::const_iterator i = parms.begin();
22434 bool result =
true;
22438 if (t0 == t1 || *t0 == *t1)
22464 else if (s0 && s0 != s1)
22475 bool symbols_are_equal = (s0 && s1 && result);
22477 if (symbols_are_equal)
22489 bool decl_bases_different = !l.decl_base::operator==(r);
22496 if (decl_bases_different)
22506 if (!l.decl_base::operator==(r))
22518 if (l.get_binding() != r.get_binding())
22575 return equals(*
this, *o, 0);
22599 return hash_fn(*
this);
22614 if (priv_->id_.empty())
22619 string virtual_member_suffix;
22629 virtual_member_suffix +=
"/o";
22632 if (s->has_aliases())
22639 priv_->id_ = env.
intern(s->get_id_string());
22641 if (!virtual_member_suffix.empty())
22642 priv_->id_ = env.
intern(priv_->id_ + virtual_member_suffix);
22686 if (v.visit_begin(
this))
22689 if (type_base_sptr t =
get_type())
22693 return v.visit_end(
this);
22715 if (l.get() == r.get())
22738 struct function_decl::parameter::priv
22742 bool variadic_marker_;
22749 priv(type_base_sptr type,
22751 bool variadic_marker)
22754 variadic_marker_(variadic_marker)
22758 function_decl::parameter::parameter(
const type_base_sptr type,
22760 const string& name,
22761 const location& loc,
22763 : type_or_decl_base(type->get_environment(),
22764 FUNCTION_PARAMETER_DECL | ABSTRACT_DECL_BASE),
22765 decl_base(type->get_environment(), name, loc),
22766 priv_(new priv(type, index, is_variadic))
22768 runtime_type_instance(
this);
22771 function_decl::parameter::parameter(
const type_base_sptr type,
22773 const string& name,
22774 const location& loc,
22776 bool is_artificial)
22777 : type_or_decl_base(type->get_environment(),
22778 FUNCTION_PARAMETER_DECL | ABSTRACT_DECL_BASE),
22779 decl_base(type->get_environment(), name, loc),
22780 priv_(new priv(type, index, is_variadic))
22782 runtime_type_instance(
this);
22783 set_is_artificial(is_artificial);
22786 function_decl::parameter::parameter(
const type_base_sptr type,
22787 const string& name,
22788 const location& loc,
22790 bool is_artificial)
22791 : type_or_decl_base(type->get_environment(),
22792 FUNCTION_PARAMETER_DECL | ABSTRACT_DECL_BASE),
22793 decl_base(type->get_environment(), name, loc),
22794 priv_(new priv(type, 0, is_variadic))
22796 runtime_type_instance(
this);
22797 set_is_artificial(is_artificial);
22800 function_decl::parameter::parameter(
const type_base_sptr type,
22803 : type_or_decl_base(type->get_environment(),
22804 FUNCTION_PARAMETER_DECL | ABSTRACT_DECL_BASE),
22805 decl_base(type->get_environment(),
"", location()),
22806 priv_(new priv(type, index, variad))
22808 runtime_type_instance(
this);
22811 function_decl::parameter::~parameter() =
default;
22813 const type_base_sptr
22814 function_decl::parameter::get_type()
const
22815 {
return priv_->type_.lock();}
22842 if (get_variadic_marker()
22862 std::ostringstream o;
22863 o <<
"parameter-" << get_index();
22865 return env.
intern(o.str());
22869 function_decl::parameter::get_index()
const
22870 {
return priv_->index_;}
22873 function_decl::parameter::set_index(
unsigned i)
22874 {priv_->index_ = i;}
22878 function_decl::parameter::get_variadic_marker()
const
22879 {
return priv_->variadic_marker_;}
22905 bool result =
true;
22907 if ((l.get_variadic_marker() != r.get_variadic_marker())
22908 || (l.get_index() != r.get_index())
22909 || (!!l.get_type() != !!r.get_type()))
22914 if (l.get_index() != r.get_index())
22916 if (l.get_variadic_marker() != r.get_variadic_marker()
22917 || !!l.get_type() != !!r.get_type())
22926 if (l_type != r_type)
22944 function_decl::parameter::operator==(
const parameter& o)
const
22945 {
return equals(*
this, o, 0);}
22954 return function_decl::parameter::operator==(*p);
23000 if (v.visit_begin(
this))
23003 if (type_base_sptr t =
get_type())
23007 return v.visit_end(
this);
23018 return hash_fn_parm(
this);
23051 bool qualified_name)
const
23058 type_repr =
"void";
23064 string result = type_repr;
23065 string parm_name = get_name_id();
23067 if (!parm_name.empty())
23068 result +=
" " + parm_name;
23101 class_or_union::class_or_union(
const environment& env,
const string& name,
23102 size_t size_in_bits,
size_t align_in_bits,
23109 | ABSTRACT_DECL_BASE
23110 | ABSTRACT_SCOPE_TYPE_DECL
23111 | ABSTRACT_SCOPE_DECL),
23112 decl_base(env, name, locus, name, vis),
23113 type_base(env, size_in_bits, align_in_bits),
23117 for (member_types::iterator i = mem_types.begin();
23118 i != mem_types.end();
23129 for (member_functions::iterator i = member_fns.begin();
23130 i != member_fns.end();
23132 if (!
has_scope(static_pointer_cast<decl_base>(*i)))
23151 class_or_union::class_or_union(
const environment& env,
const string& name,
23152 size_t size_in_bits,
size_t align_in_bits,
23156 | ABSTRACT_DECL_BASE
23157 | ABSTRACT_SCOPE_TYPE_DECL
23158 | ABSTRACT_SCOPE_DECL),
23159 decl_base(env, name, locus, name, vis),
23160 type_base(env, size_in_bits, align_in_bits),
23173 class_or_union::class_or_union(
const environment& env,
const string& name,
23174 bool is_declaration_only)
23177 | ABSTRACT_DECL_BASE
23178 | ABSTRACT_SCOPE_TYPE_DECL
23179 | ABSTRACT_SCOPE_DECL),
23205 if (v.visit_begin(
this))
23214 if (!(*i)->traverse(v))
23224 if (!(*i)->traverse(v))
23234 if (!(*i)->traverse(v))
23241 for (member_function_templates::const_iterator i =
23245 if (!(*i)->traverse(v))
23252 for (member_class_templates::const_iterator i =
23256 if (!(*i)->traverse(v))
23264 bool result = v.visit_end(
this);
23293 type_base_sptr t =
is_type(decl);
23323 for (class_or_union::data_members::const_iterator it =
23412 if (t->get_is_anonymous())
23430 if (t->get_is_anonymous())
23448 if (t->get_is_anonymous())
23473 bool is_laid_out,
bool is_static,
23474 size_t offset_in_bits)
23478 priv_->data_members_.push_back(v);
23489 bool is_already_in =
false;
23490 for (data_members::const_iterator i =
23491 priv_->non_static_data_members_.begin();
23492 i != priv_->non_static_data_members_.end();
23496 is_already_in =
true;
23499 if (!is_already_in)
23500 priv_->non_static_data_members_.push_back(v);
23516 {
return priv_->data_members_;}
23531 if ((*i)->get_name() == name)
23543 if (
var_decl_sptr data_member = type->find_data_member(name))
23544 return data_member;
23558 if (!v->get_name().empty())
23566 if ((*it)->get_pretty_representation(
false,
true)
23567 == v->get_pretty_representation(
false,
true))
23594 if (v->get_name().empty())
23607 {
return priv_->non_static_data_members_;}
23625 bool is_static,
bool is_ctor,
23626 bool is_dtor,
bool is_const)
23638 priv_->member_functions_.push_back(f);
23642 if (!f->get_linkage_name().empty())
23643 priv_->mem_fns_map_[f->get_linkage_name()] = f;
23652 {
return priv_->member_functions_;}
23673 string_mem_fn_sptr_map_type::const_iterator i =
23674 priv_->mem_fns_map_.find(linkage_name);
23675 if (i == priv_->mem_fns_map_.end())
23677 return i->second.get();
23688 string_mem_fn_sptr_map_type::const_iterator i =
23689 priv_->mem_fns_map_.find(linkage_name);
23690 if (i == priv_->mem_fns_map_.end())
23716 string_mem_fn_ptr_map_type::const_iterator i =
23717 priv_->signature_2_mem_fn_map_.find(s);
23718 if (i == priv_->signature_2_mem_fn_map_.end())
23726 const member_function_templates&
23728 {
return priv_->member_function_templates_;}
23733 const member_class_templates&
23735 {
return priv_->member_class_templates_;}
23746 priv_->member_function_templates_.push_back(m);
23761 priv_->member_class_templates_.push_back(m);
23771 && priv_->data_members_.empty()
23772 && priv_->member_functions_.empty()
23773 && priv_->member_function_templates_.empty()
23774 && priv_->member_class_templates_.empty());
23793 else if (method_decl_sptr f = dynamic_pointer_cast<method_decl>(d))
23799 else if (member_function_template_sptr f =
23800 dynamic_pointer_cast<member_function_template>(d))
23802 else if (member_class_template_sptr c =
23803 dynamic_pointer_cast<member_class_template>(d))
23852 return *
this == *o;
23893 if (l_is_decl_only || r_is_decl_only)
23903 if (!def1 || !def2)
23907 && l_is_decl_only && r_is_decl_only
23948 if (!!def1 != !!def2)
23956 if (!(l.decl_base::operator==(r)
23957 && l.type_base::operator==(r)))
23968 bool val = *def1 == *def2;
23977 if (!(l.decl_base::operator==(r) && l.type_base::operator==(r)))
23984 if (types_defined_same_linux_kernel_corpus_public(l, r))
23992 #define RETURN(value) \
23993 return return_comparison_result(l, r, value, \
24000 bool result =
true;
24014 for (class_or_union::data_members::const_iterator
24028 || (*d0)->get_type() == (*d1)->get_type())
24055 for (member_function_templates::const_iterator
24060 ++fn_tmpl_it0, ++fn_tmpl_it1)
24061 if (**fn_tmpl_it0 != **fn_tmpl_it1)
24086 for (member_class_templates::const_iterator
24091 ++cl_tmpl_it0, ++cl_tmpl_it1)
24092 if (**cl_tmpl_it0 != **cl_tmpl_it1)
24120 const method_decl_sptr& method)
24142 old_type->get_parameters(),
24143 old_type->get_is_const(),
24144 old_type->get_size_in_bits(),
24145 old_type->get_alignment_in_bits()));
24146 t->get_translation_unit()->bind_function_type_life_time(new_type);
24155 method->get_binding()));
24156 new_method->set_symbol(method->
get_symbol());
24159 class_type->add_member_function(new_method,
24168 t->add_member_function(new_method,
24281 maybe_propagate_canonical_type(
const type_base& lhs_type,
24285 #if WITH_DEBUG_TYPE_CANONICALIZATION
24286 if (!env.priv_->use_canonical_type_comparison_)
24293 if (env.priv_->propagate_ct(lhs_type, rhs_type))
24304 struct class_decl::priv
24307 unordered_map<string, base_spec_sptr> bases_map_;
24313 : is_struct_(false)
24354 size_t size_in_bits,
size_t align_in_bits,
24355 bool is_struct,
const location& locus,
24362 | ABSTRACT_TYPE_BASE
24363 | ABSTRACT_DECL_BASE
24364 | ABSTRACT_SCOPE_TYPE_DECL
24365 | ABSTRACT_SCOPE_DECL),
24366 decl_base(env, name, locus, name, vis),
24367 type_base(env, size_in_bits, align_in_bits),
24369 locus, vis, mbr_types, data_mbrs, mbr_fns),
24370 priv_(new priv(is_struct, bases))
24405 size_t size_in_bits,
size_t align_in_bits,
24406 bool is_struct,
const location& locus,
24412 | ABSTRACT_TYPE_BASE
24413 | ABSTRACT_DECL_BASE
24414 | ABSTRACT_SCOPE_TYPE_DECL
24415 | ABSTRACT_SCOPE_DECL),
24424 is_anonymous ? string() : name,
24426 type_base(env, size_in_bits, align_in_bits),
24428 locus, vis, mbr_types, data_mbrs, mbr_fns),
24429 priv_(new priv(is_struct, bases))
24451 size_t size_in_bits,
size_t align_in_bits,
24452 bool is_struct,
const location& locus,
24456 | ABSTRACT_TYPE_BASE
24457 | ABSTRACT_DECL_BASE
24458 | ABSTRACT_SCOPE_TYPE_DECL
24459 | ABSTRACT_SCOPE_DECL),
24460 decl_base(env, name, locus, name, vis),
24461 type_base(env, size_in_bits, align_in_bits),
24464 priv_(new priv(is_struct))
24488 size_t size_in_bits,
size_t align_in_bits,
24489 bool is_struct,
const location& locus,
24493 | ABSTRACT_TYPE_BASE
24494 | ABSTRACT_DECL_BASE
24495 | ABSTRACT_SCOPE_TYPE_DECL
24496 | ABSTRACT_SCOPE_DECL),
24505 is_anonymous ? string() : name,
24507 type_base(env, size_in_bits, align_in_bits),
24510 priv_(new priv(is_struct))
24526 bool is_struct,
bool is_declaration_only)
24529 | ABSTRACT_TYPE_BASE
24530 | ABSTRACT_DECL_BASE
24531 | ABSTRACT_SCOPE_TYPE_DECL
24532 | ABSTRACT_SCOPE_DECL),
24536 priv_(new priv(is_struct))
24551 for (class_decl::virtual_mem_fn_map_type::iterator i =
24552 priv_->virtual_mem_fns_map_.begin();
24553 i != priv_->virtual_mem_fns_map_.end();
24555 sort_virtual_member_functions(i->second);
24563 {priv_->is_struct_ = f;}
24570 {
return priv_->is_struct_;}
24578 priv_->bases_.push_back(b);
24579 priv_->bases_map_[b->get_base_class()->get_qualified_name()] = b;
24587 {
return priv_->bases_;}
24598 unordered_map<string, base_spec_sptr>::iterator i =
24599 priv_->bases_map_.find(qualified_name);
24601 if (i != priv_->bases_map_.end())
24602 return i->second->get_base_class();
24613 {
return priv_->virtual_mem_fns_;}
24632 {
return priv_->virtual_mem_fns_map_;}
24637 {sort_virtual_member_functions(priv_->virtual_mem_fns_);}
24658 bool qualified_name)
const
24660 string cl =
"class ";
24669 if (
internal && !
get_name().empty())
24677 string result = cl;
24678 if (qualified_name)
24687 class_decl::insert_member_decl(decl_base_sptr d)
24689 if (method_decl_sptr f = dynamic_pointer_cast<method_decl>(d))
24704 struct class_decl::base_spec::priv
24707 long offset_in_bits_;
24711 long offset_in_bits,
24714 offset_in_bits_(offset_in_bits),
24715 is_virtual_(is_virtual)
24733 long offset_in_bits,
24736 ABSTRACT_DECL_BASE),
24738 base->get_linkage_name(), base->get_visibility()),
24740 priv_(new priv(base, offset_in_bits, is_virtual))
24752 {
return priv_->base_class_.lock();}
24759 {
return priv_->is_virtual_;}
24766 {
return priv_->offset_in_bits_;}
24796 if (v.visit_begin(
this))
24799 get_base_class()->traverse(v);
24803 return v.visit_end(
this);
24823 class_decl::base_spec::base_spec(
const type_base_sptr& base,
24825 long offset_in_bits,
24828 ABSTRACT_DECL_BASE),
24834 priv_(new priv(dynamic_pointer_cast<
class_decl>(base),
24841 class_decl::base_spec::~base_spec() =
default;
24867 if (!l.member_base::operator==(r))
24893 return equals(*
this, *o, 0);
24914 mem_fn_context_rel::~mem_fn_context_rel()
24934 method_decl::method_decl(
const string& name,
24936 bool declared_inline,
24938 const string& linkage_name,
24943 | ABSTRACT_DECL_BASE
24947 declared_inline, locus, linkage_name, vis, bind)
24971 method_decl::method_decl(
const string& name,
24973 bool declared_inline,
24975 const string& linkage_name,
24980 | ABSTRACT_DECL_BASE
24982 decl_base(type->get_environment(), name, locus, linkage_name, vis),
24985 declared_inline, locus, linkage_name, vis, bind)
25008 method_decl::method_decl(
const string& name,
25009 type_base_sptr type,
25010 bool declared_inline,
25012 const string& linkage_name,
25017 | ABSTRACT_DECL_BASE
25019 decl_base(type->get_environment(), name, locus, linkage_name, vis),
25022 declared_inline, locus, linkage_name, vis, bind)
25041 class_or_union_sptr cl = t->get_class_type();
25043 cl->priv_->mem_fns_map_[l] = m;
25044 if (!old_lname.empty() && l != old_lname)
25046 if (method_decl_sptr m = cl->find_member_function_sptr(old_lname))
25049 cl->priv_->mem_fns_map_.erase(old_lname);
25055 method_decl::~method_decl()
25092 if (l.get() == r.get())
25145 {
return dynamic_pointer_cast<method_decl>(d);}
25149 struct virtual_member_function_less_than
25173 if (f_offset != s_offset)
return f_offset < s_offset;
25179 if (fn != sn)
return fn < sn;
25185 if ((!f_sym) != (!s_sym))
return !f_sym;
25186 if (f_sym && s_sym)
25188 fn = f_sym->get_id_string();
25189 sn = s_sym->get_id_string();
25190 if (fn != sn)
return fn < sn;
25197 if (fn != sn)
return fn < sn;
25201 string fn_filepath, sn_filepath;
25202 unsigned line = 0, column = 0;
25205 fn_loc.
expand(fn_filepath, line, column);
25207 sn_loc.expand(sn_filepath, line, column);
25208 return fn_filepath < sn_filepath;
25223 operator()(
const method_decl_sptr f,
25224 const method_decl_sptr s)
25225 {
return operator()(*f, *s);}
25234 virtual_member_function_less_than lt;
25235 std::stable_sort(mem_fns.begin(), mem_fns.end(), lt);
25264 size_t vtable_offset,
25265 bool is_static,
bool is_ctor,
25266 bool is_dtor,
bool is_const)
25269 is_dtor, is_const);
25277 sort_virtual_member_functions(klass->priv_->virtual_mem_fns_);
25296 class_decl::member_functions::const_iterator m;
25297 for (m = klass->priv_->virtual_mem_fns_.begin();
25298 m != klass->priv_->virtual_mem_fns_.end();
25300 if (m->get() == method.get()
25301 || (*m)->get_linkage_name() == method->get_linkage_name())
25303 if (m == klass->priv_->virtual_mem_fns_.end())
25304 klass->priv_->virtual_mem_fns_.push_back(method);
25312 class_decl::virtual_mem_fn_map_type::iterator i =
25313 klass->priv_->virtual_mem_fns_map_.find(voffset);
25314 if (i == klass->priv_->virtual_mem_fns_map_.end())
25317 virtual_mem_fns_at_voffset.push_back(method);
25318 klass->priv_->virtual_mem_fns_map_[voffset] = virtual_mem_fns_at_voffset;
25322 for (m = i->second.begin() ; m != i->second.end(); ++m)
25323 if (m->get() == method.get()
25324 || (*m)->get_linkage_name() == method->get_linkage_name())
25326 if (m == i->second.end())
25327 i->second.push_back(method);
25356 if ((*b)->get_is_virtual()
25357 || (*b)->get_base_class()->has_virtual_bases())
25386 ssize_t offset = -1;
25387 for (class_decl::virtual_mem_fn_map_type::const_iterator e =
25391 if (e->first > offset)
25404 return hash_class(
this);
25417 methods_equal_modulo_elf_symbol(
const method_decl_sptr& f,
25418 const method_decl_sptr& s)
25420 method_decl_sptr first = f, second = s;
25422 first->get_symbol();
25424 second->get_symbol();
25426 first->get_linkage_name();
25428 second->get_linkage_name();
25431 first->set_linkage_name(
"");
25433 second->set_linkage_name(
"");
25435 bool equal = *first == *second;
25437 first->set_symbol(saved_first_elf_symbol);
25438 first->set_linkage_name(saved_first_linkage_name);
25439 second->set_symbol(saved_second_elf_symbol);
25440 second->set_linkage_name(saved_second_linkage_name);
25461 method_matches_at_least_one_in_vector(
const method_decl_sptr& method,
25464 for (class_decl::member_functions::const_iterator i = fns.begin();
25473 if (methods_equal_modulo_elf_symbol(method, *i))
25489 maybe_cancel_propagated_canonical_type(
const class_or_union& t)
25491 const environment& env = t.get_environment();
25492 if (env.do_on_the_fly_canonicalization())
25493 if (
is_type(&t)->priv_->canonical_type_propagated())
25495 is_type(&t)->priv_->clear_propagated_canonical_type();
25496 env.priv_->remove_from_types_with_non_confirmed_propagated_ct(&t);
25529 bool result =
false;
25530 if (l.
get_environment().priv_->is_type_comparison_cached(l, r, result))
25542 bool result =
true;
25556 if (!had_canonical_type)
25557 maybe_cancel_propagated_canonical_type(r);
25563 #define RETURN(value) CACHE_AND_RETURN_COMPARISON_RESULT(value)
25575 for (class_decl::base_specs::const_iterator
25587 (*b1)->get_base_class().get()))
25633 for (class_decl::virtual_mem_fn_map_type::const_iterator first_v_fn_entry =
25636 ++first_v_fn_entry)
25638 unsigned voffset = first_v_fn_entry->first;
25640 first_v_fn_entry->second;
25642 const class_decl::virtual_mem_fn_map_type::const_iterator
25654 second_v_fn_entry->second;
25656 bool matches =
false;
25657 for (class_decl::member_functions::const_iterator i =
25658 first_vfns.begin();
25659 i != first_vfns.end();
25661 if (method_matches_at_least_one_in_vector(*i, second_vfns))
25751 return *
this == *o;
25795 if (l.get() == r.get())
25827 operator==(
const class_or_union_sptr& l,
const class_or_union_sptr& r)
25829 if (l.get() == r.get())
25846 operator!=(
const class_or_union_sptr& l,
const class_or_union_sptr& r)
25866 if (v.visit_begin(
this))
25875 if (!(*i)->traverse(v))
25886 if (!(*i)->traverse(v))
25896 if (!(*i)->traverse(v))
25906 if (!(*i)->traverse(v))
25913 for (member_function_templates::const_iterator i =
25917 if (!(*i)->traverse(v))
25924 for (member_class_templates::const_iterator i =
25928 if (!(*i)->traverse(v))
25936 bool result = v.visit_end(
this);
25945 context_rel::~context_rel()
25949 member_base::operator==(
const member_base& o)
const
25969 if (l.get() == r.get())
25974 return *l ==
static_cast<const decl_base&
>(*r);
26013 {
return dynamic_pointer_cast<class_decl::base_spec>(tod);}
26016 member_function_template::operator==(
const member_base& other)
const
26023 if (!(is_constructor() == o.is_constructor()
26024 && is_const() == o.is_const()
26025 && member_base::operator==(o)))
26032 return ftdecl->function_tdecl::operator==(*other_ftdecl);
26051 const member_function_template_sptr& r)
26053 if (l.get() == r.get())
26072 const member_function_template_sptr& r)
26089 if (v.visit_begin(
this))
26096 return v.visit_end(
this);
26112 if (!member_base::operator==(o))
26115 return as_class_tdecl()->class_tdecl::operator==(o);
26129 if (!decl_base::operator==(other))
26131 return as_class_tdecl()->class_tdecl::operator==(other);
26145 return *
this == *o;
26158 const member_class_template_sptr& r)
26160 if (l.get() == r.get())
26178 const member_class_template_sptr& r)
26195 if (v.visit_begin(
this))
26202 return v.visit_end(
this);
26222 case private_access:
26225 case protected_access:
26228 case public_access:
26252 c->set_is_static(s);
26262 for (class_decl::data_members::iterator i =
26263 cl->priv_->non_static_data_members_.begin();
26264 i != cl->priv_->non_static_data_members_.end();
26267 if ((*i)->get_name() == v->get_name())
26269 cl->priv_->non_static_data_members_.erase(i);
26275 bool is_already_in_non_static_data_members =
false;
26276 for (class_or_union::data_members::iterator i =
26277 cl->priv_->non_static_data_members_.begin();
26278 i != cl->priv_->non_static_data_members_.end();
26281 if ((*i)->get_name() == v->get_name())
26283 is_already_in_non_static_data_members =
true;
26287 if (!is_already_in_non_static_data_members)
26291 for (class_or_union::data_members::const_iterator i =
26292 cl->priv_->data_members_.begin();
26293 i != cl->priv_->data_members_.end();
26296 if ((*i)->get_name() == v->get_name())
26303 cl->priv_->non_static_data_members_.push_back(var);
26344 size_t size_in_bits,
const location& locus,
26349 | ABSTRACT_TYPE_BASE
26350 | ABSTRACT_DECL_BASE),
26351 decl_base(env, name, locus, name, vis),
26354 locus, vis, mbr_types, data_mbrs, member_fns)
26380 size_t size_in_bits,
const location& locus,
26386 | ABSTRACT_TYPE_BASE
26387 | ABSTRACT_DECL_BASE),
26396 is_anonymous ? string() : name,
26400 locus, vis, mbr_types, data_mbrs, member_fns)
26418 size_t size_in_bits,
const location& locus,
26422 | ABSTRACT_TYPE_BASE
26423 | ABSTRACT_DECL_BASE
26424 | ABSTRACT_SCOPE_TYPE_DECL
26425 | ABSTRACT_SCOPE_DECL),
26426 decl_base(env, name, locus, name, vis),
26449 size_t size_in_bits,
const location& locus,
26453 | ABSTRACT_TYPE_BASE
26454 | ABSTRACT_DECL_BASE
26455 | ABSTRACT_SCOPE_TYPE_DECL
26456 | ABSTRACT_SCOPE_DECL),
26465 is_anonymous ? string() : name,
26484 const string& name,
26485 bool is_declaration_only)
26488 | ABSTRACT_TYPE_BASE
26489 | ABSTRACT_DECL_BASE
26490 | ABSTRACT_SCOPE_TYPE_DECL
26491 | ABSTRACT_SCOPE_DECL),
26518 bool qualified_name)
const
26523 if (
internal && !
get_name().empty())
26524 repr = string(
"union ") +
26534 if (qualified_name)
26571 return *
this == *o;
26585 return *
this == *o;
26618 if (v.visit_begin(
this))
26627 if (!(*i)->traverse(v))
26637 if (!(*i)->traverse(v))
26647 if (!(*i)->traverse(v))
26654 for (member_function_templates::const_iterator i =
26658 if (!(*i)->traverse(v))
26665 for (member_class_templates::const_iterator i =
26669 if (!(*i)->traverse(v))
26677 bool result = v.visit_end(
this);
26716 bool result =
false;
26717 if (l.
get_environment().priv_->is_type_comparison_cached(l, r, result))
26738 const method_decl_sptr& f)
26753 const class_or_union_sptr t = union_type;
26768 if (l.get() == r.get())
26792 class template_decl::priv
26796 std::list<template_parameter_sptr> parms_;
26809 {priv_->parms_.push_back(p);}
26815 const std::list<template_parameter_sptr>&
26817 {
return priv_->parms_;}
26830 const string& name,
26855 return *
this == *other;
26868 list<shared_ptr<template_parameter> >::const_iterator t0, t1;
26894 class template_parameter::priv
26900 mutable bool hashing_started_;
26901 mutable bool comparison_started_;
26909 template_decl_(enclosing_template_decl),
26910 hashing_started_(),
26911 comparison_started_()
26915 template_parameter::template_parameter(
unsigned index,
26917 : priv_(new priv(index, enclosing_template))
26921 template_parameter::get_index()
const
26922 {
return priv_->index_;}
26925 template_parameter::get_enclosing_template_decl()
const
26926 {
return priv_->template_decl_.lock();}
26929 template_parameter::get_hashing_has_started()
const
26930 {
return priv_->hashing_started_;}
26933 template_parameter::set_hashing_has_started(
bool f)
const
26934 {priv_->hashing_started_ = f;}
26939 if (get_index() != o.get_index())
26942 if (priv_->comparison_started_)
26945 bool result =
false;
26950 priv_->comparison_started_ =
true;
26952 if (!!get_enclosing_template_decl() != !!o.get_enclosing_template_decl())
26954 else if (get_enclosing_template_decl()
26955 && (*get_enclosing_template_decl()
26956 != *o.get_enclosing_template_decl()))
26961 priv_->comparison_started_ =
false;
26981 class type_tparameter::priv
26996 type_tparameter::type_tparameter(
unsigned index,
26998 const string& name,
27002 | ABSTRACT_TYPE_BASE
27004 decl_base(enclosing_tdecl->get_environment(), name, locus),
27005 type_base(enclosing_tdecl->get_environment(), 0, 0),
27006 type_decl(enclosing_tdecl->get_environment(), name, 0, 0, locus),
27021 if (!type_decl::operator==(other))
27041 if (!type_decl::operator==(other))
27061 if (!decl_base::operator==(other))
27097 {
return *
this ==
static_cast<const type_base&
>(other);}
27099 type_tparameter::~type_tparameter()
27103 class non_type_tparameter::priv
27113 priv(type_base_sptr type)
27131 non_type_tparameter::non_type_tparameter(
unsigned index,
27133 const string& name,
27134 type_base_sptr type,
27137 decl_base(type->get_environment(), name, locus,
""),
27139 priv_(new priv(type))
27147 const type_base_sptr
27149 {
return priv_->type_.lock();}
27158 return hash_tparm(
this);
27164 if (!decl_base::operator==(other))
27171 return (template_parameter::operator==(o)
27190 non_type_tparameter::~non_type_tparameter()
27196 class template_tparameter::priv
27210 template_tparameter::template_tparameter(
unsigned index,
27212 const string& name,
27216 | ABSTRACT_TYPE_BASE
27218 decl_base(enclosing_tdecl->get_environment(), name, locus),
27219 type_base(enclosing_tdecl->get_environment(), 0, 0),
27220 type_decl(enclosing_tdecl->get_environment(), name,
27221 0, 0, locus, name, VISIBILITY_DEFAULT),
27223 template_decl(enclosing_tdecl->get_environment(), name, locus),
27241 return (type_tparameter::operator==(o)
27260 return (type_tparameter::operator==(o)
27274 return *
this ==
static_cast<const type_base&
>(other);
27293 template_tparameter::~template_tparameter()
27301 class type_composition::priv
27325 type_composition::type_composition(
unsigned index,
27329 ABSTRACT_DECL_BASE),
27340 const type_base_sptr
27342 {
return priv_->type_.lock();}
27349 {priv_->type_ = t;}
27358 return hash_type_composition(
this);
27361 type_composition::~type_composition()
27370 class function_tdecl::priv
27382 : pattern_(pattern), binding_(bind)
27409 | ABSTRACT_SCOPE_DECL),
27413 priv_(new priv(bind))
27437 | ABSTRACT_SCOPE_DECL),
27442 priv_(new priv(pattern, bind))
27453 priv_->pattern_ = p;
27463 {
return priv_->pattern_;}
27470 {
return priv_->binding_;}
27482 return *
this == *o;
27496 return *
this == *o;
27509 && template_decl::operator==(o)
27510 && scope_decl::operator==(o)
27534 if (!v.visit_begin(
this))
27541 return v.visit_end(
this);
27544 function_tdecl::~function_tdecl()
27552 class class_tdecl::priv
27563 : pattern_(pattern)
27582 | ABSTRACT_SCOPE_DECL),
27607 | ABSTRACT_SCOPE_DECL),
27612 priv_(new priv(pattern))
27623 priv_->pattern_ = p;
27633 {
return priv_->pattern_;}
27642 if (!(template_decl::operator==(o)
27643 && scope_decl::operator==(o)
27662 return *
this ==
static_cast<const decl_base&
>(o);
27670 {
return *
this ==
static_cast<const decl_base&
>(o);}
27686 if (v.visit_begin(
this))
27690 pattern->traverse(v);
27693 return v.visit_end(
this);
27696 class_tdecl::~class_tdecl()
27707 non_canonicalized_subtype_detector();
27710 non_canonicalized_subtype_detector(
type_base* type)
27712 has_non_canonical_type_()
27721 has_non_canonical_type()
const
27722 {
return has_non_canonical_type_;}
27727 visit_begin(function_decl* f)
27745 visit_begin(type_base* t)
27749 if (!t->get_canonical_type())
27753 has_non_canonical_type_ = t;
27768 visit_end(type_base* )
27770 if (has_non_canonical_type_)
27787 non_canonicalized_subtype_detector v(t.get());
27789 return v.has_non_canonical_type();
27805 const type_base_sptr t_v2)
27812 return (t1 != t2 && repr1 == repr2);
27823 env.priv_->extra_live_types_.push_back(t);
27859 string repr = v->get_pretty_representation(
true);
27860 std::hash<string> hash_string;
27861 h = hashing::combine_hashes(h, hash_string(repr));
27868 string repr = f->get_pretty_representation(
true);
27869 std::hash<string> hash_string;
27870 h = hashing::combine_hashes(h, hash_string(repr));
27875 type_base_sptr parm_type = p->get_type();
27877 std::hash<bool> hash_bool;
27878 std::hash<unsigned> hash_unsigned;
27880 h = hashing::combine_hashes(h, hash_unsigned(p->get_index()));
27881 h = hashing::combine_hashes(h, hash_bool(p->get_variadic_marker()));
27887 std::hash<size_t> hash_size;
27888 std::hash<bool> hash_bool;
27889 type_base_sptr type = bs->get_base_class();
27891 h = hashing::combine_hashes(h, hash_member(*bs));
27892 h = hashing::combine_hashes(h, hash_size(bs->get_offset_in_bits()));
27893 h = hashing::combine_hashes(h, hash_bool(bs->get_is_virtual()));
27900 result = d->get_hash();
27925 {
return hash_as_canonical_type_or_constant(t);}
28033 exemplar =
const_cast<type_base*
>(type);
28062 hash_as_canonical_type_or_constant(
const type_base *t)
28069 if (!canonical_type)
28087 if (canonical_type)
28088 return reinterpret_cast<size_t>(canonical_type);
28163 const type_base_sptr& second,
28164 bool indirect_type)
28196 bool indirect_type)
28198 if (!!first != !!second)
28210 if (
typeid(*first) !=
typeid(*second))
28226 if (ty1->is_lvalue() != ty2->is_lvalue())
28229 ty2->get_pointed_to_type(),
28248 if (!indirect_type)
28252 return ty1->get_name() == ty2->
get_name();
28258 if (!indirect_type)
28262 return (
get_name(ty1->get_underlying_type())
28270 && ty1->get_name() != ty2->
get_name())
28273 if (!indirect_type)
28276 || (ty1->get_non_static_data_members().size()
28280 for (class_or_union::data_members::const_iterator
28281 i = ty1->get_non_static_data_members().begin(),
28283 (i != ty1->get_non_static_data_members().end()
28290 dm2->get_type().get(),
28303 && ty1->get_name() != ty2->
get_name())
28306 if (!indirect_type)
28316 if (!indirect_type)
28319 || ty1->get_dimension_count() != ty2->get_dimension_count())
28353 if (ty1->get_parameters().size() != ty2->
get_parameters().size())
28356 for (function_type::parameters::const_iterator
28357 i = ty1->get_parameters().begin(),
28359 (i != ty1->get_parameters().end()
28389 const char* dm_name)
28417 return cou->find_data_member(dm);
28432 unsigned parm_index)
28439 if (parms.size() <= parm_index)
28442 return parms[parm_index].get();
28457 std::ostringstream o;
28460 o <<
"unnamed-enum";
28464 o <<
"-underlying-type-" << size;
28484 return data_member;
28504 for (; d != e; ++d)
28525 stream_pretty_representation_of_fn_parms(
const function_type& fn_type,
28526 ostream& o,
bool qualified,
28534 type_base_sptr type;
28541 if (i != first_parm)
28544 type = parm->get_type();
28605 add_outer_pointer_to_fn_type_expr(
const type_base* p,
28606 const string& input,
28607 bool qualified,
bool internal)
28613 string star_or_ref;
28626 if (!pointed_to_fn)
28629 std::ostringstream left, right, inner;
28631 inner <<
"(" << star_or_ref << input <<
")";
28633 type_base_sptr type;
28634 stream_pretty_representation_of_fn_parms(*pointed_to_fn, right,
28635 qualified,
internal);
28636 type_base_sptr return_type =
28639 : pointed_to_fn->get_return_type();
28649 result = left.str() +
" " + inner.str() + right.str();
28653 string inner_string = inner.str() + right.str();
28654 result = add_outer_pointer_to_fn_type_expr(p, inner_string,
28655 qualified,
internal);
28659 string inner_string = inner.str() + right.str();
28660 result = add_outer_pointer_to_array_type_expr(p, inner_string,
28661 qualified,
internal);
28716 add_outer_pointer_to_fn_type_expr(
const type_base_sptr& p,
28717 const string& input,
28718 bool qualified,
bool internal)
28719 {
return add_outer_pointer_to_fn_type_expr(p.get(), input, qualified,
internal);}
28772 add_outer_pointer_to_array_type_expr(
const type_base* p,
28773 const string& input,
bool qualified,
28779 string star_or_ref;
28780 type_base_sptr pointed_to_type;
28784 pointed_to_type = ptr->get_pointed_to_type();
28789 pointed_to_type = ref->get_pointed_to_type();
28797 std::ostringstream left, right, inner;
28798 inner <<
"(" << star_or_ref << input <<
")";
28799 right << array->get_subrange_representation();
28802 type_base_sptr array_element_type = array->get_element_type();
28808 left <<
get_type_name(array_element_type, qualified,
internal);
28809 result = left.str() + inner.str() + right.str();
28814 string r = inner.str() + right.str();
28815 result = add_outer_pointer_to_fn_type_expr(p, r, qualified,
internal);
28820 string inner_string = inner.str() + right.str();
28821 result = add_outer_pointer_to_array_type_expr(p, inner_string,
28822 qualified,
internal);
28881 add_outer_pointer_to_array_type_expr(
const type_base_sptr& pointer_to_ar,
28882 const string& input,
bool qualified,
28884 {
return add_outer_pointer_to_array_type_expr(pointer_to_ar.get(),
28885 input, qualified,
internal);}
28933 add_outer_ptr_to_mbr_type_expr(
const ptr_to_mbr_type* p,
28934 const string& input,
bool qualified,
28940 std::ostringstream left, right, inner;
28941 string containing_type_name =
get_type_name(p->get_containing_type(),
28942 qualified,
internal);
28943 type_base_sptr mbr_type = p->get_member_type();
28947 inner <<
"(" << containing_type_name <<
"::*" << input <<
")";
28948 stream_pretty_representation_of_fn_parms(*fn_type, right,
28949 qualified,
internal);
28957 left <<
get_type_name(return_type, qualified,
internal) <<
" ";;
28958 result = left.str() + inner.str() + right.str();
28962 string inner_str = inner.str() + right.str();
28963 result = pointer_declaration_name(p, inner_str, qualified,
internal);
28967 string inner_str = inner.str() + right.str();
28968 result = add_outer_ptr_to_mbr_type_expr(p, inner_str,
28969 qualified,
internal);
28976 inner <<
"(" << containing_type_name <<
"::*" << input <<
")";
28977 stream_pretty_representation_of_fn_parms(*fn_type, right,
28978 qualified,
internal);
28979 string inner_str = inner.str() + right.str();
28980 result = add_outer_ptr_to_mbr_type_expr(ptr_mbr_type, inner_str,
28981 qualified,
internal);
28985 left <<
get_type_name(p->get_member_type(), qualified,
internal) <<
" ";
28986 inner << containing_type_name <<
"::*" << input;
28987 result = left.str()+ inner.str();
29040 const string& input,
bool qualified,
29042 {
return add_outer_ptr_to_mbr_type_expr(p.get(), input, qualified,
internal);}
29062 add_outer_pointer_to_ptr_to_mbr_type_expr(
const type_base* p,
29063 const string& input,
bool qualified,
29069 string star_or_ref;
29070 type_base_sptr pointed_to_type;
29074 pointed_to_type = ptr->get_pointed_to_type();
29079 pointed_to_type= ref->get_pointed_to_type();
29083 if (!pointed_to_type)
29088 if (!pointed_to_ptr_to_mbr)
29091 std::ostringstream inner;
29092 inner << star_or_ref << input;
29093 string result = add_outer_ptr_to_mbr_type_expr(pointed_to_ptr_to_mbr,
29095 qualified,
internal);
29112 static interned_string
29113 pointer_declaration_name(
const type_base* ptr,
29114 const string& idname,
29115 bool qualified,
bool internal)
29118 return interned_string();
29120 type_base_sptr pointed_to_type;
29121 string star_or_ref;
29124 pointed_to_type = p->get_pointed_to_type();
29129 pointed_to_type = p->get_pointed_to_type();
29133 if (!pointed_to_type)
29134 return interned_string();
29147 if (!idname.empty())
29154 result = add_outer_pointer_to_fn_type_expr(ptr, idname,
29155 qualified,
internal);
29157 result = add_outer_pointer_to_array_type_expr(ptr, idname,
29158 qualified,
internal);
29160 result = add_outer_pointer_to_ptr_to_mbr_type_expr(ptr, idname,
29161 qualified,
internal);
29165 return ptr->get_environment().intern(result);
29182 static interned_string
29183 pointer_declaration_name(
const type_base_sptr& ptr,
29184 const string& variable_name,
29185 bool qualified,
bool internal)
29186 {
return pointer_declaration_name(ptr.get(), variable_name,
29187 qualified,
internal);}
29202 static interned_string
29203 array_declaration_name(
const array_type_def* array,
29204 const string& variable_name,
29205 bool qualified,
bool internal)
29208 return interned_string();
29210 type_base_sptr e_type = array->get_element_type();
29211 string e_type_repr =
29219 std::ostringstream o;
29220 if (!variable_name.empty())
29221 o << variable_name <<
" is ";
29223 << array->get_subrange_representation()
29224 <<
") of " << e_type_repr;
29235 result = e_type_repr;
29236 if (!variable_name.empty())
29237 result += variable_name;
29238 result += array->get_subrange_representation();
29242 string s = variable_name + array->get_subrange_representation();
29243 result = pointer_declaration_name(p, s, qualified,
internal);
29247 string s = variable_name + array->get_subrange_representation();
29248 result = ptr_to_mbr_declaration_name(p, s, qualified,
internal);
29253 return array->get_environment().intern(result);
29269 static interned_string
29271 const string& variable_name,
29272 bool qualified,
bool internal)
29273 {
return array_declaration_name(array.get(), variable_name,
29274 qualified,
internal);}
29289 static interned_string
29290 ptr_to_mbr_declaration_name(
const ptr_to_mbr_type* ptr,
29291 const string& variable_name,
29292 bool qualified,
bool internal)
29295 return interned_string();
29297 string input = variable_name;
29298 string result = add_outer_ptr_to_mbr_type_expr(ptr, input,
29299 qualified,
internal);
29300 return ptr->get_environment().intern(result);
29316 static interned_string
29318 const string& variable_name,
29319 bool qualified,
bool internal)
29321 return ptr_to_mbr_declaration_name(ptr.get(), variable_name,
29322 qualified,
internal);
29332 struct ir_node_visitor::priv
29347 ir_node_visitor::~ir_node_visitor() =
default;
29356 {priv_->allow_visiting_already_visited_type_node = f;}
29365 {
return priv_->allow_visiting_already_visited_type_node;}
29385 size_t canonical_ptr_value =
reinterpret_cast<size_t>(canonical_type);
29386 priv_->visited_ir_nodes.insert(canonical_ptr_value);
29399 {priv_->visited_ir_nodes.clear();}
29419 size_t ptr_value =
reinterpret_cast<size_t>(canonical_type);
29420 pointer_set::iterator it = priv_->visited_ir_nodes.find(ptr_value);
29421 if (it == priv_->visited_ir_nodes.end())
29428 ir_node_visitor::visit_begin(
decl_base*)
29436 ir_node_visitor::visit_begin(scope_decl*)
29440 ir_node_visitor::visit_end(scope_decl*)
29444 ir_node_visitor::visit_begin(type_base*)
29448 ir_node_visitor::visit_end(type_base*)
29452 ir_node_visitor::visit_begin(scope_type_decl* t)
29453 {
return visit_begin(
static_cast<type_base*
>(t));}
29456 ir_node_visitor::visit_end(scope_type_decl* t)
29457 {
return visit_end(
static_cast<type_base*
>(t));}
29460 ir_node_visitor::visit_begin(type_decl* t)
29461 {
return visit_begin(
static_cast<type_base*
>(t));}
29464 ir_node_visitor::visit_end(type_decl* t)
29465 {
return visit_end(
static_cast<type_base*
>(t));}
29468 ir_node_visitor::visit_begin(namespace_decl* d)
29469 {
return visit_begin(
static_cast<decl_base*
>(d));}
29472 ir_node_visitor::visit_end(namespace_decl* d)
29473 {
return visit_end(
static_cast<decl_base*
>(d));}
29476 ir_node_visitor::visit_begin(qualified_type_def* t)
29477 {
return visit_begin(
static_cast<type_base*
>(t));}
29480 ir_node_visitor::visit_end(qualified_type_def* t)
29481 {
return visit_end(
static_cast<type_base*
>(t));}
29484 ir_node_visitor::visit_begin(pointer_type_def* t)
29485 {
return visit_begin(
static_cast<type_base*
>(t));}
29488 ir_node_visitor::visit_end(pointer_type_def* t)
29489 {
return visit_end(
static_cast<type_base*
>(t));}
29492 ir_node_visitor::visit_begin(reference_type_def* t)
29493 {
return visit_begin(
static_cast<type_base*
>(t));}
29496 ir_node_visitor::visit_end(reference_type_def* t)
29497 {
return visit_end(
static_cast<type_base*
>(t));}
29500 ir_node_visitor::visit_begin(ptr_to_mbr_type* t)
29501 {
return visit_begin(
static_cast<type_base*
>(t));}
29504 ir_node_visitor::visit_end(ptr_to_mbr_type* t)
29505 {
return visit_end(
static_cast<type_base*
>(t));}
29508 ir_node_visitor::visit_begin(array_type_def* t)
29509 {
return visit_begin(
static_cast<type_base*
>(t));}
29512 ir_node_visitor::visit_end(array_type_def* t)
29513 {
return visit_end(
static_cast<type_base*
>(t));}
29516 ir_node_visitor::visit_begin(array_type_def::subrange_type* t)
29517 {
return visit_begin(
static_cast<type_base*
>(t));}
29520 ir_node_visitor::visit_end(array_type_def::subrange_type* t)
29521 {
return visit_end(
static_cast<type_base*
>(t));}
29524 ir_node_visitor::visit_begin(enum_type_decl* t)
29525 {
return visit_begin(
static_cast<type_base*
>(t));}
29528 ir_node_visitor::visit_end(enum_type_decl* t)
29529 {
return visit_end(
static_cast<type_base*
>(t));}
29532 ir_node_visitor::visit_begin(typedef_decl* t)
29533 {
return visit_begin(
static_cast<type_base*
>(t));}
29536 ir_node_visitor::visit_end(typedef_decl* t)
29537 {
return visit_end(
static_cast<type_base*
>(t));}
29540 ir_node_visitor::visit_begin(function_type* t)
29541 {
return visit_begin(
static_cast<type_base*
>(t));}
29544 ir_node_visitor::visit_end(function_type* t)
29545 {
return visit_end(
static_cast<type_base*
>(t));}
29548 ir_node_visitor::visit_begin(var_decl* d)
29549 {
return visit_begin(
static_cast<decl_base*
>(d));}
29552 ir_node_visitor::visit_end(var_decl* d)
29553 {
return visit_end(
static_cast<decl_base*
>(d));}
29556 ir_node_visitor::visit_begin(function_decl* d)
29557 {
return visit_begin(
static_cast<decl_base*
>(d));}
29560 ir_node_visitor::visit_end(function_decl* d)
29561 {
return visit_end(
static_cast<decl_base*
>(d));}
29564 ir_node_visitor::visit_begin(function_decl::parameter* d)
29565 {
return visit_begin(
static_cast<decl_base*
>(d));}
29568 ir_node_visitor::visit_end(function_decl::parameter* d)
29569 {
return visit_end(
static_cast<decl_base*
>(d));}
29572 ir_node_visitor::visit_begin(function_tdecl* d)
29573 {
return visit_begin(
static_cast<decl_base*
>(d));}
29576 ir_node_visitor::visit_end(function_tdecl* d)
29577 {
return visit_end(
static_cast<decl_base*
>(d));}
29580 ir_node_visitor::visit_begin(class_tdecl* d)
29581 {
return visit_begin(
static_cast<decl_base*
>(d));}
29584 ir_node_visitor::visit_end(class_tdecl* d)
29585 {
return visit_end(
static_cast<decl_base*
>(d));}
29588 ir_node_visitor::visit_begin(class_or_union* t)
29589 {
return visit_begin(
static_cast<type_base*
>(t));}
29592 ir_node_visitor::visit_end(class_or_union* t)
29593 {
return visit_end(
static_cast<type_base*
>(t));}
29596 ir_node_visitor::visit_begin(class_decl* t)
29597 {
return visit_begin(
static_cast<type_base*
>(t));}
29600 ir_node_visitor::visit_end(class_decl* t)
29601 {
return visit_end(
static_cast<type_base*
>(t));}
29604 ir_node_visitor::visit_begin(union_decl* t)
29605 {
return visit_begin(
static_cast<type_base*
>(t));}
29608 ir_node_visitor::visit_end(union_decl* t)
29609 {
return visit_end(
static_cast<type_base*
>(t));}
29612 ir_node_visitor::visit_begin(class_decl::base_spec* d)
29613 {
return visit_begin(
static_cast<decl_base*
>(d));}
29616 ir_node_visitor::visit_end(class_decl::base_spec* d)
29617 {
return visit_end(
static_cast<decl_base*
>(d));}
29620 ir_node_visitor::visit_begin(member_function_template* d)
29621 {
return visit_begin(
static_cast<decl_base*
>(d));}
29624 ir_node_visitor::visit_end(member_function_template* d)
29625 {
return visit_end(
static_cast<decl_base*
>(d));}
29628 ir_node_visitor::visit_begin(member_class_template* d)
29629 {
return visit_begin(
static_cast<decl_base*
>(d));}
29632 ir_node_visitor::visit_end(member_class_template* d)
29633 {
return visit_end(
static_cast<decl_base*
>(d));}
29645 static __thread
size_t counter;
29647 std::ostringstream o;
29654 typedef unordered_map<
const function_decl*, string,
29655 function_decl::hash,
29674 static const string&
29678 fns_to_str_map_type::const_iterator i = m.find(fn);
29681 string s = get_next_string();
29702 fns_to_str(vector<function_decl*>::const_iterator begin,
29703 vector<function_decl*>::const_iterator end,
29707 vector<function_decl*>::const_iterator i;
29708 for (i = begin; i != end; ++i)
29709 o <<
"'" << fn_to_str(*i, m) <<
"' ";
29735 fns_to_str(vector<function_decl*>::const_iterator a_begin,
29736 vector<function_decl*>::const_iterator a_end,
29737 vector<function_decl*>::const_iterator b_begin,
29738 vector<function_decl*>::const_iterator b_end,
29742 fns_to_str(a_begin, a_end, m, o);
29744 fns_to_str(b_begin, b_end, m, o);
29768 fns_to_str(vector<function_decl*>::const_iterator a_begin,
29769 vector<function_decl*>::const_iterator a_end,
29770 vector<function_decl*>::const_iterator b_begin,
29771 vector<function_decl*>::const_iterator b_end,
29775 fns_to_str(a_begin, a_end, b_begin, b_end, m, o);
29797 std::string parent_qualified_name;
29806 if (!d->priv_->qualified_parent_name_.empty())
29812 d->priv_->qualified_name_ =
29813 env.
intern(d->priv_->qualified_parent_name_ +
"::" + d->
get_name());
29818 if (d->priv_->scoped_name_.empty())
29823 d->priv_->scoped_name_ =
29826 d->priv_->scoped_name_ =
29844 {
return do_update(d);}
29856 return do_update(d);
This header declares filters for the diff trees resulting from comparing ABI Corpora.
The private data and functions of the abigail::ir::corpus type.
#define ABG_RETURN_FALSE
A macro used to return the "false" boolean from DIE comparison routines.
#define ABG_RETURN(value)
A macro used to return from DIE comparison routines.
#define ABG_ASSERT(cond)
This is a wrapper around the 'assert' glibc call. It allows for its argument to have side effects,...
Declaration of types pertaining to the interned string pool used throughout Libabigail,...
This contains the private implementation of the suppression engine of libabigail.
#define CACHE_COMPARISON_RESULT_AND_RETURN(value)
Cache the result of a comparison between too artifacts (l & r) and return immediately.
#define RETURN_TRUE_IF_COMPARISON_CYCLE_DETECTED(l, r)
This macro is to be used while comparing composite types that might recursively refer to themselves....
Types of the main internal representation of libabigail.
Wrappers around regex types and functions.
This type abstracts the configuration information of the library.
bool has_string(const char *s) const
Test if the interned string pool already contains a string with a given value.
const char * get_string(const char *s) const
Get a pointer to the interned string which has a given value.
interned_string create_string(const std::string &)
Create an interned string with a given value.
interned_string_pool()
Default constructor.
~interned_string_pool()
Destructor.
The abstraction of an interned string.
bool empty() const
Test if the current instance of interned_string is empty.
This class is to hold the value of the bound of a subrange. The value can be either signed or unsigne...
void set_signed(int64_t v)
Setter of the bound value as signed.
void set_signedness(enum signedness s)
Setter of the signedness (unsigned VS signed) of the bound value.
enum signedness get_signedness() const
Getter of the signedness (unsigned VS signed) of the bound value.
int64_t get_signed_value() const
Getter of the bound value as a signed value.
bool operator==(const bound_value &) const
Equality operator of the bound value.
uint64_t get_unsigned_value()
Getter of the bound value as an unsigned value.
bound_value()
Default constructor of the array_type_def::subrange_type::bound_value class.
void set_unsigned(uint64_t v)
Setter of the bound value as unsigned.
Abstraction for an array range type, like in Ada, or just for an array dimension like in C or C++.
void set_lower_bound(int64_t lb)
Setter of the lower bound.
bool is_non_finite() const
Test if the length of the subrange type is infinite.
void set_upper_bound(int64_t ub)
Setter of the upper bound of the subrange type.
void set_underlying_type(const type_base_sptr &)
Setter of the underlying type of the subrange, that is, the type that defines the range.
string as_string() const
Return a string representation of the sub range.
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
bool operator!=(const decl_base &o) const
Equality operator.
int64_t get_upper_bound() const
Getter of the upper bound of the subrange type.
type_base_sptr get_underlying_type() const
Getter of the underlying type of the subrange, that is, the type that defines the range.
virtual bool operator==(const decl_base &) const
Equality operator.
int64_t get_lower_bound() const
Getter of the lower bound of the subrange type.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Build a pretty representation for an array_type_def::subrange_type.
static string vector_as_string(const vector< subrange_sptr > &)
Return a string representation of a vector of subranges.
uint64_t get_length() const
Getter of the length of the subrange type.
translation_unit::language get_language() const
Getter of the language that generated this type.
The abstraction of an array type.
virtual bool is_non_finite() const
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Build and return the qualified name of the current instance of the array_type_def.
const type_base_sptr get_element_type() const
Getter of the type of an array element.
void set_element_type(const type_base_sptr &element_type)
Setter of the type of array element.
shared_ptr< subrange_type > subrange_sptr
Convenience typedef for a shared pointer on a function_decl::subrange.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
const std::vector< subrange_sptr > & get_subranges() const
Get the array's subranges.
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
std::vector< subrange_sptr > subranges_type
Convenience typedef for a vector of subrange_sptr.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representation of the current instance of array_type_def.
translation_unit::language get_language() const
Get the language of the array.
virtual void append_subranges(const std::vector< subrange_sptr > &subs)
Append subranges from the vector.
Abstraction of a base specifier in a class declaration.
class_decl_sptr get_base_class() const
Get the base class referred to by the current base class specifier.
bool get_is_virtual() const
Getter of the "is-virtual" proprerty of the base class specifier.
long get_offset_in_bits() const
Getter of the offset of the base.
virtual bool traverse(ir_node_visitor &)
Traverses an instance of class_decl::base_spec, visiting all the sub-types and decls that it might co...
virtual bool operator==(const decl_base &) const
Comparison operator for class_decl::base_spec.
virtual size_t get_hash() const
Calculate the hash value for a class_decl::base_spec.
Abstracts a class declaration.
void is_struct(bool f)
Set the "is-struct" flag of the class.
bool has_virtual_member_functions() const
Test if the current instance of class_decl has virtual member functions.
const virtual_mem_fn_map_type & get_virtual_mem_fns_map() const
Get the map that associates a virtual table offset to the virtual member functions with that virtual ...
bool is_struct() const
Test if the class is a struct.
const base_specs & get_base_specifiers() const
Get the base specifiers for this class.
virtual ~class_decl()
Destructor of the class_decl type.
virtual void on_canonical_type_set()
This method is invoked automatically right after the current instance of class_decl has been canonica...
bool has_vtable() const
Test if the current instance has a vtable.
ssize_t get_biggest_vtable_offset() const
Get the highest vtable offset of all the virtual methods of the class.
bool has_virtual_bases() const
Test if the current instance of class_decl has at least one virtual base.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
shared_ptr< base_spec > base_spec_sptr
Convenience typedef.
void add_base_specifier(shared_ptr< base_spec > b)
Add a base specifier to this class.
const member_functions & get_virtual_mem_fns() const
Get the virtual member functions of this class.
void sort_virtual_mem_fns()
Sort the virtual member functions by their virtual index.
friend bool equals(const class_decl &, const class_decl &, change_kind *)
Compares two instances of class_decl.
virtual bool operator==(const decl_base &) const
Comparison operator for class_decl.
bool has_no_base_nor_member() const
Return true iff the class has no entity in its scope.
virtual size_t get_hash() const
Return the hash value for the current instance.
class_decl_sptr find_base_class(const string &) const
Find a base class of a given qualified name for the current class.
vector< base_spec_sptr > base_specs
Convenience typedef.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Getter of the pretty representation of the current instance of class_decl.
The base type of class_decl and union_decl.
virtual size_t get_num_anonymous_member_classes() const
Get the number of anonymous member classes contained in this class.
void add_member_function(method_decl_sptr f, access_specifier a, bool is_static, bool is_ctor, bool is_dtor, bool is_const)
Add a member function.
const var_decl_sptr find_anonymous_data_member(const var_decl_sptr &) const
Find an anonymous data member in the class.
const member_functions & get_member_functions() const
Get the member functions of this class_or_union.
virtual void remove_member_decl(decl_base_sptr)
Remove a given decl from the current class_or_union scope.
const member_function_templates & get_member_function_templates() const
Get the member function templates of this class.
virtual size_t get_size_in_bits() const
Getter of the size of the class_or_union type.
virtual size_t get_num_anonymous_member_unions() const
Get the number of anonymous member unions contained in this class.
void add_member_function_template(member_function_template_sptr)
Append a member function template to the class_or_union.
unordered_map< ssize_t, member_functions > virtual_mem_fn_map_type
Convenience typedef.
vector< method_decl_sptr > member_functions
Convenience typedef.
const data_members & get_data_members() const
Get the data members of this class_or_union.
void add_data_member(var_decl_sptr v, access_specifier a, bool is_laid_out, bool is_static, size_t offset_in_bits)
Add a data member to the current instance of class_or_union.
const method_decl * find_member_function_from_signature(const string &s) const
Find a method (member function) using its signature (pretty representation) as a key.
method_decl_sptr find_member_function_sptr(const string &mangled_name)
Find a method, using its linkage name as a key.
virtual void set_size_in_bits(size_t)
Setter of the size of the class_or_union type.
decl_base_sptr insert_member_decl(decl_base_sptr member)
Insert a data member to this class_or_union type.
virtual decl_base_sptr add_member_decl(const decl_base_sptr &)
Add a member declaration to the current instance of class_or_union. The member declaration can be eit...
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
void add_member_class_template(member_class_template_sptr m)
Append a member class template to the class_or_union.
const data_members & get_non_static_data_members() const
Get the non-static data memebers of this class_or_union.
const method_decl * find_member_function(const string &mangled_name) const
Find a method, using its linkage name as a key.
void maybe_fixup_members_of_anon_data_member(var_decl_sptr &anon_dm)
Fixup the members of the type of an anonymous data member.
vector< var_decl_sptr > data_members
Convenience typedef.
virtual ~class_or_union()
Destrcutor of the class_or_union type.
bool has_no_member() const
virtual bool operator==(const decl_base &) const
Equality operator.
friend void set_member_is_static(decl_base &d, bool s)
Sets the static-ness property of a class member.
virtual size_t get_alignment_in_bits() const
Getter of the alignment of the class_or_union type.
const member_class_templates & get_member_class_templates() const
Get the member class templates of this class.
virtual void set_alignment_in_bits(size_t)
Setter of the alignment of the class type.
vector< type_base_sptr > member_types
Convenience typedef.
virtual size_t get_num_anonymous_member_enums() const
Get the number of anonymous member enums contained in this class.
const var_decl_sptr find_data_member(const string &) const
Find a data member of a given name in the current class_or_union.
Abstract a class template.
shared_ptr< class_decl > get_pattern() const
Getter of the pattern of the template.
void set_pattern(class_decl_sptr p)
Setter of the pattern of the template.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
virtual bool operator==(const decl_base &) const
Return true iff both scopes have the same names and have the same member decls.
The abstraction of the relationship between an entity and its containing scope (its context)....
This is the abstraction of a set of translation units (themselves seen as bundles of unitary abi arte...
shared_ptr< exported_decls_builder > exported_decls_builder_sptr
Convenience typedef for shared_ptr<exported_decls_builder>.
const translation_units & get_translation_units() const
Return the list of translation units of the current corpus.
type_maps & get_types()
Get the maps that associate a name to a certain kind of type.
type_maps & get_type_per_loc_map()
Get the maps that associate a location string to a certain kind of type.
const corpus_group * get_group() const
Getter of the group this corpus is a member of.
const environment & get_environment() const
Getter of the enviroment of the corpus.
The base type of all declarations.
void set_definition_of_declaration(const decl_base_sptr &)
Set the definition of this declaration-only decl_base.
void set_is_declaration_only(bool f)
Set a flag saying if the enum_type_decl is a declaration-only enum_type_decl.
virtual bool operator!=(const decl_base &) const
Inequality operator.
scope_decl * get_scope() const
Return the type containing the current decl, if any.
void set_qualified_name(const interned_string &) const
Setter for the qualified name.
void set_is_in_public_symbol_table(bool)
Set the flag saying if this decl is from a symbol that is in a public symbols table,...
friend bool get_member_is_static(const decl_base &d)
Gets a flag saying if a class member is static or not.
const decl_base_sptr get_earlier_declaration() const
If this decl_base is a definition, get its earlier declaration.
virtual void set_linkage_name(const string &m)
Setter for the linkage name.
const decl_base * get_naked_definition_of_declaration() const
If this decl_base is declaration-only, get its definition, if any.
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the decl.
void clear_qualified_name()
Clear the qualified name of this decl.
void set_name(const string &n)
Setter for the name of the decl.
const location & get_location() const
Get the location of a given declaration.
typedef_decl_sptr get_naming_typedef() const
Getter for the naming typedef of the current decl.
const interned_string & get_name() const
Getter for the name of the current decl.
virtual void set_scope(scope_decl *)
Setter of the scope of the current decl.
const interned_string & peek_qualified_name() const
Getter for the qualified name.
const context_rel * get_context_rel() const
Getter for the context relationship.
friend void set_member_function_is_virtual(function_decl &, bool)
Set the virtual-ness of a member function.
bool get_is_anonymous() const
Test if the current declaration is anonymous.
friend decl_base_sptr add_decl_to_scope(decl_base_sptr decl, scope_decl *scpe)
Appends a declaration to a given scope, if the declaration doesn't already belong to one and if the d...
virtual const interned_string & get_scoped_name() const
Return the scoped name of the decl.
const decl_base_sptr get_definition_of_declaration() const
If this decl_base is declaration-only, get its definition, if any.
friend void set_member_access_specifier(decl_base &d, access_specifier a)
Sets the access specifier for a class member.
void set_naming_typedef(const typedef_decl_sptr &)
Set the naming typedef of the current instance of decl_base.
void set_location(const location &l)
Set the location for a given declaration.
void set_is_anonymous(bool)
Set the "is_anonymous" flag of the current declaration.
void set_visibility(visibility v)
Setter for the visibility of the decl.
void set_temporary_qualified_name(const interned_string &) const
Setter for the temporary qualified name of the current declaration.
visibility get_visibility() const
Getter for the visibility of the decl.
visibility
ELF visibility.
bool get_is_declaration_only() const
Test if a decl_base is a declaration-only decl.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
void set_earlier_declaration(const decl_base_sptr &)
set the earlier declaration of this decl_base definition.
const interned_string & get_linkage_name() const
Getter for the mangled name.
friend enum access_specifier get_member_access_specifier(const decl_base &d)
Gets the access specifier for a class member.
friend bool get_member_function_is_virtual(const function_decl &f)
Test if a given member function is virtual.
virtual ~decl_base()
Destructor of the decl_base type.
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
const interned_string & get_qualified_parent_name() const
Return a copy of the qualified name of the parent of the current decl.
bool get_is_anonymous_or_has_anonymous_parent() const
bool get_has_anonymous_parent() const
Get the "has_anonymous_parent" flag of the current declaration.
bool get_is_in_public_symbol_table() const
Test if the decl is defined in a ELF symbol table as a public symbol.
friend bool equals(const decl_base &, const decl_base &, change_kind *)
Compares two instances of decl_base.
virtual size_t get_hash() const
Get the hash of a decl. If the hash hasn't been computed yet, compute it ans store its value; otherwi...
const interned_string & peek_temporary_qualified_name() const
Getter of the temporary qualified name of the current declaration.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representatin of the current declaration.
The abstraction for a data member context relationship. This relates a data member to its parent clas...
const var_decl * get_anonymous_data_member() const
Return a non-nil value if this data member context relationship has an anonymous data member....
void set_anonymous_data_member(var_decl *)
Set the containing anonymous data member of this data member context relationship....
The abstraction of the version of an ELF symbol.
version & operator=(const version &o)
Assign a version to the current one.
bool operator==(const version &o) const
Compares the current version against another one.
bool is_default() const
Getter for the 'is_default' property of the version.
const string & str() const
Getter for the version name.
bool operator!=(const version &o) const
Inequality operator.
Abstraction of an elf symbol.
const abg_compat::optional< std::string > & get_namespace() const
Getter of the 'namespace' property.
elf_symbol_sptr get_alias_which_equals(const elf_symbol &other) const
In the list of aliases of a given elf symbol, get the alias that equals this current symbol.
elf_symbol_sptr get_next_common_instance() const
Get the next common instance of the current common symbol.
type get_type() const
Getter for the type of the current instance of elf_symbol.
const elf_symbol_sptr get_main_symbol() const
Get the main symbol of an alias chain.
void set_is_in_ksymtab(bool is_in_ksymtab)
Setter of the 'is-in-ksymtab' property.
bool has_aliases() const
Check if the current elf_symbol has an alias.
void set_name(const string &n)
Setter for the name of the current intance of elf_symbol.
bool is_suppressed() const
Getter for the 'is-suppressed' property.
binding
The binding of a symbol.
int get_number_of_aliases() const
Get the number of aliases to this elf symbol.
string get_aliases_id_string(const string_elf_symbols_map_type &symtab, bool include_symbol_itself=true) const
Return a comma separated list of the id of the current symbol as well as the id string of its aliases...
void set_binding(binding b)
Setter for the binding of the current instance of elf_symbol.
void add_common_instance(const elf_symbol_sptr &)
Add a common instance to the current common elf symbol.
void add_alias(const elf_symbol_sptr &)
Add an alias to the current elf symbol.
void set_is_suppressed(bool is_suppressed)
Setter for the 'is-suppressed' property.
bool is_variable() const
Test if the current instance of elf_symbol is a variable symbol or not.
elf_symbol_sptr update_main_symbol(const std::string &)
Update the main symbol for a group of aliased symbols.
void set_size(size_t)
Setter of the size of the symbol.
const string & get_name() const
Getter for the name of the elf_symbol.
binding get_binding() const
Getter for the binding of the current instance of elf_symbol.
static bool get_name_and_version_from_id(const string &id, string &name, string &ver)
Given the ID of a symbol, get the name and the version of said 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.
void set_version(const version &v)
Setter for the version of the current instance of elf_symbol.
const abg_compat::optional< uint32_t > & get_crc() const
Getter of the 'crc' property.
void set_visibility(visibility v)
Setter of the visibility of the current instance of elf_symbol.
bool does_alias(const elf_symbol &) const
Test if the current symbol aliases another one.
bool is_main_symbol() const
Tests whether this symbol is the main symbol.
void set_crc(const abg_compat::optional< uint32_t > &crc)
Setter of the 'crc' property.
static elf_symbol_sptr create(const environment &e, size_t i, size_t s, const string &n, type t, binding b, bool d, bool c, const version &ve, visibility vi, bool is_in_ksymtab=false, const abg_compat::optional< uint32_t > &crc={}, const abg_compat::optional< std::string > &ns={}, bool is_suppressed=false)
Factory of instances of elf_symbol.
visibility
The visibility of the symbol.
version & get_version() const
Getter for the version of the current instanc of elf_symbol.
bool is_common_symbol() const
Return true if the symbol is a common one.
void set_index(size_t)
Setter for the index.
visibility get_visibility() const
Getter of the visibility of the current instance of elf_symbol.
bool has_other_common_instances() const
Return true if this common common symbol has other common instances.
size_t get_index() const
Getter for the index.
const string & get_id_string() const
Get a string that is representative of a given elf_symbol.
elf_symbol_sptr get_alias_from_name(const string &name) const
From the aliases of the current symbol, lookup one with a given name.
const environment & get_environment() const
Getter of the environment used by the current instance of elf_symbol.
void set_type(type t)
Setter for the type of the current instance of elf_symbol.
bool is_public() const
Test if the current instance of elf_symbol is public or not.
bool is_in_ksymtab() const
Getter of the 'is-in-ksymtab' property.
size_t get_size() const
Getter of the size of the symbol.
bool is_defined() const
Test if the current instance of elf_symbol is defined or not.
void set_namespace(const abg_compat::optional< std::string > &ns)
Setter of the 'namespace' property.
elf_symbol_sptr get_next_alias() const
Get the next alias of the current symbol.
bool operator==(const elf_symbol &) const
Test if two main symbols are textually equal, or, if they have aliases that are textually equal.
The abstraction of an enumerator.
enumerator()
Default constructor of the enum_type_decl::enumerator type.
bool operator!=(const enumerator &other) const
Inequality operator.
void set_name(const string &n)
Setter for the name of enum_type_decl::enumerator.
enum_type_decl * get_enum_type() const
Getter for the enum type that this enumerator is for.
const string & get_name() const
Getter for the name of the current instance of enum_type_decl::enumerator.
void set_enum_type(enum_type_decl *)
Setter for the enum type that this enumerator is for.
void set_value(int64_t v)
Setter for the value of enum_type_decl::enumerator.
const string & get_qualified_name(bool internal=false) const
Getter for the qualified name of the current instance of enum_type_decl::enumerator....
int64_t get_value() const
Getter for the value of enum_type_decl::enumerator.
bool operator==(const enumerator &other) const
Equality operator.
enumerator & operator=(const enumerator &)
Assignment operator of the enum_type_decl::enumerator type.
Abstracts a declaration for an enum type.
std::vector< enumerator > enumerators
Convenience typedef for a list of enumerator.
virtual ~enum_type_decl()
Destructor for the enum type declaration.
const enumerators & get_enumerators() const
const enumerators & get_sorted_enumerators() const
Get the lexicographically sorted vector of enumerators.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
type_base_sptr get_underlying_type() const
Return the underlying type of the enum.
virtual bool operator==(const decl_base &) const
Equality operator.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representation of the current instance of enum_type_decl.
This is an abstraction of the set of resources necessary to manage several aspects of the internal re...
bool decl_only_class_equals_definition() const
Getter of the "decl-only-class-equals-definition" flag.
bool is_void_pointer_type(const type_base_sptr &) const
Test if a given type is the same as the void pointer type of the environment.
std::unordered_map< string, std::vector< type_base_sptr > > canonical_types_map_type
A convenience typedef for a map of canonical types. The key is the pretty representation string of a ...
bool user_set_analyze_exported_interfaces_only() const
Getter for a property that says if the user actually did set the analyze_exported_interfaces_only() p...
const type_base_sptr & get_void_type() const
Get the unique type_decl that represents a "void" type for the current environment....
bool is_variadic_parameter_type(const type_base *) const
Test if a type is a variadic parameter type as defined in the current environment.
static string & get_variadic_parameter_type_name()
Getter of the name of the variadic parameter type.
const type_base_sptr & get_void_pointer_type() const
Getter of the "pointer-to-void" IR node that is shared across the ABI corpus. This node must be the o...
const config & get_config() const
Getter of the general configuration object.
environment()
Default constructor of the environment type.
vector< type_base_sptr > * get_canonical_types(const char *name)
Get the vector of canonical types which have a given "string representation".
bool canonicalization_is_done() const
Test if the canonicalization of types created out of the current environment is done.
type_base * get_canonical_type(const char *name, unsigned index)
Get a given canonical type which has a given "string representation".
const type_base_sptr & get_variadic_parameter_type() const
Get a type_decl instance that represents a the type of a variadic function parameter....
bool is_void_type(const type_base_sptr &) const
Test if a given type is a void type as defined in the current environment.
virtual ~environment()
Destructor for the environment type.
interned_string intern(const string &) const
Do intern a string.
bool do_on_the_fly_canonicalization() const
Getter for the "on-the-fly-canonicalization" flag.
bool analyze_exported_interfaces_only() const
Getter for the property that controls if we are to restrict the analysis to the types that are only r...
canonical_types_map_type & get_canonical_types_map()
Getter the map of canonical types.
Abstraction of a function parameter.
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the parameter.
interned_string get_type_name() const
interned_string get_name_id() const
Get a name uniquely identifying the parameter in the function.
const string get_type_pretty_representation() const
virtual bool traverse(ir_node_visitor &v)
Traverse the diff sub-tree under the current instance function_decl.
virtual size_t get_hash() const
Get the hash of a decl. If the hash hasn't been computed yet, compute it ans store its value; otherwi...
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Compute and return a copy of the pretty representation of the current function parameter.
Abstraction for a function declaration.
shared_ptr< parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
string get_pretty_representation_of_declarator(bool internal=false) const
Compute and return the pretty representation for the part of the function declaration that starts at ...
const function_type * get_naked_type() const
Fast getter of the type of the current instance of function_decl.
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
void append_parameters(std::vector< parameter_sptr > &parms)
Append a vector of parameters to the type of this function.
bool is_variadic() const
Return true iff the function takes a variable number of parameters.
parameters::const_iterator get_first_non_implicit_parm() const
Getter for the first non-implicit parameter of a function decl.
const function_type_sptr get_type() const
Return the type of the current instance of function_decl.
function_decl(const string &name, function_type_sptr function_type, bool declared_inline, const location &locus, const string &mangled_name, visibility vis, binding bind)
Constructor of the function_decl.
const type_base_sptr get_return_type() const
function_decl_sptr clone() const
Create a new instance of function_decl that is a clone of the current one.
const std::vector< parameter_sptr > & get_parameters() const
void append_parameter(parameter_sptr parm)
Append a parameter to the type of this function.
void set_symbol(const elf_symbol_sptr &sym)
This sets the underlying ELF symbol for the current function decl.
virtual ~function_decl()
Destructor of the function_decl type.
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...
virtual bool operator==(const decl_base &o) const
Comparison operator for function_decl.
std::vector< parameter_sptr > parameters
Convenience typedef for a vector of parameter_sptr.
virtual size_t get_hash() const
The virtual implementation of 'get_hash' for a function_decl.
bool is_declared_inline() const
Test if the function was declared inline.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representation of the current instance of function_decl.
interned_string get_id() const
Return an ID that tries to uniquely identify the function inside a program or a library.
Abstract a function template declaration.
binding get_binding() const
Get the binding of the function template.
void set_pattern(shared_ptr< function_decl > p)
Set a new pattern to the function template.
shared_ptr< function_decl > get_pattern() const
Get the pattern of the function template.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
virtual bool operator==(const decl_base &) const
Comparison operator for the function_tdecl type.
Abstraction of a function type.
shared_ptr< function_decl::parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
virtual bool traverse(ir_node_visitor &)
Traverses an instance of function_type, visiting all the sub-types and decls that it might contain.
bool is_variadic() const
Test if the current instance of function_type is for a variadic function.
parameters::const_iterator get_first_parm() const
Get the first parameter of the function.
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
virtual bool operator==(const type_base &) const
Equality operator for function_type.
void append_parameter(parameter_sptr parm)
Append a new parameter to the vector of parameters of the current instance of function_type.
void set_parameters(const parameters &p)
Setter for the parameters of the current instance of function_type.
const interned_string & get_cached_name(bool internal=false) const
Get the name of the current function_type.
const parameter_sptr get_parm_at_index_from_first_non_implicit_parm(size_t) const
Get the Ith parameter of the vector of parameters of the current instance of function_type.
type_base_sptr get_return_type() const
Getter for the return type of the current instance of function_type.
void set_return_type(type_base_sptr t)
Setter of the return type of the current instance of function_type.
parameters::const_iterator get_first_non_implicit_parm() const
Get the first parameter of the function.
const parameters & get_parameters() const
Getter for the set of parameters of the current intance of function_type.
std::vector< parameter_sptr > parameters
Convenience typedef for a vector of parameter_sptr.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Return a copy of the pretty representation of the current function_type.
This abstracts the global scope of a given translation unit.
The internal representation of an integral type.
void set_modifiers(modifiers_type)
Setter of the modifiers bitmap of the integral_type.
string to_string(bool internal=false) const
Return the string representation of the current instance of integral_type.
base_type get_base_type() const
Getter of the base type of the integral_type.
modifiers_type
The modifiers of the base types above. Several modifiers can be combined for a given base type....
@ LONG_LONG_MODIFIER
The "long long" modifier.
@ LONG_MODIFIER
The "long" modifier.
@ SIGNED_MODIFIER
The "signed" modifier.
@ UNSIGNED_MODIFIER
The "unsigned" modier.
@ SHORT_MODIFIER
The "short" modifier.
bool operator==(const integral_type &) const
Equality operator for the integral_type.
base_type
The possible base types of integral types. We might have forgotten many of these, so do not hesitate ...
@ WCHAR_T_BASE_TYPE
The "wchar_t" base type.
@ CHAR32_T_BASE_TYPE
The "char32_t" base type.
@ FLOAT_BASE_TYPE
The "float" base type.
@ BOOL_BASE_TYPE
The "bool" base type in C++ or "_Bool" in C11.
@ CHAR_BASE_TYPE
The "char" base type.
@ CHAR16_T_BASE_TYPE
The "char16_t base type.
@ INT_BASE_TYPE
The "int" base type.
@ DOUBLE_BASE_TYPE
The "double" base type.
modifiers_type get_modifiers() const
Getter of the modifiers bitmap of the integral_type.
integral_type()
Default constructor of the integral_type.
The base class for the visitor type hierarchy used for traversing a translation unit.
bool allow_visiting_already_visited_type_node() const
Get if the walker using this visitor is allowed to re-visit a type node that was previously visited o...
bool type_node_has_been_visited(type_base *) const
Test if a given type node has been marked as visited.
void forget_visited_type_nodes()
Un-mark all visited type nodes.
ir_node_visitor()
Default Constructor of the ir_node_visitor type.
void mark_type_node_as_visited(type_base *)
Mark a given type node as having been visited.
The entry point to manage locations.
location create_new_location(const std::string &fle, size_t lne, size_t col)
Insert the triplet representing a source locus into our internal vector of location triplet....
void expand_location(const location &location, std::string &path, unsigned &line, unsigned &column) const
Given an instance of location type, return the triplet {path,line,column} that represents the source ...
The source location of a token.
bool get_is_artificial() const
Test if the location is artificial.
unsigned get_value() const
Get the value of the location.
string expand(void) const
Expand the location into a string.
void expand(std::string &path, unsigned &line, unsigned &column) const
Expand the current location into a tripplet file path, line and column number.
Abstraction of a member function context relationship. This relates a member function to its parent c...
bool is_constructor() const
Getter for the 'is-constructor' property.
bool is_const() const
Getter for the 'is-const' property.
size_t vtable_offset() const
Getter for the vtable offset property.
bool is_destructor() const
Getter for the 'is-destructor' property.
The base class for member types, data members and member functions. Its purpose is mainly to carry th...
access_specifier get_access_specifier() const
Getter for the access specifier of this member.
bool get_is_static() const
Abstracts a member class template template.
virtual bool operator==(const member_base &o) const
Equality operator of the the member_class_template class.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Abstract a member function template.
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Abstraction of the declaration of a method.
friend void set_member_function_is_const(function_decl &, bool)
set the const-ness property of a member function.
virtual void set_linkage_name(const string &)
Set the linkage name of the method.
const method_type_sptr get_type() const
Abstracts the type of a class member function.
void set_class_type(const class_or_union_sptr &t)
Sets the class type of the current instance of method_type.
void set_is_const(bool)
Setter of the "is-const" property of method_type.
virtual ~method_type()
The destructor of method_type.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Return a copy of the pretty representation of the current method_type.
class_or_union_sptr get_class_type() const
Get the class type this method belongs to.
bool get_is_const() const
Getter of the "is-const" property of method_type.
The abstraction of a namespace declaration.
bool is_empty_or_has_empty_sub_namespaces() const
Test if the current namespace_decl is empty or contains empty namespaces itself.
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
namespace_decl(const environment &env, const string &name, const location &locus, visibility vis=VISIBILITY_DEFAULT)
Constructor.
virtual bool operator==(const decl_base &) const
Return true iff both namespaces and their members are equal.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Build and return a copy of the pretty representation of the namespace.
Abstracts non type template parameters.
const type_base_sptr get_type() const
Getter for the type of the template parameter.
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
virtual size_t get_hash() const
Get the hash value of the current instance.
The abstraction of a pointer type.
void set_pointed_to_type(const type_base_sptr &)
Set the pointed-to type of the pointer.
virtual void get_qualified_name(interned_string &, bool internal=false) const
Build and return the qualified name of the current instance of pointer_type_def.
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
virtual bool operator==(const decl_base &) const
Return true iff both instances of pointer_type_def are equal.
const type_base_sptr get_pointed_to_type() const
Getter of the pointed-to type.
type_base * get_naked_pointed_to_type() const
Getter of a naked pointer to the pointed-to type.
The abstraction of a pointer-to-member type.
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Get the qualified name for the current ptr_to_mbr_type.
const type_base_sptr & get_containing_type() const
Getter of the type containing the member pointed-to by the current ptr_to_mbr_type.
bool operator==(const ptr_to_mbr_type &) const
Equality operator for the current ptr_to_mbr_type.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function for ptr_to_mbr_type.
const type_base_sptr & get_member_type() const
Getter of the member type of the current ptr_to_mbr_type.
virtual ~ptr_to_mbr_type()
Desctructor for ptr_to_mbr_type.
The abstraction of a qualified type.
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Implementation for the virtual qualified name builder for qualified_type_def.
void set_underlying_type(const type_base_sptr &)
Setter of the underlying type.
virtual size_t get_size_in_bits() const
Get the size of the qualified type def.
string get_cv_quals_string_prefix() const
Compute and return the string prefix or suffix representing the qualifiers hold by the current instan...
CV
Bit field values representing the cv qualifiers of the underlying type.
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
void set_cv_quals(CV cv_quals)
Setter of the const/value qualifiers bit field.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
CV get_cv_quals() const
Getter of the const/volatile qualifier bit field.
type_base_sptr get_underlying_type() const
Getter of the underlying type.
virtual bool operator==(const decl_base &) const
Equality operator for qualified types.
string build_name(bool, bool internal=false) const
Build the name of the current instance of qualified type.
Abstracts a reference type.
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Build and return the qualified name of the current instance of the reference_type_def.
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
void set_pointed_to_type(type_base_sptr &pointed_to_type)
Setter of the pointed_to type of the current reference type.
virtual bool operator==(const decl_base &) const
Equality operator of the reference_type_def type.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representation of the current instance of reference_type_def.
A declaration that introduces a scope.
virtual size_t get_num_anonymous_member_classes() const
Getter for the number of anonymous classes contained in this scope.
void remove_member_type(type_base_sptr t)
Remove a member type from the current class_or_union scope.
void insert_member_type(type_base_sptr t, declarations::iterator before)
Insert a member type.
void add_member_type(type_base_sptr t)
Add a member type to the current instance of class_or_union.
virtual size_t get_num_anonymous_member_unions() const
Getter for the number of anonymous unions contained in this scope.
scopes & get_member_scopes()
Getter for the scopes carried by the current scope.
std::vector< scope_decl_sptr > scopes
Convenience typedef for a vector of scope_decl_sptr.
bool is_empty() const
Test if the current scope is empty.
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
const type_base_sptrs_type & get_member_types() const
Get the member types of this scope_decl.
decl_base_sptr insert_member_decl(decl_base_sptr member, declarations::iterator before)
Insert a member decl to this scope, right before an element pointed to by a given iterator....
std::vector< decl_base_sptr > declarations
Convenience typedef for a vector of decl_base_sptr.
const type_base_sptrs_type & get_sorted_canonical_types() const
Return a vector of sorted canonical types of the current scope.
bool find_iterator_for_member(const decl_base *, declarations::iterator &)
Find a member of the current scope and return an iterator on it.
virtual void remove_member_decl(decl_base_sptr member)
Remove a declaration from the current scope.
virtual decl_base_sptr add_member_decl(const decl_base_sptr &member)
Add a member decl to this scope. Note that user code should not use this, but rather use add_decl_to_...
type_base_sptr find_member_type(const string &name) const
Find a member type of a given name, inside the current scope_decl.
const declarations & get_member_decls() const
Getter for the member declarations carried by the current scope_decl.
const canonical_type_sptr_set_type & get_canonical_types() const
@eturn the set of canonical types of the the current scope.
const type_base_sptrs_type & get_sorted_member_types() const
Get the sorted member types of this scope_decl.
friend decl_base_sptr add_decl_to_scope(decl_base_sptr decl, scope_decl *scope)
Appends a declaration to a given scope, if the declaration doesn't already belong to one and if the d...
virtual bool operator==(const decl_base &) const
Return true iff both scopes have the same names and have the same member decls.
const declarations & get_sorted_member_decls() const
Getter for the sorted member declarations carried by the current scope_decl.
virtual size_t get_num_anonymous_member_enums() const
Getter for the number of anonymous enums contained in this scope.
virtual size_t get_hash() const
Return the hash value for the current instance of scope_decl.
A type that introduces a scope.
virtual bool traverse(ir_node_visitor &)
Traverses an instance of scope_type_decl, visiting all the sub-types and decls that it might contain.
virtual bool operator==(const decl_base &) const
Equality operator between two scope_type_decl.
The base class of templates.
const std::list< template_parameter_sptr > & get_template_parameters() const
Get the list of template parameters of the current instance of template_decl.
virtual ~template_decl()
Destructor.
void add_template_parameter(const template_parameter_sptr p)
Add a new template parameter to the current instance of template_decl.
virtual bool operator==(const decl_base &o) const
Equality operator.
Base class for a template parameter. Client code should use the more specialized type_template_parame...
virtual ~template_parameter()
Destructor.
bool operator!=(const template_parameter &) const
Inequality operator.
Abstracts a template template parameter.
virtual bool operator==(const type_base &) const
Equality operator.
This is the abstraction of the set of relevant artefacts (types, variable declarations,...
void set_address_size(char)
Setter of the address size in this translation unit.
const std::string & get_absolute_path() const
Get the concatenation of the build directory and the relative path of the translation unit.
void set_is_constructed(bool)
Setter of the 'is_constructed" flag. It says if the translation unit is fully constructed or not.
bool operator==(const translation_unit &) const
Compare the current translation unit against another one.
const corpus * get_corpus() const
Get the corpus this translation unit is a member of.
char get_address_size() const
Getter of the address size in this translation unit.
const std::string & get_compilation_dir_path() const
Get the path of the directory that was 'current' when the translation unit was compiled.
void set_corpus(corpus *)
Set the corpus this translation unit is a member of.
void set_language(language l)
Setter of the language of the source code of the translation unit.
void bind_function_type_life_time(function_type_sptr) const
Ensure that the life time of a function type is bound to the life time of the current translation uni...
const scope_decl_sptr & get_global_scope() const
Getter of the the global scope of the translation unit.
bool is_empty() const
Tests whether if the current translation unit contains ABI artifacts or not.
bool is_constructed() const
Getter of the 'is_constructed" flag. It says if the translation unit is fully constructed or not.
const std::string & get_path() const
Get the path of the current translation unit.
void set_compilation_dir_path(const std::string &)
Set the path of the directory that was 'current' when the translation unit was compiled.
location_manager & get_loc_mgr()
Getter of the location manager for the current translation unit.
void set_path(const string &)
Set the path associated to the current instance of translation_unit.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse virtual function.
language
The language of the translation unit.
bool operator!=(const translation_unit &) const
Inequality operator.
const vector< function_type_sptr > & get_live_fn_types() const
Get the vector of function types that are used in the current translation unit.
const environment & get_environment() const
Getter of the environment of the current translation_unit.
const type_maps & get_types() const
Getter of the types of the current translation_unit.
language get_language() const
Getter of the language of the source code of the translation unit.
bool visiting() const
This should returns false before and after the node has been visiting. During the visiting of the nod...
An abstraction helper for type declarations.
const interned_string & get_cached_pretty_representation(bool internal=false) const
Get the pretty representation of the current type.
type_base * get_naked_canonical_type() const
Getter of the canonical type pointer.
virtual size_t get_size_in_bits() const
Getter for the size of the type.
virtual bool traverse(ir_node_visitor &)
Default implementation of traversal for types. This function does nothing. It must be implemented by ...
virtual void on_canonical_type_set()
This method is invoked automatically right after the current instance of class_decl has been canonica...
virtual void set_size_in_bits(size_t)
Setter for the size of the type.
virtual bool operator!=(const type_base &) const
Inequality operator.
virtual bool operator==(const type_base &) const
Return true iff both type declarations are equal.
virtual size_t get_alignment_in_bits() const
Getter for the alignment of the type.
virtual void set_alignment_in_bits(size_t)
Setter for the alignment of the type.
type_base_sptr get_canonical_type() const
Getter of the canonical type of the current instance of type_base.
This abstracts a composition of types based on template type parameters. The result of the compositio...
const type_base_sptr get_composed_type() const
Getter for the resulting composed type.
void set_composed_type(type_base_sptr t)
Setter for the resulting composed type.
virtual size_t get_hash() const
Get the hash value for the current instance.
A basic type declaration that introduces no scope.
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Implementation for the virtual qualified name builder for type_decl.
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
virtual bool operator!=(const type_base &) const
Return true if both types equals.
virtual bool operator==(const type_base &) const
Return true if both types equals.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representation of the current instance of type_decl.
This is a type that aggregates maps of all the kinds of types that are supported by libabigail.
istring_type_base_wptrs_map_type & typedef_types()
Getter for the map that associates the name of a typedef to the vector of instances of typedef_decl_s...
istring_type_base_wptrs_map_type & function_types()
Getter for the map that associates the name of a function type to the vector of instances of function...
istring_type_base_wptrs_map_type & reference_types()
Getter for the map that associates the name of a reference type to the vector of instances of referen...
const istring_type_base_wptrs_map_type & class_types() const
Getter for the map that associates the name of a class type to the vector of instances of class_decl_...
istring_type_base_wptrs_map_type & union_types()
Getter for the map that associates the name of a union type to the vector of instances of union_decl_...
istring_type_base_wptrs_map_type & array_types()
Getter for the map that associates the name of an array type to the vector of instances of array_type...
istring_type_base_wptrs_map_type & enum_types()
Getter for the map that associates the name of an enum type to the vector of instances of enum_type_d...
bool empty() const
Test if the type_maps is empty.
istring_type_base_wptrs_map_type & qualified_types()
Getter for the map that associates the name of a qualified type to the vector of instances of qualifi...
istring_type_base_wptrs_map_type & ptr_to_mbr_types()
Getter for the map that associates the name of a pointer-to-member type to the vector of instances of...
const vector< type_base_wptr > & get_types_sorted_by_name() const
Getter of all types types sorted by their pretty representation.
istring_type_base_wptrs_map_type & pointer_types()
Getter for the map that associates the name of a pointer type to the vector of instances of pointer_t...
const istring_type_base_wptrs_map_type & basic_types() const
Getter for the map that associates the name of a basic type to the vector instances of type_decl_sptr...
const istring_type_base_wptrs_map_type & subrange_types() const
Getter for the map that associates the name of a subrange type to the vector of instances of array_ty...
The base class of both types and declarations.
void set_translation_unit(translation_unit *)
Set the translation_unit this ABI artifact belongs to.
bool get_is_artificial() const
Getter of the flag that says if the artefact is artificial.
virtual ~type_or_decl_base()
The destructor of the type_or_decl_base type.
location & get_artificial_location() const
Getter of the artificial location of the artifact.
bool has_artificial_location() const
Test if the current ABI artifact carries an artificial location.
friend type_base * is_type(const type_or_decl_base *)
Test whether a declaration is a type.
const corpus * get_corpus() const
Get the corpus this ABI artifact belongs to.
friend class_decl * is_class_type(const type_or_decl_base *)
Test whether a type is a class.
enum type_or_decl_kind kind() const
Getter for the "kind" property of type_or_decl_base type.
void set_is_artificial(bool)
Setter of the flag that says if the artefact is artificial.
virtual bool traverse(ir_node_visitor &)
Traverse the the ABI artifact.
const void * runtime_type_instance() const
Getter of the pointer to the runtime type sub-object of the current instance.
const void * type_or_decl_base_pointer() const
Getter of the pointer to either the type_base sub-object of the current instance if it's a type,...
bool hashing_started() const
Getter for the 'hashing_started' property.
void set_artificial_location(const location &)
Setter of the artificial location of the artificat.
type_or_decl_kind
This is a bitmap type which instance is meant to contain the runtime type of a given ABI artifact....
const environment & get_environment() const
Getter of the environment of the current ABI artifact.
friend decl_base * is_decl(const type_or_decl_base *d)
Test if an ABI artifact is a declaration.
const translation_unit * get_translation_unit() const
Get the translation_unit this ABI artifact belongs to.
Abstracts a type template parameter.
virtual bool operator==(const type_base &) const
Equality operator.
The abstraction of a typedef declaration.
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Implementation of the virtual "get_qualified_name" method.
void set_underlying_type(const type_base_sptr &)
Setter ofthe underlying type of the typedef.
virtual size_t get_size_in_bits() const
Return the size of the typedef.
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
type_base_sptr get_underlying_type() const
Getter of the underlying type of the typedef.
virtual bool operator==(const decl_base &) const
Equality operator.
virtual size_t get_alignment_in_bits() const
Return the alignment of the typedef.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Build a pretty representation for a typedef_decl.
Abstracts a union type declaration.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
virtual bool operator==(const decl_base &) const
Comparison operator for union_decl.
virtual ~union_decl()
Destructor of the union_decl type.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Getter of the pretty representation of the current instance of union_decl.
Abstracts a variable declaration.
binding get_binding() const
Getter of the binding of the variable.
void set_type(type_base_sptr &)
Setter of the type of the variable.
void set_binding(binding b)
Setter of the binding of the variable.
friend uint64_t get_data_member_offset(const var_decl_sptr m)
Get the offset of a data member.
var_decl_sptr clone() const
Create a new var_decl that is a clone of the current one.
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 * get_naked_type() const
Getter of the type of the variable.
friend bool get_data_member_is_laid_out(const var_decl &m)
Test whether a data member is laid out.
const type_base_sptr get_type() const
Getter of the type of the variable.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
string get_anon_dm_reliable_name(bool qualified=true) const
Get a name that is valid even for an anonymous data member.
void set_symbol(const elf_symbol_sptr &sym)
Sets the underlying ELF symbol for the current 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(...
virtual bool operator==(const decl_base &) const
Comparison operator of var_decl.
virtual size_t get_hash() const
Return the hash value for the current instance.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Build and return the pretty representation of this variable.
interned_string get_id() const
Return an ID that tries to uniquely identify the variable inside a program or a library.
bool is_decl_only_class_with_size_change(const class_or_union &first, const class_or_union &second)
Test if two classes that are decl-only (have the decl-only flag and carry no data members) but are di...
const type_base * is_void_pointer_type_equivalent(const type_base &type)
Test if a type is equivalent to a pointer to void type.
shared_ptr< reference_type_def > reference_type_def_sptr
Convenience typedef for a shared pointer on a reference_type_def.
bool is_declaration_only_class_or_union_type(const type_base_sptr &t, bool look_through_decl_only)
Test wheter a type is a declaration-only class.
bool enum_has_non_name_change(const enum_type_decl &l, const enum_type_decl &r, change_kind *k)
Test if two enums differ, but not by a name change.
const type_base_wptrs_type * lookup_class_types(const string &qualified_name, const corpus &corp)
Look into a given corpus to find the class type*s* that have a given qualified name.
const type_base_sptr lookup_type_in_scope(const string &fqn, const scope_decl_sptr &skope)
Lookup a type in a scope.
bool is_non_canonicalized_type(const type_base *t)
Test if a given type is allowed to be non canonicalized.
bool get_member_function_is_dtor(const function_decl &f)
Test whether a member function is a destructor.
const type_base * peel_qualified_type(const type_base *type)
Return the leaf underlying type of a qualified type.
shared_ptr< method_type > method_type_sptr
Convenience typedef for shared pointer to method_type.
translation_unit * get_translation_unit(const shared_ptr< decl_base > decl)
Return the translation unit a declaration belongs to.
size_t hash_type(const type_base *t)
Hash an ABI artifact that is either a type.
var_decl_sptr get_last_data_member(const class_or_union &klass)
Get the last data member of a class type.
bool is_anonymous_or_typedef_named(const decl_base &d)
Test if a given decl is anonymous or has a naming typedef.
bool is_typedef_of_maybe_qualified_class_or_union_type(const type_base_sptr &t)
Test if a type is a typedef of a class or union type, or a typedef of a qualified class or union type...
decl_base_sptr add_decl_to_scope(decl_base_sptr decl, const scope_decl_sptr &scope)
Appends a declaration to a given scope, if the declaration doesn't already belong to a scope.
function_decl_sptr is_function_decl(const type_or_decl_base_sptr &d)
Test whether a declaration is a function_decl.
class_decl_sptr is_class_type(const type_or_decl_base_sptr &d)
Test whether a type is a class.
bool get_member_is_static(const decl_base &d)
Gets a flag saying if a class member is static or not.
pointer_type_def_sptr is_pointer_to_npaf_type(const type_base_sptr &t)
Test if we are looking at a pointer to a neither-a-pointer-to-an-array-nor-a-function type.
bool debug_equals(const type_or_decl_base *l, const type_or_decl_base *r)
Test if two ABI artifacts are equal.
decl_base * debug(const decl_base *artifact)
Emit a textual representation of an artifact to std error stream for debugging purposes.
shared_ptr< function_decl > function_decl_sptr
Convenience typedef for a shared pointer on a function_decl.
access_specifier
Access specifier for class members.
pointer_type_def_sptr lookup_pointer_type(const interned_string &qualified_name, const corpus &corp)
Look into a given corpus to find a pointer type which has a given qualified name.
class_decl_sptr lookup_class_type(const interned_string &qualified_name, const corpus &corp)
Look into a given corpus to find a class type which has a given qualified name.
interned_string get_type_name(const type_base &t, bool qualified, bool internal)
Get the name of a given type and return a copy of it.
void maybe_update_types_lookup_map(const function_type_sptr &fn_type)
Update the map that associates the fully qualified name of a function type with the type itself.
bool function_decls_alias(const function_decl &f1, const function_decl &f2)
Test if two function declarations are aliases.
pointer_type_def_sptr is_pointer_to_array_type(const type_base_sptr &t)
Test if a type is a pointer to array type.
shared_ptr< class_tdecl > class_tdecl_sptr
Convenience typedef for a shared pointer on a class_tdecl.
weak_ptr< function_type > function_type_wptr
Convenience typedef for a weak pointer on a function_type.
type_base_sptr lookup_class_or_typedef_type(const string &qualified_name, const corpus &corp)
Look into a corpus to find a class, union or typedef type which has a given qualified name.
void set_member_function_is_virtual(function_decl &f, bool is_virtual)
Set the virtual-ness of a member function.
ssize_t get_member_function_vtable_offset(const function_decl &f)
Get the vtable offset of a member function.
reference_type_def_sptr lookup_reference_type(const interned_string &qualified_name, const corpus &corp)
Look into a given corpus to find a reference type which has a given qualified name.
type_decl_sptr lookup_basic_type_per_location(const string &loc, const corpus &corp)
Lookup a type_decl type from a given corpus, by its location.
ptr_to_mbr_type_sptr is_ptr_to_mbr_type(const type_or_decl_base_sptr &t, bool look_through_qualifiers)
Test whether a type is a ptr_to_mbr_type_sptr.
class_decl_sptr is_compatible_with_class_type(const decl_base_sptr &t)
Test if a type is a class. This function looks through typedefs.
corpus::origin operator|=(corpus::origin &l, corpus::origin r)
Bitwise |= operator for the corpus::origin type.
vector< type_base_wptr > type_base_wptrs_type
A convenience typedef for a vector of type_base_wptr.
const type_base_sptr is_void_pointer_type(const type_base_sptr &t)
Test if a type is a pointer to void type.
bool operator==(const union_decl_sptr &l, const union_decl_sptr &r)
Turn equality of shared_ptr of union_decl into a deep equality; that is, make it compare the pointed ...
void fixup_virtual_member_function(method_decl_sptr method)
When a virtual member function has seen its virtualness set by set_member_function_is_virtual(),...
void pop_composite_type_comparison_operands(const type_base &left, const type_base &right)
Pop a pair of operands from the stack of operands to the current type comparison.
bool equals_modulo_cv_qualifier(const array_type_def *l, const array_type_def *r)
Test if two variables are equals modulo CV qualifiers.
const type_base_wptrs_type * lookup_enum_types(const string &qualified_name, const corpus &corp)
Look into a given corpus to find the enum type*s* that have a given qualified name.
qualified_type_def_sptr clone_qualified_type(const qualified_type_def_sptr &t)
Clone a qualifiend type.
string get_class_or_union_flat_representation(const class_or_union_sptr &cou, const string &indent, bool one_line, bool internal, bool qualified_names)
Get the flat representation of an instance of class_or_union type.
bool is_type(const type_or_decl_base &tod)
Test whether a declaration is a type.
scope_decl * is_scope_decl(decl_base *d)
Test if a declaration is a scope_decl.
union_decl_sptr lookup_union_type(const string &type_name, const corpus &corp)
Look into a given corpus to find a union type which has a given qualified name.
bool is_anonymous_data_member(const decl_base &d)
Test if a decl is an anonymous data member.
bool is_anonymous_data_member(const var_decl &d)
Test if a var_decl is an anonymous data member.
string translation_unit_language_to_string(translation_unit::language l)
Converts a translation_unit::language enumerator into a string.
weak_ptr< type_base > type_base_wptr
Convenience typedef for a weak pointer on a type_base.
type_decl_sptr is_integral_type(const type_or_decl_base_sptr &t)
Test if a type is an integral type.
type_base_sptr peel_reference_type(const type_base_sptr &type)
Return the leaf pointed-to type node of a reference_type_def node.
bool has_scope(const decl_base &d)
Tests if a declaration has got a scope.
scope_decl * get_type_scope(const type_base_sptr &t)
Get the scope of a given type.
integral_type::modifiers_type operator~(integral_type::modifiers_type l)
Bitwise one's complement operator for integral_type::modifiers_type.
array_type_def::subrange_type * is_subrange_type(const type_or_decl_base *type)
Test if a type is an array_type_def::subrange_type.
shared_ptr< elf_symbol > elf_symbol_sptr
A convenience typedef for a shared pointer to elf_symbol.
typedef_decl_sptr lookup_typedef_type(const interned_string &qualified_name, const corpus &corp)
Look into a given corpus to find a typedef type which has a given qualified name.
type_base_sptr lookup_type_from_translation_unit(const string &type_name, const string &tu_path, const corpus &corp)
Lookup a type from a given translation unit present in a give corpus.
var_decl_sptr get_data_member(type_base *clazz, const char *member_name)
Get a given data member, referred to by its name, of a class type.
type_base * get_exemplar_type(const type_base *type)
For a given type, return its exemplar type.
location get_location(const decl_base_sptr &decl)
Get the location of a given declaration.
const typedef_decl * is_typedef(const type_or_decl_base *t)
Test whether a type is a typedef.
void remove_decl_from_scope(decl_base_sptr decl)
Remove a given decl from its scope.
type_base_sptr peel_qualified_or_typedef_type(const type_base_sptr &t)
Return the leaf underlying type of a qualified or typedef type.
bool odr_is_relevant(const type_or_decl_base &artifact)
By looking at the language of the TU a given ABI artifact belongs to, test if the ONE Definition Rule...
array_type_def_sptr clone_array(const array_type_def_sptr &array)
Clone an array type.
enum_type_decl_sptr lookup_enum_type_per_location(const string &loc, const corpus &corp)
Look up an enum_type_decl from a given corpus, by its location.
change_kind
A bitfield that gives callers of abigail::ir::equals() some insight about how different two internal ...
@ LOCAL_TYPE_CHANGE_KIND
This means that a given IR artifact has a local type change.
@ SUBTYPE_CHANGE_KIND
This means that a given IR artifact has changes in some of its sub-types, with respect to the other a...
@ LOCAL_NON_TYPE_CHANGE_KIND
This means that a given IR artifact has a local non-type change. That is a change that is carried by ...
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.
const ptr_to_mbr_type * is_ptr_to_mbr_type(const type_or_decl_base *t, bool look_through_qualifiers)
Test whether a type is a ptr_to_mbr_type.
const var_decl_sptr get_first_non_anonymous_data_member(const var_decl_sptr anon_dm)
Get the first non-anonymous data member of a given anonymous data member.
bool is_user_defined_type(const type_base *t)
Test if a type is user-defined.
bool operator==(const translation_unit_sptr &l, const translation_unit_sptr &r)
A deep comparison operator for pointers to translation units.
class_or_union_sptr anonymous_data_member_to_class_or_union(const var_decl_sptr &d)
Get the class_or_union type of a given anonymous data member.
weak_ptr< class_decl > class_decl_wptr
Convenience typedef for a weak pointer on a class_decl.
const interned_string & get_node_name(var_decl_sptr node)
Gets the name of a var_decl node.
vector< type_base_sptr > type_base_sptrs_type
Helper typedef for a vector of shared pointer to a type_base.
void debug_comp_stack(const environment &env)
Emit a trace of the two comparison operands stack on the standard error stream.
bool collect_non_anonymous_data_members(const class_or_union *cou, string_decl_base_sptr_map &dms)
Collect all the non-anonymous data members of a class or union type.
bool is_class_type(const type_or_decl_base &t)
Test whether a type is a class.
type_base_sptr synthesize_type_from_translation_unit(const type_base_sptr &type, translation_unit &tu)
In a translation unit, lookup a given type or synthesize it if it's a qualified type.
bool maybe_update_types_lookup_map< function_type >(const function_type_sptr &type, istring_type_base_wptrs_map_type &types_map, bool)
This is the specialization for type function_type of the function template:
shared_ptr< array_type_def > array_type_def_sptr
Convenience typedef for a shared pointer on a array_type_def.
method_type * is_method_type(type_or_decl_base *t)
Test whether a type is a method_type.
function_type_sptr lookup_or_synthesize_fn_type(const function_type_sptr &fn_t, const corpus &corpus)
Look into an ABI corpus for a function type.
qualified_type_def_sptr lookup_qualified_type(const interned_string &qualified_name, const corpus &corp)
Look into a given corpus to find a qualified type which has a given qualified name.
bool is_declaration_only_class_or_union_type(const type_base *t, bool look_through_decl_only)
Test wheter a type is a declaration-only class.
bool is_global_scope(const shared_ptr< scope_decl >scope)
Tests whether if a given scope is the global scope.
type_base_sptr lookup_type(const type_base_sptr &t, const corpus &corp)
Look into a given corpus to find a type.
string get_pretty_representation(const type_or_decl_base *tod, bool internal)
Build and return a copy of the pretty representation of an ABI artifact that could be either a type o...
class_decl::base_spec * is_class_base_spec(const type_or_decl_base *tod)
Test if an ABI artifact is a class base specifier.
type_base_sptr lookup_class_typedef_or_enum_type(const string &qualified_name, const corpus &corp)
Look into a corpus to find a class, typedef or enum type which has a given qualified name.
void mark_types_as_being_compared(T &l, T &r)
Mark a pair of types as being compared.
const type_base_sptr peel_qualified_type(const type_base_sptr &type)
Return the leaf underlying type of a qualified type.
type_base_sptr peel_const_qualified_type(const qualified_type_def_sptr &q)
If a qualified type is const, then return its underlying type.
bool is_at_template_scope(const shared_ptr< decl_base > decl)
Tests whether a given decl is at template scope.
function_type_sptr lookup_function_type(const interned_string &qualified_name, const corpus &corp)
Look into a given corpus to find a function type which has a given qualified name.
const class_or_union_sptr data_member_has_anonymous_type(const var_decl &d)
Test if a data member has annonymous type or not.
type_decl * is_integral_type(const type_or_decl_base *t)
Test if a type is an integral type.
bool anonymous_data_member_exists_in_class(const var_decl &anon_dm, const class_or_union &clazz)
Test if a given anonymous data member exists in a class or union.
void set_member_function_is_dtor(function_decl &f, bool d)
Set the destructor-ness property of a member function.
const function_type * is_function_type(const type_or_decl_base *t)
Test whether a type is a function_type.
const type_base_sptr peel_array_type(const type_base_sptr &type)
Return the leaf element type of an array.
bool maybe_update_types_lookup_map< class_decl >(const class_decl_sptr &class_type, istring_type_base_wptrs_map_type &map, bool use_type_name_as_key)
This is the specialization for type class_decl of the function template:
bool types_have_similar_structure(const type_base_sptr &first, const type_base_sptr &second, bool indirect_type)
Test if two types have similar structures, even though they are (or can be) different.
shared_ptr< template_parameter > template_parameter_sptr
Convenience typedef for shared pointer to template parameter.
enum_type_decl_sptr look_through_decl_only_enum(enum_type_decl_sptr enom)
If an enum is a decl-only enum, get its definition. Otherwise, just return the initial enum.
class_or_union * is_class_or_union_type(const type_or_decl_base *t)
Test if a type is a class_or_union.
type_base_sptr look_through_decl_only(const type_base_sptr &t)
If a type is is decl-only, then get its definition. Otherwise, just return the initial type.
shared_ptr< class_decl > class_decl_sptr
Convenience typedef for a shared pointer on a class_decl.
type_base_sptr peel_typedef_pointer_or_reference_type(const type_base_sptr type)
Return the leaf underlying or pointed-to type node of a typedef_decl, pointer_type_def,...
void set_member_function_is_const(function_decl &f, bool is_const)
set the const-ness property of a member function.
string get_name(const type_or_decl_base_sptr &tod, bool qualified)
Build and return a copy of the name of an ABI artifact that is either a type of a decl.
bool is_anonymous_type(const type_base_sptr &t)
Test if a given type is anonymous.
decl_base_sptr strip_useless_const_qualification(const qualified_type_def_sptr t)
Strip qualification from a qualified type, when it makes sense.
bool string_to_elf_symbol_type(const string &s, elf_symbol::type &t)
Convert a string representing a symbol type into an elf_symbol::type.
namespace_decl_sptr is_namespace(const decl_base_sptr &d)
Tests if a declaration is a namespace declaration.
array_type_def_sptr is_array_of_qualified_element(const type_base_sptr &type)
Test if an array type is an array to a qualified element type.
const var_decl_sptr get_next_data_member(const class_or_union *klass, const var_decl_sptr &data_member)
In the context of a given class or union, this function returns the data member that is located after...
void set_member_function_is_ctor(function_decl &f, bool c)
Setter for the is_ctor property of the member function.
const type_decl * is_type_decl(const type_or_decl_base *t)
Test whether a type is a type_decl (a builtin type).
decl_base * is_decl_slow(const type_or_decl_base *t)
Test if an ABI artifact is a declaration.
decl_base_sptr look_through_decl_only(const decl_base &d)
If a decl is decl-only get its definition. Otherwise, just return nil.
function_type_sptr is_function_type(const type_or_decl_base_sptr &t)
Test whether a type is a function_type.
scope_decl_sptr is_scope_decl(const decl_base_sptr &d)
Test if a declaration is a scope_decl.
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.
void set_member_access_specifier(decl_base &d, access_specifier a)
Sets the access specifier for a class member.
bool is_template_parameter(const shared_ptr< decl_base > decl)
Tests whether a decl is a template parameter.
typedef_decl_sptr is_typedef(const type_or_decl_base_sptr t)
Test whether a type is a typedef.
type_base_sptr is_type(const type_or_decl_base_sptr &tod)
Test whether a declaration is a type.
uint64_t get_var_size_in_bits(const var_decl_sptr &v)
Get the size of a given variable.
string get_debug_representation(const type_or_decl_base *artifact)
Get the textual representation of a type for debugging purposes.
shared_ptr< function_type > function_type_sptr
Convenience typedef for a shared pointer on a function_type.
shared_ptr< typedef_decl > typedef_decl_sptr
Convenience typedef for a shared pointer on a typedef_decl.
function_type_sptr synthesize_function_type_from_translation_unit(const function_type &fn_type, translation_unit &tu)
In a translation unit, lookup the sub-types that make up a given function type and if the sub-types a...
std::ostream & operator<<(std::ostream &o, elf_symbol::type t)
Serialize an instance of symbol_type and stream it to a given output stream.
type_base_sptr peel_pointer_type(const type_base_sptr &type)
Return the leaf pointed-to type node of a pointer_type_def node.
bool var_equals_modulo_types(const var_decl &l, const var_decl &r, change_kind *k)
Compares two instances of var_decl without taking their type into account.
type_base_sptr lookup_type_through_translation_units(const string &qn, const corpus &abi_corpus)
Lookup a type definition in all the translation units of a given ABI corpus.
void sort_types(const canonical_type_sptr_set_type &types, vector< type_base_sptr > &result)
Sort types in a hopefully stable manner.
type_base * peel_pointer_or_reference_type(const type_base *type, bool peel_qual_type)
Return the leaf underlying or pointed-to type node of a, pointer_type_def, reference_type_def or qual...
decl_base_sptr is_decl_slow(const type_or_decl_base_sptr &t)
Test if an ABI artifact is a declaration.
reference_type_def * is_reference_type(type_or_decl_base *t, bool look_through_qualifiers)
Test whether a type is a reference_type_def.
corpus::origin operator|(corpus::origin l, corpus::origin r)
Bitwise | operator for the corpus::origin type.
bool elf_symbol_is_function(elf_symbol::type t)
Test if the type of an ELF symbol denotes a function symbol.
bool is_cplus_plus_language(translation_unit::language l)
Test if a language enumerator designates the C++ language.
bool try_canonical_compare(const T *l, const T *r)
Compare two types by comparing their canonical types if present.
enum_type_decl_sptr is_compatible_with_enum_type(const decl_base_sptr &t)
Test if a type is an enum. This function looks through typedefs.
function_decl::parameter_sptr is_function_parameter(const type_or_decl_base_sptr tod)
Test whether an ABI artifact is a function_decl.
class_or_union_sptr look_through_decl_only_class(class_or_union_sptr klass)
If a class (or union) is a decl-only class, get its definition. Otherwise, just return the initial cl...
bool lookup_decl_only_class_types(const interned_string &qualified_name, const corpus &corp, type_base_wptrs_type &result)
Look into a given corpus to find the class type*s* that have a given qualified name and that are decl...
bool member_function_has_vtable_offset(const function_decl &f)
Test if a virtual member function has a vtable offset set.
bool parse_integral_type(const string &type_name, integral_type &type)
Parse an integral type from a string.
const type_base * peel_typedef_type(const type_base *type)
Return the leaf underlying type node of a typedef_decl node.
unordered_map< interned_string, bool, hash_interned_string > interned_string_bool_map_type
Convenience typedef for a map of interned_string -> bool.
type_base_sptr lookup_type_through_scopes(const list< string > &fqn, const translation_unit &tu)
Lookup a type from a translation unit by walking its scopes in sequence and by looking into them.
const enum_type_decl * is_enum_type(const type_or_decl_base *d)
Test if a decl is an enum_type_decl.
const global_scope * get_global_scope(const shared_ptr< decl_base > decl)
Return the global scope as seen by a given declaration.
unordered_map< interned_string, type_base_wptrs_type, hash_interned_string > istring_type_base_wptrs_map_type
A convenience typedef for a map which key is an interned_string and which value is a vector of type_b...
shared_ptr< class_or_union > is_class_or_union_type(const shared_ptr< type_or_decl_base > &t)
Test if a type is a class_or_union.
bool function_decl_is_less_than(const function_decl &f, const function_decl &s)
Test if the pretty representation of a given function_decl is lexicographically less then the pretty ...
bool elf_symbols_alias(const elf_symbol &s1, const elf_symbol &s2)
Test if two symbols alias.
var_decl_sptr find_data_member_from_anonymous_data_member(const var_decl_sptr &anon_dm, const string &name)
Find a data member inside an anonymous data member.
shared_ptr< var_decl > var_decl_sptr
Convenience typedef for a shared pointer on a var_decl.
shared_ptr< ptr_to_mbr_type > ptr_to_mbr_type_sptr
Convenience typedef for a shared pointer to a ptr_to_mbr_type.
const location & get_natural_or_artificial_location(const decl_base *decl)
Get the non-artificial (natural) location of a decl.
string build_qualified_name(const scope_decl *scope, const type_base_sptr &type)
Build and return the qualified name of a type in its scope.
size_t hash_type_or_decl(const type_or_decl_base *tod)
Hash an ABI artifact that is either a type or a decl.
array_type_def_sptr is_array_type(const type_or_decl_base_sptr &type, bool look_through_qualifiers)
Test if a type is an array_type_def.
corpus::origin operator&(corpus::origin l, corpus::origin r)
Bitwise & operator for the corpus::origin type.
unordered_map< const function_decl *, string, function_decl::hash, function_decl::ptr_equal > fns_to_str_map_type
Convenience typedef for a hash map of pointer to function_decl and string.
shared_ptr< scope_decl > scope_decl_sptr
Convenience typedef for a shared pointer on a scope_decl.
class_decl_sptr lookup_class_type_per_location(const string &loc, const corpus &corp)
Look up a class_decl from a given corpus by its location.
bool string_to_elf_symbol_binding(const string &s, elf_symbol::binding &b)
Convert a string representing a an elf symbol binding into an elf_symbol::binding.
shared_ptr< type_or_decl_base > type_or_decl_base_sptr
A convenience typedef for a shared_ptr to type_or_decl_base.
shared_ptr< translation_unit > translation_unit_sptr
Convenience typedef for a shared pointer on a translation_unit type.
bool is_data_member_of_anonymous_class_or_union(const var_decl &d)
Test if a var_decl is a data member belonging to an anonymous type.
namespace_decl * is_namespace(const decl_base *d)
Tests if a declaration is a namespace declaration.
type_base * peel_typedef_pointer_or_reference_type(const type_base *type, bool peel_qual_type)
Return the leaf underlying or pointed-to type node of a typedef_decl, pointer_type_def or reference_t...
const type_base * is_void_pointer_type_equivalent(const type_base *type)
Test if a type is equivalent to a pointer to void type.
lookup_entity_kind
This enum describe the kind of entity to lookup, while using the lookup API.
type_base * type_has_non_canonicalized_subtype(type_base_sptr t)
Test if a type has sub-types that are non-canonicalized.
unordered_map< string, decl_base_sptr > string_decl_base_sptr_map
Convenience typedef for a map which key is a string and which value is a decl_base_sptr.
bool is_function_template_pattern(const shared_ptr< decl_base > decl)
Test whether a decl is the pattern of a function template.
void push_composite_type_comparison_operands(const type_base &left, const type_base &right)
Push a pair of operands on the stack of operands of the current type comparison, during type canonica...
bool is_java_language(translation_unit::language l)
Test if a language enumerator designates the Java language.
function_decl::parameter * is_function_parameter(const type_or_decl_base *tod)
Test whether a declaration is a function_decl.
type_decl_sptr lookup_basic_type(const string &qualified_name, const corpus &corp)
Look into a given corpus to find a basic type which has a given qualified name.
class_or_union * is_at_class_scope(const decl_base &decl)
Tests whether a given decl is at class scope.
bool equals(const decl_base &l, const decl_base &r, change_kind *k)
Compares two instances of decl_base.
bool get_data_member_is_laid_out(const var_decl &m)
Test whether a data member is laid out.
bool is_template_parm_composition_type(const shared_ptr< decl_base > decl)
Tests whether a decl is a template parameter composition type.
const decl_base_sptr lookup_var_decl_in_scope(const std::list< string > &comps, const scope_decl_sptr &skope)
lookup a var_decl in a scope.
bool string_to_elf_symbol_visibility(const string &s, elf_symbol::visibility &v)
Convert a string representing a an elf symbol visibility into an elf_symbol::visibility.
union_decl_sptr lookup_union_type_per_location(const string &loc, const corpus &corp)
Lookup a union type in a given corpus, from its location.
type_base_sptr canonicalize(type_base_sptr t)
Compute the canonical type of a given type.
weak_ptr< elf_symbol > elf_symbol_wptr
A convenience typedef for a weak pointer to elf_symbol.
bool get_member_function_is_const(const function_decl &f)
Test whether a member function is const.
interned_string get_name_of_reference_to_type(const type_base &pointed_to_type, bool lvalue_reference, bool qualified, bool internal)
Get the name of the reference to a given type.
shared_ptr< pointer_type_def > pointer_type_def_sptr
Convenience typedef for a shared pointer on a pointer_type_def.
void maybe_update_types_lookup_map(const type_decl_sptr &basic_type)
Update the map that associates the fully qualified name of a basic type with the type itself.
bool is_enumerator_present_in_enum(const enum_type_decl::enumerator &enr, const enum_type_decl &enom)
Test if a given enumerator is found present in an enum.
interned_string get_method_type_name(const method_type &fn_type, bool internal)
Get the name of a given method type and return a copy of it.
bool is_const_qualified_type(const qualified_type_def_sptr &t)
Test if a given qualified type is const.
translation_unit::language string_to_translation_unit_language(const string &l)
Parse a string representing a language into a translation_unit::language enumerator into a string.
enum_type_decl_sptr is_enum_type(const type_or_decl_base_sptr &d)
Test if a decl is an enum_type_decl.
var_decl_sptr has_fake_flexible_array_data_member(const class_decl_sptr &klass)
Test if the last data member of a class is an array with one element.
type_base_sptr lookup_type_per_location(const interned_string &loc, const corpus &corp)
Lookup a type from a corpus, by its location.
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.
uint64_t get_absolute_data_member_offset(const var_decl &m)
Get the absolute offset of a data member.
shared_ptr< ir_traversable_base > ir_traversable_base_sptr
Convenience typedef for a shared pointer to ir_traversable_base.
bool is_member_function(const function_decl &f)
Test whether a function_decl is a member function.
const function_decl::parameter * get_function_parameter(const decl_base *fun, unsigned parm_index)
Get the function parameter designated by its index.
var_decl * is_var_decl(const type_or_decl_base *tod)
Tests if a declaration is a variable declaration.
bool is_c_language(translation_unit::language l)
Test if a language enumerator designates the C language.
decl_base * is_decl(const type_or_decl_base *d)
Test if an ABI artifact is a declaration.
void keep_type_alive(type_base_sptr t)
Make sure that the life time of a given (smart pointer to a) type is the same as the life time of the...
method_decl * is_method_decl(const type_or_decl_base *d)
Test if a function_decl is actually a method_decl.
bool is_member_type(const type_base_sptr &t)
Tests if a type is a class member.
string get_class_or_union_flat_representation(const class_or_union &cou, const string &indent, bool one_line, bool internal, bool qualified_names)
Get the flat representation of an instance of class_or_union type.
array_type_def::subrange_sptr is_subrange_type(const type_or_decl_base_sptr &type)
Test if a type is an array_type_def::subrange_type.
decl_base_sptr add_decl_to_scope(decl_base_sptr decl, scope_decl *scope)
Appends a declaration to a given scope, if the declaration doesn't already belong to one and if the d...
string build_internal_underlying_enum_type_name(const string &base_name, bool is_anonymous, uint64_t size)
Build the internal name of the underlying type of an enum.
bool is_npaf_type(const type_base_sptr &t)
Test if a type is a neither a pointer, an array nor a function type.
access_specifier get_member_access_specifier(const decl_base &d)
Gets the access specifier for a class member.
shared_ptr< enum_type_decl > enum_type_decl_sptr
Convenience typedef for shared pointer to a enum_type_decl.
void set_data_member_offset(var_decl_sptr m, uint64_t o)
Set the offset of a data member into its containing class.
type_base_sptr strip_typedef(const type_base_sptr type)
Recursively returns the the underlying type of a typedef. The return type should not be a typedef of ...
uint64_t get_data_member_offset(const var_decl &m)
Get the offset of a data member.
unordered_set< uintptr_t > pointer_set
A convenience typedef for an unordered set of pointer values.
type_decl_sptr is_type_decl(const type_or_decl_base_sptr &t)
Test whether a type is a type_decl (a builtin type).
class_or_union * is_at_class_scope(const decl_base_sptr decl)
Tests whether a given decl is at class scope.
bool get_member_function_is_virtual(const function_decl &f)
Test if a given member function is virtual.
const pointer_type_def * is_pointer_type(const type_or_decl_base *t, bool look_through_qualifiers)
Test whether a type is a pointer_type_def.
string get_class_or_enum_flat_representation(const type_base &coe, const string &indent, bool one_line, bool internal, bool qualified_name)
Get the flat representation of an instance of enum_type_decl type.
bool types_are_compatible(const decl_base_sptr d1, const decl_base_sptr d2)
Test if two types are equal modulo a typedef.
class_or_union * anonymous_data_member_to_class_or_union(const var_decl *d)
Get the class_or_union type of a given anonymous data member.
location get_location(const type_base_sptr &type)
Get the location of the declaration of a given type.
pointer_type_def_sptr is_pointer_to_function_type(const type_base_sptr &t)
Test if a type is a pointer to function type.
weak_ptr< decl_base > decl_base_wptr
Convenience typedef for a weak pointer to a decl_base.
decl_base_sptr insert_decl_into_scope(decl_base_sptr decl, scope_decl::declarations::iterator before, scope_decl *scope)
Inserts a declaration into a given scope, before a given IR child node of the scope.
interned_string get_function_type_name(const function_type_sptr &fn_type, bool internal)
Get the name of a given function type and return a copy of it.
bool return_comparison_result(T &l, T &r, bool value, bool propagate_canonical_type=true)
Return the result of the comparison of two (sub) types.
class_or_union * look_through_decl_only_class(class_or_union *the_class)
If a class (or union) is a decl-only class, get its definition. Otherwise, just return the initial cl...
bool is_union_type(const type_or_decl_base &t)
Test if a type is a union_decl.
const location & get_artificial_or_natural_location(const decl_base *decl)
Get the artificial location of a decl.
typedef_decl_sptr lookup_typedef_type_per_location(const string &loc, const corpus &corp)
Lookup a typedef_decl from a corpus, by its location.
type_base_sptr peel_typedef_type(const type_base_sptr &type)
Return the leaf underlying type node of a typedef_decl node.
interned_string get_name_of_qualified_type(const type_base_sptr &underlying_type, qualified_type_def::CV quals, bool qualified, bool internal)
Get the name of a qualified type, given the underlying type and its qualifiers.
shared_ptr< template_decl > template_decl_sptr
Convenience typedef for a shared pointer to template_decl.
array_type_def_sptr is_typedef_of_array(const type_base_sptr &t)
Test if a type is a typedef of an array.
string get_string_representation_of_cv_quals(const qualified_type_def::CV cv_quals)
Get the string representation of a CV qualifier bitmap.
void set_data_member_is_laid_out(var_decl_sptr m, bool l)
Set a flag saying if a data member is laid out.
pointer_type_def_sptr is_pointer_to_ptr_to_mbr_type(const type_base_sptr &t)
Test if we are looking at a pointer to pointer to member type.
bool is_data_member(const var_decl &v)
Test if a var_decl is a data member.
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.
union_decl_sptr is_union_type(const shared_ptr< type_or_decl_base > &t)
Test if a type is a union_decl.
const decl_base * get_type_declaration(const type_base *t)
Get the declaration for a given type.
bool is_at_global_scope(const decl_base *decl)
Tests whether a given declaration is at global scope.
void set_member_is_static(decl_base &d, bool s)
Sets the static-ness property of a class member.
array_type_def * is_array_type(const type_or_decl_base *type, bool look_through_qualifiers)
Test if a type is an array_type_def.
weak_ptr< template_decl > template_decl_wptr
Convenience typedef for a weak pointer to template_decl.
const var_decl * lookup_data_member(const type_base *type, const char *dm_name)
Look for a data member of a given class, struct or union type and return it.
interned_string get_function_id_or_pretty_representation(const function_decl *fn)
Get the ID of a function, or, if the ID can designate several different functions,...
shared_ptr< type_decl > type_decl_sptr
Convenience typedef for a shared pointer on a type_decl.
bool is_comparison_cycle_detected(T &l, T &r)
Detect if a recursive comparison cycle is detected while structurally comparing two types (a....
typedef_decl_sptr clone_typedef(const typedef_decl_sptr &t)
Clone a typedef type.
string get_pretty_representation(const method_type_sptr method, bool internal)
Get the pretty representation of a method type.
string get_enum_flat_representation(const enum_type_decl_sptr &enum_type, const string &indent, bool one_line, bool qualified_names)
Get the flat representation of an instance of enum_type_decl type.
void unmark_types_as_being_compared(T &l, T &r)
Mark a pair of types as being not compared anymore.
unordered_set< type_base_sptr, canonical_type_hash > canonical_type_sptr_set_type
Helper typedef for an unordered set of type_base_sptr which uses pointer value to tell its members ap...
array_type_def_sptr lookup_array_type(const interned_string &qualified_name, const corpus &corp)
Look into a given corpus to find an array type which has the same qualified name as a given array typ...
shared_ptr< namespace_decl > namespace_decl_sptr
Convenience typedef for a shared pointer on namespace_decl.
var_decl_sptr is_var_decl(const type_or_decl_base_sptr &decl)
Tests if a declaration is a variable declaration.
bool is_ada_language(translation_unit::language l)
Test if a language enumerator designates the Ada language.
string demangle_cplus_mangled_name(const string &mangled_name)
Demangle a C++ mangled name and return the resulting string.
bool is_unique_type(const type_base_sptr &t)
Test if a type is unique in the entire environment.
string components_to_type_name(const list< string > &comps)
Turn a set of qualified name components (that name a type) into a qualified name string.
interned_string get_type_name(const type_base_sptr &t, bool qualified, bool internal)
Get the name of a given type and return a copy of it.
bool mark_dependant_types_compared_until(const type_base &r)
In the stack of the current types being compared (as part of type canonicalization),...
corpus::origin operator&=(corpus::origin &l, corpus::origin r)
Bitwise &= operator for the corpus::origin type.
type_base_sptr clone_array_tree(const type_base_sptr t)
Clone a type tree made of an array or a typedef of array.
string get_enum_flat_representation(const enum_type_decl &enum_type, const string &indent, bool one_line, bool qualified_names)
Get the flat representation of an instance of enum_type_decl type.
interned_string get_function_type_name(const function_type &fn_type, bool internal)
Get the name of a given function type and return a copy of it.
decl_base_sptr is_decl(const type_or_decl_base_sptr &d)
Test if an ABI artifact is a declaration.
bool operator!=(const translation_unit_sptr &l, const translation_unit_sptr &r)
A deep inequality operator for pointers to translation units.
interned_string get_name_of_pointer_to_type(const type_base &pointed_to_type, bool qualified, bool internal)
Get the name of the pointer to a given type.
function_decl * is_function_decl(const type_or_decl_base *d)
Test whether a declaration is a function_decl.
bool is_template_decl(const decl_base_sptr &decl)
Tests whether a decl is a template.
bool elf_symbol_is_variable(elf_symbol::type t)
Test if the type of an ELF symbol denotes a function symbol.
bool type_has_sub_type_changes(const type_base_sptr t_v1, const type_base_sptr t_v2)
Tests if the change of a given type effectively comes from just its sub-types. That is,...
var_decl_sptr has_flexible_array_data_member(const class_decl_sptr &klass)
Test if the last data member of a class is an array with non-finite data member.
method_type_sptr is_method_type(const type_or_decl_base_sptr &t)
Test whether a type is a method_type.
qualified_type_def * is_qualified_type(const type_or_decl_base *t)
Test whether a type is a reference_type_def.
bool is_typedef_ptr_or_ref_to_decl_only_class_or_union_type(const type_base *t)
Test if a type is a typedef, pointer or reference to a decl-only class/union.
const scope_decl * get_top_most_scope_under(const decl_base_sptr decl, const scope_decl_sptr scope)
Return the a scope S containing a given declaration and that is right under a given scope P.
std::unordered_map< string, elf_symbols > string_elf_symbols_map_type
Convenience typedef for a map which key is a string and which value is a vector of elf_symbol.
string build_qualified_name(const scope_decl *scope, const string &name)
Build and return a qualified name from a name and its scope.
void set_member_function_vtable_offset(function_decl &f, ssize_t s)
Set the vtable offset of a member function.
method_decl_sptr copy_member_function(const class_or_union_sptr &t, const method_decl_sptr &method)
Copy a method of a class_or_union into a new class_or_union.
decl_base_sptr get_type_declaration(const type_base_sptr t)
Get the declaration for a given type.
shared_ptr< function_tdecl > function_tdecl_sptr
Convenience typedef for a shared pointer on a function_tdecl.
type_base * peel_qualified_or_typedef_type(const type_base *type)
Return the leaf underlying type of a qualified or typedef type.
type_base_sptr type_or_void(const type_base_sptr t, const environment &env)
Return either the type given in parameter if it's non-null, or the void type.
pointer_type_def_sptr is_pointer_type(const type_or_decl_base_sptr &t, bool look_through_qualifiers)
Test whether a type is a pointer_type_def.
const type_base_wptrs_type * lookup_union_types(const string &qualified_name, const corpus &corp)
Look into a given corpus to find the union types that have a given qualified name.
bool is_member_decl(const decl_base_sptr d)
Tests if a declaration is a class member.
bool maybe_compare_as_member_decls(const decl_base &l, const decl_base &r, change_kind *k)
Compare the properties that belong to the "is-a-member-relation" of a decl.
qualified_type_def_sptr is_qualified_type(const type_or_decl_base_sptr &t)
Test whether a type is a qualified_type_def.
bool class_or_union_types_of_same_kind(const class_or_union_sptr &first, const class_or_union_sptr &second)
Test if two class or union types are of the same kind.
class_decl_sptr lookup_class_type_through_scopes(const list< string > &fqn, const translation_unit &tu)
Lookup a class type from a translation unit by walking its scopes in sequence and by looking into the...
reference_type_def_sptr is_reference_type(const type_or_decl_base_sptr &t, bool look_through_qualifiers)
Test whether a type is a reference_type_def.
void fqn_to_components(const string &fqn, list< string > &comps)
Decompose a fully qualified name into the list of its components.
bool get_member_function_is_ctor(const function_decl &f)
Test whether a member function is a constructor.
bool is_declaration_only_class_type(const type_base_sptr &t, bool look_through_decl_only)
Test wheter a type is a declaration-only class.
enum_type_decl_sptr lookup_enum_type(const interned_string &qualified_name, const corpus &corp)
Look into a given corpus to find an enum type which has a given qualified name.
bool match(const regex_t_sptr &r, const std::string &str)
See if a string matches a regex.
std::shared_ptr< regex_t > regex_t_sptr
A convenience typedef for a shared pointer of regex_t.
Toplevel namespace for libabigail.
std::string operator+(const interned_string &s1, const std::string &s2)
Concatenation operator.
bool operator==(const std::string &l, const interned_string &r)
Equality operator.
std::ostream & operator<<(std::ostream &o, const interned_string &s)
Streaming operator.
unordered_map< string, string * > pool_map_type
Convenience typedef for a map of string -> string*.
A functor to hash instances of interned_string.
size_t operator()(const type_base_sptr &l) const
Hash a type by returning the pointer value of its canonical type.
The hashing functor for class_decl::base_spec.
Hasher for the class_decl type.
The private data of the environment type.
A hashing functor fo instances and pointers of function_decl.
A hashing functor for a function_decl::parameter.
Equality functor for instances of function_decl.
The hashing functor for function_type.
The type of the private data of the function_type type.
virtual bool traverse(ir_node_visitor &v)
Traverse a given IR node and its children, calling an visitor on each node.
The hashing functor for member_base.
Hasher for the non_type_tparameter type.
Hasher for the scope_decl type.
Private type to hold private members of translation_unit.
Definition of the private data of type_base.
Hasher for the type_composition type.
A predicate for deep equality of instances of shared_ptr<type_base>
A hashing functor for instances and pointers of var_decl.
A deleter for shared pointers that ... doesn't delete the object managed by the shared pointer.