20#include <unordered_map>
24#include "abg-internal.h"
26ABG_BEGIN_EXPORT_DECLARATIONS
33ABG_END_EXPORT_DECLARATIONS
69using std::unordered_map;
70using std::dynamic_pointer_cast;
71using std::static_pointer_cast;
78struct interned_string_pool::priv
98{
return priv_->map.find(s) != priv_->map.end();}
109 unordered_map<string, string*>::const_iterator i =
111 if (i == priv_->map.end())
114 return i->second->c_str();
126 string*& result = priv_->map[str_value];
127 if (!result && !str_value.empty())
128 result =
new string(str_value);
135 for (pool_map_type::iterator i = priv_->map.begin();
136 i != priv_->map.end();
153{
return r.operator==(l);}
156operator!=(
const std::string& l,
const interned_string& r)
171 o << static_cast<std::string>(s);
187{
return static_cast<std::string
>(s1) + s2;}
201{
return s1 +
static_cast<std::string
>(s2);}
207hash_as_canonical_type_or_constant(
const type_base *t);
210has_generic_anonymous_internal_type_name(
const decl_base *d);
212static interned_string
213get_generic_anonymous_internal_type_name(
const decl_base *d);
216get_internal_integral_type_name(
const type_base*);
219update_qualified_name(decl_base * d);
222update_qualified_name(decl_base_sptr d);
226 const type_base& right);
230 const type_base& right);
249 env.priv_->push_composite_type_comparison_operands(&left, &right);
270 env.priv_->pop_composite_type_comparison_operands(&left, &right);
334 return env.priv_->mark_dependant_types_compared_until(&r);
341class expanded_location
353 expanded_location(
const string& path,
unsigned line,
unsigned column)
354 : path_(path), line_(line), column_(column)
360 return (path_ == l.path_
362 && column_ && l.column_);
366 operator<(
const expanded_location& l)
const
370 else if (path_ > l.path_)
375 else if (line_ > l.line_)
378 return column_ < l.column_;
395 if (!get_location_manager())
416 unsigned line = 0, column = 0;
417 expand(path, line, column);
419 std::ostringstream o;
420 o << path <<
":" << line <<
":" << column;
424struct location_manager::priv
430 std::vector<expanded_location> locs;
433location_manager::location_manager()
437location_manager::~location_manager() =
default;
452 expanded_location l(file_path, line, col);
456 priv_->locs.push_back(l);
457 return location(priv_->locs.size(),
this);
474 unsigned& column)
const
478 expanded_location &l = priv_->locs[
location.value_ - 1];
491struct type_maps::priv
504 mutable vector<type_base_wptr> sorted_types_;
507type_maps::type_maps()
511type_maps::~type_maps() =
default;
536{
return priv_->basic_types_;}
543{
return priv_->basic_types_;}
550{
return priv_->class_types_;}
557{
return priv_->class_types_;}
564{
return priv_->union_types_;}
571{
return priv_->union_types_;}
578{
return priv_->enum_types_;}
585{
return priv_->enum_types_;}
592{
return priv_->typedef_types_;}
599{
return priv_->typedef_types_;}
605{
return priv_->qualified_types_;}
611{
return priv_->qualified_types_;}
618{
return priv_->pointer_types_;}
625{
return priv_->pointer_types_;}
632{
return priv_->reference_types_;}
639{
return priv_->reference_types_;}
646{
return priv_->array_types_;}
653{
return priv_->array_types_;}
660{
return priv_->subrange_types_;}
667{
return priv_->subrange_types_;}
674{
return priv_->function_types_;}
681{
return priv_->function_types_;}
700 if (l == 0 && r == 0)
705 return l_repr < r_repr;
719 operator()(
const type_base_sptr &l,
const type_base_sptr &r)
const
720 {
return operator()(l.get(), r.get());}
734 {
return operator()(type_base_sptr(l), type_base_sptr(r));}
737#ifdef WITH_DEBUG_SELF_COMPARISON
753notify_equality_failed(
const type_or_decl_base &l __attribute__((unused)),
754 const type_or_decl_base &r __attribute__((unused)))
771notify_equality_failed(
const type_or_decl_base *l __attribute__((unused)),
772 const type_or_decl_base *r __attribute__((unused)))
775#define ABG_RETURN_EQUAL(l, r) \
779 notify_equality_failed(l, r); \
785#define ABG_RETURN_FALSE \
788 notify_equality_failed(l, r); \
792#define ABG_RETURN(value) \
795 if (value == false) \
796 notify_equality_failed(l, r); \
802#define ABG_RETURN_FALSE return false
803#define ABG_RETURN(value) return (value)
804#define ABG_RETURN_EQUAL(l, r) return ((l) == (r));
820#if WITH_DEBUG_TYPE_CANONICALIZATION
840 if (env.priv_->use_canonical_type_comparison_)
844 ABG_RETURN_EQUAL(lc, rc);
850 ABG_RETURN_EQUAL(lc, rc);
869 bool result = l.priv_->comparison_started(l, r);
909#define RETURN_TRUE_IF_COMPARISON_CYCLE_DETECTED(l, r) \
912 if (is_comparison_cycle_detected(l, r)) \
914 mark_dependant_types_compared_until(r); \
933 l.priv_->mark_as_being_compared(l, r);
968 l.priv_->unmark_as_being_compared(l, r);
1017 bool propagate_canonical_type =
true)
1019 if (propagate_canonical_type && (value ==
true))
1020 maybe_propagate_canonical_type(l, r);
1033 && (
is_type(&r)->priv_->depends_on_recursive_type()
1034 || env.priv_->is_recursive_type(&r))
1035 &&
is_type(&r)->priv_->canonical_type_propagated()
1036 && !
is_type(&r)->priv_->propagated_canonical_type_confirmed()
1037 && !env.priv_->right_type_comp_operands_.empty())
1042 env.priv_->add_to_types_with_non_confirmed_propagated_ct(
is_type(&r));
1044 else if (value ==
true && env.priv_->right_type_comp_operands_.empty())
1053 env.priv_->confirm_ct_propagation(&r);
1055 else if (value ==
true)
1058 env.priv_->add_to_types_with_non_confirmed_propagated_ct(
is_type(&r));
1059 else if (value ==
false)
1066 env.priv_->cancel_all_non_confirmed_propagated_canonical_types();
1078 && env.priv_->right_type_comp_operands_.empty()
1079 && !env.priv_->types_with_non_confirmed_propagated_ct_.empty())
1084 env.priv_->confirm_ct_propagation();
1086#ifdef WITH_DEBUG_SELF_COMPARISON
1087 if (value ==
false && env.priv_->right_type_comp_operands_.empty())
1089 for (
const auto i : env.priv_->types_with_non_confirmed_propagated_ct_)
1092 env.priv_->check_abixml_canonical_type_propagation_during_self_comp(t);
1100#define CACHE_AND_RETURN_COMPARISON_RESULT(value) \
1103 bool res = return_comparison_result(l, r, value); \
1104 l.get_environment().priv_->cache_type_comparison_result(l, r, res); \
1112#define CACHE_COMPARISON_RESULT_AND_RETURN(value) \
1115 l.get_environment().priv_->cache_type_comparison_result(l, r, value); \
1123const vector<type_base_wptr>&
1126 if (priv_->sorted_types_.empty())
1128 istring_type_base_wptrs_map_type::const_iterator i;
1129 vector<type_base_wptr>::const_iterator j;
1132 for (j = i->second.begin(); j != i->second.end(); ++j)
1133 priv_->sorted_types_.push_back(*j);
1136 for (j = i->second.begin(); j != i->second.end(); ++j)
1137 priv_->sorted_types_.push_back(*j);
1140 for (j = i->second.begin(); j != i->second.end(); ++j)
1141 priv_->sorted_types_.push_back(*j);
1144 for (j = i->second.begin(); j != i->second.end(); ++j)
1145 priv_->sorted_types_.push_back(*j);
1148 for (j = i->second.begin(); j != i->second.end(); ++j)
1149 priv_->sorted_types_.push_back(*j);
1151 type_name_comp comp;
1152 sort(priv_->sorted_types_.begin(), priv_->sorted_types_.end(), comp);
1155 return priv_->sorted_types_;
1174 const std::string& path,
1176 : priv_(new
priv(env))
1178 priv_->path_ = path;
1179 priv_->address_size_ = address_size;
1201 if (!priv_->global_scope_)
1203 priv_->global_scope_.reset
1205 priv_->global_scope_->set_translation_unit
1208 return priv_->global_scope_;
1216{
return priv_->types_;}
1223{
return priv_->types_;}
1230const vector<function_type_sptr>&
1232{
return priv_->live_fn_types_;}
1239{
return priv_->env_;}
1246{
return priv_->language_;}
1253{priv_->language_ = l;}
1266{
return priv_->path_;}
1277{priv_->path_ = a_path;}
1290{
return priv_->comp_dir_path_;}
1301{priv_->comp_dir_path_ = d;}
1310 if (priv_->abs_path_.empty())
1313 if (!priv_->path_.empty())
1315 if (!priv_->comp_dir_path_.empty())
1317 path = priv_->comp_dir_path_;
1320 path += priv_->path_;
1322 priv_->abs_path_ = path;
1325 return priv_->abs_path_;
1344{
return priv_->corp;}
1360{
return priv_->loc_mgr_;}
1368{
return priv_->loc_mgr_;}
1377 if (!priv_->global_scope_)
1387{
return priv_->address_size_;}
1394{priv_->address_size_= a;}
1410{
return priv_->is_constructed_;}
1426{priv_->is_constructed_ = f;}
1465 const_cast<translation_unit*
>(
this)->priv_->live_fn_types_.push_back(ftype);
1496translation_unit::~translation_unit()
1509 case translation_unit::LANG_UNKNOWN:
1510 return "LANG_UNKNOWN";
1511 case translation_unit::LANG_Cobol74:
1512 return "LANG_Cobol74";
1513 case translation_unit::LANG_Cobol85:
1514 return "LANG_Cobol85";
1515 case translation_unit::LANG_C89:
1517 case translation_unit::LANG_C99:
1519 case translation_unit::LANG_C11:
1521 case translation_unit::LANG_C:
1523 case translation_unit::LANG_C_plus_plus_11:
1524 return "LANG_C_plus_plus_11";
1525 case translation_unit::LANG_C_plus_plus_14:
1526 return "LANG_C_plus_plus_14";
1527 case translation_unit::LANG_C_plus_plus:
1528 return "LANG_C_plus_plus";
1529 case translation_unit::LANG_ObjC:
1531 case translation_unit::LANG_ObjC_plus_plus:
1532 return "LANG_ObjC_plus_plus";
1533 case translation_unit::LANG_Fortran77:
1534 return "LANG_Fortran77";
1535 case translation_unit::LANG_Fortran90:
1536 return "LANG_Fortran90";
1537 case translation_unit::LANG_Fortran95:
1538 return "LANG_Fortran95";
1539 case translation_unit::LANG_Ada83:
1540 return "LANG_Ada83";
1541 case translation_unit::LANG_Ada95:
1542 return "LANG_Ada95";
1543 case translation_unit::LANG_Pascal83:
1544 return "LANG_Pascal83";
1545 case translation_unit::LANG_Modula2:
1546 return "LANG_Modula2";
1547 case translation_unit::LANG_Java:
1549 case translation_unit::LANG_PLI:
1551 case translation_unit::LANG_UPC:
1553 case translation_unit::LANG_D:
1555 case translation_unit::LANG_Python:
1556 return "LANG_Python";
1557 case translation_unit::LANG_Go:
1559 case translation_unit::LANG_Mips_Assembler:
1560 return "LANG_Mips_Assembler";
1562 return "LANG_UNKNOWN";
1565 return "LANG_UNKNOWN";
1577 if (l ==
"LANG_Cobol74")
1578 return translation_unit::LANG_Cobol74;
1579 else if (l ==
"LANG_Cobol85")
1580 return translation_unit::LANG_Cobol85;
1581 else if (l ==
"LANG_C89")
1582 return translation_unit::LANG_C89;
1583 else if (l ==
"LANG_C99")
1584 return translation_unit::LANG_C99;
1585 else if (l ==
"LANG_C11")
1586 return translation_unit::LANG_C11;
1587 else if (l ==
"LANG_C")
1588 return translation_unit::LANG_C;
1589 else if (l ==
"LANG_C_plus_plus_11")
1590 return translation_unit::LANG_C_plus_plus_11;
1591 else if (l ==
"LANG_C_plus_plus_14")
1592 return translation_unit::LANG_C_plus_plus_14;
1593 else if (l ==
"LANG_C_plus_plus")
1594 return translation_unit::LANG_C_plus_plus;
1595 else if (l ==
"LANG_ObjC")
1596 return translation_unit::LANG_ObjC;
1597 else if (l ==
"LANG_ObjC_plus_plus")
1598 return translation_unit::LANG_ObjC_plus_plus;
1599 else if (l ==
"LANG_Fortran77")
1600 return translation_unit::LANG_Fortran77;
1601 else if (l ==
"LANG_Fortran90")
1602 return translation_unit::LANG_Fortran90;
1603 else if (l ==
"LANG_Fortran95")
1604 return translation_unit::LANG_Fortran95;
1605 else if (l ==
"LANG_Ada83")
1606 return translation_unit::LANG_Ada83;
1607 else if (l ==
"LANG_Ada95")
1608 return translation_unit::LANG_Ada95;
1609 else if (l ==
"LANG_Pascal83")
1610 return translation_unit::LANG_Pascal83;
1611 else if (l ==
"LANG_Modula2")
1612 return translation_unit::LANG_Modula2;
1613 else if (l ==
"LANG_Java")
1614 return translation_unit::LANG_Java;
1615 else if (l ==
"LANG_PLI")
1616 return translation_unit::LANG_PLI;
1617 else if (l ==
"LANG_UPC")
1618 return translation_unit::LANG_UPC;
1619 else if (l ==
"LANG_D")
1620 return translation_unit::LANG_D;
1621 else if (l ==
"LANG_Python")
1622 return translation_unit::LANG_Python;
1623 else if (l ==
"LANG_Go")
1624 return translation_unit::LANG_Go;
1625 else if (l ==
"LANG_Mips_Assembler")
1626 return translation_unit::LANG_Mips_Assembler;
1628 return translation_unit::LANG_UNKNOWN;
1639 return (l == translation_unit::LANG_C89
1640 || l == translation_unit::LANG_C99
1641 || l == translation_unit::LANG_C11
1642 || l == translation_unit::LANG_C);
1653 return (l == translation_unit::LANG_C_plus_plus_03
1654 || l == translation_unit::LANG_C_plus_plus_11
1655 || l == translation_unit::LANG_C_plus_plus_14
1656 || l == translation_unit::LANG_C_plus_plus);
1666{
return l == translation_unit::LANG_Java;}
1676 return (l == translation_unit::LANG_Ada83
1677 || l == translation_unit::LANG_Ada95);
1690 if (l.get() == r.get())
1713struct elf_symbol::priv
1753 bool is_in_ksymtab_;
1756 bool is_suppressed_;
1771 is_in_ksymtab_(false),
1774 is_suppressed_(false)
1777 priv(
const environment& e,
1785 const elf_symbol::version& ve,
1807 is_common_ = type_ == COMMON_TYPE;
1841elf_symbol::elf_symbol(
const environment& e,
1917 elf_symbol_sptr sym(
new elf_symbol(e, i, s, n, t, b, d, c, ve, vi,
1919 sym->priv_->main_symbol_ = sym;
1959{
return priv_->env_;}
1966{
return priv_->index_;}
1980{
return priv_->name_;}
1989 priv_->id_string_.clear();
1997{
return priv_->type_;}
2011{
return priv_->size_;}
2018{priv_->size_ = size;}
2025{
return priv_->binding_;}
2032{priv_->binding_ = b;}
2039{
return priv_->version_;}
2047 priv_->version_ = v;
2048 priv_->id_string_.clear();
2057{priv_->visibility_ = v;}
2065{
return priv_->visibility_;}
2073{
return priv_->is_defined_;}
2081{priv_->is_defined_ = d;}
2128{
return priv_->is_in_ksymtab_;}
2143{
return priv_->crc_;}
2157{
return priv_->namespace_;}
2164{priv_->namespace_ = ns;}
2173{
return priv_->is_suppressed_;}
2212{
return priv_->main_symbol_.lock();}
2219{
return priv_->main_symbol_.lock();}
2233{
return priv_->next_alias_.lock();}
2253 a = a->get_next_alias())
2276 a && !a->is_main_symbol();
2277 a = a->get_next_alias())
2279 if (a->get_next_alias()->is_main_symbol())
2287 last_alias->priv_->next_alias_ = alias;
2290 priv_->next_alias_ = alias;
2320 a = a->get_next_alias())
2321 if (a->get_name() == name)
2331 priv_->main_symbol_ = new_main;
2333 a = a->get_next_alias())
2334 a->priv_->main_symbol_ = new_main;
2344{
return priv_->is_common_;}
2375{
return priv_->next_common_instance_.lock();}
2390 ABG_ASSERT(!common->has_other_common_instances());
2399 c = c->get_next_common_instance())
2404 last_common_instance = c;
2409 last_common_instance->priv_->next_common_instance_ = common;
2412 priv_->next_common_instance_ = common;
2432 if (priv_->id_string_.empty())
2444 priv_->id_string_ = s;
2447 return priv_->id_string_;
2464 a = a->get_next_alias())
2465 if (a->get_name() == name)
2482 a && a.get() != a->get_main_symbol().get();
2483 a = a->get_next_alias())
2484 if (textually_equals(*
this, *a))
2501 bool include_symbol_itself)
const
2505 if (include_symbol_itself)
2508 vector<elf_symbol_sptr> aliases;
2509 compute_aliases_for_elf_symbol(*
this, syms, aliases);
2510 if (!aliases.empty() && include_symbol_itself)
2513 for (vector<elf_symbol_sptr>::const_iterator i = aliases.begin();
2517 if (i != aliases.begin())
2519 result += (*i)->get_id_string();
2534 vector<elf_symbol_sptr> aliases;
2535 if (include_symbol_itself)
2540 a = a->get_next_alias())
2541 aliases.push_back(a);
2544 for (vector<elf_symbol_sptr>::const_iterator i = aliases.begin();
2548 if (i != aliases.begin())
2550 result += (*i)->get_id_string();
2570 name.clear(), ver.clear();
2572 string::size_type i =
id.find(
'@');
2573 if (i == string::npos)
2579 name =
id.substr(0, i);
2585 string::size_type j =
id.find(
'@', i);
2586 if (j == string::npos)
2613 bool are_equal = textually_equals(*
this, other);
2634 a && !a->is_main_symbol();
2635 a = a->get_next_alias())
2659 return *lhs == *rhs;
2685compute_aliases_for_elf_symbol(
const elf_symbol& sym,
2687 vector<elf_symbol_sptr>& aliases)
2691 for (; a && !a->is_main_symbol(); a = a->get_next_alias())
2692 aliases.push_back(a);
2694 for (string_elf_symbols_map_type::const_iterator i = symtab.begin();
2697 for (elf_symbols::const_iterator j = i->second.begin();
2698 j != i->second.end();
2703 s && !s->is_main_symbol();
2704 s = s->get_next_alias())
2705 aliases.push_back(s);
2708 s && !s->is_main_symbol();
2709 s = s->get_next_alias())
2711 aliases.push_back(*j);
2756 case elf_symbol::NOTYPE_TYPE:
2757 repr =
"unspecified symbol type";
2759 case elf_symbol::OBJECT_TYPE:
2760 repr =
"variable symbol type";
2762 case elf_symbol::FUNC_TYPE:
2763 repr =
"function symbol type";
2765 case elf_symbol::SECTION_TYPE:
2766 repr =
"section symbol type";
2768 case elf_symbol::FILE_TYPE:
2769 repr =
"file symbol type";
2771 case elf_symbol::COMMON_TYPE:
2772 repr =
"common data object symbol type";
2774 case elf_symbol::TLS_TYPE:
2775 repr =
"thread local data object symbol type";
2777 case elf_symbol::GNU_IFUNC_TYPE:
2778 repr =
"indirect function symbol type";
2782 std::ostringstream s;
2783 s <<
"unknown symbol type (" << (char)t <<
')';
2806 case elf_symbol::LOCAL_BINDING:
2807 repr =
"local binding";
2809 case elf_symbol::GLOBAL_BINDING:
2810 repr =
"global binding";
2812 case elf_symbol::WEAK_BINDING:
2813 repr =
"weak binding";
2815 case elf_symbol::GNU_UNIQUE_BINDING:
2816 repr =
"GNU unique binding";
2820 std::ostringstream s;
2821 s <<
"unknown binding (" << (
unsigned char) b <<
")";
2844 case elf_symbol::DEFAULT_VISIBILITY:
2845 repr =
"default visibility";
2847 case elf_symbol::PROTECTED_VISIBILITY:
2848 repr =
"protected visibility";
2850 case elf_symbol::HIDDEN_VISIBILITY:
2851 repr =
"hidden visibility";
2853 case elf_symbol::INTERNAL_VISIBILITY:
2854 repr =
"internal visibility";
2858 std::ostringstream s;
2859 s <<
"unknown visibility (" << (
unsigned char) v <<
")";
2881 t = elf_symbol::NOTYPE_TYPE;
2882 else if (s ==
"object-type")
2883 t = elf_symbol::OBJECT_TYPE;
2884 else if (s ==
"func-type")
2885 t = elf_symbol::FUNC_TYPE;
2886 else if (s ==
"section-type")
2887 t = elf_symbol::SECTION_TYPE;
2888 else if (s ==
"file-type")
2889 t = elf_symbol::FILE_TYPE;
2890 else if (s ==
"common-type")
2891 t = elf_symbol::COMMON_TYPE;
2892 else if (s ==
"tls-type")
2893 t = elf_symbol::TLS_TYPE;
2894 else if (s ==
"gnu-ifunc-type")
2895 t = elf_symbol::GNU_IFUNC_TYPE;
2913 if (s ==
"local-binding")
2914 b = elf_symbol::LOCAL_BINDING;
2915 else if (s ==
"global-binding")
2916 b = elf_symbol::GLOBAL_BINDING;
2917 else if (s ==
"weak-binding")
2918 b = elf_symbol::WEAK_BINDING;
2919 else if (s ==
"gnu-unique-binding")
2920 b = elf_symbol::GNU_UNIQUE_BINDING;
2938 if (s ==
"default-visibility")
2939 v = elf_symbol::DEFAULT_VISIBILITY;
2940 else if (s ==
"protected-visibility")
2941 v = elf_symbol::PROTECTED_VISIBILITY;
2942 else if (s ==
"hidden-visibility")
2943 v = elf_symbol::HIDDEN_VISIBILITY;
2944 else if (s ==
"internal-visibility")
2945 v = elf_symbol::INTERNAL_VISIBILITY;
2960{
return t == elf_symbol::FUNC_TYPE;}
2970{
return t == elf_symbol::OBJECT_TYPE;}
2974struct elf_symbol::version::priv
2980 : is_default_(false)
2983 priv(
const string& v,
2990elf_symbol::version::version()
2997elf_symbol::version::version(
const string& v,
2999 : priv_(new priv(v, is_default))
3003 : priv_(new priv(v.str(), v.is_default()))
3007elf_symbol::version::~version() =
default;
3012elf_symbol::version::operator
const string&()
const
3013{
return priv_->version_;}
3020{
return priv_->version_;}
3027{priv_->version_ = s;}
3034{
return priv_->is_default_;}
3041{priv_->is_default_ = f;}
3044elf_symbol::version::is_empty()
const
3045{
return str().empty();}
3054{
return str() == o.
str();}
3083struct dm_context_rel::priv
3086 size_t offset_in_bits_;
3089 priv(
bool is_static =
false)
3090 : is_laid_out_(!is_static),
3092 anonymous_data_member_()
3095 priv(
bool is_laid_out,
size_t offset_in_bits)
3096 : is_laid_out_(is_laid_out),
3097 offset_in_bits_(offset_in_bits),
3098 anonymous_data_member_()
3102dm_context_rel::dm_context_rel()
3107dm_context_rel::dm_context_rel(scope_decl* s,
3109 size_t offset_in_bits,
3112 : context_rel(s, a, is_static),
3113 priv_(new priv(is_laid_out, offset_in_bits))
3116dm_context_rel::dm_context_rel(scope_decl* s)
3122dm_context_rel::get_is_laid_out()
const
3123{
return priv_->is_laid_out_;}
3126dm_context_rel::set_is_laid_out(
bool f)
3127{priv_->is_laid_out_ = f;}
3130dm_context_rel::get_offset_in_bits()
const
3131{
return priv_->offset_in_bits_;}
3134dm_context_rel::set_offset_in_bits(
size_t o)
3135{priv_->offset_in_bits_ = o;}
3138dm_context_rel::operator==(
const dm_context_rel& o)
const
3140 if (!context_rel::operator==(o))
3143 return (priv_->is_laid_out_ == o.priv_->is_laid_out_
3144 && priv_->offset_in_bits_ == o.priv_->offset_in_bits_);
3148dm_context_rel::operator!=(
const dm_context_rel& o)
const
3159{
return priv_->anonymous_data_member_;}
3169{priv_->anonymous_data_member_ = anon_dm;}
3171dm_context_rel::~dm_context_rel()
3197{
return priv_->canonical_types_;}
3210is_ptr_ref_or_qual_type(
const type_base *t)
3227compare_using_locations(
const decl_base *f,
3241 unsigned l1 = 0, l2 = 0, c1 = 0, c2 = 0;
3264struct decl_topo_comp
3275 operator()(
const decl_base *f,
3294 if ((!f->get_corpus() && !s->get_corpus())
3295 || (f->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN
3296 && s->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN))
3297 return compare_using_locations(f, s);
3304 if (fl.get_value() && sl.get_value())
3305 return compare_using_locations(f, s);
3306 else if (!!fl != !!sl)
3313 if (f->get_is_anonymous()
3314 && s->get_is_anonymous()
3317 return f->get_name() < s->get_name();
3331 operator()(
const decl_base_sptr &f,
3332 const decl_base_sptr &s)
3333 {
return operator()(f.get(), s.get());}
3344struct type_topo_comp
3352 has_artificial_or_natural_location(
const decl_base* d)
3361 has_artificial_or_natural_location(
const type_base* t)
3363 if (decl_base *d =
is_decl(t))
3364 return has_artificial_or_natural_location(d);
3376 operator()(
const type_base_sptr &f,
3377 const type_base_sptr &s)
3378 {
return operator()(f.get(), s.get());}
3388 operator()(
const type_base *f,
3393 if ((!f->get_corpus() && !s->get_corpus())
3394 || (f->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN
3395 && s->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN))
3398 bool f_is_ptr_ref_or_qual = is_ptr_ref_or_qual_type(f);
3399 bool s_is_ptr_ref_or_qual = is_ptr_ref_or_qual_type(s);
3401 if (f_is_ptr_ref_or_qual != s_is_ptr_ref_or_qual)
3402 return !f_is_ptr_ref_or_qual && s_is_ptr_ref_or_qual;
3404 if (f_is_ptr_ref_or_qual && s_is_ptr_ref_or_qual
3405 && !has_artificial_or_natural_location(f)
3406 && !has_artificial_or_natural_location(s))
3414 if (q->get_cv_quals() == qualified_type_def::CV_NONE)
3446 type_base *peeled_f =
3448 type_base *peeled_s =
3505 decl_topo_comp decl_comp;
3506 return decl_comp(fd, sd);
3517 vector<type_base_sptr>& result)
3520 result.push_back(t);
3522 type_topo_comp comp;
3523 std::stable_sort(result.begin(), result.end(), comp);
3535const type_base_sptr&
3538 if (!priv_->void_type_)
3539 priv_->void_type_.reset(
new type_decl(*
this,
3542 return priv_->void_type_;
3554const type_base_sptr&
3557 if (!priv_->void_pointer_type_)
3560 return priv_->void_pointer_type_;
3573const type_base_sptr&
3576 if (!priv_->variadic_marker_type_)
3577 priv_->variadic_marker_type_.
3580 return priv_->variadic_marker_type_;
3589 static string variadic_parameter_type_name =
"variadic parameter type";
3590 return variadic_parameter_type_name;
3600{
return priv_->canonicalization_is_done_;}
3614{priv_->canonicalization_is_done_ = f;}
3623{
return priv_->do_on_the_fly_canonicalization_;}
3632{priv_->do_on_the_fly_canonicalization_ = f;}
3656{
return priv_->decl_only_class_equals_definition_;}
3681{priv_->decl_only_class_equals_definition_ = f;}
3786{
return const_cast<environment*
>(
this)->priv_->string_pool_.create_string(s);}
3793{
return priv_->config_;}
3803{
return priv_->analyze_exported_interfaces_only_.has_value();}
3816{priv_->analyze_exported_interfaces_only_ = f;}
3829{
return priv_->analyze_exported_interfaces_only_.value_or(
false);}
3831#ifdef WITH_DEBUG_SELF_COMPARISON
3844environment::set_self_comparison_debug_input(
const corpus_sptr& c)
3846 self_comparison_debug_is_on(
true);
3847 if (priv_->first_self_comparison_corpus_.expired())
3848 priv_->first_self_comparison_corpus_ = c;
3849 else if (priv_->second_self_comparison_corpus_.expired()
3850 && c.get() != corpus_sptr(priv_->first_self_comparison_corpus_).get())
3851 priv_->second_self_comparison_corpus_ = c;
3864environment::get_self_comparison_debug_inputs(corpus_sptr& first_corpus,
3865 corpus_sptr& second_corpus)
3867 first_corpus = priv_->first_self_comparison_corpus_.lock();
3868 second_corpus = priv_->second_self_comparison_corpus_.lock();
3875environment::self_comparison_debug_is_on(
bool f)
3876{priv_->self_comparison_debug_on_ = f;}
3883environment::self_comparison_debug_is_on()
const
3884{
return priv_->self_comparison_debug_on_;}
3887#ifdef WITH_DEBUG_TYPE_CANONICALIZATION
3894environment::debug_type_canonicalization_is_on(
bool flag)
3895{priv_->debug_type_canonicalization_ = flag;}
3903environment::debug_type_canonicalization_is_on()
const
3904{
return priv_->debug_type_canonicalization_;}
3912environment::debug_die_canonicalization_is_on(
bool flag)
3913{priv_->debug_die_canonicalization_ = flag;}
3921environment::debug_die_canonicalization_is_on()
const
3922{
return priv_->debug_die_canonicalization_;}
3938vector<type_base_sptr>*
3965 if (!types ||index >= types->size())
3967 return (*types)[index].get();
3970#ifdef WITH_DEBUG_SELF_COMPARISON
3980const unordered_map<string, uintptr_t>&
3981environment::get_type_id_canonical_type_map()
const
3982{
return priv_->get_type_id_canonical_type_map();}
3993unordered_map<string, uintptr_t>&
3994environment::get_type_id_canonical_type_map()
3995{
return priv_->get_type_id_canonical_type_map();}
4010const unordered_map<uintptr_t, string>&
4011environment::get_pointer_type_id_map()
const
4012{
return priv_->get_pointer_type_id_map();}
4027unordered_map<uintptr_t, string>&
4028environment::get_pointer_type_id_map()
4029{
return priv_->get_pointer_type_id_map();}
4047environment::get_type_id_from_pointer(uintptr_t ptr)
const
4048{
return priv_->get_type_id_from_pointer(ptr);}
4066environment::get_type_id_from_type(
const type_base *t)
const
4067{
return priv_->get_type_id_from_type(t);}
4084environment::get_canonical_type_from_type_id(
const char* type_id)
const
4085{
return priv_->get_canonical_type_from_type_id(type_id);}
4093struct type_or_decl_base::priv
4111 void* type_or_decl_ptr_;
4112 bool hashing_started_;
4113 const environment& env_;
4114 translation_unit* translation_unit_;
4119 location artificial_location_;
4123 bool is_artificial_;
4131 priv(
const environment& e,
4135 type_or_decl_ptr_(),
4138 translation_unit_(),
4158 (
static_cast<unsigned>(l) |
static_cast<unsigned>(r));
4178 (
static_cast<unsigned>(l) &
static_cast<unsigned>(r));
4199 :priv_(new priv(e, k))
4215{
return priv_->is_artificial_;}
4227{priv_->is_artificial_ = f;}
4238{
return priv_->kind();}
4258{
return priv_->rtti_;}
4267{
return priv_->rtti_;}
4279 priv_->type_or_decl_ptr_ = t;
4281 priv_->type_or_decl_ptr_ = d;
4304{
return priv_->type_or_decl_ptr_;}
4311{
return priv_->hashing_started_;}
4318{priv_->hashing_started_ = b;}
4325{
return priv_->env_;}
4343{priv_->artificial_location_ = l;}
4361{
return priv_->artificial_location_;}
4369 return (priv_->artificial_location_
4370 && priv_->artificial_location_.get_is_artificial());
4401{priv_->translation_unit_ = tu;}
4410{
return priv_->translation_unit_;}
4442 *dr =
dynamic_cast<const decl_base*
>(r);
4451 *tr =
dynamic_cast<const type_base*
>(r);
4496struct decl_base::priv
4498 bool in_pub_sym_tab_;
4524 decl_base_sptr declaration_;
4526 decl_base* naked_definition_of_declaration_;
4527 bool is_declaration_only_;
4531 : in_pub_sym_tab_(false),
4532 is_anonymous_(true),
4534 visibility_(VISIBILITY_DEFAULT),
4535 naked_definition_of_declaration_(),
4536 is_declaration_only_(false)
4539 priv(interned_string name, interned_string linkage_name,
visibility vis)
4540 : in_pub_sym_tab_(false),
4543 qualified_name_(name),
4544 linkage_name_(linkage_name),
4546 naked_definition_of_declaration_(),
4547 is_declaration_only_(false)
4549 is_anonymous_ = name_.
empty();
4574 const string& linkage_name,
4577 priv_(new priv(e.intern(name), e.intern(linkage_name), vis))
4601 priv_(new priv(name, linkage_name, vis))
4628{
return priv_->qualified_name_;}
4637{priv_->qualified_name_.clear();}
4644{priv_->qualified_name_ = n;}
4657{
return priv_->temporary_qualified_name_;}
4671{priv_->temporary_qualified_name_ = n;}
4678{
return priv_->context_;}
4685{
return priv_->context_;}
4689{priv_->context_ = c;}
4720{
return priv_->in_pub_sym_tab_;}
4728{priv_->in_pub_sym_tab_ = f;}
4748{
return priv_->location_;}
4790 priv_->location_ = l;
4800 priv_->is_anonymous_ = n.empty();
4811{
return priv_->is_anonymous_;}
4821{priv_->is_anonymous_ = f;}
4858{
return priv_->naming_typedef_;}
4886 &&
is_type(
this)->get_naked_canonical_type() ==
nullptr);
4888 priv_->naming_typedef_ = t;
4895 update_qualified_name(
this);
4903{
return priv_->linkage_name_;}
4912 priv_->linkage_name_ = env.
intern(m);
4920{
return priv_->visibility_;}
4927{priv_->visibility_ = v;}
4936 if (priv_->context_)
4937 return priv_->context_->get_scope();
4947{
return priv_->qualified_parent_name_;}
4954{
return priv_->name_;}
4989 bool qualified_name)
const
4993 && has_generic_anonymous_internal_type_name(
this))
5004 string name = get_generic_anonymous_internal_type_name(
this);
5032{
return priv_->qualified_name_;}
5046{
return priv_->scoped_name_;}
5054{
return priv_->declaration_;}
5063 if (d && d->get_is_declaration_only())
5064 priv_->declaration_ = d;
5074{
return priv_->definition_of_declaration_.lock();}
5090{
return priv_->naked_definition_of_declaration_;}
5097{
return priv_->is_declaration_only_;}
5107 bool update_types_lookup_map = !f && priv_->is_declaration_only_;
5109 priv_->is_declaration_only_ = f;
5111 if (update_types_lookup_map)
5114 scope_decl::declarations::iterator i;
5115 if (s->find_iterator_for_member(
this, i))
5125 return static_cast<change_kind>(
static_cast<unsigned>(l)
5126 |
static_cast<unsigned>(r));
5132 return static_cast<change_kind>(
static_cast<unsigned>(l)
5133 &
static_cast<unsigned>(r));
5180 bool member_types_or_functions =
5184 if (member_types_or_functions)
5193 la = r1->get_access_specifier();
5194 ra = r2->get_access_specifier();
5195 r1->set_access_specifier(no_access);
5196 r2->set_access_specifier(no_access);
5199 bool rels_are_different = *r1 != *r2;
5201 if (member_types_or_functions)
5204 r1->set_access_specifier(la);
5205 r2->set_access_specifier(ra);
5208 if (rels_are_different)
5229get_decl_name_for_comparison(
const decl_base &d)
5231 if (has_generic_anonymous_internal_type_name(&d)
5237 r += get_generic_anonymous_internal_type_name(&d);
5273 if (!l_linkage_name.
empty() && !r_linkage_name.
empty())
5275 if (l_linkage_name != r_linkage_name)
5310 bool decls_are_same = (ln == rn);
5319 decls_are_same =
true;
5329 if (!decls_are_same)
5352{
return equals(*
this, other, 0);}
5391 if (!priv_->context_)
5394 priv_->context_->set_scope(scope);
5412 case decl_base::VISIBILITY_NONE:
5415 case decl_base::VISIBILITY_DEFAULT:
5418 case decl_base::VISIBILITY_PROTECTED:
5421 case decl_base::VISIBILITY_HIDDEN:
5424 case decl_base::VISIBILITY_INTERNAL:
5444 case decl_base::BINDING_NONE:
5447 case decl_base::BINDING_LOCAL:
5450 case decl_base::BINDING_GLOBAL:
5453 case decl_base::BINDING_WEAK:
5476 if (l.get() == r.get())
5512 if (l.get() == r.get())
5598{
return dynamic_pointer_cast<scope_decl>(d);}
5664 return c->get_access_specifier();
5694 c->set_access_specifier(a);
5724 return c->get_is_static();
5866 var_decl_sptr first = *klass->get_non_static_data_members().begin();
5887 if (!klass ||!data_member)
5890 for (class_or_union::data_members::const_iterator it =
5894 if (**it == *data_member)
6081 return class_or_union_sptr();
6090const class_or_union_sptr
6095 if (cou->get_is_anonymous())
6098 return class_or_union_sptr();
6107const class_or_union_sptr
6112 return class_or_union_sptr();
6121const class_or_union_sptr
6136 return class_or_union_sptr();
6161 for (
auto anon_dm_m : cl->get_non_static_data_members())
6208 ctxt_rel->set_offset_in_bits(o);
6223 return ctxt_rel->get_offset_in_bits();
6313 const var_decl *containing_anonymous_data_member =
6316 uint64_t containing_anonymous_data_member_offset = 0;
6317 if (containing_anonymous_data_member)
6318 containing_anonymous_data_member_offset =
6321 return (ctxt_rel->get_offset_in_bits()
6323 containing_anonymous_data_member_offset);
6351 type_base_sptr t = v->get_type();
6354 return t->get_size_in_bits();
6368 ctxt_rel->set_is_laid_out(l);
6383 return ctxt_rel->get_is_laid_out();
6685 return ctxt->is_virtual();
6722 ctxt->is_virtual(is_virtual);
6737 (dynamic_pointer_cast<method_decl>(fn));
6775 if (!cl->get_canonical_type())
6781 type_base_sptr t = type;
6792 ty->get_size_in_bits(),
6793 ty->get_alignment_in_bits(),
6794 ty->get_location()));
6802 ty->get_size_in_bits(),
6803 ty->get_alignment_in_bits(),
6804 ty->get_location()));
6813 ty->get_location()));
6819 t.reset(
new array_type_def(p, ty->get_subranges(), ty->get_location()));
6824 for (function_decl::parameters::const_iterator i =
6825 ty->get_parameters().begin();
6826 i != ty->get_parameters().end();
6837 p->get_variadic_marker(),
6838 p->get_is_artificial()));
6839 parm.push_back(stripped);
6844 parm, ty->get_is_const(),
6845 ty->get_size_in_bits(),
6846 ty->get_alignment_in_bits()));
6851 for (function_decl::parameters::const_iterator i =
6852 ty->get_parameters().begin();
6853 i != ty->get_parameters().end();
6864 p->get_variadic_marker(),
6865 p->get_is_artificial()));
6866 parm.push_back(stripped);
6871 ty->get_size_in_bits(),
6872 ty->get_alignment_in_bits()));
6875 if (!t->get_translation_unit())
6876 t->set_translation_unit(type->get_translation_unit());
6881 return t->get_canonical_type() ? t->get_canonical_type() : t;
6904 decl_base_sptr result = t;
6905 type_base_sptr u = t->get_underlying_type();
6908 if ((t->get_cv_quals() & qualified_type_def::CV_CONST
6910 || (t->get_cv_quals() & qualified_type_def::CV_CONST
6912 || t->get_cv_quals() == qualified_type_def::CV_NONE)
6958static qualified_type_def_sptr
6959strip_redundant_quals_from_underyling_types(
const qualified_type_def_sptr& t,
6968 qualified_type_def_sptr underlying_qualified_type =
6976 currated_quals &= ~redundant_quals;
6977 t->set_cv_quals(currated_quals);
6981 redundant_quals |= currated_quals;
6983 qualified_type_def_sptr result = t;
6984 if (underlying_qualified_type)
6988 strip_redundant_quals_from_underyling_types(underlying_qualified_type,
7022strip_redundant_quals_from_underyling_types(
const qualified_type_def_sptr& t)
7028 strip_redundant_quals_from_underyling_types(t, redundant_quals);
7055 return t->get_underlying_type();
7109 return t->get_pointed_to_type();
7165 return t->get_pointed_to_type();
7323 type_base_sptr type = t;
7346 type_base_sptr typ = type;
7408 bool peel_qual_type)
7447 bool peel_qual_type)
7485 vector<array_type_def::subrange_sptr> subranges;
7487 for (vector<array_type_def::subrange_sptr>::const_iterator i =
7488 array->get_subranges().begin();
7489 i != array->get_subranges().end();
7495 (*i)->get_lower_bound(),
7496 (*i)->get_upper_bound(),
7497 (*i)->get_underlying_type(),
7498 (*i)->get_location(),
7499 (*i)->get_language()));
7500 subrange->is_infinite((*i)->is_infinite());
7503 subranges.push_back(subrange);
7508 subranges, array->get_location()));
7531 (
new typedef_decl(t->get_name(), t->get_underlying_type(),
7532 t->get_location(), t->get_linkage_name(),
7533 t->get_visibility()));
7549qualified_type_def_sptr
7555 qualified_type_def_sptr result
7557 t->get_cv_quals(), t->get_location()));
7569static type_base_sptr
7570clone_typedef_array_qualified_type(type_base_sptr type)
7576 type_base_sptr result;
7585 return type_base_sptr();
7608 type_base_sptr result = clone_typedef_array_qualified_type(t);
7611 type_base_sptr subtree;
7615 clone_typedef_array_qualified_type(type->get_underlying_type());
7619 type->set_underlying_type(subtree);
7625 clone_typedef_array_qualified_type(type->get_element_type());
7629 type->set_element_type(subtree);
7639 clone_typedef_array_qualified_type(t->get_underlying_type());
7646 t->set_underlying_type (s);
7655 clone_typedef_array_qualified_type(t->get_underlying_type());
7662 t->set_underlying_type(s);
7670 type_base_sptr e = t->get_element_type();
7674 clone_typedef_array_qualified_type(e);
7680 t->set_element_type(s);
7699 ::qualified_name_setter setter;
7707update_qualified_name(decl_base_sptr d)
7708{
return update_qualified_name(d.get());}
7728{
return reinterpret_cast<size_t>(l);}
7730struct scope_decl::priv
7775{
return priv_->canonical_types_;}
7793 if (priv_->sorted_canonical_types_.empty())
7795 for (canonical_type_sptr_set_type::const_iterator e =
7799 priv_->sorted_canonical_types_.push_back(*e);
7801 type_topo_comp comp;
7802 std::stable_sort(priv_->sorted_canonical_types_.begin(),
7803 priv_->sorted_canonical_types_.end(),
7806 return priv_->sorted_canonical_types_;
7816{
return priv_->members_;}
7825{
return priv_->members_;}
7835 decl_topo_comp comp;
7836 if (priv_->sorted_members_.empty())
7841 priv_->sorted_members_.push_back(*i);
7843 std::stable_sort(priv_->sorted_members_.begin(),
7844 priv_->sorted_members_.end(),
7847 return priv_->sorted_members_;
7862 if (t->get_is_anonymous())
7880 if (t->get_is_anonymous())
7898 if (t->get_is_anonymous())
7909{
return priv_->member_scopes_;}
7916{
return priv_->member_scopes_;}
7942 member->set_scope(
this);
7943 priv_->members_.push_back(member);
7945 priv_->member_types_.push_back(
is_type(member));
7948 priv_->member_scopes_.push_back(m);
7950 update_qualified_name(member);
7957 member->set_translation_unit(tu);
7970{
return priv_->member_types_;}
7985 return type_base_sptr();
7995 declarations::iterator before)
8001 priv_->member_types_.push_back(t);
8037 for (
auto i = priv_->member_types_.begin();
8038 i != priv_->member_types_.end();
8043 priv_->member_types_.erase(i);
8056 if (priv_->sorted_member_types_.empty())
8059 priv_->sorted_member_types_.push_back(t);
8061 type_topo_comp comp;
8062 std::stable_sort(priv_->sorted_member_types_.begin(),
8063 priv_->sorted_member_types_.end(),
8066 return priv_->sorted_member_types_;
8082 declarations::iterator before)
8086 member->set_scope(
this);
8087 priv_->members_.insert(before, member);
8090 priv_-> member_scopes_.push_back(m);
8092 update_qualified_name(member);
8099 member->set_translation_unit(tu);
8113 for (declarations::iterator i = priv_->members_.begin();
8114 i != priv_->members_.end();
8119 priv_->members_.erase(i);
8129 for (scopes::iterator i = priv_->member_scopes_.begin();
8130 i != priv_->member_scopes_.end();
8135 priv_->member_scopes_.erase(i);
8151 return hash_scope(
this);
8178 if (!l.decl_base::operator==(r))
8187 scope_decl::declarations::const_iterator i, j;
8229 return equals(*
this, *other, 0);
8244 if (l.get() == r.get())
8270 declarations::iterator& i)
8285 if ((*it).get() == decl)
8305 declarations::iterator& i)
8322 if (v.visit_begin(
this))
8325 for (scope_decl::declarations::const_iterator i =
8329 if (!(*i)->traverse(v))
8333 return v.visit_end(
this);
8336scope_decl::~scope_decl()
8351 if (scope && decl && !decl->
get_scope())
8392 scope_decl::declarations::iterator before,
8395 if (scope && decl && !decl->
get_scope())
8414 scope_decl::declarations::iterator before,
8424 | ABSTRACT_DECL_BASE
8425 | ABSTRACT_SCOPE_DECL),
8428 translation_unit_(tu)
8430 runtime_type_instance(
this);
8449 return scope ?
dynamic_cast<global_scope*
> (scope) : 0;
8556 if (cv_quals & qualified_type_def::CV_RESTRICT)
8558 if (cv_quals & qualified_type_def::CV_CONST)
8564 if (cv_quals & qualified_type_def::CV_VOLATILE)
8616{
return get_name(tod.get(), qualified);}
8634 string qualified_name;
8638 if (qualified_name.empty())
8639 qualified_name = name;
8641 qualified_name = qualified_name +
"::" + name;
8643 return qualified_name;
8678 location loc = decl->get_location();
8682 if (c->get_is_declaration_only() && c->get_definition_of_declaration())
8685 loc = c->get_location();
8743has_generic_anonymous_internal_type_name(
const decl_base *d)
8760static interned_string
8761get_generic_anonymous_internal_type_name(
const decl_base *d)
8763 ABG_ASSERT(has_generic_anonymous_internal_type_name(d));
8765 const environment&env = d->get_environment();
8767 interned_string result;
8800get_internal_integral_type_name(
const type_base* t)
8808 integral_type int_type;
8810 name = int_type.to_string(
true);
8848 r += get_generic_anonymous_internal_type_name(d);
8856 return env.
intern(get_internal_integral_type_name(t));
8895 bool qualified,
bool internal)
8898 string tn =
get_type_name(pointed_to_type, qualified, internal);
8917 bool lvalue_reference,
8918 bool qualified,
bool internal)
8922 string name =
get_type_name(pointed_to_type, qualified, internal);
8923 if (lvalue_reference)
8948 bool qualified,
bool internal)
8950 const environment& env = underlying_type->get_environment();
8953 string name =
get_type_name(underlying_type, qualified, internal);
8955 if (quals_repr.empty() && internal)
8967 if (!quals_repr.empty())
8976 name = quals_repr +
" " + name;
9033 std::ostringstream o;
9038 type_base_sptr return_type =
9047 type_base_sptr type;
9048 for (function_type::parameters::const_iterator i =
9055 type = (*i)->get_type();
9062 return env.
intern(o.str());
9081 c->get_exported_decls_builder();
9082 if (b->fn_id_maps_to_several_fns(fn))
9138 std::ostringstream o;
9143 type_base_sptr return_type =
9150 o << return_type->get_cached_pretty_representation(internal);
9159 o <<
" (" << class_type->get_qualified_name(internal) <<
"::*)"
9162 type_base_sptr type;
9163 for (function_type::parameters::const_iterator i =
9170 type = (*i)->get_type();
9174 o << type->get_cached_pretty_representation(internal);
9182 return env.
intern(o.str());
9348 std::ostringstream o;
9366 std::ostringstream o;
9421 const string& indent,
9424 bool qualified_names)
9427 string local_indent =
" ";
9432 if (!internal && clazz->is_struct())
9438 repr = indent +
"union";
9456 for (class_or_union::data_members::const_iterator dm = dmems.begin();
9460 if (dm != dmems.begin())
9465 real_indent =
"\n" + indent + local_indent;
9472 real_indent, one_line, internal, qualified_names);
9477 if (dm != dmems.begin())
9478 repr += real_indent;
9479 repr += (*dm)->get_pretty_representation(internal,
9484 real_indent+ (*dm)->get_pretty_representation(internal,
9493 repr += indent +
"}";
9516 const string& indent,
9519 bool qualified_names)
9523 internal, qualified_names);
9545 const string& indent,
9548 bool qualified_names)
9576 std::ostringstream o;
9591 o <<
" :" << std::endl;
9595 if (b->get_is_virtual())
9597 o << b->get_base_class()->get_qualified_name()
9607 <<
" // @: " << std::hex <<
is_type(c)
9613 type_base_sptr t = m->get_type();
9617 << m->get_pretty_representation(
false,
9621 if (t && t->get_canonical_type())
9622 o <<
" // uses canonical type '@"
9623 << std::hex << t->get_canonical_type().get() << std::dec;
9625 o <<
"'" << std::endl;
9630 o <<
" // virtual member functions\n\n";
9632 o <<
" " << f->get_pretty_representation(
false,
9634 <<
";" << std::endl;
9637 o <<
"};" << std::endl;
9643 string name = e->get_qualified_name();
9644 std::ostringstream o;
9645 o <<
"union " << name
9647 << e->get_underlying_type()->get_pretty_representation(
false,
9651 <<
" // size in bits: " << e->get_size_in_bits() <<
"\n"
9652 <<
" // is-declaration-only: " << e->get_is_declaration_only() <<
"\n"
9654 <<
" // translation unit: "
9655 << e->get_translation_unit()->get_absolute_path() <<
"\n"
9656 <<
" // @: " << std::hex <<
is_type(e)
9657 <<
", @canonical: " << e->get_canonical_type().get() << std::dec
9660 for (
const auto &enom : e->get_enumerators())
9661 o <<
" " << enom.get_name() <<
" = " << enom.get_value() <<
",\n";
9667 return artifact->get_pretty_representation(
true,
9766 return const_cast<type_base*
>(artifact);
9783 return const_cast<decl_base*
>(artifact);
9813debug_comp_vec(
const vector<const type_base*>& vect, std::ostringstream& o)
9817 o <<
"|" << t->get_pretty_representation()
9818 <<
"@" << std::hex << t << std::dec;
9830print_comp_stack(
const environment& env)
9832 std::ostringstream o;
9833 o <<
"left-operands: ";
9834 debug_comp_vec(env.priv_->left_type_comp_operands_, o);
9835 o <<
"\n" <<
"right-operands: ";
9836 debug_comp_vec(env.priv_->right_type_comp_operands_, o);
9849 std::cerr << print_comp_stack(env);
9850 std::cerr << std::endl;
9882{
return dynamic_cast<const decl_base*
>(t);}
9900{
return dynamic_pointer_cast<decl_base>(t);}
9916 const type_base_sptr type2)
9918 if (!type1 || !type2)
9954 const decl_base_sptr d2)
10092 const string& name)
10097 if (!containing_class_or_union)
10114{
return (decl &&
dynamic_cast<template_decl*
>(decl->get_scope()));}
10124 return (decl && (dynamic_pointer_cast<type_tparameter>(decl)
10125 || dynamic_pointer_cast<non_type_tparameter>(decl)
10126 || dynamic_pointer_cast<template_tparameter>(decl)));
10156{
return dynamic_pointer_cast<function_decl>(d);}
10179{
return dynamic_pointer_cast<function_decl::parameter>(tod);}
10190 if (d && (d->
kind() & type_or_decl_base::ABSTRACT_DECL_BASE))
10192 if (!(d->
kind() & type_or_decl_base::ABSTRACT_TYPE_BASE))
10218{
return dynamic_pointer_cast<decl_base>(d);}
10240{
return dynamic_pointer_cast<decl_base>(t);}
10250 if (
dynamic_cast<const type_base*
>(&tod))
10263 if (t && (t->
kind() & type_or_decl_base::ABSTRACT_TYPE_BASE))
10277{
return dynamic_pointer_cast<type_base>(tod);}
10309 if (!cou->get_naming_typedef())
10333{
return dynamic_cast<const type_decl*
>(t);}
10341{
return dynamic_pointer_cast<type_decl>(t);}
10391{
return dynamic_pointer_cast<typedef_decl>(t);}
10472{
return dynamic_pointer_cast<enum_type_decl>(d);}
10526 if (t->
kind() & type_or_decl_base::CLASS_TYPE)
10540{
return dynamic_pointer_cast<class_decl>(d);}
10560 return klass->get_is_declaration_only();
10595shared_ptr<class_or_union>
10597{
return dynamic_pointer_cast<class_or_union>(t);}
10626{
return dynamic_pointer_cast<union_decl>(t);}
10640 if (t->
kind() & type_or_decl_base::POINTER_TYPE)
10667{
return dynamic_pointer_cast<pointer_type_def>(t);}
10763{
return dynamic_pointer_cast<reference_type_def>(t);}
10836const type_base_sptr
10839 type_base_sptr nil;
10843 if (t->get_environment().get_void_pointer_type().get() == t.get())
10872qualified_type_def_sptr
10874{
return dynamic_pointer_cast<qualified_type_def>(t);}
10884{
return dynamic_pointer_cast<function_type>(t);}
10914{
return dynamic_pointer_cast<method_type>(t);}
10994 decl_base_sptr decl;
11001 while (decl->get_is_declaration_only()
11002 && decl->get_definition_of_declaration())
11003 decl = decl->get_definition_of_declaration();
11070 decl_base_sptr d =
is_decl(t);
11095{
return dynamic_pointer_cast<var_decl>(decl);}
11104{
return dynamic_pointer_cast<namespace_decl>(d);}
11138 && dynamic_pointer_cast<function_decl>(decl)
11158{
return dynamic_pointer_cast<array_type_def>(type);}
11166qualified_type_def_sptr
11170 return qualified_type_def_sptr();
11225array_type_def::subrange_type*
11240{
return dynamic_pointer_cast<array_type_def::subrange_type>(type);}
11250{
return decl && dynamic_pointer_cast<template_decl>(decl);}
11256 LOOKUP_ENTITY_TYPE,
11288find_next_delim_in_cplus_type(
const string& fqn,
11292 int angle_count = 0;
11293 bool found =
false;
11295 for (; i < fqn.size(); ++i)
11299 else if (fqn[i] ==
'>')
11301 else if (i + 1 < fqn.size()
11304 && fqn[i+1] ==
':')
11321 list<string>& comps)
11323 string::size_type fqn_size = fqn.size(), comp_begin = 0, comp_end = fqn_size;
11326 if (!find_next_delim_in_cplus_type(fqn, comp_begin, comp_end))
11327 comp_end = fqn_size;
11329 string comp = fqn.substr(comp_begin, comp_end - comp_begin);
11330 comps.push_back(comp);
11332 comp_begin = comp_end + 2;
11333 if (comp_begin >= fqn_size)
11349 for (list<string>::const_iterator c = comps.begin();
11352 if (c == comps.begin())
11355 result +=
"::" + *c;
11370template<
typename T>
11372iterator_is_last(T& container,
11373 typename T::const_iterator i)
11375 typename T::const_iterator next = i;
11377 return (next == container.end());
11394lookup_types_in_map(
const interned_string& type_name,
11397 istring_type_base_wptrs_map_type::const_iterator i = type_map.find(type_name);
11398 if (i != type_map.end())
11419template <
class TypeKind>
11420static shared_ptr<TypeKind>
11421lookup_type_in_map(
const interned_string& type_name,
11424 istring_type_base_wptrs_map_type::const_iterator i = type_map.find(type_name);
11425 if (i != type_map.end())
11429 for (
auto j : i->second)
11431 type_base_sptr t(j);
11432 decl_base_sptr d =
is_decl(t);
11433 if (d && !d->get_is_declaration_only())
11434 return dynamic_pointer_cast<TypeKind>(type_base_sptr(j));
11439 return dynamic_pointer_cast<TypeKind>(type_base_sptr(i->second.back()));
11441 return shared_ptr<TypeKind>();
11458 return lookup_type_in_map<type_decl>(type_name,
11517 return lookup_type_in_map<class_decl>(type_name,
11535 return lookup_type_in_map<union_decl>(type_name,
11570 union_decl_sptr result = lookup_type_in_map<union_decl>(loc, m);
11603 return lookup_type_in_map<enum_type_decl>(type_name,
11642 return lookup_type_in_map<typedef_decl>(type_name,
11678qualified_type_def_sptr
11683 return lookup_type_in_map<qualified_type_def>(type_name,
11702qualified_type_def_sptr
11729 return lookup_type_in_map<pointer_type_def>(type_name,
11791 return lookup_type_in_map<reference_type_def>(type_name,
11810 bool lvalue_reference,
11835 return lookup_type_in_map<array_type_def>(type_name,
11855 return lookup_type_in_map<function_type>(type_name,
11901const type_base_sptr
11905 type_base_sptr result;
11944const type_base_sptr
11968const type_base_sptr
11972 list<string> comps;
11985const decl_base_sptr
11989 list<string> comps;
12005template<
typename NodeKind>
12017{
return node->get_name();}
12037{
return node->get_name();}
12046template<
typename NodeKind>
12047static decl_base_sptr
12048convert_node_to_decl(shared_ptr<NodeKind> node);
12061template<
typename NodeKind>
12063lookup_node_in_scope(
const list<string>& fqn,
12067 shared_ptr<NodeKind> node;
12068 bool it_is_last =
false;
12071 for (list<string>::const_iterator c = fqn.begin(); c != fqn.end(); ++c)
12074 it_is_last = iterator_is_last(fqn, c);
12075 for (scope_decl::declarations::const_iterator m =
12076 cur_scope->get_member_decls().begin();
12077 m != cur_scope->get_member_decls().end();
12083 scope = dynamic_pointer_cast<scope_decl>(*m);
12084 if (scope && scope->get_name() == *c)
12093 node = dynamic_pointer_cast<NodeKind>(*m);
12097 dynamic_pointer_cast<class_decl>(node))
12098 if (cl->get_is_declaration_only()
12099 && !cl->get_definition_of_declaration())
12101 resulting_decl = node;
12106 if (!new_scope && !resulting_decl)
12107 return decl_base_sptr();
12108 cur_scope = new_scope;
12111 return resulting_decl;
12132const type_base_sptr
12135{
return is_type(lookup_node_in_scope<type_base>(comps, scope));}
12159static const type_base_sptr
12161 const vector<scope_decl*>& access_path,
12164 vector<scope_decl*> a = access_path;
12165 type_base_sptr result;
12170 first_scope = a.back();
12178 for (scope_decl::declarations::const_iterator i =
12182 if (
is_type(*i) && (*i)->get_name() == n)
12190 first_scope = a.back();
12191 interned_string scope_name, cur_scope_name = first_scope->
get_name();
12192 for (scope_decl::scopes::const_iterator i =
12197 scope_name = (*i)->get_name();
12198 if (scope_name == cur_scope_name)
12224static const type_base_sptr
12226 const scope_decl* scope)
12229 return type_base_sptr();
12233 vector<scope_decl*> access_path;
12234 for (scope_decl* s = type_decl->get_scope(); s != 0; s = s->get_scope())
12236 access_path.push_back(s);
12262const type_base_sptr
12277const decl_base_sptr
12280{
return is_var_decl(lookup_node_in_scope<var_decl>(comps, skope));}
12293template<
typename NodeKind>
12295lookup_node_in_translation_unit(
const list<string>& fqn,
12313{
return is_type(lookup_node_in_translation_unit<type_base>(fqn, tu));}
12333{
return is_class_type(lookup_node_in_translation_unit<class_decl>(fqn, tu));}
12346lookup_basic_type_through_translation_units(
const interned_string& type_name,
12347 const corpus& abi_corpus)
12351 for (translation_units::const_iterator tu =
12371static union_decl_sptr
12372lookup_union_type_through_translation_units(
const interned_string& type_name,
12373 const corpus & abi_corpus)
12375 union_decl_sptr result;
12377 for (translation_units::const_iterator tu =
12378 abi_corpus.get_translation_units().begin();
12379 tu != abi_corpus.get_translation_units().end();
12398lookup_enum_type_through_translation_units(
const interned_string& type_name,
12399 const corpus & abi_corpus)
12403 for (translation_units::const_iterator tu =
12404 abi_corpus.get_translation_units().begin();
12405 tu != abi_corpus.get_translation_units().end();
12422lookup_typedef_type_through_translation_units(
const interned_string& type_name,
12423 const corpus & abi_corpus)
12427 for (translation_units::const_iterator tu =
12428 abi_corpus.get_translation_units().begin();
12429 tu != abi_corpus.get_translation_units().end();
12446static qualified_type_def_sptr
12447lookup_qualified_type_through_translation_units(
const interned_string& t_name,
12448 const corpus & abi_corpus)
12450 qualified_type_def_sptr result;
12452 for (translation_units::const_iterator tu =
12453 abi_corpus.get_translation_units().begin();
12454 tu != abi_corpus.get_translation_units().end();
12472lookup_pointer_type_through_translation_units(
const interned_string& type_name,
12473 const corpus & abi_corpus)
12477 for (translation_units::const_iterator tu =
12478 abi_corpus.get_translation_units().begin();
12479 tu != abi_corpus.get_translation_units().end();
12497lookup_reference_type_through_translation_units(
const interned_string& t_name,
12498 const corpus & abi_corpus)
12502 for (translation_units::const_iterator tu =
12503 abi_corpus.get_translation_units().begin();
12504 tu != abi_corpus.get_translation_units().end();
12522lookup_array_type_through_translation_units(
const interned_string& type_name,
12523 const corpus & abi_corpus)
12527 for (translation_units::const_iterator tu =
12528 abi_corpus.get_translation_units().begin();
12529 tu != abi_corpus.get_translation_units().end();
12547lookup_function_type_through_translation_units(
const interned_string& type_name,
12548 const corpus & abi_corpus)
12552 for (translation_units::const_iterator tu =
12553 abi_corpus.get_translation_units().begin();
12554 tu != abi_corpus.get_translation_units().end();
12572 const corpus& abi_corpus)
12574 type_base_sptr result;
12576 for (translation_units::const_iterator tu =
12597 const string& tu_path,
12600 string_tu_map_type::const_iterator i = corp.priv_->path_tu_map.find(tu_path);
12601 if (i == corp.priv_->path_tu_map.end())
12602 return type_base_sptr();
12631 for (translation_units::const_iterator i =
12677 result = lookup_type_in_map<type_decl>(qualified_name, m);
12679 result = lookup_basic_type_through_translation_units(qualified_name, corp);
12699 result = lookup_type_in_map<type_decl>(loc, m);
12790 class_decl_sptr result = lookup_type_in_map<class_decl>(qualified_name, m);
12808 return lookup_types_in_map(qualified_name, m);
12834 for (
auto type : *v)
12836 type_base_sptr t(type);
12838 if (c->get_is_declaration_only()
12839 && !c->get_definition_of_declaration())
12840 result.push_back(type);
12843 return !result.empty();
12859 return lookup_types_in_map(qualified_name, m);
12940 union_decl_sptr result = lookup_type_in_map<union_decl>(type_name, m);
12942 result = lookup_union_type_through_translation_units(type_name, corp);
13021 lookup_type_in_map<enum_type_decl>(qualified_name, m);
13023 result = lookup_enum_type_through_translation_units(qualified_name, corp);
13041 return lookup_types_in_map(qualified_name, m);
13146 lookup_type_in_map<typedef_decl>(qualified_name, m);
13148 result = lookup_typedef_type_through_translation_units(qualified_name,
13243qualified_type_def_sptr
13258qualified_type_def_sptr
13264 qualified_type_def_sptr result =
13265 lookup_type_in_map<qualified_type_def>(qualified_name, m);
13268 result = lookup_qualified_type_through_translation_units(qualified_name,
13310 lookup_type_in_map<pointer_type_def>(qualified_name, m);
13312 result = lookup_pointer_type_through_translation_units(qualified_name,
13360 lookup_type_in_map<reference_type_def>(qualified_name, m);
13362 result = lookup_reference_type_through_translation_units(qualified_name,
13409 lookup_type_in_map<array_type_def>(qualified_name, m);
13411 result = lookup_array_type_through_translation_units(qualified_name, corp);
13480 lookup_type_in_map<function_type>(qualified_name, m);
13482 result = lookup_function_type_through_translation_units(qualified_name,
13505 type_base_sptr result;
13538 type_base_sptr result;
13586 return type_base_sptr();
13603template<
typename TypeKind>
13607 bool use_type_name_as_key =
true)
13611 if (use_type_name_as_key)
13613 else if (
location l = type->get_location())
13615 string str = l.expand();
13616 s = type->get_environment().intern(str);
13619 istring_type_base_wptrs_map_type::iterator i = types_map.find(s);
13620 bool result =
false;
13622 if (i == types_map.end())
13624 types_map[s].push_back(type);
13628 i->second.push_back(type);
13649 bool use_type_name_as_key)
13653 bool update_qname_map =
true;
13654 if (type->get_is_declaration_only())
13660 is_class_type(class_type->get_definition_of_declaration()))
13664 if (!update_qname_map)
13668 if (use_type_name_as_key)
13670 string qname = type->get_qualified_name();
13671 s = type->get_environment().intern(qname);
13673 else if (
location l = type->get_location())
13675 string str = l.expand();
13676 s = type->get_environment().intern(str);
13679 bool result =
false;
13680 istring_type_base_wptrs_map_type::iterator i = map.find(s);
13681 if (i == map.end())
13683 map[s].push_back(type);
13687 i->second.push_back(type);
13713 bool result =
false;
13715 istring_type_base_wptrs_map_type::iterator i = types_map.find(s);
13716 if (i == types_map.end())
13718 types_map[s].push_back(type);
13722 i->second.push_back(type);
13742 maybe_update_types_lookup_map<type_decl>
13743 (basic_type, tu->get_types().basic_types());
13745 if (
corpus *type_corpus = basic_type->get_corpus())
13747 maybe_update_types_lookup_map<type_decl>
13749 type_corpus->priv_->get_types().basic_types());
13751 maybe_update_types_lookup_map<type_decl>
13753 type_corpus->get_type_per_loc_map().basic_types(),
13758 maybe_update_types_lookup_map<type_decl>
13760 group->priv_->get_types().basic_types());
13762 maybe_update_types_lookup_map<type_decl>
13764 group->get_type_per_loc_map().basic_types(),
13787 (class_type, tu->get_types().class_types());
13789 if (
corpus *type_corpus = class_type->get_corpus())
13793 type_corpus->priv_->get_types().class_types());
13797 type_corpus->get_type_per_loc_map().class_types(),
13804 group->priv_->get_types().class_types());
13808 group->get_type_per_loc_map().class_types(),
13829 maybe_update_types_lookup_map<union_decl>
13830 (union_type, tu->get_types().union_types());
13832 if (
corpus *type_corpus = union_type->get_corpus())
13834 maybe_update_types_lookup_map<union_decl>
13836 type_corpus->priv_->get_types().union_types());
13838 maybe_update_types_lookup_map<union_decl>
13840 type_corpus->get_type_per_loc_map().union_types(),
13845 maybe_update_types_lookup_map<union_decl>
13847 group->priv_->get_types().union_types());
13849 maybe_update_types_lookup_map<union_decl>
13851 group->get_type_per_loc_map().union_types(),
13872 maybe_update_types_lookup_map<enum_type_decl>
13873 (enum_type, tu->get_types().enum_types());
13875 if (
corpus *type_corpus = enum_type->get_corpus())
13877 maybe_update_types_lookup_map<enum_type_decl>
13879 type_corpus->priv_->get_types().enum_types());
13881 maybe_update_types_lookup_map<enum_type_decl>
13883 type_corpus->get_type_per_loc_map().enum_types(),
13888 maybe_update_types_lookup_map<enum_type_decl>
13890 group->priv_->get_types().enum_types());
13892 maybe_update_types_lookup_map<enum_type_decl>
13894 group->get_type_per_loc_map().enum_types(),
13916 maybe_update_types_lookup_map<typedef_decl>
13917 (typedef_type, tu->get_types().typedef_types());
13919 if (
corpus *type_corpus = typedef_type->get_corpus())
13921 maybe_update_types_lookup_map<typedef_decl>
13923 type_corpus->priv_->get_types().typedef_types());
13925 maybe_update_types_lookup_map<typedef_decl>
13927 type_corpus->get_type_per_loc_map().typedef_types(),
13932 maybe_update_types_lookup_map<typedef_decl>
13934 group->priv_->get_types().typedef_types());
13936 maybe_update_types_lookup_map<typedef_decl>
13938 group->get_type_per_loc_map().typedef_types(),
13959 maybe_update_types_lookup_map<qualified_type_def>
13960 (qualified_type, tu->get_types().qualified_types());
13962 if (
corpus *type_corpus = qualified_type->get_corpus())
13964 maybe_update_types_lookup_map<qualified_type_def>
13966 type_corpus->priv_->get_types().qualified_types());
13970 maybe_update_types_lookup_map<qualified_type_def>
13972 group->priv_->get_types().qualified_types());
13992 maybe_update_types_lookup_map<pointer_type_def>
13993 (pointer_type, tu->get_types().pointer_types());
13995 if (
corpus *type_corpus = pointer_type->get_corpus())
13997 maybe_update_types_lookup_map<pointer_type_def>
13999 type_corpus->priv_->get_types().pointer_types());
14003 maybe_update_types_lookup_map<pointer_type_def>
14005 group->priv_->get_types().pointer_types());
14025 maybe_update_types_lookup_map<reference_type_def>
14026 (reference_type, tu->get_types().reference_types());
14028 if (
corpus *type_corpus = reference_type->get_corpus())
14030 maybe_update_types_lookup_map<reference_type_def>
14032 type_corpus->priv_->get_types().reference_types());
14036 maybe_update_types_lookup_map<reference_type_def>
14038 group->priv_->get_types().reference_types());
14058 maybe_update_types_lookup_map<array_type_def>
14059 (array_type, tu->get_types().array_types());
14061 if (
corpus *type_corpus = array_type->get_corpus())
14063 maybe_update_types_lookup_map<array_type_def>
14065 type_corpus->priv_->get_types().array_types());
14067 maybe_update_types_lookup_map<array_type_def>
14069 type_corpus->get_type_per_loc_map().array_types(),
14074 maybe_update_types_lookup_map<array_type_def>
14076 group->priv_->get_types().array_types());
14078 maybe_update_types_lookup_map<array_type_def>
14080 group->get_type_per_loc_map().array_types(),
14102 maybe_update_types_lookup_map<array_type_def::subrange_type>
14103 (subrange_type, tu->get_types().subrange_types());
14105 if (
corpus *type_corpus = subrange_type->get_corpus())
14107 maybe_update_types_lookup_map<array_type_def::subrange_type>
14109 type_corpus->priv_->get_types().subrange_types());
14111 maybe_update_types_lookup_map<array_type_def::subrange_type>
14113 type_corpus->get_type_per_loc_map().subrange_types(),
14116 if (
corpus *group = subrange_type->get_corpus())
14118 maybe_update_types_lookup_map<array_type_def::subrange_type>
14120 group->priv_->get_types().subrange_types());
14122 maybe_update_types_lookup_map<array_type_def::subrange_type>
14124 group->get_type_per_loc_map().subrange_types(),
14147 (fn_type, tu->get_types().function_types());
14149 if (
corpus *type_corpus = fn_type->get_corpus())
14153 type_corpus->priv_->get_types().function_types());
14155 if (
corpus *group = fn_type->get_corpus())
14159 group->priv_->get_types().function_types());
14246 type_base_sptr result;
14254 type_base_sptr underlying_type =
14257 if (underlying_type)
14260 qual->get_cv_quals(),
14261 qual->get_location()));
14266 type_base_sptr pointed_to_type =
14269 if (pointed_to_type)
14272 p->get_size_in_bits(),
14273 p->get_alignment_in_bits(),
14274 p->get_location()));
14279 type_base_sptr pointed_to_type =
14281 if (pointed_to_type)
14285 r->get_size_in_bits(),
14286 r->get_alignment_in_bits(),
14287 r->get_location()));
14301 tu.priv_->synthesized_types_.push_back(result);
14334 type_base_sptr result_return_type;
14339 if (!result_return_type)
14343 type_base_sptr parm_type;
14345 for (function_type::parameters::const_iterator i =
14350 type_base_sptr t = (*i)->get_type();
14357 (*i)->get_location(),
14358 (*i)->get_variadic_marker(),
14359 (*i)->get_is_artificial()));
14360 parms.push_back(parm);
14363 class_or_union_sptr class_type;
14375 result_fn_type.reset(
new method_type(result_return_type,
14387 tu.priv_->synthesized_types_.push_back(result_fn_type);
14391 return result_fn_type;
14402 if (mangled_name.empty())
14407 char * str = abi::__cxa_demangle(mangled_name.c_str(),
14408 NULL, &l, &status);
14409 string demangled_name = mangled_name;
14413 demangled_name = str;
14417 return demangled_name;
14442global_scope::~global_scope()
14447maybe_propagate_canonical_type(
const type_base& lhs_type,
14448 const type_base& rhs_type);
14467types_defined_same_linux_kernel_corpus_public(
const type_base& t1,
14468 const type_base& t2)
14470 const corpus *t1_corpus = t1.get_corpus(), *t2_corpus = t2.get_corpus();
14471 string t1_file_path, t2_file_path;
14475 if (!(t1_corpus && t2_corpus
14476 && t1_corpus == t2_corpus
14477 && (t1_corpus->get_origin() & corpus::LINUX_KERNEL_BINARY_ORIGIN)
14482 class_or_union *c1 = 0, *c2 = 0;
14488 if ((c1 && c1->get_is_anonymous() && !c1->get_naming_typedef())
14489 || (c2 && c2->get_is_anonymous() && !c2->get_naming_typedef()))
14496 && c1->get_is_anonymous() && c1->get_naming_typedef()
14497 && c2->get_is_anonymous() && c2->get_naming_typedef())
14498 if (c1->get_naming_typedef()->get_name()
14499 != c2->get_naming_typedef()->get_name())
14505 if (e1->get_is_anonymous() || e2->get_is_anonymous())
14515 if (c1->get_is_declaration_only() != c2->get_is_declaration_only())
14517 if (c1->get_environment().decl_only_class_equals_definition())
14527 if (t1.get_size_in_bits() != t2.get_size_in_bits())
14536 l = c1->get_location();
14538 l =
dynamic_cast<const decl_base&
>(t1).
get_location();
14540 unsigned line = 0, col = 0;
14542 l.
expand(t1_file_path, line, col);
14544 l = c2->get_location();
14546 l =
dynamic_cast<const decl_base&
>(t2).
get_location();
14548 l.
expand(t2_file_path, line, col);
14551 if (t1_file_path.empty() || t2_file_path.empty())
14554 if (t1_file_path == t2_file_path)
14590compare_types_during_canonicalization(
const type_base& canonical_type,
14591 const type_base& candidate_type)
14593#ifdef WITH_DEBUG_TYPE_CANONICALIZATION
14594 const environment& env = canonical_type.get_environment();
14595 if (env.debug_type_canonicalization_is_on())
14597 bool canonical_equality =
false, structural_equality =
false;
14598 env.priv_->use_canonical_type_comparison_ =
false;
14599 structural_equality = canonical_type == candidate_type;
14600 env.priv_->use_canonical_type_comparison_ =
true;
14601 canonical_equality = canonical_type == candidate_type;
14602 if (canonical_equality != structural_equality)
14604 std::cerr <<
"structural & canonical equality different for type: "
14605 << canonical_type.get_pretty_representation(
true,
true)
14609 return structural_equality;
14612 return canonical_type == candidate_type;
14636compare_canonical_type_against_candidate(
const type_base& canonical_type,
14637 const type_base& candidate_type)
14639 environment& env =
const_cast<environment&
>(canonical_type.get_environment());
14657 bool saved_decl_only_class_equals_definition =
14658 env.decl_only_class_equals_definition();
14659 env.do_on_the_fly_canonicalization(
true);
14662 env.decl_only_class_equals_definition(
false);
14663 env.priv_->allow_type_comparison_results_caching(
true);
14664 bool equal = (types_defined_same_linux_kernel_corpus_public(canonical_type,
14666 || compare_types_during_canonicalization(canonical_type,
14671 env.priv_->clear_type_comparison_results_cache();
14672 env.priv_->allow_type_comparison_results_caching(
false);
14673 env.do_on_the_fly_canonicalization(
false);
14674 env.decl_only_class_equals_definition
14675 (saved_decl_only_class_equals_definition);
14700compare_canonical_type_against_candidate(
const type_base* canonical_type,
14701 const type_base* candidate_type)
14703 return compare_canonical_type_against_candidate(*canonical_type,
14728compare_canonical_type_against_candidate(
const type_base_sptr& canonical_type,
14729 const type_base_sptr& candidate_type)
14731 return compare_canonical_type_against_candidate(canonical_type.get(),
14732 candidate_type.get());
14758type_base::get_canonical_type_for(type_base_sptr t)
14763 environment& env =
const_cast<environment&
>(t->get_environment());
14767 return type_base_sptr();
14773 bool decl_only_class_equals_definition =
14786 if (decl_only_class_equals_definition)
14787 if (class_or_union)
14788 if (class_or_union->get_is_declaration_only())
14789 return type_base_sptr();
14792 if (t->get_canonical_type())
14793 return t->get_canonical_type();
14801 || !class_or_union->get_is_anonymous()
14802 || class_or_union->get_linkage_name().empty());
14814 string repr = t->get_cached_pretty_representation(
true);
14819 type_base_sptr canonical_type_present_in_corpus;
14821 env.get_canonical_types_map();
14823 type_base_sptr result;
14824 environment::canonical_types_map_type::iterator i = types.find(repr);
14825 if (i == types.end())
14827 vector<type_base_sptr> v;
14834 vector<type_base_sptr> &v = i->second;
14841 for (vector<type_base_sptr>::const_reverse_iterator it = v.rbegin();
14845 bool equal = compare_canonical_type_against_candidate(*it, t);
14852#ifdef WITH_DEBUG_SELF_COMPARISON
14853 if (env.self_comparison_debug_is_on())
14857 corpus_sptr corp1, corp2;
14858 env.get_self_comparison_debug_inputs(corp1, corp2);
14859 if (corp1 && corp2 && t->get_corpus() == corp2.get())
14870 check_canonical_type_from_abixml_during_self_comp(t,
14876 uintptr_t should_have_canonical_type = 0;
14877 string type_id = env.get_type_id_from_type(t.get());
14878 if (type_id.empty())
14879 type_id =
"type-id-<not-found>";
14881 should_have_canonical_type =
14882 env.get_canonical_type_from_type_id(type_id.c_str());
14883 std::cerr <<
"error: wrong canonical type for '"
14892 <<
"'. Should have had canonical type: "
14894 << should_have_canonical_type
14900 uintptr_t ptr_val =
reinterpret_cast<uintptr_t
>(t.get());
14901 string type_id = env.get_type_id_from_pointer(ptr_val);
14902 if (type_id.empty())
14903 type_id =
"type-id-<not-found>";
14920 std::cerr <<
"error: wrong induced canonical type for '"
14922 <<
"' from second corpus"
14923 <<
", ptr: " << std::hex << t.get()
14924 <<
" type-id: " << type_id
14963maybe_adjust_canonical_type(
const type_base_sptr& canonical,
14964 const type_base_sptr& type)
14968 || type->get_naked_canonical_type()
14970 || type.get() == canonical.get())
14977 if (canonical_class)
14981 for (class_decl::member_functions::const_iterator i =
14982 cl->get_member_functions().begin();
14983 i != cl->get_member_functions().end();
14985 if ((*i)->get_symbol())
14988 find_member_function((*i)->get_linkage_name()))
14991 if (s1 && !m->get_symbol())
15014 if (type->get_is_artificial() != canonical->get_is_artificial())
15015 canonical->set_is_artificial(
false);
15039 if (t->get_canonical_type())
15040 return t->get_canonical_type();
15042 type_base_sptr canonical = type_base::get_canonical_type_for(t);
15043 maybe_adjust_canonical_type(canonical, t);
15045 t->priv_->canonical_type = canonical;
15046 t->priv_->naked_canonical_type = canonical.get();
15060 ABG_ASSERT(!t->priv_->canonical_type_propagated()
15061 || t->priv_->propagated_canonical_type_confirmed());
15064 if (type_base_sptr d =
is_type(cl->get_earlier_declaration()))
15065 if ((canonical = d->get_canonical_type()))
15067 d->priv_->canonical_type = canonical;
15068 d->priv_->naked_canonical_type = canonical.get();
15085 if (type_base_sptr c =
is_type(scope)->get_canonical_type())
15099#ifdef WITH_DEBUG_CT_PROPAGATION
15108 env.priv_->erase_type_with_cleared_propagated_canonical_type(t.get());
15112 t->on_canonical_type_set();
15123 priv_->definition_of_declaration_ = d;
15125 if (type_base_sptr canonical_type =
is_type(d)->get_canonical_type())
15126 t->priv_->canonical_type = canonical_type;
15128 priv_->naked_definition_of_declaration_ =
const_cast<decl_base*
>(d.get());
15138 priv_(new
priv(s, a))
15150{
return priv_->canonical_type.lock();}
15166{
return priv_->naked_canonical_type;}
15191 return priv_->internal_cached_repr_;
15200 return priv_->cached_repr_;
15238{
return equals(*
this, other, 0);}
15255{priv_->size_in_bits = s;}
15262{
return priv_->size_in_bits;}
15269{priv_->alignment_in_bits = a;}
15276{
return priv_->alignment_in_bits;}
15292 v.visit_begin(
this);
15293 bool result = v.visit_end(
this);
15299type_base::~type_base()
15318 static_cast<unsigned>(r));
15333 static_cast<unsigned>(r));
15390parse_integral_type_modifier(
const string& word,
15393 if (word ==
"signed")
15395 else if (word ==
"unsigned")
15397 else if (word ==
"short")
15399 else if (word ==
"long")
15401 else if (word ==
"long long")
15419parse_base_integral_type(
const string& type_name,
15422 if (type_name ==
"int")
15424 else if (type_name ==
"char")
15426 else if (type_name ==
"bool" || type_name ==
"_Bool")
15428 else if (type_name ==
"double")
15430 else if (type_name ==
"float")
15432 else if (type_name ==
"char16_t")
15434 else if (type_name ==
"char32_t")
15436 else if (type_name ==
"wchar_t")
15461 string input = type_name;
15462 string::size_type len = input.length();
15463 string::size_type cur_pos = 0, prev_pos = 0;
15464 string cur_word, prev_word;
15467 while (cur_pos < len)
15469 if (cur_pos < len && isspace(input[cur_pos]))
15472 while (cur_pos < len && isspace(input[cur_pos]));
15474 prev_pos = cur_pos;
15475 cur_pos = input.find(
' ', prev_pos);
15476 prev_word = cur_word;
15477 cur_word = input.substr(prev_pos, cur_pos - prev_pos);
15480 && cur_word ==
"long"
15481 && prev_word !=
"long")
15483 if (cur_pos < len && isspace(input[cur_pos]))
15486 while (cur_pos < len && isspace(input[cur_pos]));
15487 prev_pos = cur_pos;
15489 cur_pos = input.find(
' ', prev_pos);
15490 string saved_prev_word = prev_word;
15491 prev_word = cur_word;
15492 cur_word = input.substr(prev_pos, cur_pos - prev_pos);
15493 if (cur_word ==
"long")
15494 cur_word =
"long long";
15497 cur_pos = prev_pos;
15498 cur_word = prev_word;
15499 prev_word = saved_prev_word;
15503 if (!parse_integral_type_modifier(cur_word, modifiers))
15505 if (!parse_base_integral_type(cur_word, base))
15543 : base_(INT_BASE_TYPE),
15544 modifiers_(NO_MODIFIER)
15553 : base_(b), modifiers_(m)
15561 : base_(INT_BASE_TYPE),
15562 modifiers_(NO_MODIFIER)
15580{
return modifiers_;}
15597{
return base_ == other.base_ && modifiers_ == other.modifiers_;}
15615 result +=
"signed ";
15617 result +=
"unsigned ";
15628 result +=
"short ";
15632 result +=
"long long ";
15643 result +=
"double";
15647 result +=
"char16_t";
15649 result +=
"char32_t";
15651 result +=
"wchar_t";
15661integral_type::operator string()
const
15662{
return to_string();}
15685 const string& name,
15686 size_t size_in_bits,
15687 size_t alignment_in_bits,
15689 const string& linkage_name,
15694 | ABSTRACT_TYPE_BASE
15695 | ABSTRACT_DECL_BASE),
15696 decl_base(env, name, locus, linkage_name, vis),
15697 type_base(env, size_in_bits, alignment_in_bits)
15708 string integral_type_name = int_type;
15742 bool result =
false;
15773 return *
this == *other;
15801 return *
this == other;
15847 if (l.get() == r.get())
15875 bool internal)
const
15899 if (decl_base::priv_->internal_qualified_name_.
empty())
15900 decl_base::priv_->internal_qualified_name_ =
15901 env.
intern(get_internal_integral_type_name(
this));
15902 return decl_base::priv_->internal_qualified_name_;
15906 decl_base::priv_->temporary_internal_qualified_name_ =
15907 env.
intern(get_internal_integral_type_name(
this));
15908 return decl_base::priv_->temporary_internal_qualified_name_;
15934 bool qualified_name)
const
15938 return get_internal_integral_type_name(
this);
15940 if (qualified_name)
15958 v.visit_begin(
this);
15959 bool result = v.visit_end(
this);
15965type_decl::~type_decl()
15985 const string& name,
15986 size_t size_in_bits,
15987 size_t alignment_in_bits,
15991 ABSTRACT_SCOPE_TYPE_DECL
15992 | ABSTRACT_TYPE_BASE
15993 | ABSTRACT_DECL_BASE),
15995 type_base(env, size_in_bits, alignment_in_bits),
16064 return *
this == *other;
16088 if (v.visit_begin(
this))
16091 for (scope_decl::declarations::const_iterator i =
16095 if (!(*i)->traverse(v))
16100 bool result = v.visit_end(
this);
16106scope_type_decl::~scope_type_decl()
16122 const string& name,
16133 | ABSTRACT_DECL_BASE
16134 | ABSTRACT_SCOPE_DECL),
16160 bool qualified_name)
const
16202 if (!ns->is_empty_or_has_empty_sub_namespaces())
16223 if (v.visit_begin(
this))
16226 scope_decl::declarations::const_iterator i;
16232 dynamic_pointer_cast<ir_traversable_base>(*i);
16234 if (!t->traverse (v))
16239 return v.visit_end(
this);
16242namespace_decl::~namespace_decl()
16251class qualified_type_def::priv
16262 weak_ptr<type_base> underlying_type_;
16265 : cv_quals_(CV_NONE)
16270 : cv_quals_(quals),
16271 underlying_type_(t)
16323qualified_type_def::qualified_type_def(type_base_sptr type,
16328 | ABSTRACT_TYPE_BASE
16329 | ABSTRACT_DECL_BASE),
16330 type_base(type->get_environment(), type->get_size_in_bits(),
16331 type->get_alignment_in_bits()),
16332 decl_base(type->get_environment(),
"", locus,
"",
16333 dynamic_pointer_cast<
decl_base>(type)->get_visibility()),
16334 priv_(new priv(quals, type))
16353 | ABSTRACT_TYPE_BASE
16354 | ABSTRACT_DECL_BASE),
16358 priv_(new priv(quals))
16381 s = ut->get_size_in_bits();
16410 bool result =
true;
16477 return *
this == *other;
16495 return *
this == *other;
16510 bool internal)
const
16538 priv_->temporary_internal_name_ =
16540 return priv_->temporary_internal_name_;
16556 if (priv_->internal_name_.empty())
16557 priv_->internal_name_ =
16560 return priv_->internal_name_;
16589 if (v.visit_begin(
this))
16596 bool result = v.visit_end(
this);
16601qualified_type_def::~qualified_type_def()
16608{
return priv_->cv_quals_;}
16613{priv_->cv_quals_ = cv_quals;}
16627{
return priv_->underlying_type_.lock();}
16636 priv_->underlying_type_ = t;
16646 scope_decl::declarations::iterator i;
16647 if (s->find_iterator_for_member(
this, i))
16662operator==(
const qualified_type_def_sptr& l,
const qualified_type_def_sptr& r)
16664 if (l.get() == r.get())
16680operator!=(
const qualified_type_def_sptr& l,
const qualified_type_def_sptr& r)
16688 (
static_cast<unsigned>(lhs) |
static_cast<unsigned>(rhs));
16712 (
static_cast<unsigned>(lhs) &
static_cast<unsigned>(rhs));
16734 case qualified_type_def::CV_NONE:
16737 case qualified_type_def::CV_CONST:
16740 case qualified_type_def::CV_VOLATILE:
16743 case qualified_type_def::CV_RESTRICT:
16757struct pointer_type_def::priv
16764 priv(
const type_base_sptr& t)
16766 naked_pointed_to_type_(t.get())
16770 : naked_pointed_to_type_()
16795pointer_type_def::pointer_type_def(
const type_base_sptr& pointed_to,
16796 size_t size_in_bits,
16797 size_t align_in_bits,
16801 | ABSTRACT_TYPE_BASE
16802 | ABSTRACT_DECL_BASE),
16803 type_base(pointed_to->get_environment(), size_in_bits, align_in_bits),
16804 decl_base(pointed_to->get_environment(),
"", locus,
""),
16805 priv_(new priv(pointed_to))
16811 const environment& env = pointed_to->get_environment();
16812 decl_base_sptr pto = dynamic_pointer_cast<decl_base>(pointed_to);
16813 string name = (pto ? pto->get_name() : string(
"void")) +
"*";
16831pointer_type_def::pointer_type_def(
const environment& env,
size_t size_in_bits,
16832 size_t alignment_in_bits,
16836 | ABSTRACT_TYPE_BASE
16837 | ABSTRACT_DECL_BASE),
16838 type_base(env, size_in_bits, alignment_in_bits),
16843 string name = string(
"void") +
"*";
16854 priv_->pointed_to_type_ = t;
16855 priv_->naked_pointed_to_type_ = t.get();
16860 decl_base_sptr pto = dynamic_pointer_cast<decl_base>(t);
16861 string name = (pto ? pto->get_name() : string(
"void")) +
"*";
16944 return *
this == *o;
16965const type_base_sptr
16967{
return priv_->pointed_to_type_.lock();}
16974{
return priv_->naked_pointed_to_type_;}
17012 if (priv_->internal_qualified_name_.empty())
17013 if (pointed_to_type)
17014 priv_->internal_qualified_name_ =
17018 return priv_->internal_qualified_name_;
17026 if (pointed_to_type)
17027 priv_->temp_internal_qualified_name_ =
17031 return priv_->temp_internal_qualified_name_;
17051 if (pointed_to_type)
17077 if (v.visit_begin(
this))
17085 bool result = v.visit_end(
this);
17090pointer_type_def::~pointer_type_def()
17107 if (l.get() == r.get())
17157reference_type_def::reference_type_def(
const type_base_sptr pointed_to,
17159 size_t size_in_bits,
17160 size_t align_in_bits,
17164 | ABSTRACT_TYPE_BASE
17165 | ABSTRACT_DECL_BASE),
17166 type_base(pointed_to->get_environment(), size_in_bits, align_in_bits),
17167 decl_base(pointed_to->get_environment(),
"", locus,
""),
17174 decl_base_sptr pto = dynamic_pointer_cast<decl_base>(pointed_to);
17179 name = string(pto->get_name()) +
"&";
17187 const environment& env = pointed_to->get_environment();
17192 pointed_to->get_environment()));
17215reference_type_def::reference_type_def(
const environment& env,
bool lvalue,
17216 size_t size_in_bits,
17217 size_t alignment_in_bits,
17221 | ABSTRACT_TYPE_BASE
17222 | ABSTRACT_DECL_BASE),
17223 type_base(env, size_in_bits, alignment_in_bits),
17228 string name =
"void&";
17243 pointed_to_type_ = pointed_to_type;
17245 decl_base_sptr pto;
17247 {pto = dynamic_pointer_cast<decl_base>(pointed_to_type);}
17254 string name = string(pto->get_name()) +
"&";
17284 if (l.is_lvalue() != r.is_lvalue())
17292 bool result = (l.get_pointed_to_type() == r.get_pointed_to_type());
17331 return *
this == *other;
17346 return *
this == *other;
17350reference_type_def::get_pointed_to_type()
const
17351{
return pointed_to_type_.lock();}
17354reference_type_def::is_lvalue()
const
17355{
return is_lvalue_;}
17414 bool qualified_name)
const
17418 (get_pointed_to_type()),
17442 if (v.visit_begin(
this))
17445 if (type_base_sptr t = get_pointed_to_type())
17450 bool result = v.visit_end(
this);
17455reference_type_def::~reference_type_def()
17472 if (l.get() == r.get())
17500array_type_def::subrange_type::~subrange_type() =
default;
17509 : s_(UNSIGNED_SIGNEDNESS)
17518 : s_(UNSIGNED_SIGNEDNESS)
17527 : s_(SIGNED_SIGNEDNESS)
17535enum array_type_def::subrange_type::bound_value::signedness
17559{
return v_.unsigned_;}
17567 s_ = UNSIGNED_SIGNEDNESS;
17577 s_ = SIGNED_SIGNEDNESS;
17589 return s_ == v.s_ && v_.unsigned_ == v.v_.unsigned_;
17594struct array_type_def::subrange_type::priv
17604 : upper_bound_(ub), language_(l), infinite_(false)
17607 priv(bound_value lb, bound_value ub,
17609 : lower_bound_(lb), upper_bound_(ub),
17610 language_(l), infinite_(false)
17613 priv(bound_value lb, bound_value ub,
const type_base_sptr &u,
17615 : lower_bound_(lb), upper_bound_(ub), underlying_type_(u),
17616 language_(l), infinite_(false)
17635 const string& name,
17638 const type_base_sptr& utype,
17643 upper_bound.get_unsigned_value()
17644 - lower_bound.get_unsigned_value(),
17647 priv_(new priv(lower_bound, upper_bound, utype, l))
17667 const string& name,
17674 upper_bound.get_unsigned_value()
17675 - lower_bound.get_unsigned_value(), 0),
17677 priv_(new priv(lower_bound, upper_bound, l))
17695 const string& name,
17700 type_base(env, upper_bound.get_unsigned_value(), 0),
17702 priv_(new priv(upper_bound, l))
17713{
return priv_->underlying_type_.lock();}
17722 ABG_ASSERT(priv_->underlying_type_.expired());
17723 priv_->underlying_type_ = u;
17731{
return priv_->upper_bound_.get_signed_value();}
17738{
return priv_->lower_bound_.get_signed_value();}
17745{priv_->upper_bound_ = ub;}
17752{priv_->lower_bound_ = lb;}
17769 if (get_upper_bound() >= get_lower_bound())
17770 return get_upper_bound() - get_lower_bound() + 1;
17779{
return priv_->infinite_;}
17787{priv_->infinite_ = f;}
17794{
return priv_->language_;}
17802 std::ostringstream o;
17806 type_base_sptr underlying_type = get_underlying_type();
17807 if (underlying_type)
17809 o <<
"range "<< get_lower_bound() <<
" .. " << get_upper_bound();
17814 o <<
"[" << get_length() <<
"]";
17829 for (vector<subrange_sptr>::const_iterator i = v.begin();
17832 r += (*i)->as_string();
17861 bool result =
true;
17905 return *
this == *other;
17973 repr +=
"<anonymous range>";
17975 repr +=
"<range " +
get_name() +
">";
17976 repr += as_string();
17994 if (v.visit_begin(
this))
17997 if (type_base_sptr u = get_underlying_type())
18002 bool result = v.visit_end(
this);
18009struct array_type_def::priv
18016 priv(type_base_sptr t)
18021 : element_type_(t), subranges_(subs)
18041array_type_def::array_type_def(
const type_base_sptr e_type,
18042 const std::vector<subrange_sptr>& subs,
18046 | ABSTRACT_TYPE_BASE
18047 | ABSTRACT_DECL_BASE),
18050 priv_(new priv(e_type))
18074 const std::vector<subrange_sptr>& subs,
18078 | ABSTRACT_TYPE_BASE
18079 | ABSTRACT_DECL_BASE),
18093array_type_def::update_size()
18095 type_base_sptr e = priv_->element_type_.lock();
18098 size_t s = e->get_size_in_bits();
18102 s *= sub->get_length();
18110array_type_def::get_subrange_representation()
const
18125get_type_representation(
const array_type_def& a,
bool internal)
18127 type_base_sptr e_type = a.get_element_type();
18133 std::ostringstream o;
18135 << a.get_subrange_representation()
18137 << e_type ? e_type->get_pretty_representation(internal):string(
"void");
18147 + a.get_subrange_representation();
18152 + a.get_subrange_representation();
18179{
return get_type_representation(*
this, internal);}
18203 std::vector<array_type_def::subrange_sptr > this_subs = l.
get_subranges();
18204 std::vector<array_type_def::subrange_sptr > other_subs = r.
get_subranges();
18206 bool result =
true;
18207 if (this_subs.size() != other_subs.size())
18216 std::vector<array_type_def::subrange_sptr >::const_iterator i,j;
18217 for (i = this_subs.begin(), j = other_subs.begin();
18218 i != this_subs.end() && j != other_subs.end();
18265 std::vector<array_type_def::subrange_sptr > this_subs = l->
get_subranges();
18266 std::vector<array_type_def::subrange_sptr > other_subs = r->
get_subranges();
18268 if (this_subs.size() != other_subs.size())
18271 std::vector<array_type_def::subrange_sptr >::const_iterator i,j;
18272 for (i = this_subs.begin(), j = other_subs.begin();
18273 i != this_subs.end() && j != other_subs.end();
18283 if (*first_element_type != *second_element_type)
18295 const std::vector<subrange_sptr>& subranges =
18298 if (subranges.empty())
18299 return translation_unit::LANG_C11;
18300 return subranges.front()->get_language();
18319 return *
this == *other;
18325const type_base_sptr
18327{
return priv_->element_type_.lock();}
18343 priv_->element_type_ = element_type;
18354 for (
const auto &sub : subs)
18355 priv_->subranges_.push_back(sub);
18367 if (priv_->subranges_.empty())
18370 for (std::vector<shared_ptr<subrange_type> >::const_iterator i =
18371 priv_->subranges_.begin();
18372 i != priv_->subranges_.end();
18374 if ((*i)->is_infinite())
18381array_type_def::get_dimension_count()
const
18382{
return priv_->subranges_.size();}
18416 if (priv_->internal_qualified_name_.empty())
18417 priv_->internal_qualified_name_ =
18418 env.
intern(get_type_representation(*
this,
true));
18419 return priv_->internal_qualified_name_;
18423 priv_->temp_internal_qualified_name_ =
18424 env.
intern(get_type_representation(*
this,
true));
18425 return priv_->temp_internal_qualified_name_;
18463 if (v.visit_begin(
this))
18471 bool result = v.visit_end(
this);
18477array_type_def::get_location()
const
18481const std::vector<array_type_def::subrange_sptr>&
18483{
return priv_->subranges_;}
18485array_type_def::~array_type_def()
18492class enum_type_decl::priv
18494 type_base_sptr underlying_type_;
18502 priv(type_base_sptr underlying_type,
18504 : underlying_type_(underlying_type),
18522enum_type_decl::enum_type_decl(
const string& name,
18524 type_base_sptr underlying_type,
18526 const string& linkage_name,
18530 | ABSTRACT_TYPE_BASE
18531 | ABSTRACT_DECL_BASE),
18532 type_base(underlying_type->get_environment(),
18533 underlying_type->get_size_in_bits(),
18534 underlying_type->get_alignment_in_bits()),
18535 decl_base(underlying_type->get_environment(),
18536 name, locus, linkage_name, vis),
18537 priv_(new priv(underlying_type, enums))
18543 e->set_enum_type(
this);
18549{
return priv_->underlying_type_;}
18554{
return priv_->enumerators_;}
18559{
return priv_->enumerators_;}
18580 bool qualified_name)
const
18582 string r =
"enum ";
18608 if (v.visit_begin(
this))
18616 bool result = v.visit_end(
this);
18638 bool result =
false;
18648 enum_type_decl::enumerators::const_iterator i, j;
18681 if (!(l.decl_base::operator==(r) && l.type_base::operator==(r)))
18686 if (!l.decl_base::operator==(r))
18688 if (!l.type_base::operator==(r))
18735enumerators_values_are_equal(
const enum_type_decl::enumerator &enr,
18736 const enum_type_decl::enumerator &enl)
18737{
return enr.get_value() == enl.get_value();}
18760is_enumerator_value_present_in_enum(
const enum_type_decl::enumerator &enr,
18761 const enum_type_decl &enom,
18762 vector<enum_type_decl::enumerator>& redundant_enrs)
18764 bool found =
false;
18765 for (
const auto &e : enom.get_enumerators())
18766 if (enumerators_values_are_equal(e, enr))
18770 redundant_enrs.push_back(e);
18788is_enumerator_value_redundant(
const enum_type_decl::enumerator &enr,
18789 const enum_type_decl &enom)
18791 vector<enum_type_decl::enumerator> redundant_enrs;
18792 if (is_enumerator_value_present_in_enum(enr, enom, redundant_enrs))
18794 if (!redundant_enrs.empty())
18822 bool result =
true;
18838 if (!!def1 != !!def2)
18868 if (!(def1->decl_base::operator==(*def2)
18869 && def1->type_base::operator==(*def2)))
18874 if (!def1->decl_base::operator==(*def2))
18876 if (!def1->type_base::operator==(*def2))
18926 if (!is_enumerator_present_in_enum(e, *def2)
18927 && (!is_enumerator_value_redundant(e, *def2)
18928 || !is_enumerator_value_redundant(e, *def1)))
18941 if (!is_enumerator_present_in_enum(e, *def1)
18942 && (!is_enumerator_value_redundant(e, *def1)
18943 || !is_enumerator_value_redundant(e, *def2)))
18985 return *
this == *other;
19000 if (l.get() == r.get())
19002 decl_base_sptr o = r;
19019class enum_type_decl::enumerator::priv
19023 string qualified_name_;
19026 friend class enum_type_decl::enumerator;
19034 priv(
const string& name,
19036 enum_type_decl* e = 0)
19048enum_type_decl::enumerator::~enumerator() =
default;
19059 : priv_(new priv(name, value))
19066 : priv_(new priv(other.
get_name(),
19068 other.get_enum_type()))
19093 bool names_equal =
true;
19095 return names_equal && (get_value() == other.
get_value());
19114{
return priv_->name_;}
19132 if (priv_->qualified_name_.empty())
19134 priv_->qualified_name_ =
19135 get_enum_type()->get_qualified_name(internal)
19139 return priv_->qualified_name_;
19155{
return priv_->value_;}
19169{
return priv_->enum_type_;}
19176{priv_->enum_type_ = e;}
19182struct typedef_decl::priv
19185 string internal_qualified_name_;
19186 string temp_internal_qualified_name_;
19188 priv(
const type_base_sptr& t)
19189 : underlying_type_(t)
19204typedef_decl::typedef_decl(
const string& name,
19205 const type_base_sptr underlying_type,
19207 const string& linkage_name,
19211 | ABSTRACT_TYPE_BASE
19212 | ABSTRACT_DECL_BASE),
19217 name, locus, linkage_name, vis),
19218 priv_(new priv(underlying_type))
19234typedef_decl::typedef_decl(
const string& name,
19237 const string& mangled_name,
19241 | ABSTRACT_TYPE_BASE
19242 | ABSTRACT_DECL_BASE),
19245 decl_base(env, name, locus, mangled_name, vis),
19246 priv_(new priv(nullptr))
19307 bool result =
true;
19311 if (!(l.decl_base::operator==(r)))
19358 return *
this == *other;
19380 bool qualified_name)
const
19383 string result =
"typedef ";
19384 if (qualified_name)
19397{
return priv_->underlying_type_.lock();}
19405 priv_->underlying_type_ = t;
19426 if (v.visit_begin(
this))
19434 bool result = v.visit_end(
this);
19439typedef_decl::~typedef_decl()
19445struct var_decl::priv
19458 priv(type_base_sptr t,
19461 naked_type_(t.get()),
19472 naked_type_ = t.get();
19489var_decl::var_decl(
const string& name,
19490 type_base_sptr type,
19492 const string& linkage_name,
19496 VAR_DECL | ABSTRACT_DECL_BASE),
19497 decl_base(type->get_environment(), name, locus, linkage_name, vis),
19498 priv_(new priv(type, bind))
19506const type_base_sptr
19508{
return priv_->type_.lock();}
19515{priv_->set_type(t);}
19526{
return priv_->naked_type_;}
19533{
return priv_->binding_;}
19540{priv_->binding_ = b;}
19556 priv_->symbol_ = sym;
19571{
return priv_->symbol_;}
19640 bool result =
true;
19653 else if (s0 && s0 != s1)
19661 bool symbols_are_equal = (s0 && s1 && result);
19663 if (symbols_are_equal)
19672 bool decl_bases_different = !l.decl_base::operator==(r);
19673 const_cast<var_decl&
>(l).set_qualified_name(n1);
19674 const_cast<var_decl&
>(r).set_qualified_name(n2);
19676 if (decl_bases_different)
19686 if (!l.decl_base::operator==(r))
19735 bool result =
true;
19771 return equals(*
this, *other, 0);
19786 if (priv_->id_.empty())
19791 sym_str = s->get_id_string();
19796 priv_->id_ = env.
intern(repr);
19797 if (!sym_str.empty())
19798 priv_->id_ = env.
intern(priv_->id_ +
"{" + sym_str +
"}");
19810 return hash_var(
this);
19875 result =
"static ";
19879 bool member_of_anonymous_class =
false;
19882 member_of_anonymous_class =
true;
19887 if (member_of_anonymous_class || !qualified_name)
19892 type_base_sptr et = t->get_element_type();
19896 result += decl->get_qualified_name(internal)
19897 +
" " + name + t->get_subrange_representation();
19910 "",
true, internal);
19916 "",
true, internal);
19919 && (member_of_anonymous_class || !qualified_name))
19935 && (member_of_anonymous_class || !qualified_name))
19989 if (v.visit_begin(
this))
19992 if (type_base_sptr t =
get_type())
19996 return v.visit_end(
this);
19999var_decl::~var_decl()
20014 priv_->cached_name_.clear();
20015 priv_->internal_cached_name_.clear();
20035function_type::function_type(type_base_sptr return_type,
20037 size_t size_in_bits,
20038 size_t alignment_in_bits)
20040 FUNCTION_TYPE | ABSTRACT_TYPE_BASE),
20041 type_base(return_type->get_environment(), size_in_bits, alignment_in_bits),
20042 priv_(new
priv(parms, return_type))
20046 for (parameters::size_type i = 0, j = 1;
20047 i < priv_->parms_.size();
20050 if (i == 0 && priv_->parms_[i]->get_is_artificial())
20057 priv_->parms_[i]->set_index(j);
20068function_type::function_type(type_base_sptr return_type,
20069 size_t size_in_bits,
size_t alignment_in_bits)
20071 FUNCTION_TYPE | ABSTRACT_TYPE_BASE),
20072 type_base(return_type->get_environment(), size_in_bits, alignment_in_bits),
20073 priv_(new
priv(return_type))
20088 size_t size_in_bits,
20089 size_t alignment_in_bits)
20091 type_base(env, size_in_bits, alignment_in_bits),
20103{
return priv_->return_type_.lock();}
20111{priv_->return_type_ = t;}
20120{
return priv_->parms_;}
20163 for (parameters::size_type i = 0, j = 1;
20164 i < priv_->parms_.size();
20167 if (i == 0 && priv_->parms_[i]->get_is_artificial())
20174 priv_->parms_[i]->set_index(j);
20185 parm->set_index(priv_->parms_.size());
20186 priv_->parms_.push_back(parm);
20200 return (!priv_->parms_.empty()
20201 && priv_->parms_.back()->get_variadic_marker());
20233#define RETURN(value) CACHE_AND_RETURN_COMPARISON_RESULT(value)
20242 bool cached_result =
false;
20245 return cached_result;
20250 bool result =
true;
20252 if (!l.type_base::operator==(r))
20263 l_class = m->get_class_type().get();
20266 r_class = m->get_class_type().get();
20270 if (!!l_class != !!r_class)
20280 != r_class->get_qualified_name()))
20297 bool compare_result_types =
true;
20298 string l_rt_name = l_return_type_decl
20301 string r_rt_name = r_return_type_decl
20307 (r_class && (r_class->get_qualified_name() == r_rt_name)))
20308 compare_result_types =
false;
20310 if (compare_result_types)
20336 if (l_rt_name != r_rt_name)
20345 vector<shared_ptr<function_decl::parameter> >::const_iterator i,j;
20386function_type::parameters::const_iterator
20392 bool is_method =
dynamic_cast<const method_type*
>(
this);
20408function_type::parameters::const_iterator
20435 if (priv_->internal_cached_name_.empty())
20436 priv_->internal_cached_name_ =
20438 return priv_->internal_cached_name_;
20442 priv_->temp_internal_cached_name_ =
20445 return priv_->temp_internal_cached_name_;
20452 if (priv_->cached_name_.empty())
20453 priv_->cached_name_ =
20455 return priv_->cached_name_;
20459 priv_->cached_name_ =
20461 return priv_->cached_name_;
20522 if (v.visit_begin(
this))
20525 bool keep_going =
true;
20529 if (!t->traverse(v))
20530 keep_going =
false;
20537 if (type_base_sptr parm_type = (*i)->get_type())
20538 if (!parm_type->traverse(v))
20543 return v.visit_end(
this);
20546function_type::~function_type()
20552struct method_type::priv
20554 class_or_union_wptr class_type_;
20582method_type::method_type (type_base_sptr return_type,
20583 class_or_union_sptr class_type,
20584 const std::vector<function_decl::parameter_sptr>& p,
20586 size_t size_in_bits,
20587 size_t alignment_in_bits)
20589 METHOD_TYPE | ABSTRACT_TYPE_BASE | FUNCTION_TYPE),
20590 type_base(class_type->get_environment(), size_in_bits, alignment_in_bits),
20591 function_type(return_type, p, size_in_bits, alignment_in_bits),
20622method_type::method_type(type_base_sptr return_type,
20623 type_base_sptr class_type,
20624 const std::vector<function_decl::parameter_sptr>& p,
20626 size_t size_in_bits,
20627 size_t alignment_in_bits)
20629 METHOD_TYPE | ABSTRACT_TYPE_BASE | FUNCTION_TYPE),
20630 type_base(class_type->get_environment(), size_in_bits, alignment_in_bits),
20631 function_type(return_type, p, size_in_bits, alignment_in_bits),
20647 size_t size_in_bits,
20648 size_t alignment_in_bits)
20650 type_base(env, size_in_bits, alignment_in_bits),
20670method_type::method_type(class_or_union_sptr class_type,
20672 size_t size_in_bits,
20673 size_t alignment_in_bits)
20675 METHOD_TYPE | ABSTRACT_TYPE_BASE | FUNCTION_TYPE),
20676 type_base(class_type->get_environment(), size_in_bits, alignment_in_bits),
20679 alignment_in_bits),
20692{
return class_or_union_sptr(priv_->class_type_);}
20705 priv_->class_type_ = t;
20733{priv_->is_const = f;}
20740{
return priv_->is_const;}
20750struct function_decl::priv
20752 bool declared_inline_;
20760 : declared_inline_(false),
20766 bool declared_inline,
20768 : declared_inline_(declared_inline),
20771 naked_type_(t.get())
20775 bool declared_inline,
20778 : declared_inline_(declared_inline),
20781 naked_type_(t.get()),
20803 bool declared_inline,
20805 const string& mangled_name,
20809 FUNCTION_DECL | ABSTRACT_DECL_BASE),
20840 type_base_sptr fn_type,
20841 bool declared_inline,
20843 const string& linkage_name,
20847 FUNCTION_DECL | ABSTRACT_DECL_BASE),
20848 decl_base(fn_type->get_environment(), name, locus, linkage_name, vis),
20849 priv_(new priv(dynamic_pointer_cast<
function_type>(fn_type),
20876 string result = mem_fn ?
"method ":
"function ";
20881 result +=
"virtual ";
20883 decl_base_sptr type;
20895 result += type->get_qualified_name(internal) +
" ";
20929 result += mem_fn->
get_type()->get_class_type()->get_qualified_name()
20941 if (mem_fn && i != end)
20947 for (; i != end; ++i)
20950 if (parm.get() != first_parm.get())
20952 if (parm->get_variadic_marker()
20957 type_base_sptr type = parm->get_type();
20968 result +=
" const";
20979function_decl::parameters::const_iterator
20985 bool is_method =
dynamic_cast<const method_decl*
>(
this);
20998const shared_ptr<function_type>
21000{
return priv_->type_.lock();}
21015{
return priv_->naked_type_;}
21020 priv_->type_ = fn_type;
21021 priv_->naked_type_ = fn_type.get();
21038 priv_->symbol_ = sym;
21053{
return priv_->symbol_;}
21056function_decl::is_declared_inline()
const
21057{
return priv_->declared_inline_;}
21060function_decl::get_binding()
const
21061{
return priv_->binding_;}
21064const shared_ptr<type_base>
21066{
return get_type()->get_return_type();}
21069const std::vector<shared_ptr<function_decl::parameter> >&
21071{
return get_type()->get_parameters();}
21078{
get_type()->append_parameter(parm);}
21086 for (std::vector<shared_ptr<parameter> >::const_iterator i = parms.begin();
21105 is_declared_inline(),
21125 is_declared_inline(),
21159 bool result =
true;
21163 if (t0 == t1 || *t0 == *t1)
21189 else if (s0 && s0 != s1)
21200 bool symbols_are_equal = (s0 && s1 && result);
21202 if (symbols_are_equal)
21214 bool decl_bases_different = !l.decl_base::operator==(r);
21221 if (decl_bases_different)
21231 if (!l.decl_base::operator==(r))
21241 if (l.is_declared_inline() != r.is_declared_inline()
21242 || l.get_binding() != r.get_binding())
21299 return equals(*
this, *o, 0);
21323 return hash_fn(*
this);
21338 if (priv_->id_.empty())
21343 if (s->has_aliases())
21350 priv_->id_ = env.
intern(s->get_id_string());
21394 if (v.visit_begin(
this))
21397 if (type_base_sptr t =
get_type())
21401 return v.visit_end(
this);
21423 if (l.get() == r.get())
21446struct function_decl::parameter::priv
21450 bool variadic_marker_;
21457 priv(type_base_sptr type,
21459 bool variadic_marker)
21462 variadic_marker_(variadic_marker)
21466function_decl::parameter::parameter(
const type_base_sptr type,
21468 const string& name,
21469 const location& loc,
21471 : type_or_decl_base(type->get_environment(),
21472 FUNCTION_PARAMETER_DECL | ABSTRACT_DECL_BASE),
21473 decl_base(type->get_environment(), name, loc),
21474 priv_(new priv(type, index, is_variadic))
21476 runtime_type_instance(
this);
21479function_decl::parameter::parameter(
const type_base_sptr type,
21481 const string& name,
21482 const location& loc,
21484 bool is_artificial)
21485 : type_or_decl_base(type->get_environment(),
21486 FUNCTION_PARAMETER_DECL | ABSTRACT_DECL_BASE),
21487 decl_base(type->get_environment(), name, loc),
21488 priv_(new priv(type, index, is_variadic))
21490 runtime_type_instance(
this);
21491 set_is_artificial(is_artificial);
21494function_decl::parameter::parameter(
const type_base_sptr type,
21495 const string& name,
21496 const location& loc,
21498 bool is_artificial)
21499 : type_or_decl_base(type->get_environment(),
21500 FUNCTION_PARAMETER_DECL | ABSTRACT_DECL_BASE),
21501 decl_base(type->get_environment(), name, loc),
21502 priv_(new priv(type, 0, is_variadic))
21504 runtime_type_instance(
this);
21505 set_is_artificial(is_artificial);
21508function_decl::parameter::parameter(
const type_base_sptr type,
21511 : type_or_decl_base(type->get_environment(),
21512 FUNCTION_PARAMETER_DECL | ABSTRACT_DECL_BASE),
21513 decl_base(type->get_environment(),
"", location()),
21514 priv_(new priv(type, index, variad))
21516 runtime_type_instance(
this);
21519function_decl::parameter::~parameter() =
default;
21521const type_base_sptr
21522function_decl::parameter::get_type()
const
21523{
return priv_->type_.lock();}
21550 if (get_variadic_marker()
21570 std::ostringstream o;
21571 o <<
"parameter-" << get_index();
21573 return env.
intern(o.str());
21577function_decl::parameter::get_index()
const
21578{
return priv_->index_;}
21581function_decl::parameter::set_index(
unsigned i)
21582{priv_->index_ = i;}
21586function_decl::parameter::get_variadic_marker()
const
21587{
return priv_->variadic_marker_;}
21613 bool result =
true;
21615 if ((l.get_variadic_marker() != r.get_variadic_marker())
21616 || (l.get_index() != r.get_index())
21617 || (!!l.get_type() != !!r.get_type()))
21622 if (l.get_index() != r.get_index())
21624 if (l.get_variadic_marker() != r.get_variadic_marker()
21625 || !!l.get_type() != !!r.get_type())
21634 if (l_type != r_type)
21652function_decl::parameter::operator==(
const parameter& o)
const
21653{
return equals(*
this, o, 0);}
21662 return function_decl::parameter::operator==(*p);
21708 if (v.visit_begin(
this))
21711 if (type_base_sptr t =
get_type())
21715 return v.visit_end(
this);
21726 return hash_fn_parm(
this);
21766 type_repr =
"void";
21772 string result = type_repr;
21773 string parm_name = get_name_id();
21775 if (!parm_name.empty())
21776 result +=
" " + parm_name;
21810 size_t size_in_bits,
size_t align_in_bits,
21817 | ABSTRACT_DECL_BASE
21818 | ABSTRACT_SCOPE_TYPE_DECL
21819 | ABSTRACT_SCOPE_DECL),
21820 decl_base(env, name, locus, name, vis),
21821 type_base(env, size_in_bits, align_in_bits),
21825 for (member_types::iterator i = mem_types.begin();
21826 i != mem_types.end();
21837 for (member_functions::iterator i = member_fns.begin();
21838 i != member_fns.end();
21840 if (!
has_scope(static_pointer_cast<decl_base>(*i)))
21860 size_t size_in_bits,
size_t align_in_bits,
21864 | ABSTRACT_DECL_BASE
21865 | ABSTRACT_SCOPE_TYPE_DECL
21866 | ABSTRACT_SCOPE_DECL),
21867 decl_base(env, name, locus, name, vis),
21868 type_base(env, size_in_bits, align_in_bits),
21882 bool is_declaration_only)
21885 | ABSTRACT_DECL_BASE
21886 | ABSTRACT_SCOPE_TYPE_DECL
21887 | ABSTRACT_SCOPE_DECL),
21913 if (v.visit_begin(
this))
21922 if (!(*i)->traverse(v))
21932 if (!(*i)->traverse(v))
21942 if (!(*i)->traverse(v))
21949 for (member_function_templates::const_iterator i =
21953 if (!(*i)->traverse(v))
21960 for (member_class_templates::const_iterator i =
21964 if (!(*i)->traverse(v))
21972 bool result = v.visit_end(
this);
22001 type_base_sptr t =
is_type(decl);
22031 for (class_or_union::data_members::const_iterator it =
22120 if (t->get_is_anonymous())
22138 if (t->get_is_anonymous())
22156 if (t->get_is_anonymous())
22181 bool is_laid_out,
bool is_static,
22182 size_t offset_in_bits)
22186 priv_->data_members_.push_back(v);
22197 bool is_already_in =
false;
22198 for (data_members::const_iterator i =
22199 priv_->non_static_data_members_.begin();
22200 i != priv_->non_static_data_members_.end();
22204 is_already_in =
true;
22207 if (!is_already_in)
22208 priv_->non_static_data_members_.push_back(v);
22224{
return priv_->data_members_;}
22239 if ((*i)->get_name() == name)
22251 if (
var_decl_sptr data_member = type->find_data_member(name))
22252 return data_member;
22266 if (!v->get_name().empty())
22274 if ((*it)->get_pretty_representation(
false,
true)
22275 == v->get_pretty_representation(
false,
true))
22302 if (v->get_name().empty())
22315{
return priv_->non_static_data_members_;}
22333 bool is_static,
bool is_ctor,
22334 bool is_dtor,
bool is_const)
22346 priv_->member_functions_.push_back(f);
22350 if (!f->get_linkage_name().empty())
22351 priv_->mem_fns_map_[f->get_linkage_name()] = f;
22360{
return priv_->member_functions_;}
22381 string_mem_fn_sptr_map_type::const_iterator i =
22382 priv_->mem_fns_map_.find(linkage_name);
22383 if (i == priv_->mem_fns_map_.end())
22385 return i->second.get();
22396 string_mem_fn_sptr_map_type::const_iterator i =
22397 priv_->mem_fns_map_.find(linkage_name);
22398 if (i == priv_->mem_fns_map_.end())
22424 string_mem_fn_ptr_map_type::const_iterator i =
22425 priv_->signature_2_mem_fn_map_.find(s);
22426 if (i == priv_->signature_2_mem_fn_map_.end())
22434const member_function_templates&
22436{
return priv_->member_function_templates_;}
22441const member_class_templates&
22443{
return priv_->member_class_templates_;}
22454 priv_->member_function_templates_.push_back(m);
22469 priv_->member_class_templates_.push_back(m);
22479 && priv_->data_members_.empty()
22480 && priv_->member_functions_.empty()
22481 && priv_->member_function_templates_.empty()
22482 && priv_->member_class_templates_.empty());
22501 else if (method_decl_sptr f = dynamic_pointer_cast<method_decl>(d))
22507 else if (member_function_template_sptr f =
22508 dynamic_pointer_cast<member_function_template>(d))
22510 else if (member_class_template_sptr c =
22511 dynamic_pointer_cast<member_class_template>(d))
22560 return *
this == *o;
22601 if (l_is_decl_only || r_is_decl_only)
22611 if (!def1 || !def2)
22615 && l_is_decl_only && r_is_decl_only
22656 if (!!def1 != !!def2)
22664 if (!(l.decl_base::operator==(r)
22665 && l.type_base::operator==(r)))
22676 bool val = *def1 == *def2;
22685 if (!(l.decl_base::operator==(r) && l.type_base::operator==(r)))
22692 if (types_defined_same_linux_kernel_corpus_public(l, r))
22700#define RETURN(value) \
22701 return return_comparison_result(l, r, value, \
22708 bool result =
true;
22722 for (class_or_union::data_members::const_iterator
22736 || (*d0)->get_type() == (*d1)->get_type())
22763 for (member_function_templates::const_iterator
22768 ++fn_tmpl_it0, ++fn_tmpl_it1)
22769 if (**fn_tmpl_it0 != **fn_tmpl_it1)
22794 for (member_class_templates::const_iterator
22799 ++cl_tmpl_it0, ++cl_tmpl_it1)
22800 if (**cl_tmpl_it0 != **cl_tmpl_it1)
22828 const method_decl_sptr& method)
22850 old_type->get_parameters(),
22851 old_type->get_is_const(),
22852 old_type->get_size_in_bits(),
22853 old_type->get_alignment_in_bits()));
22859 method->is_declared_inline(),
22863 method->get_binding()));
22864 new_method->set_symbol(method->
get_symbol());
22867 class_type->add_member_function(new_method,
22876 t->add_member_function(new_method,
22989maybe_propagate_canonical_type(
const type_base& lhs_type,
22993#if WITH_DEBUG_TYPE_CANONICALIZATION
22994 if (!env.priv_->use_canonical_type_comparison_)
23001 if (env.priv_->propagate_ct(lhs_type, rhs_type))
23012struct class_decl::priv
23015 unordered_map<string, base_spec_sptr> bases_map_;
23021 : is_struct_(false)
23062 size_t size_in_bits,
size_t align_in_bits,
23063 bool is_struct,
const location& locus,
23070 | ABSTRACT_TYPE_BASE
23071 | ABSTRACT_DECL_BASE
23072 | ABSTRACT_SCOPE_TYPE_DECL
23073 | ABSTRACT_SCOPE_DECL),
23074 decl_base(env, name, locus, name, vis),
23075 type_base(env, size_in_bits, align_in_bits),
23077 locus, vis, mbr_types, data_mbrs, mbr_fns),
23078 priv_(new priv(is_struct, bases))
23113 size_t size_in_bits,
size_t align_in_bits,
23114 bool is_struct,
const location& locus,
23120 | ABSTRACT_TYPE_BASE
23121 | ABSTRACT_DECL_BASE
23122 | ABSTRACT_SCOPE_TYPE_DECL
23123 | ABSTRACT_SCOPE_DECL),
23132 is_anonymous ? string() : name,
23134 type_base(env, size_in_bits, align_in_bits),
23136 locus, vis, mbr_types, data_mbrs, mbr_fns),
23137 priv_(new priv(is_struct, bases))
23159 size_t size_in_bits,
size_t align_in_bits,
23160 bool is_struct,
const location& locus,
23164 | ABSTRACT_TYPE_BASE
23165 | ABSTRACT_DECL_BASE
23166 | ABSTRACT_SCOPE_TYPE_DECL
23167 | ABSTRACT_SCOPE_DECL),
23168 decl_base(env, name, locus, name, vis),
23169 type_base(env, size_in_bits, align_in_bits),
23172 priv_(new priv(is_struct))
23196 size_t size_in_bits,
size_t align_in_bits,
23197 bool is_struct,
const location& locus,
23201 | ABSTRACT_TYPE_BASE
23202 | ABSTRACT_DECL_BASE
23203 | ABSTRACT_SCOPE_TYPE_DECL
23204 | ABSTRACT_SCOPE_DECL),
23213 is_anonymous ? string() : name,
23215 type_base(env, size_in_bits, align_in_bits),
23218 priv_(new priv(is_struct))
23234 bool is_struct,
bool is_declaration_only)
23237 | ABSTRACT_TYPE_BASE
23238 | ABSTRACT_DECL_BASE
23239 | ABSTRACT_SCOPE_TYPE_DECL
23240 | ABSTRACT_SCOPE_DECL),
23244 priv_(new priv(is_struct))
23259 for (class_decl::virtual_mem_fn_map_type::iterator i =
23260 priv_->virtual_mem_fns_map_.begin();
23261 i != priv_->virtual_mem_fns_map_.end();
23263 sort_virtual_member_functions(i->second);
23271{priv_->is_struct_ = f;}
23278{
return priv_->is_struct_;}
23286 priv_->bases_.push_back(b);
23287 priv_->bases_map_[b->get_base_class()->get_qualified_name()] = b;
23295{
return priv_->bases_;}
23306 unordered_map<string, base_spec_sptr>::iterator i =
23307 priv_->bases_map_.find(qualified_name);
23309 if (i != priv_->bases_map_.end())
23310 return i->second->get_base_class();
23321{
return priv_->virtual_mem_fns_;}
23340{
return priv_->virtual_mem_fns_map_;}
23345{sort_virtual_member_functions(priv_->virtual_mem_fns_);}
23366 bool qualified_name)
const
23368 string cl =
"class ";
23377 if (internal && !
get_name().empty())
23385 string result = cl;
23386 if (qualified_name)
23395class_decl::insert_member_decl(decl_base_sptr d)
23397 if (method_decl_sptr f = dynamic_pointer_cast<method_decl>(d))
23412struct class_decl::base_spec::priv
23415 long offset_in_bits_;
23419 long offset_in_bits,
23422 offset_in_bits_(offset_in_bits),
23423 is_virtual_(is_virtual)
23441 long offset_in_bits,
23444 ABSTRACT_DECL_BASE),
23446 base->get_linkage_name(), base->get_visibility()),
23448 priv_(new priv(base, offset_in_bits, is_virtual))
23460{
return priv_->base_class_.lock();}
23467{
return priv_->is_virtual_;}
23474{
return priv_->offset_in_bits_;}
23504 if (v.visit_begin(
this))
23507 get_base_class()->traverse(v);
23511 return v.visit_end(
this);
23531class_decl::base_spec::base_spec(
const type_base_sptr& base,
23533 long offset_in_bits,
23536 ABSTRACT_DECL_BASE),
23542 priv_(new priv(dynamic_pointer_cast<
class_decl>(base),
23549class_decl::base_spec::~base_spec() =
default;
23575 if (!l.member_base::operator==(r))
23601 return equals(*
this, *o, 0);
23622mem_fn_context_rel::~mem_fn_context_rel()
23642method_decl::method_decl(
const string& name,
23644 bool declared_inline,
23646 const string& linkage_name,
23651 | ABSTRACT_DECL_BASE
23655 declared_inline, locus, linkage_name, vis, bind)
23679method_decl::method_decl(
const string& name,
23681 bool declared_inline,
23683 const string& linkage_name,
23688 | ABSTRACT_DECL_BASE
23690 decl_base(type->get_environment(), name, locus, linkage_name, vis),
23693 declared_inline, locus, linkage_name, vis, bind)
23716method_decl::method_decl(
const string& name,
23717 type_base_sptr type,
23718 bool declared_inline,
23720 const string& linkage_name,
23725 | ABSTRACT_DECL_BASE
23727 decl_base(type->get_environment(), name, locus, linkage_name, vis),
23730 declared_inline, locus, linkage_name, vis, bind)
23749 class_or_union_sptr cl = t->get_class_type();
23751 cl->priv_->mem_fns_map_[l] = m;
23752 if (!old_lname.empty())
23754 if (method_decl_sptr m = cl->find_member_function_sptr(old_lname))
23756 if (m.get() ==
this)
23757 cl->priv_->mem_fns_map_.erase(old_lname);
23763method_decl::~method_decl()
23800 if (l.get() == r.get())
23853{
return dynamic_pointer_cast<method_decl>(d);}
23857struct virtual_member_function_less_than
23881 if (f_offset != s_offset)
return f_offset < s_offset;
23889 if ((!f_sym) != (!s_sym))
return !f_sym;
23890 if (f_sym && s_sym)
23892 fn = f_sym->get_id_string();
23893 sn = s_sym->get_id_string();
23894 if (fn != sn)
return fn < sn;
23900 if (fn != sn)
return fn < sn;
23906 if (fn != sn)
return fn < sn;
23910 string fn_filepath, sn_filepath;
23911 unsigned line = 0, column = 0;
23914 fn_loc.
expand(fn_filepath, line, column);
23916 sn_loc.expand(sn_filepath, line, column);
23917 return fn_filepath < sn_filepath;
23932 operator()(
const method_decl_sptr f,
23933 const method_decl_sptr s)
23934 {
return operator()(*f, *s);}
23943 virtual_member_function_less_than lt;
23944 std::stable_sort(mem_fns.begin(), mem_fns.end(), lt);
23973 size_t vtable_offset,
23974 bool is_static,
bool is_ctor,
23975 bool is_dtor,
bool is_const)
23978 is_dtor, is_const);
23986 sort_virtual_member_functions(klass->priv_->virtual_mem_fns_);
24005 class_decl::member_functions::const_iterator m;
24006 for (m = klass->priv_->virtual_mem_fns_.begin();
24007 m != klass->priv_->virtual_mem_fns_.end();
24009 if (m->get() == method.get())
24011 if (m == klass->priv_->virtual_mem_fns_.end())
24012 klass->priv_->virtual_mem_fns_.push_back(method);
24020 class_decl::virtual_mem_fn_map_type::iterator i =
24021 klass->priv_->virtual_mem_fns_map_.find(voffset);
24022 if (i == klass->priv_->virtual_mem_fns_map_.end())
24025 virtual_mem_fns_at_voffset.push_back(method);
24026 klass->priv_->virtual_mem_fns_map_[voffset] = virtual_mem_fns_at_voffset;
24030 for (m = i->second.begin() ; m != i->second.end(); ++m)
24031 if (m->get() == method.get())
24033 if (m == i->second.end())
24034 i->second.push_back(method);
24063 if ((*b)->get_is_virtual()
24064 || (*b)->get_base_class()->has_virtual_bases())
24093 ssize_t offset = -1;
24094 for (class_decl::virtual_mem_fn_map_type::const_iterator e =
24098 if (e->first > offset)
24111 return hash_class(
this);
24124methods_equal_modulo_elf_symbol(
const method_decl_sptr& f,
24125 const method_decl_sptr& s)
24127 method_decl_sptr first = f, second = s;
24129 first->get_symbol();
24131 second->get_symbol();
24133 first->get_linkage_name();
24135 second->get_linkage_name();
24138 first->set_linkage_name(
"");
24140 second->set_linkage_name(
"");
24142 bool equal = *first == *second;
24144 first->set_symbol(saved_first_elf_symbol);
24145 first->set_linkage_name(saved_first_linkage_name);
24146 second->set_symbol(saved_second_elf_symbol);
24147 second->set_linkage_name(saved_second_linkage_name);
24168method_matches_at_least_one_in_vector(
const method_decl_sptr& method,
24171 for (class_decl::member_functions::const_iterator i = fns.begin();
24180 if (methods_equal_modulo_elf_symbol(method, *i))
24196maybe_cancel_propagated_canonical_type(
const class_or_union& t)
24198 const environment& env = t.get_environment();
24199 if (env.do_on_the_fly_canonicalization())
24200 if (
is_type(&t)->priv_->canonical_type_propagated())
24202 is_type(&t)->priv_->clear_propagated_canonical_type();
24203 env.priv_->remove_from_types_with_non_confirmed_propagated_ct(&t);
24236 bool result =
false;
24237 if (l.
get_environment().priv_->is_type_comparison_cached(l, r, result))
24249 bool result =
true;
24263 if (!had_canonical_type)
24264 maybe_cancel_propagated_canonical_type(r);
24270#define RETURN(value) CACHE_AND_RETURN_COMPARISON_RESULT(value)
24282 for (class_decl::base_specs::const_iterator
24294 (*b1)->get_base_class().get()))
24340 for (class_decl::virtual_mem_fn_map_type::const_iterator first_v_fn_entry =
24343 ++first_v_fn_entry)
24345 unsigned voffset = first_v_fn_entry->first;
24347 first_v_fn_entry->second;
24349 const class_decl::virtual_mem_fn_map_type::const_iterator
24361 second_v_fn_entry->second;
24363 bool matches =
false;
24364 for (class_decl::member_functions::const_iterator i =
24365 first_vfns.begin();
24366 i != first_vfns.end();
24368 if (method_matches_at_least_one_in_vector(*i, second_vfns))
24458 return *
this == *o;
24502 if (l.get() == r.get())
24534operator==(
const class_or_union_sptr& l,
const class_or_union_sptr& r)
24536 if (l.get() == r.get())
24553operator!=(
const class_or_union_sptr& l,
const class_or_union_sptr& r)
24573 if (v.visit_begin(
this))
24582 if (!(*i)->traverse(v))
24593 if (!(*i)->traverse(v))
24603 if (!(*i)->traverse(v))
24613 if (!(*i)->traverse(v))
24620 for (member_function_templates::const_iterator i =
24624 if (!(*i)->traverse(v))
24631 for (member_class_templates::const_iterator i =
24635 if (!(*i)->traverse(v))
24643 bool result = v.visit_end(
this);
24652context_rel::~context_rel()
24656member_base::operator==(
const member_base& o)
const
24676 if (l.get() == r.get())
24681 return *l ==
static_cast<const decl_base&
>(*r);
24720{
return dynamic_pointer_cast<class_decl::base_spec>(tod);}
24723member_function_template::operator==(
const member_base& other)
const
24730 if (!(is_constructor() == o.is_constructor()
24731 && is_const() == o.is_const()
24732 && member_base::operator==(o)))
24739 return ftdecl->function_tdecl::operator==(*other_ftdecl);
24758 const member_function_template_sptr& r)
24760 if (l.get() == r.get())
24779 const member_function_template_sptr& r)
24796 if (v.visit_begin(
this))
24803 return v.visit_end(
this);
24819 if (!member_base::operator==(o))
24822 return as_class_tdecl()->class_tdecl::operator==(o);
24836 if (!decl_base::operator==(other))
24838 return as_class_tdecl()->class_tdecl::operator==(other);
24852 return *
this == *o;
24865 const member_class_template_sptr& r)
24867 if (l.get() == r.get())
24885 const member_class_template_sptr& r)
24902 if (v.visit_begin(
this))
24909 return v.visit_end(
this);
24929 case private_access:
24932 case protected_access:
24935 case public_access:
24959 c->set_is_static(s);
24969 for (class_decl::data_members::iterator i =
24970 cl->priv_->non_static_data_members_.begin();
24971 i != cl->priv_->non_static_data_members_.end();
24974 if ((*i)->get_name() == v->get_name())
24976 cl->priv_->non_static_data_members_.erase(i);
24982 bool is_already_in_non_static_data_members =
false;
24983 for (class_or_union::data_members::iterator i =
24984 cl->priv_->non_static_data_members_.begin();
24985 i != cl->priv_->non_static_data_members_.end();
24988 if ((*i)->get_name() == v->get_name())
24990 is_already_in_non_static_data_members =
true;
24994 if (!is_already_in_non_static_data_members)
24998 for (class_or_union::data_members::const_iterator i =
24999 cl->priv_->data_members_.begin();
25000 i != cl->priv_->data_members_.end();
25003 if ((*i)->get_name() == v->get_name())
25010 cl->priv_->non_static_data_members_.push_back(var);
25051 size_t size_in_bits,
const location& locus,
25056 | ABSTRACT_TYPE_BASE
25057 | ABSTRACT_DECL_BASE),
25058 decl_base(env, name, locus, name, vis),
25061 locus, vis, mbr_types, data_mbrs, member_fns)
25087 size_t size_in_bits,
const location& locus,
25093 | ABSTRACT_TYPE_BASE
25094 | ABSTRACT_DECL_BASE),
25103 is_anonymous ? string() : name,
25107 locus, vis, mbr_types, data_mbrs, member_fns)
25125 size_t size_in_bits,
const location& locus,
25129 | ABSTRACT_TYPE_BASE
25130 | ABSTRACT_DECL_BASE
25131 | ABSTRACT_SCOPE_TYPE_DECL
25132 | ABSTRACT_SCOPE_DECL),
25133 decl_base(env, name, locus, name, vis),
25156 size_t size_in_bits,
const location& locus,
25160 | ABSTRACT_TYPE_BASE
25161 | ABSTRACT_DECL_BASE
25162 | ABSTRACT_SCOPE_TYPE_DECL
25163 | ABSTRACT_SCOPE_DECL),
25172 is_anonymous ? string() : name,
25191 const string& name,
25192 bool is_declaration_only)
25195 | ABSTRACT_TYPE_BASE
25196 | ABSTRACT_DECL_BASE
25197 | ABSTRACT_SCOPE_TYPE_DECL
25198 | ABSTRACT_SCOPE_DECL),
25225 bool qualified_name)
const
25230 if (internal && !
get_name().empty())
25231 repr = string(
"union ") +
25241 if (qualified_name)
25278 return *
this == *o;
25292 return *
this == *o;
25325 if (v.visit_begin(
this))
25334 if (!(*i)->traverse(v))
25344 if (!(*i)->traverse(v))
25354 if (!(*i)->traverse(v))
25361 for (member_function_templates::const_iterator i =
25365 if (!(*i)->traverse(v))
25372 for (member_class_templates::const_iterator i =
25376 if (!(*i)->traverse(v))
25384 bool result = v.visit_end(
this);
25423 bool result =
false;
25424 if (l.
get_environment().priv_->is_type_comparison_cached(l, r, result))
25445 const method_decl_sptr& f)
25460 const class_or_union_sptr t = union_type;
25475 if (l.get() == r.get())
25499class template_decl::priv
25503 std::list<template_parameter_sptr> parms_;
25516{priv_->parms_.push_back(p);}
25522const std::list<template_parameter_sptr>&
25524{
return priv_->parms_;}
25537 const string& name,
25562 return *
this == *other;
25575 list<shared_ptr<template_parameter> >::const_iterator t0, t1;
25601class template_parameter::priv
25607 mutable bool hashing_started_;
25608 mutable bool comparison_started_;
25616 template_decl_(enclosing_template_decl),
25617 hashing_started_(),
25618 comparison_started_()
25622template_parameter::template_parameter(
unsigned index,
25624 : priv_(new priv(index, enclosing_template))
25628template_parameter::get_index()
const
25629{
return priv_->index_;}
25632template_parameter::get_enclosing_template_decl()
const
25633{
return priv_->template_decl_.lock();}
25636template_parameter::get_hashing_has_started()
const
25637{
return priv_->hashing_started_;}
25640template_parameter::set_hashing_has_started(
bool f)
const
25641{priv_->hashing_started_ = f;}
25646 if (get_index() != o.get_index())
25649 if (priv_->comparison_started_)
25652 bool result =
false;
25657 priv_->comparison_started_ =
true;
25659 if (!!get_enclosing_template_decl() != !!o.get_enclosing_template_decl())
25661 else if (get_enclosing_template_decl()
25662 && (*get_enclosing_template_decl()
25663 != *o.get_enclosing_template_decl()))
25668 priv_->comparison_started_ =
false;
25688class type_tparameter::priv
25703type_tparameter::type_tparameter(
unsigned index,
25705 const string& name,
25709 | ABSTRACT_TYPE_BASE
25711 decl_base(enclosing_tdecl->get_environment(), name, locus),
25712 type_base(enclosing_tdecl->get_environment(), 0, 0),
25713 type_decl(enclosing_tdecl->get_environment(), name, 0, 0, locus),
25728 if (!type_decl::operator==(other))
25748 if (!type_decl::operator==(other))
25768 if (!decl_base::operator==(other))
25804{
return *
this ==
static_cast<const type_base&
>(other);}
25806type_tparameter::~type_tparameter()
25810class non_type_tparameter::priv
25820 priv(type_base_sptr type)
25838non_type_tparameter::non_type_tparameter(
unsigned index,
25840 const string& name,
25841 type_base_sptr type,
25844 decl_base(type->get_environment(), name, locus,
""),
25846 priv_(new priv(type))
25854const type_base_sptr
25856{
return priv_->type_.lock();}
25865 return hash_tparm(
this);
25871 if (!decl_base::operator==(other))
25878 return (template_parameter::operator==(o)
25897non_type_tparameter::~non_type_tparameter()
25903class template_tparameter::priv
25917template_tparameter::template_tparameter(
unsigned index,
25919 const string& name,
25923 | ABSTRACT_TYPE_BASE
25925 decl_base(enclosing_tdecl->get_environment(), name, locus),
25926 type_base(enclosing_tdecl->get_environment(), 0, 0),
25927 type_decl(enclosing_tdecl->get_environment(), name,
25928 0, 0, locus, name, VISIBILITY_DEFAULT),
25930 template_decl(enclosing_tdecl->get_environment(), name, locus),
25948 return (type_tparameter::operator==(o)
25967 return (type_tparameter::operator==(o)
25981 return *
this ==
static_cast<const type_base&
>(other);
26000template_tparameter::~template_tparameter()
26008class type_composition::priv
26032type_composition::type_composition(
unsigned index,
26036 ABSTRACT_DECL_BASE),
26047const type_base_sptr
26049{
return priv_->type_.lock();}
26065 return hash_type_composition(
this);
26068type_composition::~type_composition()
26077class function_tdecl::priv
26089 : pattern_(pattern), binding_(bind)
26116 | ABSTRACT_SCOPE_DECL),
26120 priv_(new priv(bind))
26144 | ABSTRACT_SCOPE_DECL),
26149 priv_(new priv(pattern, bind))
26160 priv_->pattern_ = p;
26170{
return priv_->pattern_;}
26177{
return priv_->binding_;}
26189 return *
this == *o;
26203 return *
this == *o;
26216 && template_decl::operator==(o)
26217 && scope_decl::operator==(o)
26241 if (!v.visit_begin(
this))
26248 return v.visit_end(
this);
26251function_tdecl::~function_tdecl()
26259class class_tdecl::priv
26270 : pattern_(pattern)
26289 | ABSTRACT_SCOPE_DECL),
26314 | ABSTRACT_SCOPE_DECL),
26319 priv_(new priv(pattern))
26330 priv_->pattern_ = p;
26340{
return priv_->pattern_;}
26349 if (!(template_decl::operator==(o)
26350 && scope_decl::operator==(o)
26369 return *
this ==
static_cast<const decl_base&
>(o);
26377{
return *
this ==
static_cast<const decl_base&
>(o);}
26393 if (v.visit_begin(
this))
26397 pattern->traverse(v);
26400 return v.visit_end(
this);
26403class_tdecl::~class_tdecl()
26414 non_canonicalized_subtype_detector();
26417 non_canonicalized_subtype_detector(
type_base* type)
26419 has_non_canonical_type_()
26428 has_non_canonical_type()
const
26429 {
return has_non_canonical_type_;}
26434 visit_begin(function_decl* f)
26452 visit_begin(type_base* t)
26456 if (!t->get_canonical_type())
26460 has_non_canonical_type_ = t;
26475 visit_end(type_base* )
26477 if (has_non_canonical_type_)
26494 non_canonicalized_subtype_detector v(t.get());
26496 return v.has_non_canonical_type();
26512 const type_base_sptr t_v2)
26519 return (t1 != t2 && repr1 == repr2);
26530 env.priv_->extra_live_types_.push_back(t);
26566 string repr = v->get_pretty_representation(
true);
26567 std::hash<string> hash_string;
26568 h = hashing::combine_hashes(h, hash_string(repr));
26575 string repr = f->get_pretty_representation(
true);
26576 std::hash<string> hash_string;
26577 h = hashing::combine_hashes(h, hash_string(repr));
26582 type_base_sptr parm_type = p->get_type();
26584 std::hash<bool> hash_bool;
26585 std::hash<unsigned> hash_unsigned;
26587 h = hashing::combine_hashes(h, hash_unsigned(p->get_index()));
26588 h = hashing::combine_hashes(h, hash_bool(p->get_variadic_marker()));
26594 std::hash<size_t> hash_size;
26595 std::hash<bool> hash_bool;
26596 type_base_sptr type = bs->get_base_class();
26598 h = hashing::combine_hashes(h, hash_member(*bs));
26599 h = hashing::combine_hashes(h, hash_size(bs->get_offset_in_bits()));
26600 h = hashing::combine_hashes(h, hash_bool(bs->get_is_virtual()));
26607 result = d->get_hash();
26632{
return hash_as_canonical_type_or_constant(t);}
26741 exemplar =
const_cast<type_base*
>(type);
26770hash_as_canonical_type_or_constant(
const type_base *t)
26777 if (!canonical_type)
26795 if (canonical_type)
26796 return reinterpret_cast<size_t>(canonical_type);
26871 const type_base_sptr& second,
26872 bool indirect_type)
26904 bool indirect_type)
26906 if (!!first != !!second)
26918 if (
typeid(*first) !=
typeid(*second))
26934 if (ty1->is_lvalue() != ty2->is_lvalue())
26937 ty2->get_pointed_to_type(),
26944 if (!indirect_type)
26948 return ty1->get_name() == ty2->
get_name();
26954 if (!indirect_type)
26958 return (
get_name(ty1->get_underlying_type())
26966 && ty1->get_name() != ty2->
get_name())
26969 if (!indirect_type)
26972 || (ty1->get_non_static_data_members().size()
26976 for (class_or_union::data_members::const_iterator
26977 i = ty1->get_non_static_data_members().begin(),
26979 (i != ty1->get_non_static_data_members().end()
26986 dm2->get_type().get(),
26999 && ty1->get_name() != ty2->
get_name())
27002 if (!indirect_type)
27012 if (!indirect_type)
27015 || ty1->get_dimension_count() != ty2->get_dimension_count())
27049 if (ty1->get_parameters().size() != ty2->
get_parameters().size())
27052 for (function_type::parameters::const_iterator
27053 i = ty1->get_parameters().begin(),
27055 (i != ty1->get_parameters().end()
27085 const char* dm_name)
27107 unsigned parm_index)
27114 if (parms.size() <= parm_index)
27117 return parms[parm_index].get();
27132 std::ostringstream o;
27135 o <<
"unnamed-enum";
27139 o <<
"-underlying-type-" << size;
27159 return data_member;
27179 for (; d != e; ++d)
27195struct ir_node_visitor::priv
27210ir_node_visitor::~ir_node_visitor() =
default;
27219{priv_->allow_visiting_already_visited_type_node = f;}
27228{
return priv_->allow_visiting_already_visited_type_node;}
27248 size_t canonical_ptr_value =
reinterpret_cast<size_t>(canonical_type);
27249 priv_->visited_ir_nodes.insert(canonical_ptr_value);
27262{priv_->visited_ir_nodes.clear();}
27282 size_t ptr_value =
reinterpret_cast<size_t>(canonical_type);
27283 pointer_set::iterator it = priv_->visited_ir_nodes.find(ptr_value);
27284 if (it == priv_->visited_ir_nodes.end())
27291ir_node_visitor::visit_begin(
decl_base*)
27299ir_node_visitor::visit_begin(scope_decl*)
27303ir_node_visitor::visit_end(scope_decl*)
27307ir_node_visitor::visit_begin(type_base*)
27311ir_node_visitor::visit_end(type_base*)
27315ir_node_visitor::visit_begin(scope_type_decl* t)
27316{
return visit_begin(
static_cast<type_base*
>(t));}
27319ir_node_visitor::visit_end(scope_type_decl* t)
27320{
return visit_end(
static_cast<type_base*
>(t));}
27323ir_node_visitor::visit_begin(type_decl* t)
27324{
return visit_begin(
static_cast<type_base*
>(t));}
27327ir_node_visitor::visit_end(type_decl* t)
27328{
return visit_end(
static_cast<type_base*
>(t));}
27331ir_node_visitor::visit_begin(namespace_decl* d)
27332{
return visit_begin(
static_cast<decl_base*
>(d));}
27335ir_node_visitor::visit_end(namespace_decl* d)
27336{
return visit_end(
static_cast<decl_base*
>(d));}
27339ir_node_visitor::visit_begin(qualified_type_def* t)
27340{
return visit_begin(
static_cast<type_base*
>(t));}
27343ir_node_visitor::visit_end(qualified_type_def* t)
27344{
return visit_end(
static_cast<type_base*
>(t));}
27347ir_node_visitor::visit_begin(pointer_type_def* t)
27348{
return visit_begin(
static_cast<type_base*
>(t));}
27351ir_node_visitor::visit_end(pointer_type_def* t)
27352{
return visit_end(
static_cast<type_base*
>(t));}
27355ir_node_visitor::visit_begin(reference_type_def* t)
27356{
return visit_begin(
static_cast<type_base*
>(t));}
27359ir_node_visitor::visit_end(reference_type_def* t)
27360{
return visit_end(
static_cast<type_base*
>(t));}
27363ir_node_visitor::visit_begin(array_type_def* t)
27364{
return visit_begin(
static_cast<type_base*
>(t));}
27367ir_node_visitor::visit_end(array_type_def* t)
27368{
return visit_end(
static_cast<type_base*
>(t));}
27371ir_node_visitor::visit_begin(array_type_def::subrange_type* t)
27372{
return visit_begin(
static_cast<type_base*
>(t));}
27375ir_node_visitor::visit_end(array_type_def::subrange_type* t)
27376{
return visit_end(
static_cast<type_base*
>(t));}
27379ir_node_visitor::visit_begin(enum_type_decl* t)
27380{
return visit_begin(
static_cast<type_base*
>(t));}
27383ir_node_visitor::visit_end(enum_type_decl* t)
27384{
return visit_end(
static_cast<type_base*
>(t));}
27387ir_node_visitor::visit_begin(typedef_decl* t)
27388{
return visit_begin(
static_cast<type_base*
>(t));}
27391ir_node_visitor::visit_end(typedef_decl* t)
27392{
return visit_end(
static_cast<type_base*
>(t));}
27395ir_node_visitor::visit_begin(function_type* t)
27396{
return visit_begin(
static_cast<type_base*
>(t));}
27399ir_node_visitor::visit_end(function_type* t)
27400{
return visit_end(
static_cast<type_base*
>(t));}
27403ir_node_visitor::visit_begin(var_decl* d)
27404{
return visit_begin(
static_cast<decl_base*
>(d));}
27407ir_node_visitor::visit_end(var_decl* d)
27408{
return visit_end(
static_cast<decl_base*
>(d));}
27411ir_node_visitor::visit_begin(function_decl* d)
27412{
return visit_begin(
static_cast<decl_base*
>(d));}
27415ir_node_visitor::visit_end(function_decl* d)
27416{
return visit_end(
static_cast<decl_base*
>(d));}
27419ir_node_visitor::visit_begin(function_decl::parameter* d)
27420{
return visit_begin(
static_cast<decl_base*
>(d));}
27423ir_node_visitor::visit_end(function_decl::parameter* d)
27424{
return visit_end(
static_cast<decl_base*
>(d));}
27427ir_node_visitor::visit_begin(function_tdecl* d)
27428{
return visit_begin(
static_cast<decl_base*
>(d));}
27431ir_node_visitor::visit_end(function_tdecl* d)
27432{
return visit_end(
static_cast<decl_base*
>(d));}
27435ir_node_visitor::visit_begin(class_tdecl* d)
27436{
return visit_begin(
static_cast<decl_base*
>(d));}
27439ir_node_visitor::visit_end(class_tdecl* d)
27440{
return visit_end(
static_cast<decl_base*
>(d));}
27443ir_node_visitor::visit_begin(class_or_union* t)
27444{
return visit_begin(
static_cast<type_base*
>(t));}
27447ir_node_visitor::visit_end(class_or_union* t)
27448{
return visit_end(
static_cast<type_base*
>(t));}
27451ir_node_visitor::visit_begin(class_decl* t)
27452{
return visit_begin(
static_cast<type_base*
>(t));}
27455ir_node_visitor::visit_end(class_decl* t)
27456{
return visit_end(
static_cast<type_base*
>(t));}
27459ir_node_visitor::visit_begin(union_decl* t)
27460{
return visit_begin(
static_cast<type_base*
>(t));}
27463ir_node_visitor::visit_end(union_decl* t)
27464{
return visit_end(
static_cast<type_base*
>(t));}
27467ir_node_visitor::visit_begin(class_decl::base_spec* d)
27468{
return visit_begin(
static_cast<decl_base*
>(d));}
27471ir_node_visitor::visit_end(class_decl::base_spec* d)
27472{
return visit_end(
static_cast<decl_base*
>(d));}
27475ir_node_visitor::visit_begin(member_function_template* d)
27476{
return visit_begin(
static_cast<decl_base*
>(d));}
27479ir_node_visitor::visit_end(member_function_template* d)
27480{
return visit_end(
static_cast<decl_base*
>(d));}
27483ir_node_visitor::visit_begin(member_class_template* d)
27484{
return visit_begin(
static_cast<decl_base*
>(d));}
27487ir_node_visitor::visit_end(member_class_template* d)
27488{
return visit_end(
static_cast<decl_base*
>(d));}
27500 static __thread
size_t counter;
27502 std::ostringstream o;
27509typedef unordered_map<
const function_decl*, string,
27510 function_decl::hash,
27529static const string&
27533 fns_to_str_map_type::const_iterator i = m.find(fn);
27536 string s = get_next_string();
27557fns_to_str(vector<function_decl*>::const_iterator begin,
27558 vector<function_decl*>::const_iterator end,
27562 vector<function_decl*>::const_iterator i;
27563 for (i = begin; i != end; ++i)
27564 o <<
"'" << fn_to_str(*i, m) <<
"' ";
27590fns_to_str(vector<function_decl*>::const_iterator a_begin,
27591 vector<function_decl*>::const_iterator a_end,
27592 vector<function_decl*>::const_iterator b_begin,
27593 vector<function_decl*>::const_iterator b_end,
27597 fns_to_str(a_begin, a_end, m, o);
27599 fns_to_str(b_begin, b_end, m, o);
27623fns_to_str(vector<function_decl*>::const_iterator a_begin,
27624 vector<function_decl*>::const_iterator a_end,
27625 vector<function_decl*>::const_iterator b_begin,
27626 vector<function_decl*>::const_iterator b_end,
27630 fns_to_str(a_begin, a_end, b_begin, b_end, m, o);
27652 std::string parent_qualified_name;
27661 if (!d->priv_->qualified_parent_name_.empty())
27666 d->priv_->qualified_name_ =
27667 env.
intern(d->priv_->qualified_parent_name_ +
"::" + d->
get_name());
27670 if (d->priv_->scoped_name_.empty())
27675 d->priv_->scoped_name_ =
27678 d->priv_->scoped_name_ =
27696{
return do_update(d);}
27708 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.
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 is_infinite() const
Test if the length of the subrange type is infinite.
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 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.
virtual bool is_infinite() const
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
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.
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 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...
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.
const corpus * get_corpus() const
Get the corpus this ABI artifact belongs to.
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.
friend class_decl * is_class_type(const type_or_decl_base *)
Test whether a type is a class.
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,...
friend decl_base * is_decl(const type_or_decl_base *d)
Test if an ABI artifact is a declaration.
friend pointer_type_def * is_pointer_type(type_or_decl_base *)
Test whether a type is a pointer_type_def.
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 type_base * is_type(const type_or_decl_base *)
Test whether a declaration is a type.
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.
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.
const type_base * peel_pointer_type(const type_base *type)
Return the leaf pointed-to type node of a pointer_type_def node.
shared_ptr< reference_type_def > reference_type_def_sptr
Convenience typedef for a shared pointer on a reference_type_def.
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.
size_t hash_type(const type_base *t)
Hash an ABI artifact that is either a type.
void fqn_to_components(const string &fqn, list< string > &comps)
Decompose a fully qualified name into the list of its components.
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.
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 is_template_parm_composition_type(const shared_ptr< decl_base > decl)
Tests whether a decl is a template parameter composition type.
bool get_member_is_static(const decl_base &d)
Gets a flag saying if a class member is static or not.
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.
bool function_decls_alias(const function_decl &f1, const function_decl &f2)
Test if two function declarations are aliases.
shared_ptr< class_tdecl > class_tdecl_sptr
Convenience typedef for a shared pointer on a class_tdecl.
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:
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.
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_template_parameter(const shared_ptr< decl_base > decl)
Tests whether a decl is a template parameter.
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.
class_decl::base_spec * is_class_base_spec(const type_or_decl_base *tod)
Test if an ABI artifact is a class base specifier.
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.
void set_member_function_vtable_offset(function_decl &f, ssize_t s)
Set the vtable offset of a member function.
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.
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.
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 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.
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...
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 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.
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.
void unmark_types_as_being_compared(T &l, T &r)
Mark a pair of types as being not compared anymore.
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.
union_decl_sptr is_union_type(const shared_ptr< type_or_decl_base > &t)
Test if a type is a union_decl.
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.
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.
pointer_type_def_sptr is_pointer_type(const type_or_decl_base_sptr &t)
Test whether a type is a pointer_type_def.
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.
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...
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.
const type_base_sptr peel_qualified_type(const type_base_sptr &type)
Return the leaf underlying type of a qualified type.
array_type_def * is_array_type(const type_or_decl_base *type)
Test if a type is an array_type_def.
reference_type_def * is_reference_type(type_or_decl_base *t)
Test whether a type is a reference_type_def.
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.
translation_unit * get_translation_unit(const shared_ptr< decl_base > decl)
Return the translation unit a declaration belongs to.
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 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.
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...
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 is_comparison_cycle_detected(T &l, T &r)
Detect if a recursive comparison cycle is detected while structurally comparing two types (a....
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 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.
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.
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.
const type_base * peel_reference_type(const type_base *type)
Return the leaf pointed-to type node of a reference_type_def node.
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.
bool is_typedef_to_decl_only_class_or_union_type(const type_or_decl_base *t)
Test if a type is a typedef to a decl-only class/union.
function_decl::parameter_sptr is_function_parameter(const type_or_decl_base_sptr tod)
Test whether an ABI artifact is a function_decl.
bool is_pointer_to_decl_only_class_or_union_type(const type_or_decl_base *t)
Test if a type is a pointer to a decl-only class/union.
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.
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.
unordered_map< interned_string, bool, hash_interned_string > interned_string_bool_map_type
Convenience typedef for a map of interned_string -> bool.
const enum_type_decl * is_enum_type(const type_or_decl_base *d)
Test if a decl is an enum_type_decl.
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...
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.
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.
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.
size_t hash_type_or_decl(const type_or_decl_base *tod)
Hash an ABI artifact that is either a type or a decl.
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.
bool is_template_decl(const decl_base_sptr &decl)
Tests whether a decl is a template.
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.
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.
bool try_canonical_compare(const T *l, const T *r)
Compare two types by comparing their canonical types if present.
type_base * type_has_non_canonicalized_subtype(type_base_sptr t)
Test if a type has sub-types that are non-canonicalized.
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.
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.
pointer_type_def * is_pointer_type(type_or_decl_base *t)
Test whether a type is a pointer_type_def.
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.
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.
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.
string get_pretty_representation(const method_type_sptr method, bool internal)
Get the pretty representation of a method type.
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.
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.
const interned_string & get_node_name(var_decl_sptr node)
Gets the name of a var_decl node.
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.
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.
weak_ptr< decl_base > decl_base_wptr
Convenience typedef for a weak pointer to a decl_base.
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 is_function_template_pattern(const shared_ptr< decl_base > decl)
Test whether a decl is the pattern of a function template.
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.
bool is_global_scope(const shared_ptr< scope_decl >scope)
Tests whether if a given scope is the global scope.
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.
array_type_def_sptr is_array_type(const type_or_decl_base_sptr &type)
Test if a type is an array_type_def.
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.
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.
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.
shared_ptr< type_decl > type_decl_sptr
Convenience typedef for a shared pointer on a type_decl.
const global_scope * get_global_scope(const shared_ptr< decl_base > decl)
Return the global scope as seen by a given declaration.
typedef_decl_sptr clone_typedef(const typedef_decl_sptr &t)
Clone a typedef type.
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.
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.
void mark_types_as_being_compared(T &l, T &r)
Mark a pair of types as being compared.
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.
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.
bool is_at_template_scope(const shared_ptr< decl_base > decl)
Tests whether a given decl is at template scope.
function_decl * is_function_decl(const type_or_decl_base *d)
Test whether a declaration is a function_decl.
bool elf_symbol_is_variable(elf_symbol::type t)
Test if the type of an ELF symbol denotes a function symbol.
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,...
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:
reference_type_def_sptr is_reference_type(const type_or_decl_base_sptr &t)
Test whether a type is a reference_type_def.
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.
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.
interned_string get_function_id_or_pretty_representation(function_decl *fn)
Get the ID of a function, or, if the ID can designate several different functions,...
string build_qualified_name(const scope_decl *scope, const string &name)
Build and return a qualified name from a name and its scope.
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.
bool is_reference_to_decl_only_class_or_union_type(const type_or_decl_base *t)
Test if a type is a reference to a decl-only class/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.
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 get_member_function_is_ctor(const function_decl &f)
Test whether a member function is a constructor.
void set_member_function_is_ctor(function_decl &f, bool c)
Setter for the is_ctor property of the member function.
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.
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.
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.
bool operator==(const std::string &l, const interned_string &r)
Equality operator.
std::string operator+(const interned_string &s1, const std::string &s2)
Concatenation 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.