20 #include <unordered_map>
24 #include "abg-internal.h"
26 ABG_BEGIN_EXPORT_DECLARATIONS
69 using std::unordered_map;
70 using std::dynamic_pointer_cast;
71 using std::static_pointer_cast;
78 struct 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);}
156 operator!=(
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);}
207 hash_as_canonical_type_or_constant(
const type_base *t);
210 has_generic_anonymous_internal_type_name(
const decl_base *d);
212 static interned_string
213 get_generic_anonymous_internal_type_name(
const decl_base *d);
216 get_internal_integral_type_name(
const type_base*);
219 update_qualified_name(decl_base * d);
222 update_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);
341 class 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;
424 struct location_manager::priv
430 std::vector<expanded_location> locs;
433 location_manager::location_manager()
437 location_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
476 if (location.value_ == 0)
478 expanded_location &l = priv_->locs[location.value_ - 1];
491 struct type_maps::priv
504 mutable vector<type_base_wptr> sorted_types_;
507 type_maps::type_maps()
511 type_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_;}
685 struct type_name_comp
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
753 notify_equality_failed(
const type_or_decl_base &l __attribute__((unused)),
754 const type_or_decl_base &r __attribute__((unused)))
771 notify_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); \
800 #else // WITH_DEBUG_SELF_COMPARISON
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);
886 static_cast<const class_or_union&>(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);
950 static_cast<const class_or_union&>(r));
968 l.priv_->unmark_as_being_compared(l, r);
989 static_cast<const class_or_union&>(r));
1014 template<
typename T>
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
1045 && env.priv_->right_type_comp_operands_.empty()
1046 &&
is_type(&r)->priv_->canonical_type_propagated()
1047 && !
is_type(&r)->priv_->propagated_canonical_type_confirmed())
1056 env.priv_->confirm_ct_propagation(&r);
1058 else if (value ==
true
1059 &&
is_type(&r)->priv_->canonical_type_propagated()
1060 && !
is_type(&r)->priv_->propagated_canonical_type_confirmed())
1063 env.priv_->add_to_types_with_non_confirmed_propagated_ct(
is_type(&r));
1064 else if (value ==
false)
1071 env.priv_->cancel_all_non_confirmed_propagated_canonical_types();
1083 && env.priv_->right_type_comp_operands_.empty()
1084 && !env.priv_->types_with_non_confirmed_propagated_ct_.empty())
1089 env.priv_->confirm_ct_propagation();
1091 #ifdef WITH_DEBUG_SELF_COMPARISON
1092 if (value ==
false && env.priv_->right_type_comp_operands_.empty())
1094 for (
const auto i : env.priv_->types_with_non_confirmed_propagated_ct_)
1097 env.priv_->check_abixml_canonical_type_propagation_during_self_comp(t);
1105 #define CACHE_AND_RETURN_COMPARISON_RESULT(value) \
1108 bool res = return_comparison_result(l, r, value); \
1109 l.get_environment().priv_->cache_type_comparison_result(l, r, res); \
1117 #define CACHE_COMPARISON_RESULT_AND_RETURN(value) \
1120 l.get_environment().priv_->cache_type_comparison_result(l, r, value); \
1128 const vector<type_base_wptr>&
1131 if (priv_->sorted_types_.empty())
1133 istring_type_base_wptrs_map_type::const_iterator i;
1134 vector<type_base_wptr>::const_iterator j;
1137 for (j = i->second.begin(); j != i->second.end(); ++j)
1138 priv_->sorted_types_.push_back(*j);
1141 for (j = i->second.begin(); j != i->second.end(); ++j)
1142 priv_->sorted_types_.push_back(*j);
1145 for (j = i->second.begin(); j != i->second.end(); ++j)
1146 priv_->sorted_types_.push_back(*j);
1149 for (j = i->second.begin(); j != i->second.end(); ++j)
1150 priv_->sorted_types_.push_back(*j);
1153 for (j = i->second.begin(); j != i->second.end(); ++j)
1154 priv_->sorted_types_.push_back(*j);
1156 type_name_comp comp;
1157 sort(priv_->sorted_types_.begin(), priv_->sorted_types_.end(), comp);
1160 return priv_->sorted_types_;
1179 const std::string& path,
1181 : priv_(new
priv(env))
1183 priv_->path_ = path;
1184 priv_->address_size_ = address_size;
1206 if (!priv_->global_scope_)
1208 priv_->global_scope_.reset
1209 (
new global_scope(const_cast<translation_unit*>(
this)));
1210 priv_->global_scope_->set_translation_unit
1211 (const_cast<translation_unit*>(
this));
1213 return priv_->global_scope_;
1221 {
return priv_->types_;}
1228 {
return priv_->types_;}
1235 const vector<function_type_sptr>&
1237 {
return priv_->live_fn_types_;}
1244 {
return priv_->env_;}
1251 {
return priv_->language_;}
1258 {priv_->language_ = l;}
1271 {
return priv_->path_;}
1282 {priv_->path_ = a_path;}
1295 {
return priv_->comp_dir_path_;}
1306 {priv_->comp_dir_path_ = d;}
1315 if (priv_->abs_path_.empty())
1318 if (!priv_->path_.empty())
1320 if (!priv_->comp_dir_path_.empty())
1322 path = priv_->comp_dir_path_;
1325 path += priv_->path_;
1327 priv_->abs_path_ = path;
1330 return priv_->abs_path_;
1349 {
return priv_->corp;}
1365 {
return priv_->loc_mgr_;}
1373 {
return priv_->loc_mgr_;}
1382 if (!priv_->global_scope_)
1392 {
return priv_->address_size_;}
1399 {priv_->address_size_= a;}
1415 {
return priv_->is_constructed_;}
1431 {priv_->is_constructed_ = f;}
1470 const_cast<translation_unit*
>(
this)->priv_->live_fn_types_.push_back(ftype);
1486 ftype->set_translation_unit(const_cast<translation_unit*>(
this));
1503 translation_unit::~translation_unit()
1516 case translation_unit::LANG_UNKNOWN:
1517 return "LANG_UNKNOWN";
1518 case translation_unit::LANG_Cobol74:
1519 return "LANG_Cobol74";
1520 case translation_unit::LANG_Cobol85:
1521 return "LANG_Cobol85";
1522 case translation_unit::LANG_C89:
1524 case translation_unit::LANG_C99:
1526 case translation_unit::LANG_C11:
1528 case translation_unit::LANG_C:
1530 case translation_unit::LANG_C_plus_plus_11:
1531 return "LANG_C_plus_plus_11";
1532 case translation_unit::LANG_C_plus_plus_14:
1533 return "LANG_C_plus_plus_14";
1534 case translation_unit::LANG_C_plus_plus:
1535 return "LANG_C_plus_plus";
1536 case translation_unit::LANG_ObjC:
1538 case translation_unit::LANG_ObjC_plus_plus:
1539 return "LANG_ObjC_plus_plus";
1540 case translation_unit::LANG_Fortran77:
1541 return "LANG_Fortran77";
1542 case translation_unit::LANG_Fortran90:
1543 return "LANG_Fortran90";
1544 case translation_unit::LANG_Fortran95:
1545 return "LANG_Fortran95";
1546 case translation_unit::LANG_Ada83:
1547 return "LANG_Ada83";
1548 case translation_unit::LANG_Ada95:
1549 return "LANG_Ada95";
1550 case translation_unit::LANG_Pascal83:
1551 return "LANG_Pascal83";
1552 case translation_unit::LANG_Modula2:
1553 return "LANG_Modula2";
1554 case translation_unit::LANG_Java:
1556 case translation_unit::LANG_PLI:
1558 case translation_unit::LANG_UPC:
1560 case translation_unit::LANG_D:
1562 case translation_unit::LANG_Python:
1563 return "LANG_Python";
1564 case translation_unit::LANG_Go:
1566 case translation_unit::LANG_Mips_Assembler:
1567 return "LANG_Mips_Assembler";
1569 return "LANG_UNKNOWN";
1572 return "LANG_UNKNOWN";
1584 if (l ==
"LANG_Cobol74")
1585 return translation_unit::LANG_Cobol74;
1586 else if (l ==
"LANG_Cobol85")
1587 return translation_unit::LANG_Cobol85;
1588 else if (l ==
"LANG_C89")
1589 return translation_unit::LANG_C89;
1590 else if (l ==
"LANG_C99")
1591 return translation_unit::LANG_C99;
1592 else if (l ==
"LANG_C11")
1593 return translation_unit::LANG_C11;
1594 else if (l ==
"LANG_C")
1595 return translation_unit::LANG_C;
1596 else if (l ==
"LANG_C_plus_plus_11")
1597 return translation_unit::LANG_C_plus_plus_11;
1598 else if (l ==
"LANG_C_plus_plus_14")
1599 return translation_unit::LANG_C_plus_plus_14;
1600 else if (l ==
"LANG_C_plus_plus")
1601 return translation_unit::LANG_C_plus_plus;
1602 else if (l ==
"LANG_ObjC")
1603 return translation_unit::LANG_ObjC;
1604 else if (l ==
"LANG_ObjC_plus_plus")
1605 return translation_unit::LANG_ObjC_plus_plus;
1606 else if (l ==
"LANG_Fortran77")
1607 return translation_unit::LANG_Fortran77;
1608 else if (l ==
"LANG_Fortran90")
1609 return translation_unit::LANG_Fortran90;
1610 else if (l ==
"LANG_Fortran95")
1611 return translation_unit::LANG_Fortran95;
1612 else if (l ==
"LANG_Ada83")
1613 return translation_unit::LANG_Ada83;
1614 else if (l ==
"LANG_Ada95")
1615 return translation_unit::LANG_Ada95;
1616 else if (l ==
"LANG_Pascal83")
1617 return translation_unit::LANG_Pascal83;
1618 else if (l ==
"LANG_Modula2")
1619 return translation_unit::LANG_Modula2;
1620 else if (l ==
"LANG_Java")
1621 return translation_unit::LANG_Java;
1622 else if (l ==
"LANG_PLI")
1623 return translation_unit::LANG_PLI;
1624 else if (l ==
"LANG_UPC")
1625 return translation_unit::LANG_UPC;
1626 else if (l ==
"LANG_D")
1627 return translation_unit::LANG_D;
1628 else if (l ==
"LANG_Python")
1629 return translation_unit::LANG_Python;
1630 else if (l ==
"LANG_Go")
1631 return translation_unit::LANG_Go;
1632 else if (l ==
"LANG_Mips_Assembler")
1633 return translation_unit::LANG_Mips_Assembler;
1635 return translation_unit::LANG_UNKNOWN;
1646 return (l == translation_unit::LANG_C89
1647 || l == translation_unit::LANG_C99
1648 || l == translation_unit::LANG_C11
1649 || l == translation_unit::LANG_C);
1660 return (l == translation_unit::LANG_C_plus_plus_03
1661 || l == translation_unit::LANG_C_plus_plus_11
1662 || l == translation_unit::LANG_C_plus_plus_14
1663 || l == translation_unit::LANG_C_plus_plus);
1673 {
return l == translation_unit::LANG_Java;}
1683 return (l == translation_unit::LANG_Ada83
1684 || l == translation_unit::LANG_Ada95);
1697 if (l.get() == r.get())
1720 struct elf_symbol::priv
1760 bool is_in_ksymtab_;
1763 bool is_suppressed_;
1778 is_in_ksymtab_(false),
1781 is_suppressed_(false)
1784 priv(
const environment& e,
1792 const elf_symbol::version& ve,
1808 is_in_ksymtab_(is_in_ksymtab),
1811 is_suppressed_(is_suppressed)
1814 is_common_ = type_ == COMMON_TYPE;
1848 elf_symbol::elf_symbol(
const environment& e,
1924 elf_symbol_sptr sym(
new elf_symbol(e, i, s, n, t, b, d, c, ve, vi,
1925 is_in_ksymtab, crc, ns, is_suppressed));
1926 sym->priv_->main_symbol_ = sym;
1966 {
return priv_->env_;}
1973 {
return priv_->index_;}
1980 {priv_->index_ = s;}
1987 {
return priv_->name_;}
1996 priv_->id_string_.clear();
2004 {
return priv_->type_;}
2018 {
return priv_->size_;}
2025 {priv_->size_ = size;}
2032 {
return priv_->binding_;}
2039 {priv_->binding_ = b;}
2046 {
return priv_->version_;}
2054 priv_->version_ = v;
2055 priv_->id_string_.clear();
2064 {priv_->visibility_ = v;}
2072 {
return priv_->visibility_;}
2080 {
return priv_->is_defined_;}
2088 {priv_->is_defined_ = d;}
2135 {
return priv_->is_in_ksymtab_;}
2150 {
return priv_->crc_;}
2157 {priv_->crc_ = crc;}
2164 {
return priv_->namespace_;}
2171 {priv_->namespace_ = ns;}
2180 {
return priv_->is_suppressed_;}
2219 {
return priv_->main_symbol_.lock();}
2226 {
return priv_->main_symbol_.lock();}
2240 {
return priv_->next_alias_.lock();}
2260 a = a->get_next_alias())
2283 a && !a->is_main_symbol();
2284 a = a->get_next_alias())
2286 if (a->get_next_alias()->is_main_symbol())
2294 last_alias->priv_->next_alias_ = alias;
2297 priv_->next_alias_ = alias;
2327 a = a->get_next_alias())
2328 if (a->get_name() == name)
2338 priv_->main_symbol_ = new_main;
2340 a = a->get_next_alias())
2341 a->priv_->main_symbol_ = new_main;
2351 {
return priv_->is_common_;}
2382 {
return priv_->next_common_instance_.lock();}
2397 ABG_ASSERT(!common->has_other_common_instances());
2406 c = c->get_next_common_instance())
2411 last_common_instance = c;
2416 last_common_instance->priv_->next_common_instance_ = common;
2419 priv_->next_common_instance_ = common;
2439 if (priv_->id_string_.empty())
2451 priv_->id_string_ = s;
2454 return priv_->id_string_;
2471 a = a->get_next_alias())
2472 if (a->get_name() == name)
2489 a && a.get() != a->get_main_symbol().get();
2490 a = a->get_next_alias())
2491 if (textually_equals(*
this, *a))
2508 bool include_symbol_itself)
const
2512 if (include_symbol_itself)
2515 vector<elf_symbol_sptr> aliases;
2516 compute_aliases_for_elf_symbol(*
this, syms, aliases);
2517 if (!aliases.empty() && include_symbol_itself)
2520 for (vector<elf_symbol_sptr>::const_iterator i = aliases.begin();
2524 if (i != aliases.begin())
2526 result += (*i)->get_id_string();
2541 vector<elf_symbol_sptr> aliases;
2542 if (include_symbol_itself)
2547 a = a->get_next_alias())
2548 aliases.push_back(a);
2551 for (vector<elf_symbol_sptr>::const_iterator i = aliases.begin();
2555 if (i != aliases.begin())
2557 result += (*i)->get_id_string();
2577 name.clear(), ver.clear();
2579 string::size_type i =
id.find(
'@');
2580 if (i == string::npos)
2586 name =
id.substr(0, i);
2592 string::size_type j =
id.find(
'@', i);
2593 if (j == string::npos)
2620 bool are_equal = textually_equals(*
this, other);
2641 a && !a->is_main_symbol();
2642 a = a->get_next_alias())
2666 return *lhs == *rhs;
2692 compute_aliases_for_elf_symbol(
const elf_symbol& sym,
2694 vector<elf_symbol_sptr>& aliases)
2698 for (; a && !a->is_main_symbol(); a = a->get_next_alias())
2699 aliases.push_back(a);
2701 for (string_elf_symbols_map_type::const_iterator i = symtab.begin();
2704 for (elf_symbols::const_iterator j = i->second.begin();
2705 j != i->second.end();
2710 s && !s->is_main_symbol();
2711 s = s->get_next_alias())
2712 aliases.push_back(s);
2715 s && !s->is_main_symbol();
2716 s = s->get_next_alias())
2718 aliases.push_back(*j);
2763 case elf_symbol::NOTYPE_TYPE:
2764 repr =
"unspecified symbol type";
2766 case elf_symbol::OBJECT_TYPE:
2767 repr =
"variable symbol type";
2769 case elf_symbol::FUNC_TYPE:
2770 repr =
"function symbol type";
2772 case elf_symbol::SECTION_TYPE:
2773 repr =
"section symbol type";
2775 case elf_symbol::FILE_TYPE:
2776 repr =
"file symbol type";
2778 case elf_symbol::COMMON_TYPE:
2779 repr =
"common data object symbol type";
2781 case elf_symbol::TLS_TYPE:
2782 repr =
"thread local data object symbol type";
2784 case elf_symbol::GNU_IFUNC_TYPE:
2785 repr =
"indirect function symbol type";
2789 std::ostringstream s;
2790 s <<
"unknown symbol type (" << (char)t <<
')';
2813 case elf_symbol::LOCAL_BINDING:
2814 repr =
"local binding";
2816 case elf_symbol::GLOBAL_BINDING:
2817 repr =
"global binding";
2819 case elf_symbol::WEAK_BINDING:
2820 repr =
"weak binding";
2822 case elf_symbol::GNU_UNIQUE_BINDING:
2823 repr =
"GNU unique binding";
2827 std::ostringstream s;
2828 s <<
"unknown binding (" << (
unsigned char) b <<
")";
2851 case elf_symbol::DEFAULT_VISIBILITY:
2852 repr =
"default visibility";
2854 case elf_symbol::PROTECTED_VISIBILITY:
2855 repr =
"protected visibility";
2857 case elf_symbol::HIDDEN_VISIBILITY:
2858 repr =
"hidden visibility";
2860 case elf_symbol::INTERNAL_VISIBILITY:
2861 repr =
"internal visibility";
2865 std::ostringstream s;
2866 s <<
"unknown visibility (" << (
unsigned char) v <<
")";
2888 t = elf_symbol::NOTYPE_TYPE;
2889 else if (s ==
"object-type")
2890 t = elf_symbol::OBJECT_TYPE;
2891 else if (s ==
"func-type")
2892 t = elf_symbol::FUNC_TYPE;
2893 else if (s ==
"section-type")
2894 t = elf_symbol::SECTION_TYPE;
2895 else if (s ==
"file-type")
2896 t = elf_symbol::FILE_TYPE;
2897 else if (s ==
"common-type")
2898 t = elf_symbol::COMMON_TYPE;
2899 else if (s ==
"tls-type")
2900 t = elf_symbol::TLS_TYPE;
2901 else if (s ==
"gnu-ifunc-type")
2902 t = elf_symbol::GNU_IFUNC_TYPE;
2920 if (s ==
"local-binding")
2921 b = elf_symbol::LOCAL_BINDING;
2922 else if (s ==
"global-binding")
2923 b = elf_symbol::GLOBAL_BINDING;
2924 else if (s ==
"weak-binding")
2925 b = elf_symbol::WEAK_BINDING;
2926 else if (s ==
"gnu-unique-binding")
2927 b = elf_symbol::GNU_UNIQUE_BINDING;
2945 if (s ==
"default-visibility")
2946 v = elf_symbol::DEFAULT_VISIBILITY;
2947 else if (s ==
"protected-visibility")
2948 v = elf_symbol::PROTECTED_VISIBILITY;
2949 else if (s ==
"hidden-visibility")
2950 v = elf_symbol::HIDDEN_VISIBILITY;
2951 else if (s ==
"internal-visibility")
2952 v = elf_symbol::INTERNAL_VISIBILITY;
2967 {
return t == elf_symbol::FUNC_TYPE;}
2977 {
return t == elf_symbol::OBJECT_TYPE;}
2981 struct elf_symbol::version::priv
2987 : is_default_(false)
2990 priv(
const string& v,
2997 elf_symbol::version::version()
3004 elf_symbol::version::version(
const string& v,
3006 : priv_(new priv(v, is_default))
3010 : priv_(new priv(v.str(), v.is_default()))
3014 elf_symbol::version::~version() =
default;
3019 elf_symbol::version::operator
const string&()
const
3020 {
return priv_->version_;}
3027 {
return priv_->version_;}
3034 {priv_->version_ = s;}
3041 {
return priv_->is_default_;}
3048 {priv_->is_default_ = f;}
3051 elf_symbol::version::is_empty()
const
3052 {
return str().empty();}
3061 {
return str() == o.
str();}
3090 struct dm_context_rel::priv
3093 size_t offset_in_bits_;
3096 priv(
bool is_static =
false)
3097 : is_laid_out_(!is_static),
3099 anonymous_data_member_()
3102 priv(
bool is_laid_out,
size_t offset_in_bits)
3103 : is_laid_out_(is_laid_out),
3104 offset_in_bits_(offset_in_bits),
3105 anonymous_data_member_()
3109 dm_context_rel::dm_context_rel()
3114 dm_context_rel::dm_context_rel(scope_decl* s,
3116 size_t offset_in_bits,
3119 : context_rel(s, a, is_static),
3120 priv_(new priv(is_laid_out, offset_in_bits))
3123 dm_context_rel::dm_context_rel(scope_decl* s)
3129 dm_context_rel::get_is_laid_out()
const
3130 {
return priv_->is_laid_out_;}
3133 dm_context_rel::set_is_laid_out(
bool f)
3134 {priv_->is_laid_out_ = f;}
3137 dm_context_rel::get_offset_in_bits()
const
3138 {
return priv_->offset_in_bits_;}
3141 dm_context_rel::set_offset_in_bits(
size_t o)
3142 {priv_->offset_in_bits_ = o;}
3145 dm_context_rel::operator==(
const dm_context_rel& o)
const
3147 if (!context_rel::operator==(o))
3150 return (priv_->is_laid_out_ == o.priv_->is_laid_out_
3151 && priv_->offset_in_bits_ == o.priv_->offset_in_bits_);
3155 dm_context_rel::operator!=(
const dm_context_rel& o)
const
3166 {
return priv_->anonymous_data_member_;}
3176 {priv_->anonymous_data_member_ = anon_dm;}
3178 dm_context_rel::~dm_context_rel()
3204 {
return priv_->canonical_types_;}
3217 is_ptr_ref_or_qual_type(
const type_base *t)
3234 compare_using_locations(
const decl_base *f,
3248 unsigned l1 = 0, l2 = 0, c1 = 0, c2 = 0;
3271 struct decl_topo_comp
3282 operator()(
const decl_base *f,
3301 if ((!f->get_corpus() && !s->get_corpus())
3302 || (f->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN
3303 && s->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN))
3304 return compare_using_locations(f, s);
3311 if (fl.get_value() && sl.get_value())
3312 return compare_using_locations(f, s);
3313 else if (!!fl != !!sl)
3320 if (f->get_is_anonymous()
3321 && s->get_is_anonymous()
3324 return f->get_name() < s->get_name();
3338 operator()(
const decl_base_sptr &f,
3339 const decl_base_sptr &s)
3340 {
return operator()(f.get(), s.get());}
3351 struct type_topo_comp
3359 has_artificial_or_natural_location(
const decl_base* d)
3368 has_artificial_or_natural_location(
const type_base* t)
3370 if (decl_base *d =
is_decl(t))
3371 return has_artificial_or_natural_location(d);
3383 operator()(
const type_base_sptr &f,
3384 const type_base_sptr &s)
3385 {
return operator()(f.get(), s.get());}
3395 operator()(
const type_base *f,
3400 if ((!f->get_corpus() && !s->get_corpus())
3401 || (f->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN
3402 && s->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN))
3405 bool f_is_ptr_ref_or_qual = is_ptr_ref_or_qual_type(f);
3406 bool s_is_ptr_ref_or_qual = is_ptr_ref_or_qual_type(s);
3408 if (f_is_ptr_ref_or_qual != s_is_ptr_ref_or_qual)
3409 return !f_is_ptr_ref_or_qual && s_is_ptr_ref_or_qual;
3411 if (f_is_ptr_ref_or_qual && s_is_ptr_ref_or_qual
3412 && !has_artificial_or_natural_location(f)
3413 && !has_artificial_or_natural_location(s))
3421 if (q->get_cv_quals() == qualified_type_def::CV_NONE)
3453 type_base *peeled_f =
3455 type_base *peeled_s =
3512 decl_topo_comp decl_comp;
3513 return decl_comp(fd, sd);
3524 vector<type_base_sptr>& result)
3527 result.push_back(t);
3529 type_topo_comp comp;
3530 std::stable_sort(result.begin(), result.end(), comp);
3542 const type_base_sptr&
3545 if (!priv_->void_type_)
3546 priv_->void_type_.reset(
new type_decl(*
this,
3549 return priv_->void_type_;
3561 const type_base_sptr&
3564 if (!priv_->void_pointer_type_)
3567 return priv_->void_pointer_type_;
3580 const type_base_sptr&
3583 if (!priv_->variadic_marker_type_)
3584 priv_->variadic_marker_type_.
3587 return priv_->variadic_marker_type_;
3596 static string variadic_parameter_type_name =
"variadic parameter type";
3597 return variadic_parameter_type_name;
3607 {
return priv_->canonicalization_is_done_;}
3621 {priv_->canonicalization_is_done_ = f;}
3630 {
return priv_->do_on_the_fly_canonicalization_;}
3639 {priv_->do_on_the_fly_canonicalization_ = f;}
3663 {
return priv_->decl_only_class_equals_definition_;}
3688 {priv_->decl_only_class_equals_definition_ = f;}
3793 {
return const_cast<environment*
>(
this)->priv_->string_pool_.create_string(s);}
3800 {
return priv_->config_;}
3810 {
return priv_->analyze_exported_interfaces_only_.has_value();}
3823 {priv_->analyze_exported_interfaces_only_ = f;}
3836 {
return priv_->analyze_exported_interfaces_only_.value_or(
false);}
3838 #ifdef WITH_DEBUG_SELF_COMPARISON
3851 environment::set_self_comparison_debug_input(
const corpus_sptr& c)
3853 self_comparison_debug_is_on(
true);
3854 if (priv_->first_self_comparison_corpus_.expired())
3855 priv_->first_self_comparison_corpus_ = c;
3856 else if (priv_->second_self_comparison_corpus_.expired()
3857 && c.get() != corpus_sptr(priv_->first_self_comparison_corpus_).get())
3858 priv_->second_self_comparison_corpus_ = c;
3871 environment::get_self_comparison_debug_inputs(corpus_sptr& first_corpus,
3872 corpus_sptr& second_corpus)
3874 first_corpus = priv_->first_self_comparison_corpus_.lock();
3875 second_corpus = priv_->second_self_comparison_corpus_.lock();
3882 environment::self_comparison_debug_is_on(
bool f)
3883 {priv_->self_comparison_debug_on_ = f;}
3890 environment::self_comparison_debug_is_on()
const
3891 {
return priv_->self_comparison_debug_on_;}
3894 #ifdef WITH_DEBUG_TYPE_CANONICALIZATION
3901 environment::debug_type_canonicalization_is_on(
bool flag)
3902 {priv_->debug_type_canonicalization_ = flag;}
3910 environment::debug_type_canonicalization_is_on()
const
3911 {
return priv_->debug_type_canonicalization_;}
3919 environment::debug_die_canonicalization_is_on(
bool flag)
3920 {priv_->debug_die_canonicalization_ = flag;}
3928 environment::debug_die_canonicalization_is_on()
const
3929 {
return priv_->debug_die_canonicalization_;}
3930 #endif // WITH_DEBUG_TYPE_CANONICALIZATION
3945 vector<type_base_sptr>*
3972 if (!types ||index >= types->size())
3974 return (*types)[index].get();
3977 #ifdef WITH_DEBUG_SELF_COMPARISON
3987 const unordered_map<string, uintptr_t>&
3988 environment::get_type_id_canonical_type_map()
const
3989 {
return priv_->get_type_id_canonical_type_map();}
4000 unordered_map<string, uintptr_t>&
4001 environment::get_type_id_canonical_type_map()
4002 {
return priv_->get_type_id_canonical_type_map();}
4017 const unordered_map<uintptr_t, string>&
4018 environment::get_pointer_type_id_map()
const
4019 {
return priv_->get_pointer_type_id_map();}
4034 unordered_map<uintptr_t, string>&
4035 environment::get_pointer_type_id_map()
4036 {
return priv_->get_pointer_type_id_map();}
4054 environment::get_type_id_from_pointer(uintptr_t ptr)
const
4055 {
return priv_->get_type_id_from_pointer(ptr);}
4073 environment::get_type_id_from_type(
const type_base *t)
const
4074 {
return priv_->get_type_id_from_type(t);}
4091 environment::get_canonical_type_from_type_id(
const char* type_id)
const
4092 {
return priv_->get_canonical_type_from_type_id(type_id);}
4100 struct type_or_decl_base::priv
4118 void* type_or_decl_ptr_;
4119 bool hashing_started_;
4120 const environment& env_;
4121 translation_unit* translation_unit_;
4126 location artificial_location_;
4130 bool is_artificial_;
4138 priv(
const environment& e,
4142 type_or_decl_ptr_(),
4145 translation_unit_(),
4165 (
static_cast<unsigned>(l) | static_cast<unsigned>(r));
4185 (
static_cast<unsigned>(l) & static_cast<unsigned>(r));
4206 :priv_(new priv(e, k))
4222 {
return priv_->is_artificial_;}
4234 {priv_->is_artificial_ = f;}
4245 {
return priv_->kind();}
4265 {
return priv_->rtti_;}
4274 {
return priv_->rtti_;}
4285 if (
type_base* t = dynamic_cast<type_base*>(
this))
4286 priv_->type_or_decl_ptr_ = t;
4287 else if (
decl_base *d = dynamic_cast<decl_base*>(
this))
4288 priv_->type_or_decl_ptr_ = d;
4311 {
return priv_->type_or_decl_ptr_;}
4318 {
return priv_->hashing_started_;}
4325 {priv_->hashing_started_ = b;}
4332 {
return priv_->env_;}
4350 {priv_->artificial_location_ = l;}
4368 {
return priv_->artificial_location_;}
4376 return (priv_->artificial_location_
4377 && priv_->artificial_location_.get_is_artificial());
4408 {priv_->translation_unit_ = tu;}
4417 {
return priv_->translation_unit_;}
4449 *dr = dynamic_cast<const decl_base*>(r);
4458 *tr = dynamic_cast<const type_base*>(r);
4503 struct decl_base::priv
4505 bool in_pub_sym_tab_;
4509 interned_string name_;
4510 interned_string qualified_parent_name_;
4515 interned_string temporary_qualified_name_;
4522 interned_string qualified_name_;
4523 interned_string temporary_internal_qualified_name_;
4524 interned_string internal_qualified_name_;
4528 interned_string scoped_name_;
4529 interned_string linkage_name_;
4531 decl_base_sptr declaration_;
4533 decl_base* naked_definition_of_declaration_;
4534 bool is_declaration_only_;
4538 : in_pub_sym_tab_(false),
4539 is_anonymous_(true),
4541 visibility_(VISIBILITY_DEFAULT),
4542 naked_definition_of_declaration_(),
4543 is_declaration_only_(false)
4546 priv(interned_string name, interned_string linkage_name,
visibility vis)
4547 : in_pub_sym_tab_(false),
4550 qualified_name_(name),
4551 linkage_name_(linkage_name),
4553 naked_definition_of_declaration_(),
4554 is_declaration_only_(false)
4556 is_anonymous_ = name_.
empty();
4581 const string& linkage_name,
4584 priv_(new priv(e.intern(name), e.intern(linkage_name), vis))
4603 const interned_string& name,
4605 const interned_string& linkage_name,
4608 priv_(new priv(name, linkage_name, vis))
4633 const interned_string&
4635 {
return priv_->qualified_name_;}
4644 {priv_->qualified_name_.clear();}
4651 {priv_->qualified_name_ = n;}
4662 const interned_string&
4664 {
return priv_->temporary_qualified_name_;}
4678 {priv_->temporary_qualified_name_ = n;}
4685 {
return priv_->context_;}
4692 {
return priv_->context_;}
4696 {priv_->context_ = c;}
4707 if (
const type_base* t = dynamic_cast<const type_base*>(
this))
4727 {
return priv_->in_pub_sym_tab_;}
4735 {priv_->in_pub_sym_tab_ = f;}
4755 {
return priv_->location_;}
4797 priv_->location_ = l;
4807 priv_->is_anonymous_ = n.empty();
4818 {
return priv_->is_anonymous_;}
4828 {priv_->is_anonymous_ = f;}
4865 {
return priv_->naming_typedef_;}
4893 &&
is_type(
this)->get_naked_canonical_type() ==
nullptr);
4895 priv_->naming_typedef_ = t;
4902 update_qualified_name(
this);
4908 const interned_string&
4910 {
return priv_->linkage_name_;}
4919 priv_->linkage_name_ = env.
intern(m);
4927 {
return priv_->visibility_;}
4934 {priv_->visibility_ = v;}
4943 if (priv_->context_)
4944 return priv_->context_->get_scope();
4952 const interned_string&
4954 {
return priv_->qualified_parent_name_;}
4959 const interned_string&
4961 {
return priv_->name_;}
4996 bool qualified_name)
const
5000 && has_generic_anonymous_internal_type_name(
this))
5011 string name = get_generic_anonymous_internal_type_name(
this);
5037 const interned_string&
5039 {
return priv_->qualified_name_;}
5051 const interned_string&
5053 {
return priv_->scoped_name_;}
5059 const decl_base_sptr
5061 {
return priv_->declaration_;}
5070 if (d && d->get_is_declaration_only())
5071 priv_->declaration_ = d;
5079 const decl_base_sptr
5081 {
return priv_->definition_of_declaration_.lock();}
5097 {
return priv_->naked_definition_of_declaration_;}
5104 {
return priv_->is_declaration_only_;}
5114 bool update_types_lookup_map = !f && priv_->is_declaration_only_;
5116 priv_->is_declaration_only_ = f;
5118 if (update_types_lookup_map)
5121 scope_decl::declarations::iterator i;
5122 if (s->find_iterator_for_member(
this, i))
5132 return static_cast<change_kind>(
static_cast<unsigned>(l)
5133 | static_cast<unsigned>(r));
5139 return static_cast<change_kind>(
static_cast<unsigned>(l)
5140 & static_cast<unsigned>(r));
5187 bool member_types_or_functions =
5191 if (member_types_or_functions)
5200 la = r1->get_access_specifier();
5201 ra = r2->get_access_specifier();
5202 r1->set_access_specifier(no_access);
5203 r2->set_access_specifier(no_access);
5206 bool rels_are_different = *r1 != *r2;
5208 if (member_types_or_functions)
5211 r1->set_access_specifier(la);
5212 r2->set_access_specifier(ra);
5215 if (rels_are_different)
5235 static interned_string
5236 get_decl_name_for_comparison(
const decl_base &d)
5238 if (has_generic_anonymous_internal_type_name(&d)
5244 r += get_generic_anonymous_internal_type_name(&d);
5281 if (!l_linkage_name.
empty() && !r_linkage_name.
empty())
5283 if (l_linkage_name != r_linkage_name)
5308 interned_string ln = get_decl_name_for_comparison(l);
5309 interned_string rn = get_decl_name_for_comparison(r);
5318 bool decls_are_same = (ln == rn);
5327 decls_are_same =
true;
5337 if (!decls_are_same)
5360 {
return equals(*
this, other, 0);}
5399 if (!priv_->context_)
5402 priv_->context_->set_scope(scope);
5420 case decl_base::VISIBILITY_NONE:
5423 case decl_base::VISIBILITY_DEFAULT:
5426 case decl_base::VISIBILITY_PROTECTED:
5429 case decl_base::VISIBILITY_HIDDEN:
5432 case decl_base::VISIBILITY_INTERNAL:
5452 case decl_base::BINDING_NONE:
5455 case decl_base::BINDING_LOCAL:
5458 case decl_base::BINDING_GLOBAL:
5461 case decl_base::BINDING_WEAK:
5484 if (l.get() == r.get())
5520 if (l.get() == r.get())
5606 {
return dynamic_pointer_cast<
scope_decl>(d);}
5672 return c->get_access_specifier();
5702 c->set_access_specifier(a);
5732 return c->get_is_static();
5874 var_decl_sptr first = *klass->get_non_static_data_members().begin();
5895 if (!klass ||!data_member)
5898 for (class_or_union::data_members::const_iterator it =
5902 if (**it == *data_member)
6130 return class_or_union_sptr();
6139 const class_or_union_sptr
6144 if (cou->get_is_anonymous())
6147 return class_or_union_sptr();
6156 const class_or_union_sptr
6161 return class_or_union_sptr();
6170 const class_or_union_sptr
6185 return class_or_union_sptr();
6210 for (
auto anon_dm_m : cl->get_non_static_data_members())
6257 ctxt_rel->set_offset_in_bits(o);
6272 return ctxt_rel->get_offset_in_bits();
6362 const var_decl *containing_anonymous_data_member =
6365 uint64_t containing_anonymous_data_member_offset = 0;
6366 if (containing_anonymous_data_member)
6367 containing_anonymous_data_member_offset =
6370 return (ctxt_rel->get_offset_in_bits()
6372 containing_anonymous_data_member_offset);
6400 type_base_sptr t = v->get_type();
6403 return t->get_size_in_bits();
6417 ctxt_rel->set_is_laid_out(l);
6432 return ctxt_rel->get_is_laid_out();
6734 return ctxt->is_virtual();
6771 ctxt->is_virtual(is_virtual);
6786 (dynamic_pointer_cast<method_decl>(fn));
6824 if (!cl->get_canonical_type())
6830 type_base_sptr t = type;
6841 ty->get_size_in_bits(),
6842 ty->get_alignment_in_bits(),
6843 ty->get_location()));
6851 ty->get_size_in_bits(),
6852 ty->get_alignment_in_bits(),
6853 ty->get_location()));
6862 ty->get_location()));
6868 t.reset(
new array_type_def(p, ty->get_subranges(), ty->get_location()));
6873 for (function_decl::parameters::const_iterator i =
6874 ty->get_parameters().begin();
6875 i != ty->get_parameters().end();
6886 p->get_variadic_marker(),
6887 p->get_is_artificial()));
6888 parm.push_back(stripped);
6893 parm, ty->get_is_const(),
6894 ty->get_size_in_bits(),
6895 ty->get_alignment_in_bits()));
6900 for (function_decl::parameters::const_iterator i =
6901 ty->get_parameters().begin();
6902 i != ty->get_parameters().end();
6913 p->get_variadic_marker(),
6914 p->get_is_artificial()));
6915 parm.push_back(stripped);
6920 ty->get_size_in_bits(),
6921 ty->get_alignment_in_bits()));
6924 if (!t->get_translation_unit())
6925 t->set_translation_unit(type->get_translation_unit());
6930 return t->get_canonical_type() ? t->get_canonical_type() : t;
6953 decl_base_sptr result = t;
6954 type_base_sptr u = t->get_underlying_type();
6957 if ((t->get_cv_quals() & qualified_type_def::CV_CONST
6959 || (t->get_cv_quals() & qualified_type_def::CV_CONST
6961 || t->get_cv_quals() == qualified_type_def::CV_NONE)
7007 static qualified_type_def_sptr
7008 strip_redundant_quals_from_underyling_types(
const qualified_type_def_sptr& t,
7017 qualified_type_def_sptr underlying_qualified_type =
7025 currated_quals &= ~redundant_quals;
7026 t->set_cv_quals(currated_quals);
7030 redundant_quals |= currated_quals;
7032 qualified_type_def_sptr result = t;
7033 if (underlying_qualified_type)
7037 strip_redundant_quals_from_underyling_types(underlying_qualified_type,
7071 strip_redundant_quals_from_underyling_types(
const qualified_type_def_sptr& t)
7077 strip_redundant_quals_from_underyling_types(t, redundant_quals);
7104 return t->get_underlying_type();
7158 return t->get_pointed_to_type();
7214 return t->get_pointed_to_type();
7254 const type_base_sptr
7318 const type_base_sptr
7372 type_base_sptr type = t;
7395 type_base_sptr typ = type;
7457 bool peel_qual_type)
7496 bool peel_qual_type)
7534 vector<array_type_def::subrange_sptr> subranges;
7536 for (vector<array_type_def::subrange_sptr>::const_iterator i =
7537 array->get_subranges().begin();
7538 i != array->get_subranges().end();
7544 (*i)->get_lower_bound(),
7545 (*i)->get_upper_bound(),
7546 (*i)->get_underlying_type(),
7547 (*i)->get_location(),
7548 (*i)->get_language()));
7549 subrange->is_infinite((*i)->is_infinite());
7552 subranges.push_back(subrange);
7557 subranges, array->get_location()));
7580 (
new typedef_decl(t->get_name(), t->get_underlying_type(),
7581 t->get_location(), t->get_linkage_name(),
7582 t->get_visibility()));
7598 qualified_type_def_sptr
7604 qualified_type_def_sptr result
7606 t->get_cv_quals(), t->get_location()));
7618 static type_base_sptr
7619 clone_typedef_array_qualified_type(type_base_sptr type)
7625 type_base_sptr result;
7634 return type_base_sptr();
7657 type_base_sptr result = clone_typedef_array_qualified_type(t);
7660 type_base_sptr subtree;
7664 clone_typedef_array_qualified_type(type->get_underlying_type());
7668 type->set_underlying_type(subtree);
7674 clone_typedef_array_qualified_type(type->get_element_type());
7678 type->set_element_type(subtree);
7688 clone_typedef_array_qualified_type(t->get_underlying_type());
7692 is_decl(t->get_underlying_type())->get_scope();
7695 t->set_underlying_type (s);
7704 clone_typedef_array_qualified_type(t->get_underlying_type());
7708 is_decl(t->get_underlying_type())->get_scope();
7711 t->set_underlying_type(s);
7719 type_base_sptr e = t->get_element_type();
7723 clone_typedef_array_qualified_type(e);
7729 t->set_element_type(s);
7748 ::qualified_name_setter setter;
7756 update_qualified_name(decl_base_sptr d)
7757 {
return update_qualified_name(d.get());}
7777 {
return reinterpret_cast<size_t>(l);}
7779 struct scope_decl::priv
7824 {
return priv_->canonical_types_;}
7842 if (priv_->sorted_canonical_types_.empty())
7844 for (canonical_type_sptr_set_type::const_iterator e =
7848 priv_->sorted_canonical_types_.push_back(*e);
7850 type_topo_comp comp;
7851 std::stable_sort(priv_->sorted_canonical_types_.begin(),
7852 priv_->sorted_canonical_types_.end(),
7855 return priv_->sorted_canonical_types_;
7865 {
return priv_->members_;}
7874 {
return priv_->members_;}
7884 decl_topo_comp comp;
7885 if (priv_->sorted_members_.empty())
7890 priv_->sorted_members_.push_back(*i);
7892 std::stable_sort(priv_->sorted_members_.begin(),
7893 priv_->sorted_members_.end(),
7896 return priv_->sorted_members_;
7911 if (t->get_is_anonymous())
7929 if (t->get_is_anonymous())
7947 if (t->get_is_anonymous())
7958 {
return priv_->member_scopes_;}
7965 {
return priv_->member_scopes_;}
7991 member->set_scope(
this);
7992 priv_->members_.push_back(member);
7994 priv_->member_types_.push_back(
is_type(member));
7997 priv_->member_scopes_.push_back(m);
7999 update_qualified_name(member);
8006 member->set_translation_unit(tu);
8019 {
return priv_->member_types_;}
8034 return type_base_sptr();
8044 declarations::iterator before)
8050 priv_->member_types_.push_back(t);
8086 for (
auto i = priv_->member_types_.begin();
8087 i != priv_->member_types_.end();
8092 priv_->member_types_.erase(i);
8105 if (priv_->sorted_member_types_.empty())
8108 priv_->sorted_member_types_.push_back(t);
8110 type_topo_comp comp;
8111 std::stable_sort(priv_->sorted_member_types_.begin(),
8112 priv_->sorted_member_types_.end(),
8115 return priv_->sorted_member_types_;
8131 declarations::iterator before)
8135 member->set_scope(
this);
8136 priv_->members_.insert(before, member);
8139 priv_-> member_scopes_.push_back(m);
8141 update_qualified_name(member);
8148 member->set_translation_unit(tu);
8162 for (declarations::iterator i = priv_->members_.begin();
8163 i != priv_->members_.end();
8168 priv_->members_.erase(i);
8178 for (scopes::iterator i = priv_->member_scopes_.begin();
8179 i != priv_->member_scopes_.end();
8184 priv_->member_scopes_.erase(i);
8200 return hash_scope(
this);
8227 if (!l.decl_base::operator==(r))
8236 scope_decl::declarations::const_iterator i, j;
8278 return equals(*
this, *other, 0);
8293 if (l.get() == r.get())
8319 declarations::iterator& i)
8334 if ((*it).get() == decl)
8354 declarations::iterator& i)
8371 if (v.visit_begin(
this))
8374 for (scope_decl::declarations::const_iterator i =
8378 if (!(*i)->traverse(v))
8382 return v.visit_end(
this);
8385 scope_decl::~scope_decl()
8400 if (scope && decl && !decl->
get_scope())
8441 scope_decl::declarations::iterator before,
8444 if (scope && decl && !decl->
get_scope())
8463 scope_decl::declarations::iterator before,
8473 | ABSTRACT_DECL_BASE
8474 | ABSTRACT_SCOPE_DECL),
8477 translation_unit_(tu)
8479 runtime_type_instance(
this);
8491 if (
const global_scope* s = dynamic_cast<const global_scope*>(&decl))
8495 while (scope && !dynamic_cast<global_scope*>(scope))
8498 return scope ?
dynamic_cast<global_scope*
> (scope) : 0;
8605 if (cv_quals & qualified_type_def::CV_RESTRICT)
8607 if (cv_quals & qualified_type_def::CV_CONST)
8613 if (cv_quals & qualified_type_def::CV_VOLATILE)
8638 if (
type_base* t = dynamic_cast<type_base*>(a))
8640 else if (
decl_base *d = dynamic_cast<decl_base*>(a))
8643 result = d->get_qualified_name();
8645 result = d->get_name();
8665 {
return get_name(tod.get(), qualified);}
8683 string qualified_name;
8687 if (qualified_name.empty())
8688 qualified_name = name;
8690 qualified_name = qualified_name +
"::" + name;
8692 return qualified_name;
8727 location loc = decl->get_location();
8731 if (c->get_is_declaration_only() && c->get_definition_of_declaration())
8734 loc = c->get_location();
8792 has_generic_anonymous_internal_type_name(
const decl_base *d)
8809 static interned_string
8810 get_generic_anonymous_internal_type_name(
const decl_base *d)
8812 ABG_ASSERT(has_generic_anonymous_internal_type_name(d));
8814 const environment&env = d->get_environment();
8816 interned_string result;
8849 get_internal_integral_type_name(
const type_base* t)
8857 integral_type int_type;
8859 name = int_type.to_string(
true);
8899 r += get_generic_anonymous_internal_type_name(d);
8909 return env.
intern(get_internal_integral_type_name(t));
8918 internal, qualified));
8957 bool qualified,
bool internal)
8960 string tn =
get_type_name(pointed_to_type, qualified,
internal);
8979 bool lvalue_reference,
8980 bool qualified,
bool internal)
8984 string name =
get_type_name(pointed_to_type, qualified,
internal);
8985 if (lvalue_reference)
9010 bool qualified,
bool internal)
9012 const environment& env = underlying_type->get_environment();
9015 string name =
get_type_name(underlying_type, qualified,
internal);
9017 if (quals_repr.empty() &&
internal)
9029 if (!quals_repr.empty())
9038 name = quals_repr +
" " + name;
9095 std::ostringstream o;
9100 type_base_sptr return_type =
9109 type_base_sptr type;
9110 for (function_type::parameters::const_iterator i =
9117 type = (*i)->get_type();
9124 return env.
intern(o.str());
9143 c->get_exported_decls_builder();
9144 if (b->fn_id_maps_to_several_fns(fn))
9183 return interned_string();
9200 std::ostringstream o;
9205 type_base_sptr return_type =
9212 o << return_type->get_cached_pretty_representation(
internal);
9221 o <<
" (" << class_type->get_qualified_name(
internal) <<
"::*)"
9224 type_base_sptr type;
9225 for (function_type::parameters::const_iterator i =
9232 type = (*i)->get_type();
9236 o << type->get_cached_pretty_representation(
internal);
9244 return env.
intern(o.str());
9410 std::ostringstream o;
9428 std::ostringstream o;
9483 const string& indent,
9486 bool qualified_names)
9489 string local_indent =
" ";
9494 if (!
internal && clazz->is_struct())
9500 repr = indent +
"union";
9518 for (class_or_union::data_members::const_iterator dm = dmems.begin();
9522 if (dm != dmems.begin())
9527 real_indent =
"\n" + indent + local_indent;
9534 real_indent, one_line,
internal, qualified_names);
9539 if (dm != dmems.begin())
9540 repr += real_indent;
9541 repr += (*dm)->get_pretty_representation(
internal,
9546 real_indent+ (*dm)->get_pretty_representation(
internal,
9555 repr += indent +
"}";
9578 const string& indent,
9581 bool qualified_names)
9585 internal, qualified_names);
9607 const string& indent,
9610 bool qualified_names)
9639 const string& indent,
bool one_line,
9640 bool qualified_names)
9643 std::ostringstream o;
9644 string local_indent =
" ";
9646 repr = indent +
"enum ";
9649 o << (qualified_names
9663 o << enumerator.get_name() +
"=" << enumerator.get_value() <<
", ";
9667 o <<
"\n" + indent <<
"}";
9698 const string& indent,
bool one_line,
9699 bool qualified_names)
9705 one_line, qualified_names);
9730 const string& indent,
bool one_line,
9731 bool qualified_names)
9760 const string& indent,
9763 bool qualified_name)
9769 internal, qualified_name);
9797 std::ostringstream o;
9812 o <<
" :" << std::endl;
9816 if (b->get_is_virtual())
9818 o << b->get_base_class()->get_qualified_name()
9828 <<
" // @: " << std::hex <<
is_type(c)
9834 type_base_sptr t = m->get_type();
9838 << m->get_pretty_representation(
false,
9842 if (t && t->get_canonical_type())
9843 o <<
" // uses canonical type '@"
9844 << std::hex << t->get_canonical_type().get() << std::dec;
9846 o <<
"'" << std::endl;
9851 o <<
" // virtual member functions\n\n";
9853 o <<
" " << f->get_pretty_representation(
false,
9855 <<
";" << std::endl;
9858 o <<
"};" << std::endl;
9864 string name = e->get_qualified_name();
9865 std::ostringstream o;
9866 o <<
"enum " << name
9868 << e->get_underlying_type()->get_pretty_representation(
false,
9872 <<
" // size in bits: " << e->get_size_in_bits() <<
"\n"
9873 <<
" // is-declaration-only: " << e->get_is_declaration_only() <<
"\n"
9875 <<
" // translation unit: "
9876 << e->get_translation_unit()->get_absolute_path() <<
"\n"
9877 <<
" // @: " << std::hex <<
is_type(e)
9878 <<
", @canonical: " << e->get_canonical_type().get() << std::dec
9881 for (
const auto &enom : e->get_enumerators())
9882 o <<
" " << enom.get_name() <<
" = " << enom.get_value() <<
",\n";
9888 return artifact->get_pretty_representation(
true,
9986 debug(static_cast<const type_or_decl_base*>(artifact));
9987 return const_cast<type_base*
>(artifact);
10003 debug(static_cast<const type_or_decl_base*>(artifact));
10004 return const_cast<decl_base*
>(artifact);
10034 debug_comp_vec(
const vector<const type_base*>& vect, std::ostringstream& o)
10036 for (
auto t : vect)
10038 o <<
"|" << t->get_pretty_representation()
10039 <<
"@" << std::hex << t << std::dec;
10051 print_comp_stack(
const environment& env)
10053 std::ostringstream o;
10054 o <<
"left-operands: ";
10055 debug_comp_vec(env.priv_->left_type_comp_operands_, o);
10056 o <<
"\n" <<
"right-operands: ";
10057 debug_comp_vec(env.priv_->right_type_comp_operands_, o);
10070 std::cerr << print_comp_stack(env);
10071 std::cerr << std::endl;
10103 {
return dynamic_cast<const decl_base*
>(t);}
10121 {
return dynamic_pointer_cast<
decl_base>(t);}
10137 const type_base_sptr type2)
10139 if (!type1 || !type2)
10142 if (type1 == type2)
10175 const decl_base_sptr d2)
10313 const string& name)
10318 if (!containing_class_or_union)
10335 {
return (decl && dynamic_cast<template_decl*>(decl->get_scope()));}
10345 return (decl && (dynamic_pointer_cast<type_tparameter>(decl)
10346 || dynamic_pointer_cast<non_type_tparameter>(decl)
10347 || dynamic_pointer_cast<template_tparameter>(decl)));
10411 if (d && (d->
kind() & type_or_decl_base::ABSTRACT_DECL_BASE))
10413 if (!(d->
kind() & type_or_decl_base::ABSTRACT_TYPE_BASE))
10439 {
return dynamic_pointer_cast<
decl_base>(d);}
10461 {
return dynamic_pointer_cast<
decl_base>(t);}
10471 if (dynamic_cast<const type_base*>(&tod))
10484 if (t && (t->
kind() & type_or_decl_base::ABSTRACT_TYPE_BASE))
10498 {
return dynamic_pointer_cast<
type_base>(tod);}
10530 if (!cou->get_naming_typedef())
10554 {
return dynamic_cast<const type_decl*
>(t);}
10562 {
return dynamic_pointer_cast<
type_decl>(t);}
10747 if (t->
kind() & type_or_decl_base::CLASS_TYPE)
10748 return reinterpret_cast<class_decl*>
10749 (const_cast<type_or_decl_base*>(t)->runtime_type_instance());
10761 {
return dynamic_pointer_cast<
class_decl>(d);}
10783 if (array->is_infinite())
10840 if (look_through_decl_only)
10842 return klass->get_is_declaration_only();
10892 shared_ptr<class_or_union>
10923 const class_or_union_sptr& second)
10953 {
return dynamic_pointer_cast<
union_decl>(t);}
10967 if (t->
kind() & type_or_decl_base::POINTER_TYPE)
10968 return reinterpret_cast<pointer_type_def*>
10969 (const_cast<type_or_decl_base*>(t)->runtime_type_instance());
11120 const type_base_sptr
11123 type_base_sptr nil;
11127 if (t->get_environment().get_void_pointer_type().get() == t.get())
11156 qualified_type_def_sptr
11236 class_or_union_sptr
11246 class_or_union_sptr
11278 decl_base_sptr decl;
11285 while (decl->get_is_declaration_only()
11286 && decl->get_definition_of_declaration())
11287 decl = decl->get_definition_of_declaration();
11354 decl_base_sptr d =
is_decl(t);
11379 {
return dynamic_pointer_cast<
var_decl>(decl);}
11422 && dynamic_pointer_cast<function_decl>(decl)
11423 && dynamic_cast<template_decl*>(decl->get_scope()));
11450 qualified_type_def_sptr
11454 return qualified_type_def_sptr();
11509 array_type_def::subrange_type*
11534 {
return decl && dynamic_pointer_cast<
template_decl>(decl);}
11540 LOOKUP_ENTITY_TYPE,
11572 find_next_delim_in_cplus_type(
const string& fqn,
11576 int angle_count = 0;
11577 bool found =
false;
11579 for (; i < fqn.size(); ++i)
11583 else if (fqn[i] ==
'>')
11585 else if (i + 1 < fqn.size()
11588 && fqn[i+1] ==
':')
11605 list<string>& comps)
11607 string::size_type fqn_size = fqn.size(), comp_begin = 0, comp_end = fqn_size;
11610 if (!find_next_delim_in_cplus_type(fqn, comp_begin, comp_end))
11611 comp_end = fqn_size;
11613 string comp = fqn.substr(comp_begin, comp_end - comp_begin);
11614 comps.push_back(comp);
11616 comp_begin = comp_end + 2;
11617 if (comp_begin >= fqn_size)
11633 for (list<string>::const_iterator c = comps.begin();
11636 if (c == comps.begin())
11639 result +=
"::" + *c;
11654 template<
typename T>
11656 iterator_is_last(T& container,
11657 typename T::const_iterator i)
11659 typename T::const_iterator next = i;
11661 return (next == container.end());
11678 lookup_types_in_map(
const interned_string& type_name,
11681 istring_type_base_wptrs_map_type::const_iterator i = type_map.find(type_name);
11682 if (i != type_map.end())
11703 template <
class TypeKind>
11704 static shared_ptr<TypeKind>
11705 lookup_type_in_map(
const interned_string& type_name,
11708 istring_type_base_wptrs_map_type::const_iterator i = type_map.find(type_name);
11709 if (i != type_map.end())
11713 for (
auto j : i->second)
11715 type_base_sptr t(j);
11716 decl_base_sptr d =
is_decl(t);
11717 if (d && !d->get_is_declaration_only())
11718 return dynamic_pointer_cast<TypeKind>(type_base_sptr(j));
11723 return dynamic_pointer_cast<TypeKind>(type_base_sptr(i->second.back()));
11725 return shared_ptr<TypeKind>();
11742 return lookup_type_in_map<type_decl>(type_name,
11762 interned_string s = env.
intern(type_name);
11783 interned_string s = env.
intern(fqn);
11801 return lookup_type_in_map<class_decl>(type_name,
11819 return lookup_type_in_map<union_decl>(type_name,
11838 interned_string s = env.
intern(fqn);
11854 union_decl_sptr result = lookup_type_in_map<union_decl>(loc, m);
11887 return lookup_type_in_map<enum_type_decl>(type_name,
11906 interned_string s = env.
intern(type_name);
11926 return lookup_type_in_map<typedef_decl>(type_name,
11946 interned_string s = env.
intern(type_name);
11962 qualified_type_def_sptr
11967 return lookup_type_in_map<qualified_type_def>(type_name,
11986 qualified_type_def_sptr
12013 return lookup_type_in_map<pointer_type_def>(type_name,
12033 interned_string s = env.
intern(type_name);
12075 return lookup_type_in_map<reference_type_def>(type_name,
12094 bool lvalue_reference,
12097 interned_string type_name =
12119 return lookup_type_in_map<array_type_def>(type_name,
12139 return lookup_type_in_map<function_type>(type_name,
12185 const type_base_sptr
12189 type_base_sptr result;
12216 interned_string ifqn = env.
intern(fqn);
12228 const type_base_sptr
12252 const type_base_sptr
12256 list<string> comps;
12269 const decl_base_sptr
12273 list<string> comps;
12289 template<
typename NodeKind>
12290 static const interned_string&
12299 const interned_string&
12301 {
return node->get_name();}
12309 const interned_string&
12319 const interned_string&
12321 {
return node->get_name();}
12330 template<
typename NodeKind>
12331 static decl_base_sptr
12332 convert_node_to_decl(shared_ptr<NodeKind> node);
12345 template<
typename NodeKind>
12347 lookup_node_in_scope(
const list<string>& fqn,
12351 shared_ptr<NodeKind> node;
12352 bool it_is_last =
false;
12355 for (list<string>::const_iterator c = fqn.begin(); c != fqn.end(); ++c)
12358 it_is_last = iterator_is_last(fqn, c);
12359 for (scope_decl::declarations::const_iterator m =
12360 cur_scope->get_member_decls().begin();
12361 m != cur_scope->get_member_decls().end();
12367 scope = dynamic_pointer_cast<
scope_decl>(*m);
12368 if (scope && scope->get_name() == *c)
12377 node = dynamic_pointer_cast<NodeKind>(*m);
12381 dynamic_pointer_cast<class_decl>(node))
12382 if (cl->get_is_declaration_only()
12383 && !cl->get_definition_of_declaration())
12385 resulting_decl = node;
12390 if (!new_scope && !resulting_decl)
12391 return decl_base_sptr();
12392 cur_scope = new_scope;
12395 return resulting_decl;
12416 const type_base_sptr
12419 {
return is_type(lookup_node_in_scope<type_base>(comps, scope));}
12443 static const type_base_sptr
12445 const vector<scope_decl*>& access_path,
12448 vector<scope_decl*> a = access_path;
12449 type_base_sptr result;
12454 first_scope = a.back();
12462 for (scope_decl::declarations::const_iterator i =
12466 if (
is_type(*i) && (*i)->get_name() == n)
12474 first_scope = a.back();
12475 interned_string scope_name, cur_scope_name = first_scope->
get_name();
12476 for (scope_decl::scopes::const_iterator i =
12481 scope_name = (*i)->get_name();
12482 if (scope_name == cur_scope_name)
12508 static const type_base_sptr
12510 const scope_decl* scope)
12513 return type_base_sptr();
12517 vector<scope_decl*> access_path;
12518 for (scope_decl* s = type_decl->get_scope(); s != 0; s = s->get_scope())
12520 access_path.push_back(s);
12546 const type_base_sptr
12561 const decl_base_sptr
12564 {
return is_var_decl(lookup_node_in_scope<var_decl>(comps, skope));}
12577 template<
typename NodeKind>
12579 lookup_node_in_translation_unit(
const list<string>& fqn,
12597 {
return is_type(lookup_node_in_translation_unit<type_base>(fqn, tu));}
12617 {
return is_class_type(lookup_node_in_translation_unit<class_decl>(fqn, tu));}
12630 lookup_basic_type_through_translation_units(
const interned_string& type_name,
12631 const corpus& abi_corpus)
12635 for (translation_units::const_iterator tu =
12655 static union_decl_sptr
12656 lookup_union_type_through_translation_units(
const interned_string& type_name,
12657 const corpus & abi_corpus)
12659 union_decl_sptr result;
12661 for (translation_units::const_iterator tu =
12662 abi_corpus.get_translation_units().begin();
12663 tu != abi_corpus.get_translation_units().end();
12682 lookup_enum_type_through_translation_units(
const interned_string& type_name,
12683 const corpus & abi_corpus)
12687 for (translation_units::const_iterator tu =
12688 abi_corpus.get_translation_units().begin();
12689 tu != abi_corpus.get_translation_units().end();
12706 lookup_typedef_type_through_translation_units(
const interned_string& type_name,
12707 const corpus & abi_corpus)
12711 for (translation_units::const_iterator tu =
12712 abi_corpus.get_translation_units().begin();
12713 tu != abi_corpus.get_translation_units().end();
12730 static qualified_type_def_sptr
12731 lookup_qualified_type_through_translation_units(
const interned_string& t_name,
12732 const corpus & abi_corpus)
12734 qualified_type_def_sptr result;
12736 for (translation_units::const_iterator tu =
12737 abi_corpus.get_translation_units().begin();
12738 tu != abi_corpus.get_translation_units().end();
12756 lookup_pointer_type_through_translation_units(
const interned_string& type_name,
12757 const corpus & abi_corpus)
12761 for (translation_units::const_iterator tu =
12762 abi_corpus.get_translation_units().begin();
12763 tu != abi_corpus.get_translation_units().end();
12781 lookup_reference_type_through_translation_units(
const interned_string& t_name,
12782 const corpus & abi_corpus)
12786 for (translation_units::const_iterator tu =
12787 abi_corpus.get_translation_units().begin();
12788 tu != abi_corpus.get_translation_units().end();
12806 lookup_array_type_through_translation_units(
const interned_string& type_name,
12807 const corpus & abi_corpus)
12811 for (translation_units::const_iterator tu =
12812 abi_corpus.get_translation_units().begin();
12813 tu != abi_corpus.get_translation_units().end();
12830 static function_type_sptr
12831 lookup_function_type_through_translation_units(
const interned_string& type_name,
12832 const corpus & abi_corpus)
12834 function_type_sptr result;
12836 for (translation_units::const_iterator tu =
12837 abi_corpus.get_translation_units().begin();
12838 tu != abi_corpus.get_translation_units().end();
12856 const corpus& abi_corpus)
12858 type_base_sptr result;
12860 for (translation_units::const_iterator tu =
12881 const string& tu_path,
12884 string_tu_map_type::const_iterator i = corp.priv_->path_tu_map.find(tu_path);
12885 if (i == corp.priv_->path_tu_map.end())
12886 return type_base_sptr();
12910 function_type_sptr result;
12915 for (translation_units::const_iterator i =
12961 result = lookup_type_in_map<type_decl>(qualified_name, m);
12963 result = lookup_basic_type_through_translation_units(qualified_name, corp);
12983 result = lookup_type_in_map<type_decl>(loc, m);
13074 class_decl_sptr result = lookup_type_in_map<class_decl>(qualified_name, m);
13092 return lookup_types_in_map(qualified_name, m);
13118 for (
auto type : *v)
13120 type_base_sptr t(type);
13122 if (c->get_is_declaration_only()
13123 && !c->get_definition_of_declaration())
13124 result.push_back(type);
13127 return !result.empty();
13143 return lookup_types_in_map(qualified_name, m);
13224 union_decl_sptr result = lookup_type_in_map<union_decl>(type_name, m);
13226 result = lookup_union_type_through_translation_units(type_name, corp);
13305 lookup_type_in_map<enum_type_decl>(qualified_name, m);
13307 result = lookup_enum_type_through_translation_units(qualified_name, corp);
13325 return lookup_types_in_map(qualified_name, m);
13430 lookup_type_in_map<typedef_decl>(qualified_name, m);
13432 result = lookup_typedef_type_through_translation_units(qualified_name,
13527 qualified_type_def_sptr
13542 qualified_type_def_sptr
13548 qualified_type_def_sptr result =
13549 lookup_type_in_map<qualified_type_def>(qualified_name, m);
13552 result = lookup_qualified_type_through_translation_units(qualified_name,
13594 lookup_type_in_map<pointer_type_def>(qualified_name, m);
13596 result = lookup_pointer_type_through_translation_units(qualified_name,
13644 lookup_type_in_map<reference_type_def>(qualified_name, m);
13646 result = lookup_reference_type_through_translation_units(qualified_name,
13693 lookup_type_in_map<array_type_def>(qualified_name, m);
13695 result = lookup_array_type_through_translation_units(qualified_name, corp);
13763 function_type_sptr result =
13764 lookup_type_in_map<function_type>(qualified_name, m);
13766 result = lookup_function_type_through_translation_units(qualified_name,
13789 type_base_sptr result;
13822 type_base_sptr result;
13870 return type_base_sptr();
13887 template<
typename TypeKind>
13891 bool use_type_name_as_key =
true)
13895 if (use_type_name_as_key)
13897 else if (
location l = type->get_location())
13899 string str = l.expand();
13900 s = type->get_environment().intern(str);
13903 istring_type_base_wptrs_map_type::iterator i = types_map.find(s);
13904 bool result =
false;
13906 if (i == types_map.end())
13908 types_map[s].push_back(type);
13912 i->second.push_back(type);
13933 bool use_type_name_as_key)
13937 bool update_qname_map =
true;
13938 if (type->get_is_declaration_only())
13944 is_class_type(class_type->get_definition_of_declaration()))
13948 if (!update_qname_map)
13952 if (use_type_name_as_key)
13954 string qname = type->get_qualified_name();
13955 s = type->get_environment().intern(qname);
13957 else if (
location l = type->get_location())
13959 string str = l.expand();
13960 s = type->get_environment().intern(str);
13963 bool result =
false;
13964 istring_type_base_wptrs_map_type::iterator i = map.find(s);
13965 if (i == map.end())
13967 map[s].push_back(type);
13971 i->second.push_back(type);
13993 (
const function_type_sptr& type,
13997 bool result =
false;
13999 istring_type_base_wptrs_map_type::iterator i = types_map.find(s);
14000 if (i == types_map.end())
14002 types_map[s].push_back(type);
14006 i->second.push_back(type);
14026 maybe_update_types_lookup_map<type_decl>
14029 if (
corpus *type_corpus = basic_type->get_corpus())
14031 maybe_update_types_lookup_map<type_decl>
14033 type_corpus->priv_->get_types().basic_types());
14035 maybe_update_types_lookup_map<type_decl>
14037 type_corpus->get_type_per_loc_map().basic_types(),
14042 maybe_update_types_lookup_map<type_decl>
14044 group->priv_->get_types().basic_types());
14046 maybe_update_types_lookup_map<type_decl>
14048 group->get_type_per_loc_map().basic_types(),
14073 if (
corpus *type_corpus = class_type->get_corpus())
14077 type_corpus->priv_->get_types().class_types());
14081 type_corpus->get_type_per_loc_map().class_types(),
14088 group->priv_->get_types().class_types());
14092 group->get_type_per_loc_map().class_types(),
14113 maybe_update_types_lookup_map<union_decl>
14116 if (
corpus *type_corpus = union_type->get_corpus())
14118 maybe_update_types_lookup_map<union_decl>
14120 type_corpus->priv_->get_types().union_types());
14122 maybe_update_types_lookup_map<union_decl>
14124 type_corpus->get_type_per_loc_map().union_types(),
14129 maybe_update_types_lookup_map<union_decl>
14131 group->priv_->get_types().union_types());
14133 maybe_update_types_lookup_map<union_decl>
14135 group->get_type_per_loc_map().union_types(),
14156 maybe_update_types_lookup_map<enum_type_decl>
14159 if (
corpus *type_corpus = enum_type->get_corpus())
14161 maybe_update_types_lookup_map<enum_type_decl>
14163 type_corpus->priv_->get_types().enum_types());
14165 maybe_update_types_lookup_map<enum_type_decl>
14167 type_corpus->get_type_per_loc_map().enum_types(),
14172 maybe_update_types_lookup_map<enum_type_decl>
14174 group->priv_->get_types().enum_types());
14176 maybe_update_types_lookup_map<enum_type_decl>
14178 group->get_type_per_loc_map().enum_types(),
14200 maybe_update_types_lookup_map<typedef_decl>
14203 if (
corpus *type_corpus = typedef_type->get_corpus())
14205 maybe_update_types_lookup_map<typedef_decl>
14207 type_corpus->priv_->get_types().typedef_types());
14209 maybe_update_types_lookup_map<typedef_decl>
14211 type_corpus->get_type_per_loc_map().typedef_types(),
14216 maybe_update_types_lookup_map<typedef_decl>
14218 group->priv_->get_types().typedef_types());
14220 maybe_update_types_lookup_map<typedef_decl>
14222 group->get_type_per_loc_map().typedef_types(),
14243 maybe_update_types_lookup_map<qualified_type_def>
14246 if (
corpus *type_corpus = qualified_type->get_corpus())
14248 maybe_update_types_lookup_map<qualified_type_def>
14250 type_corpus->priv_->get_types().qualified_types());
14254 maybe_update_types_lookup_map<qualified_type_def>
14256 group->priv_->get_types().qualified_types());
14276 maybe_update_types_lookup_map<pointer_type_def>
14279 if (
corpus *type_corpus = pointer_type->get_corpus())
14281 maybe_update_types_lookup_map<pointer_type_def>
14283 type_corpus->priv_->get_types().pointer_types());
14287 maybe_update_types_lookup_map<pointer_type_def>
14289 group->priv_->get_types().pointer_types());
14309 maybe_update_types_lookup_map<reference_type_def>
14312 if (
corpus *type_corpus = reference_type->get_corpus())
14314 maybe_update_types_lookup_map<reference_type_def>
14316 type_corpus->priv_->get_types().reference_types());
14320 maybe_update_types_lookup_map<reference_type_def>
14322 group->priv_->get_types().reference_types());
14342 maybe_update_types_lookup_map<array_type_def>
14345 if (
corpus *type_corpus = array_type->get_corpus())
14347 maybe_update_types_lookup_map<array_type_def>
14349 type_corpus->priv_->get_types().array_types());
14351 maybe_update_types_lookup_map<array_type_def>
14353 type_corpus->get_type_per_loc_map().array_types(),
14358 maybe_update_types_lookup_map<array_type_def>
14360 group->priv_->get_types().array_types());
14362 maybe_update_types_lookup_map<array_type_def>
14364 group->get_type_per_loc_map().array_types(),
14386 maybe_update_types_lookup_map<array_type_def::subrange_type>
14389 if (
corpus *type_corpus = subrange_type->get_corpus())
14391 maybe_update_types_lookup_map<array_type_def::subrange_type>
14393 type_corpus->priv_->get_types().subrange_types());
14395 maybe_update_types_lookup_map<array_type_def::subrange_type>
14397 type_corpus->get_type_per_loc_map().subrange_types(),
14400 if (
corpus *group = subrange_type->get_corpus())
14402 maybe_update_types_lookup_map<array_type_def::subrange_type>
14404 group->priv_->get_types().subrange_types());
14406 maybe_update_types_lookup_map<array_type_def::subrange_type>
14408 group->get_type_per_loc_map().subrange_types(),
14433 if (
corpus *type_corpus = fn_type->get_corpus())
14437 type_corpus->priv_->get_types().function_types());
14439 if (
corpus *group = fn_type->get_corpus())
14443 group->priv_->get_types().function_types());
14534 type_base_sptr result;
14542 type_base_sptr underlying_type =
14545 if (underlying_type)
14548 qual->get_cv_quals(),
14549 qual->get_location()));
14554 type_base_sptr pointed_to_type =
14557 if (pointed_to_type)
14560 p->get_size_in_bits(),
14561 p->get_alignment_in_bits(),
14562 p->get_location()));
14567 type_base_sptr pointed_to_type =
14569 if (pointed_to_type)
14573 r->get_size_in_bits(),
14574 r->get_alignment_in_bits(),
14575 r->get_location()));
14589 tu.priv_->synthesized_types_.push_back(result);
14622 type_base_sptr result_return_type;
14627 if (!result_return_type)
14631 type_base_sptr parm_type;
14633 for (function_type::parameters::const_iterator i =
14638 type_base_sptr t = (*i)->get_type();
14645 (*i)->get_location(),
14646 (*i)->get_variadic_marker(),
14647 (*i)->get_is_artificial()));
14648 parms.push_back(parm);
14651 class_or_union_sptr class_type;
14660 function_type_sptr result_fn_type;
14663 result_fn_type.reset(
new method_type(result_return_type,
14675 tu.priv_->synthesized_types_.push_back(result_fn_type);
14679 return result_fn_type;
14690 if (mangled_name.empty())
14695 char * str = abi::__cxa_demangle(mangled_name.c_str(),
14696 NULL, &l, &status);
14697 string demangled_name = mangled_name;
14701 demangled_name = str;
14705 return demangled_name;
14730 global_scope::~global_scope()
14735 maybe_propagate_canonical_type(
const type_base& lhs_type,
14736 const type_base& rhs_type);
14755 types_defined_same_linux_kernel_corpus_public(
const type_base& t1,
14756 const type_base& t2)
14758 const corpus *t1_corpus = t1.get_corpus(), *t2_corpus = t2.get_corpus();
14759 string t1_file_path, t2_file_path;
14763 if (!(t1_corpus && t2_corpus
14764 && t1_corpus == t2_corpus
14765 && (t1_corpus->get_origin() & corpus::LINUX_KERNEL_BINARY_ORIGIN)
14770 class_or_union *c1 = 0, *c2 = 0;
14776 if ((c1 && c1->get_is_anonymous() && !c1->get_naming_typedef())
14777 || (c2 && c2->get_is_anonymous() && !c2->get_naming_typedef()))
14784 && c1->get_is_anonymous() && c1->get_naming_typedef()
14785 && c2->get_is_anonymous() && c2->get_naming_typedef())
14786 if (c1->get_naming_typedef()->get_name()
14787 != c2->get_naming_typedef()->get_name())
14793 if (e1->get_is_anonymous() || e2->get_is_anonymous())
14803 if (c1->get_is_declaration_only() != c2->get_is_declaration_only())
14805 if (c1->get_environment().decl_only_class_equals_definition())
14815 if (t1.get_size_in_bits() != t2.get_size_in_bits())
14824 l = c1->get_location();
14826 l =
dynamic_cast<const decl_base&
>(t1).
get_location();
14828 unsigned line = 0, col = 0;
14830 l.
expand(t1_file_path, line, col);
14832 l = c2->get_location();
14834 l =
dynamic_cast<const decl_base&
>(t2).
get_location();
14836 l.
expand(t2_file_path, line, col);
14839 if (t1_file_path.empty() || t2_file_path.empty())
14842 if (t1_file_path == t2_file_path)
14878 compare_types_during_canonicalization(
const type_base& canonical_type,
14879 const type_base& candidate_type)
14881 #ifdef WITH_DEBUG_TYPE_CANONICALIZATION
14882 const environment& env = canonical_type.get_environment();
14883 if (env.debug_type_canonicalization_is_on())
14885 bool canonical_equality =
false, structural_equality =
false;
14886 env.priv_->use_canonical_type_comparison_ =
false;
14887 structural_equality = canonical_type == candidate_type;
14888 env.priv_->use_canonical_type_comparison_ =
true;
14889 canonical_equality = canonical_type == candidate_type;
14890 if (canonical_equality != structural_equality)
14892 std::cerr <<
"structural & canonical equality different for type: "
14893 << canonical_type.get_pretty_representation(
true,
true)
14897 return structural_equality;
14899 #endif //end WITH_DEBUG_TYPE_CANONICALIZATION
14900 return canonical_type == candidate_type;
14924 compare_canonical_type_against_candidate(
const type_base& canonical_type,
14925 const type_base& candidate_type)
14927 environment& env =
const_cast<environment&
>(canonical_type.get_environment());
14945 bool saved_decl_only_class_equals_definition =
14946 env.decl_only_class_equals_definition();
14947 env.do_on_the_fly_canonicalization(
true);
14950 env.decl_only_class_equals_definition(
false);
14951 env.priv_->allow_type_comparison_results_caching(
true);
14952 bool equal = (types_defined_same_linux_kernel_corpus_public(canonical_type,
14954 || compare_types_during_canonicalization(canonical_type,
14959 env.priv_->clear_type_comparison_results_cache();
14960 env.priv_->allow_type_comparison_results_caching(
false);
14961 env.do_on_the_fly_canonicalization(
false);
14962 env.decl_only_class_equals_definition
14963 (saved_decl_only_class_equals_definition);
14988 compare_canonical_type_against_candidate(
const type_base* canonical_type,
14989 const type_base* candidate_type)
14991 return compare_canonical_type_against_candidate(*canonical_type,
15016 compare_canonical_type_against_candidate(
const type_base_sptr& canonical_type,
15017 const type_base_sptr& candidate_type)
15019 return compare_canonical_type_against_candidate(canonical_type.get(),
15020 candidate_type.get());
15046 type_base::get_canonical_type_for(type_base_sptr t)
15051 environment& env =
const_cast<environment&
>(t->get_environment());
15055 return type_base_sptr();
15061 bool decl_only_class_equals_definition =
15074 if (decl_only_class_equals_definition)
15075 if (class_or_union)
15076 if (class_or_union->get_is_declaration_only())
15077 return type_base_sptr();
15080 if (t->get_canonical_type())
15081 return t->get_canonical_type();
15089 || !class_or_union->get_is_anonymous()
15090 || class_or_union->get_linkage_name().empty());
15102 string repr = t->get_cached_pretty_representation(
true);
15107 type_base_sptr canonical_type_present_in_corpus;
15109 env.get_canonical_types_map();
15111 type_base_sptr result;
15112 environment::canonical_types_map_type::iterator i = types.find(repr);
15113 if (i == types.end())
15115 vector<type_base_sptr> v;
15122 vector<type_base_sptr> &v = i->second;
15129 for (vector<type_base_sptr>::const_reverse_iterator it = v.rbegin();
15133 bool equal = compare_canonical_type_against_candidate(*it, t);
15140 #ifdef WITH_DEBUG_SELF_COMPARISON
15141 if (env.self_comparison_debug_is_on())
15145 corpus_sptr corp1, corp2;
15146 env.get_self_comparison_debug_inputs(corp1, corp2);
15147 if (corp1 && corp2 && t->get_corpus() == corp2.get())
15158 check_canonical_type_from_abixml_during_self_comp(t,
15164 uintptr_t should_have_canonical_type = 0;
15165 string type_id = env.get_type_id_from_type(t.get());
15166 if (type_id.empty())
15167 type_id =
"type-id-<not-found>";
15169 should_have_canonical_type =
15170 env.get_canonical_type_from_type_id(type_id.c_str());
15171 std::cerr <<
"error: wrong canonical type for '"
15180 <<
"'. Should have had canonical type: "
15182 << should_have_canonical_type
15188 uintptr_t ptr_val =
reinterpret_cast<uintptr_t
>(t.get());
15189 string type_id = env.get_type_id_from_pointer(ptr_val);
15190 if (type_id.empty())
15191 type_id =
"type-id-<not-found>";
15208 std::cerr <<
"error: wrong induced canonical type for '"
15210 <<
"' from second corpus"
15211 <<
", ptr: " << std::hex << t.get()
15212 <<
" type-id: " << type_id
15217 #endif //WITH_DEBUG_SELF_COMPARISON
15251 maybe_adjust_canonical_type(
const type_base_sptr& canonical,
15252 const type_base_sptr& type)
15256 || type->get_naked_canonical_type()
15258 || type.get() == canonical.get())
15265 if (canonical_class)
15269 for (class_decl::member_functions::const_iterator i =
15270 cl->get_member_functions().begin();
15271 i != cl->get_member_functions().end();
15273 if ((*i)->get_symbol())
15276 find_member_function((*i)->get_linkage_name()))
15279 if (s1 && !m->get_symbol())
15292 method_decl_sptr method =
15306 if (type->get_is_artificial() != canonical->get_is_artificial())
15307 canonical->set_is_artificial(
false);
15331 if (t->get_canonical_type())
15332 return t->get_canonical_type();
15334 if (t->get_environment().priv_->do_log())
15335 std::cerr <<
"Canonicalization of type '"
15336 << t->get_pretty_representation(
true,
true)
15337 <<
"/@#" << std::hex << t.get() <<
": ";
15341 if (t->get_environment().priv_->do_log())
15343 type_base_sptr canonical = type_base::get_canonical_type_for(t);
15345 if (t->get_environment().priv_->do_log())
15348 if (t->get_environment().priv_->do_log())
15349 std::cerr << tmr <<
"\n";
15351 maybe_adjust_canonical_type(canonical, t);
15353 t->priv_->canonical_type = canonical;
15354 t->priv_->naked_canonical_type = canonical.get();
15368 ABG_ASSERT(!t->priv_->canonical_type_propagated()
15369 || t->priv_->propagated_canonical_type_confirmed());
15372 if (type_base_sptr d =
is_type(cl->get_earlier_declaration()))
15373 if ((canonical = d->get_canonical_type()))
15375 d->priv_->canonical_type = canonical;
15376 d->priv_->naked_canonical_type = canonical.get();
15393 if (type_base_sptr c =
is_type(scope)->get_canonical_type())
15407 #ifdef WITH_DEBUG_CT_PROPAGATION
15416 env.priv_->erase_type_with_cleared_propagated_canonical_type(t.get());
15420 t->on_canonical_type_set();
15431 priv_->definition_of_declaration_ = d;
15433 if (type_base_sptr canonical_type =
is_type(d)->get_canonical_type())
15434 t->priv_->canonical_type = canonical_type;
15436 priv_->naked_definition_of_declaration_ =
const_cast<decl_base*
>(d.get());
15446 priv_(new
priv(s, a))
15458 {
return priv_->canonical_type.lock();}
15474 {
return priv_->naked_canonical_type;}
15489 const interned_string&
15499 return priv_->internal_cached_repr_;
15508 return priv_->cached_repr_;
15546 {
return equals(*
this, other, 0);}
15563 {priv_->size_in_bits = s;}
15570 {
return priv_->size_in_bits;}
15577 {priv_->alignment_in_bits = a;}
15584 {
return priv_->alignment_in_bits;}
15600 v.visit_begin(
this);
15601 bool result = v.visit_end(
this);
15607 type_base::~type_base()
15626 static_cast<unsigned>(r));
15641 static_cast<unsigned>(r));
15698 parse_integral_type_modifier(
const string& word,
15701 if (word ==
"signed")
15703 else if (word ==
"unsigned")
15705 else if (word ==
"short")
15707 else if (word ==
"long")
15709 else if (word ==
"long long")
15727 parse_base_integral_type(
const string& type_name,
15730 if (type_name ==
"int")
15732 else if (type_name ==
"char")
15734 else if (type_name ==
"bool" || type_name ==
"_Bool")
15736 else if (type_name ==
"double")
15738 else if (type_name ==
"float")
15740 else if (type_name ==
"char16_t")
15742 else if (type_name ==
"char32_t")
15744 else if (type_name ==
"wchar_t")
15769 string input = type_name;
15770 string::size_type len = input.length();
15771 string::size_type cur_pos = 0, prev_pos = 0;
15772 string cur_word, prev_word;
15775 while (cur_pos < len)
15777 if (cur_pos < len && isspace(input[cur_pos]))
15780 while (cur_pos < len && isspace(input[cur_pos]));
15782 prev_pos = cur_pos;
15783 cur_pos = input.find(
' ', prev_pos);
15784 prev_word = cur_word;
15785 cur_word = input.substr(prev_pos, cur_pos - prev_pos);
15788 && cur_word ==
"long"
15789 && prev_word !=
"long")
15791 if (cur_pos < len && isspace(input[cur_pos]))
15794 while (cur_pos < len && isspace(input[cur_pos]));
15795 prev_pos = cur_pos;
15797 cur_pos = input.find(
' ', prev_pos);
15798 string saved_prev_word = prev_word;
15799 prev_word = cur_word;
15800 cur_word = input.substr(prev_pos, cur_pos - prev_pos);
15801 if (cur_word ==
"long")
15802 cur_word =
"long long";
15805 cur_pos = prev_pos;
15806 cur_word = prev_word;
15807 prev_word = saved_prev_word;
15811 if (!parse_integral_type_modifier(cur_word, modifiers))
15813 if (!parse_base_integral_type(cur_word, base))
15851 : base_(INT_BASE_TYPE),
15852 modifiers_(NO_MODIFIER)
15861 : base_(b), modifiers_(m)
15869 : base_(INT_BASE_TYPE),
15870 modifiers_(NO_MODIFIER)
15888 {
return modifiers_;}
15905 {
return base_ == other.base_ && modifiers_ == other.modifiers_;}
15923 result +=
"signed ";
15925 result +=
"unsigned ";
15936 result +=
"short ";
15940 result +=
"long long ";
15951 result +=
"double";
15955 result +=
"char16_t";
15957 result +=
"char32_t";
15959 result +=
"wchar_t";
15969 integral_type::operator string()
const
15970 {
return to_string();}
15993 const string& name,
15994 size_t size_in_bits,
15995 size_t alignment_in_bits,
15997 const string& linkage_name,
16002 | ABSTRACT_TYPE_BASE
16003 | ABSTRACT_DECL_BASE),
16004 decl_base(env, name, locus, linkage_name, vis),
16005 type_base(env, size_in_bits, alignment_in_bits)
16016 string integral_type_name = int_type;
16050 bool result =
false;
16054 result =
equals(static_cast<const decl_base&>(l),
16055 static_cast<const decl_base&>(r),
16062 result &=
equals(static_cast<const type_base&>(l),
16063 static_cast<const type_base&>(r),
16081 return *
this == *other;
16092 const type_decl* other =
dynamic_cast<const type_decl*
>(&o);
16109 return *
this == other;
16155 if (l.get() == r.get())
16183 bool internal)
const
16196 const interned_string&
16207 if (decl_base::priv_->internal_qualified_name_.
empty())
16208 decl_base::priv_->internal_qualified_name_ =
16209 env.
intern(get_internal_integral_type_name(
this));
16210 return decl_base::priv_->internal_qualified_name_;
16214 decl_base::priv_->temporary_internal_qualified_name_ =
16215 env.
intern(get_internal_integral_type_name(
this));
16216 return decl_base::priv_->temporary_internal_qualified_name_;
16242 bool qualified_name)
const
16246 return get_internal_integral_type_name(
this);
16248 if (qualified_name)
16266 v.visit_begin(
this);
16267 bool result = v.visit_end(
this);
16273 type_decl::~type_decl()
16293 const string& name,
16294 size_t size_in_bits,
16295 size_t alignment_in_bits,
16299 ABSTRACT_SCOPE_TYPE_DECL
16300 | ABSTRACT_TYPE_BASE
16301 | ABSTRACT_DECL_BASE),
16303 type_base(env, size_in_bits, alignment_in_bits),
16329 bool result =
equals(static_cast<const scope_decl&>(l),
16330 static_cast<const scope_decl&>(r),
16336 result &=
equals(static_cast<const type_base&>(l),
16337 static_cast<const type_base&>(r),
16372 return *
this == *other;
16396 if (v.visit_begin(
this))
16399 for (scope_decl::declarations::const_iterator i =
16403 if (!(*i)->traverse(v))
16408 bool result = v.visit_end(
this);
16414 scope_type_decl::~scope_type_decl()
16430 const string& name,
16441 | ABSTRACT_DECL_BASE
16442 | ABSTRACT_SCOPE_DECL),
16468 bool qualified_name)
const
16510 if (!ns->is_empty_or_has_empty_sub_namespaces())
16531 if (v.visit_begin(
this))
16534 scope_decl::declarations::const_iterator i;
16542 if (!t->traverse (v))
16547 return v.visit_end(
this);
16550 namespace_decl::~namespace_decl()
16559 class qualified_type_def::priv
16566 interned_string temporary_internal_name_;
16569 interned_string internal_name_;
16570 weak_ptr<type_base> underlying_type_;
16573 : cv_quals_(CV_NONE)
16578 : cv_quals_(quals),
16579 underlying_type_(t)
16631 qualified_type_def::qualified_type_def(type_base_sptr type,
16636 | ABSTRACT_TYPE_BASE
16637 | ABSTRACT_DECL_BASE),
16638 type_base(type->get_environment(), type->get_size_in_bits(),
16639 type->get_alignment_in_bits()),
16640 decl_base(type->get_environment(),
"", locus,
"",
16641 dynamic_pointer_cast<
decl_base>(type)->get_visibility()),
16642 priv_(new priv(quals, type))
16645 interned_string name = type->get_environment().intern(
build_name(
false));
16661 | ABSTRACT_TYPE_BASE
16662 | ABSTRACT_DECL_BASE),
16666 priv_(new priv(quals))
16671 interned_string name = env.
intern(
"void");
16689 s = ut->get_size_in_bits();
16718 bool result =
true;
16785 return *
this == *other;
16803 return *
this == *other;
16818 bool internal)
const
16829 const interned_string&
16846 priv_->temporary_internal_name_ =
16848 return priv_->temporary_internal_name_;
16864 if (priv_->internal_name_.empty())
16865 priv_->internal_name_ =
16868 return priv_->internal_name_;
16897 if (v.visit_begin(
this))
16904 bool result = v.visit_end(
this);
16909 qualified_type_def::~qualified_type_def()
16916 {
return priv_->cv_quals_;}
16921 {priv_->cv_quals_ = cv_quals;}
16935 {
return priv_->underlying_type_.lock();}
16944 priv_->underlying_type_ = t;
16954 scope_decl::declarations::iterator i;
16955 if (s->find_iterator_for_member(
this, i))
16970 operator==(
const qualified_type_def_sptr& l,
const qualified_type_def_sptr& r)
16972 if (l.get() == r.get())
16988 operator!=(
const qualified_type_def_sptr& l,
const qualified_type_def_sptr& r)
16996 (
static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs));
17020 (
static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs));
17042 case qualified_type_def::CV_NONE:
17045 case qualified_type_def::CV_CONST:
17048 case qualified_type_def::CV_VOLATILE:
17051 case qualified_type_def::CV_RESTRICT:
17065 struct pointer_type_def::priv
17069 interned_string internal_qualified_name_;
17070 interned_string temp_internal_qualified_name_;
17072 priv(
const type_base_sptr& t)
17074 naked_pointed_to_type_(t.get())
17078 : naked_pointed_to_type_()
17103 pointer_type_def::pointer_type_def(
const type_base_sptr& pointed_to,
17104 size_t size_in_bits,
17105 size_t align_in_bits,
17109 | ABSTRACT_TYPE_BASE
17110 | ABSTRACT_DECL_BASE),
17111 type_base(pointed_to->get_environment(), size_in_bits, align_in_bits),
17112 decl_base(pointed_to->get_environment(),
"", locus,
""),
17113 priv_(new priv(pointed_to))
17119 const environment& env = pointed_to->get_environment();
17120 decl_base_sptr pto = dynamic_pointer_cast<
decl_base>(pointed_to);
17121 string name = (pto ? pto->get_name() : string(
"void")) +
"*";
17139 pointer_type_def::pointer_type_def(
const environment& env,
size_t size_in_bits,
17140 size_t alignment_in_bits,
17144 | ABSTRACT_TYPE_BASE
17145 | ABSTRACT_DECL_BASE),
17146 type_base(env, size_in_bits, alignment_in_bits),
17151 string name = string(
"void") +
"*";
17162 priv_->pointed_to_type_ = t;
17163 priv_->naked_pointed_to_type_ = t.get();
17168 decl_base_sptr pto = dynamic_pointer_cast<
decl_base>(t);
17169 string name = (pto ? pto->get_name() : string(
"void")) +
"*";
17252 return *
this == *o;
17273 const type_base_sptr
17275 {
return priv_->pointed_to_type_.lock();}
17282 {
return priv_->naked_pointed_to_type_;}
17310 const interned_string&
17320 if (priv_->internal_qualified_name_.empty())
17321 if (pointed_to_type)
17322 priv_->internal_qualified_name_ =
17329 return priv_->internal_qualified_name_;
17337 if (pointed_to_type)
17338 priv_->temp_internal_qualified_name_ =
17345 return priv_->temp_internal_qualified_name_;
17365 if (pointed_to_type)
17391 if (v.visit_begin(
this))
17399 bool result = v.visit_end(
this);
17404 pointer_type_def::~pointer_type_def()
17421 if (l.get() == r.get())
17449 struct reference_type_def::priv
17454 interned_string internal_qualified_name_;
17455 interned_string temp_internal_qualified_name_;
17457 priv(
const type_base_sptr& t,
bool is_lvalue)
17459 is_lvalue_(is_lvalue)
17462 priv(
bool is_lvalue)
17463 : is_lvalue_(is_lvalue)
17492 reference_type_def::reference_type_def(
const type_base_sptr pointed_to,
17494 size_t size_in_bits,
17495 size_t align_in_bits,
17499 | ABSTRACT_TYPE_BASE
17500 | ABSTRACT_DECL_BASE),
17501 type_base(pointed_to->get_environment(), size_in_bits, align_in_bits),
17502 decl_base(pointed_to->get_environment(),
"", locus,
""),
17503 priv_(new priv(pointed_to, lvalue))
17509 decl_base_sptr pto = dynamic_pointer_cast<
decl_base>(pointed_to);
17514 name = string(pto->get_name()) +
"&";
17522 const environment& env = pointed_to->get_environment();
17546 reference_type_def::reference_type_def(
const environment& env,
bool lvalue,
17547 size_t size_in_bits,
17548 size_t alignment_in_bits,
17552 | ABSTRACT_TYPE_BASE
17553 | ABSTRACT_DECL_BASE),
17554 type_base(env, size_in_bits, alignment_in_bits),
17556 priv_(new priv(lvalue))
17559 string name =
"void&";
17574 priv_->pointed_to_type_ = pointed_to_type;
17576 decl_base_sptr pto;
17578 {pto = dynamic_pointer_cast<
decl_base>(pointed_to_type);}
17585 string name = string(pto->get_name()) +
"&";
17615 if (l.is_lvalue() != r.is_lvalue())
17623 bool result = (l.get_pointed_to_type() == r.get_pointed_to_type());
17662 return *
this == *other;
17677 return *
this == *other;
17681 reference_type_def::get_pointed_to_type()
const
17682 {
return priv_->pointed_to_type_.lock();}
17685 reference_type_def::is_lvalue()
const
17686 {
return priv_->is_lvalue_;}
17713 const interned_string&
17716 type_base_sptr pointed_to_type = get_pointed_to_type();
17723 if (priv_->internal_qualified_name_.empty())
17724 if (pointed_to_type)
17725 priv_->internal_qualified_name_ =
17733 return priv_->internal_qualified_name_;
17741 if (pointed_to_type)
17742 priv_->temp_internal_qualified_name_ =
17750 return priv_->temp_internal_qualified_name_;
17770 if (pointed_to_type)
17800 bool qualified_name)
const
17804 (get_pointed_to_type()),
17828 if (v.visit_begin(
this))
17831 if (type_base_sptr t = get_pointed_to_type())
17836 bool result = v.visit_end(
this);
17841 reference_type_def::~reference_type_def()
17858 if (l.get() == r.get())
17886 array_type_def::subrange_type::~subrange_type() =
default;
17895 : s_(UNSIGNED_SIGNEDNESS)
17904 : s_(UNSIGNED_SIGNEDNESS)
17913 : s_(SIGNED_SIGNEDNESS)
17921 enum array_type_def::subrange_type::bound_value::signedness
17937 {
return v_.signed_;
17945 {
return v_.unsigned_;}
17953 s_ = UNSIGNED_SIGNEDNESS;
17963 s_ = SIGNED_SIGNEDNESS;
17975 return s_ == v.s_ && v_.unsigned_ == v.v_.unsigned_;
17980 struct array_type_def::subrange_type::priv
17990 : upper_bound_(ub), language_(l), infinite_(false)
17993 priv(bound_value lb, bound_value ub,
17995 : lower_bound_(lb), upper_bound_(ub),
17996 language_(l), infinite_(false)
17999 priv(bound_value lb, bound_value ub,
const type_base_sptr &u,
18001 : lower_bound_(lb), upper_bound_(ub), underlying_type_(u),
18002 language_(l), infinite_(false)
18021 const string& name,
18024 const type_base_sptr& utype,
18029 upper_bound.get_unsigned_value()
18030 - lower_bound.get_unsigned_value(),
18033 priv_(new priv(lower_bound, upper_bound, utype, l))
18053 const string& name,
18060 upper_bound.get_unsigned_value()
18061 - lower_bound.get_unsigned_value(), 0),
18063 priv_(new priv(lower_bound, upper_bound, l))
18081 const string& name,
18086 type_base(env, upper_bound.get_unsigned_value(), 0),
18088 priv_(new priv(upper_bound, l))
18099 {
return priv_->underlying_type_.lock();}
18108 ABG_ASSERT(priv_->underlying_type_.expired());
18109 priv_->underlying_type_ = u;
18117 {
return priv_->upper_bound_.get_signed_value();}
18124 {
return priv_->lower_bound_.get_signed_value();}
18131 {priv_->upper_bound_ = ub;}
18138 {priv_->lower_bound_ = lb;}
18155 if (get_upper_bound() >= get_lower_bound())
18156 return get_upper_bound() - get_lower_bound() + 1;
18165 {
return priv_->infinite_;}
18173 {priv_->infinite_ = f;}
18180 {
return priv_->language_;}
18188 std::ostringstream o;
18192 type_base_sptr underlying_type = get_underlying_type();
18193 if (underlying_type)
18195 o <<
"range "<< get_lower_bound() <<
" .. " << get_upper_bound();
18200 o <<
"[" << get_length() <<
"]";
18215 for (vector<subrange_sptr>::const_iterator i = v.begin();
18218 r += (*i)->as_string();
18247 bool result =
true;
18272 const subrange_type* other =
18273 dynamic_cast<const subrange_type*
>(&o);
18291 return *
this == *other;
18359 repr +=
"<anonymous range>";
18361 repr +=
"<range " +
get_name() +
">";
18362 repr += as_string();
18380 if (v.visit_begin(
this))
18383 if (type_base_sptr u = get_underlying_type())
18388 bool result = v.visit_end(
this);
18395 struct array_type_def::priv
18399 interned_string temp_internal_qualified_name_;
18400 interned_string internal_qualified_name_;
18402 priv(type_base_sptr t)
18407 : element_type_(t), subranges_(subs)
18427 array_type_def::array_type_def(
const type_base_sptr e_type,
18428 const std::vector<subrange_sptr>& subs,
18432 | ABSTRACT_TYPE_BASE
18433 | ABSTRACT_DECL_BASE),
18436 priv_(new priv(e_type))
18460 const std::vector<subrange_sptr>& subs,
18464 | ABSTRACT_TYPE_BASE
18465 | ABSTRACT_DECL_BASE),
18479 array_type_def::update_size()
18481 type_base_sptr e = priv_->element_type_.lock();
18484 size_t s = e->get_size_in_bits();
18488 s *= sub->get_length();
18496 array_type_def::get_subrange_representation()
const
18511 get_type_representation(
const array_type_def& a,
bool internal)
18513 type_base_sptr e_type = a.get_element_type();
18519 std::ostringstream o;
18521 << a.get_subrange_representation()
18523 << e_type ? e_type->get_pretty_representation(
internal):string(
"void");
18533 + a.get_subrange_representation();
18538 + a.get_subrange_representation();
18565 {
return get_type_representation(*
this,
internal);}
18589 std::vector<array_type_def::subrange_sptr > this_subs = l.
get_subranges();
18590 std::vector<array_type_def::subrange_sptr > other_subs = r.
get_subranges();
18592 bool result =
true;
18593 if (this_subs.size() != other_subs.size())
18602 std::vector<array_type_def::subrange_sptr >::const_iterator i,j;
18603 for (i = this_subs.begin(), j = other_subs.begin();
18604 i != this_subs.end() && j != other_subs.end();
18651 std::vector<array_type_def::subrange_sptr > this_subs = l->
get_subranges();
18652 std::vector<array_type_def::subrange_sptr > other_subs = r->
get_subranges();
18654 if (this_subs.size() != other_subs.size())
18657 std::vector<array_type_def::subrange_sptr >::const_iterator i,j;
18658 for (i = this_subs.begin(), j = other_subs.begin();
18659 i != this_subs.end() && j != other_subs.end();
18669 if (*first_element_type != *second_element_type)
18681 const std::vector<subrange_sptr>& subranges =
18684 if (subranges.empty())
18685 return translation_unit::LANG_C11;
18686 return subranges.front()->get_language();
18705 return *
this == *other;
18711 const type_base_sptr
18713 {
return priv_->element_type_.lock();}
18729 priv_->element_type_ = element_type;
18740 for (
const auto &sub : subs)
18741 priv_->subranges_.push_back(sub);
18753 if (priv_->subranges_.empty())
18756 for (std::vector<shared_ptr<subrange_type> >::const_iterator i =
18757 priv_->subranges_.begin();
18758 i != priv_->subranges_.end();
18760 if ((*i)->is_infinite())
18767 array_type_def::get_dimension_count()
const
18768 {
return priv_->subranges_.size();}
18792 const interned_string&
18802 if (priv_->internal_qualified_name_.empty())
18803 priv_->internal_qualified_name_ =
18804 env.
intern(get_type_representation(*
this,
true));
18805 return priv_->internal_qualified_name_;
18809 priv_->temp_internal_qualified_name_ =
18810 env.
intern(get_type_representation(*
this,
true));
18811 return priv_->temp_internal_qualified_name_;
18849 if (v.visit_begin(
this))
18857 bool result = v.visit_end(
this);
18863 array_type_def::get_location()
const
18867 const std::vector<array_type_def::subrange_sptr>&
18869 {
return priv_->subranges_;}
18871 array_type_def::~array_type_def()
18878 class enum_type_decl::priv
18880 type_base_sptr underlying_type_;
18889 priv(type_base_sptr underlying_type,
18891 : underlying_type_(underlying_type),
18892 enumerators_(enumerators)
18909 enum_type_decl::enum_type_decl(
const string& name,
18911 type_base_sptr underlying_type,
18913 const string& linkage_name,
18917 | ABSTRACT_TYPE_BASE
18918 | ABSTRACT_DECL_BASE),
18919 type_base(underlying_type->get_environment(),
18920 underlying_type->get_size_in_bits(),
18921 underlying_type->get_alignment_in_bits()),
18922 decl_base(underlying_type->get_environment(),
18923 name, locus, linkage_name, vis),
18924 priv_(new priv(underlying_type, enums))
18930 e->set_enum_type(
this);
18936 {
return priv_->underlying_type_;}
18941 {
return priv_->enumerators_;}
18946 {
return priv_->enumerators_;}
18954 if (priv_->sorted_enumerators_.empty())
18959 priv_->sorted_enumerators_.push_back(*e);
18961 std::sort(priv_->sorted_enumerators_.begin(),
18962 priv_->sorted_enumerators_.end(),
18968 return (l.
get_name() < r.get_name());
18972 return priv_->sorted_enumerators_;
18994 bool qualified_name)
const
18996 string r =
"enum ";
19026 if (v.visit_begin(
this))
19034 bool result = v.visit_end(
this);
19056 bool result =
false;
19066 enum_type_decl::enumerators::const_iterator i, j;
19099 if (!(l.decl_base::operator==(r) && l.type_base::operator==(r)))
19104 if (!l.decl_base::operator==(r))
19106 if (!l.type_base::operator==(r))
19153 enumerators_values_are_equal(
const enum_type_decl::enumerator &enr,
19154 const enum_type_decl::enumerator &enl)
19155 {
return enr.get_value() == enl.get_value();}
19178 is_enumerator_value_present_in_enum(
const enum_type_decl::enumerator &enr,
19179 const enum_type_decl &enom,
19180 vector<enum_type_decl::enumerator>& redundant_enrs)
19182 bool found =
false;
19183 for (
const auto &e : enom.get_enumerators())
19184 if (enumerators_values_are_equal(e, enr))
19188 redundant_enrs.push_back(e);
19206 is_enumerator_value_redundant(
const enum_type_decl::enumerator &enr,
19207 const enum_type_decl &enom)
19209 vector<enum_type_decl::enumerator> redundant_enrs;
19210 if (is_enumerator_value_present_in_enum(enr, enom, redundant_enrs))
19212 if (!redundant_enrs.empty())
19240 bool result =
true;
19256 if (!!def1 != !!def2)
19286 if (!(def1->decl_base::operator==(*def2)
19287 && def1->type_base::operator==(*def2)))
19292 if (!def1->decl_base::operator==(*def2))
19294 if (!def1->type_base::operator==(*def2))
19345 && (!is_enumerator_value_redundant(e, *def2)
19346 || !is_enumerator_value_redundant(e, *def1)))
19358 for(
const auto &e : def2->get_enumerators())
19360 && (!is_enumerator_value_redundant(e, *def1)
19361 || !is_enumerator_value_redundant(e, *def2)))
19403 return *
this == *other;
19418 if (l.get() == r.get())
19420 decl_base_sptr o = r;
19437 class enum_type_decl::enumerator::priv
19441 string qualified_name_;
19444 friend class enum_type_decl::enumerator;
19452 priv(
const string& name,
19454 enum_type_decl* e = 0)
19466 enum_type_decl::enumerator::~enumerator() =
default;
19477 : priv_(new priv(name, value))
19484 : priv_(new priv(other.
get_name(),
19486 other.get_enum_type()))
19511 bool names_equal =
true;
19513 return names_equal && (get_value() == other.
get_value());
19532 {
return priv_->name_;}
19550 if (priv_->qualified_name_.empty())
19552 priv_->qualified_name_ =
19553 get_enum_type()->get_qualified_name(
internal)
19557 return priv_->qualified_name_;
19565 {priv_->name_ = n;}
19573 {
return priv_->value_;}
19580 {priv_->value_= v;}
19587 {
return priv_->enum_type_;}
19594 {priv_->enum_type_ = e;}
19600 struct typedef_decl::priv
19604 priv(
const type_base_sptr& t)
19605 : underlying_type_(t)
19620 typedef_decl::typedef_decl(
const string& name,
19621 const type_base_sptr underlying_type,
19623 const string& linkage_name,
19627 | ABSTRACT_TYPE_BASE
19628 | ABSTRACT_DECL_BASE),
19633 name, locus, linkage_name, vis),
19634 priv_(new priv(underlying_type))
19650 typedef_decl::typedef_decl(
const string& name,
19653 const string& mangled_name,
19657 | ABSTRACT_TYPE_BASE
19658 | ABSTRACT_DECL_BASE),
19661 decl_base(env, name, locus, mangled_name, vis),
19662 priv_(new priv(nullptr))
19723 bool result =
true;
19727 if (!(l.decl_base::operator==(r)))
19774 return *
this == *other;
19796 bool qualified_name)
const
19799 string result =
"typedef ";
19804 if (qualified_name)
19818 {
return priv_->underlying_type_.lock();}
19826 priv_->underlying_type_ = t;
19840 bool internal)
const
19850 const interned_string&
19858 return decl_base::priv_->internal_qualified_name_;
19860 return decl_base::priv_->qualified_name_;
19879 if (v.visit_begin(
this))
19887 bool result = v.visit_end(
this);
19892 typedef_decl::~typedef_decl()
19898 struct var_decl::priv
19904 interned_string id_;
19911 priv(type_base_sptr t,
19914 naked_type_(t.get()),
19925 naked_type_ = t.get();
19942 var_decl::var_decl(
const string& name,
19943 type_base_sptr type,
19945 const string& linkage_name,
19949 VAR_DECL | ABSTRACT_DECL_BASE),
19950 decl_base(type->get_environment(), name, locus, linkage_name, vis),
19951 priv_(new priv(type, bind))
19959 const type_base_sptr
19961 {
return priv_->type_.lock();}
19968 {priv_->set_type(t);}
19979 {
return priv_->naked_type_;}
19986 {
return priv_->binding_;}
19993 {priv_->binding_ = b;}
20009 priv_->symbol_ = sym;
20024 {
return priv_->symbol_;}
20093 bool result =
true;
20106 else if (s0 && s0 != s1)
20114 bool symbols_are_equal = (s0 && s1 && result);
20116 if (symbols_are_equal)
20125 bool decl_bases_different = !l.decl_base::operator==(r);
20126 const_cast<var_decl&
>(l).set_qualified_name(n1);
20127 const_cast<var_decl&
>(r).set_qualified_name(n2);
20129 if (decl_bases_different)
20139 if (!l.decl_base::operator==(r))
20188 bool result =
true;
20224 return equals(*
this, *other, 0);
20239 if (priv_->id_.empty())
20244 sym_str = s->get_id_string();
20249 priv_->id_ = env.
intern(repr);
20250 if (!sym_str.empty())
20251 priv_->id_ = env.
intern(priv_->id_ +
"{" + sym_str +
"}");
20263 return hash_var(
this);
20292 const interned_string&
20328 result =
"static ";
20332 bool member_of_anonymous_class =
false;
20335 member_of_anonymous_class =
true;
20340 if (member_of_anonymous_class || !qualified_name)
20345 type_base_sptr et = t->get_element_type();
20349 result += decl->get_qualified_name(
internal)
20350 +
" " + name + t->get_subrange_representation();
20363 "",
true,
internal);
20369 "",
true,
internal);
20372 && (member_of_anonymous_class || !qualified_name))
20388 && (member_of_anonymous_class || !qualified_name))
20442 if (v.visit_begin(
this))
20445 if (type_base_sptr t =
get_type())
20449 return v.visit_end(
this);
20452 var_decl::~var_decl()
20467 priv_->cached_name_.clear();
20468 priv_->internal_cached_name_.clear();
20488 function_type::function_type(type_base_sptr return_type,
20490 size_t size_in_bits,
20491 size_t alignment_in_bits)
20493 FUNCTION_TYPE | ABSTRACT_TYPE_BASE),
20494 type_base(return_type->get_environment(), size_in_bits, alignment_in_bits),
20495 priv_(new
priv(parms, return_type))
20499 for (parameters::size_type i = 0, j = 1;
20500 i < priv_->parms_.size();
20503 if (i == 0 && priv_->parms_[i]->get_is_artificial())
20510 priv_->parms_[i]->set_index(j);
20521 function_type::function_type(type_base_sptr return_type,
20522 size_t size_in_bits,
size_t alignment_in_bits)
20524 FUNCTION_TYPE | ABSTRACT_TYPE_BASE),
20525 type_base(return_type->get_environment(), size_in_bits, alignment_in_bits),
20526 priv_(new
priv(return_type))
20541 size_t size_in_bits,
20542 size_t alignment_in_bits)
20544 type_base(env, size_in_bits, alignment_in_bits),
20556 {
return priv_->return_type_.lock();}
20564 {priv_->return_type_ = t;}
20573 {
return priv_->parms_;}
20595 if (dynamic_cast<const method_type*>(
this))
20616 for (parameters::size_type i = 0, j = 1;
20617 i < priv_->parms_.size();
20620 if (i == 0 && priv_->parms_[i]->get_is_artificial())
20627 priv_->parms_[i]->set_index(j);
20638 parm->set_index(priv_->parms_.size());
20639 priv_->parms_.push_back(parm);
20653 return (!priv_->parms_.empty()
20654 && priv_->parms_.back()->get_variadic_marker());
20686 #define RETURN(value) CACHE_AND_RETURN_COMPARISON_RESULT(value)
20695 bool cached_result =
false;
20703 bool result =
true;
20705 if (!l.type_base::operator==(r))
20714 class_or_union* l_class = 0, *r_class = 0;
20715 if (
const method_type* m = dynamic_cast<const method_type*>(&l))
20716 l_class = m->get_class_type().get();
20718 if (
const method_type* m = dynamic_cast<const method_type*>(&r))
20719 r_class = m->get_class_type().get();
20723 if (!!l_class != !!r_class)
20733 != r_class->get_qualified_name()))
20750 bool compare_result_types =
true;
20751 string l_rt_name = l_return_type_decl
20754 string r_rt_name = r_return_type_decl
20760 (r_class && (r_class->get_qualified_name() == r_rt_name)))
20761 compare_result_types =
false;
20763 if (compare_result_types)
20789 if (l_rt_name != r_rt_name)
20798 vector<shared_ptr<function_decl::parameter> >::const_iterator i,j;
20839 function_type::parameters::const_iterator
20845 bool is_method =
dynamic_cast<const method_type*
>(
this);
20861 function_type::parameters::const_iterator
20881 const interned_string&
20888 if (priv_->internal_cached_name_.empty())
20889 priv_->internal_cached_name_ =
20891 return priv_->internal_cached_name_;
20895 priv_->temp_internal_cached_name_ =
20898 return priv_->temp_internal_cached_name_;
20905 if (priv_->cached_name_.empty())
20906 priv_->cached_name_ =
20908 return priv_->cached_name_;
20912 priv_->cached_name_ =
20914 return priv_->cached_name_;
20975 if (v.visit_begin(
this))
20978 bool keep_going =
true;
20982 if (!t->traverse(v))
20983 keep_going =
false;
20990 if (type_base_sptr parm_type = (*i)->get_type())
20991 if (!parm_type->traverse(v))
20996 return v.visit_end(
this);
20999 function_type::~function_type()
21005 struct method_type::priv
21007 class_or_union_wptr class_type_;
21035 method_type::method_type (type_base_sptr return_type,
21036 class_or_union_sptr class_type,
21037 const std::vector<function_decl::parameter_sptr>& p,
21039 size_t size_in_bits,
21040 size_t alignment_in_bits)
21042 METHOD_TYPE | ABSTRACT_TYPE_BASE | FUNCTION_TYPE),
21043 type_base(class_type->get_environment(), size_in_bits, alignment_in_bits),
21044 function_type(return_type, p, size_in_bits, alignment_in_bits),
21075 method_type::method_type(type_base_sptr return_type,
21076 type_base_sptr class_type,
21077 const std::vector<function_decl::parameter_sptr>& p,
21079 size_t size_in_bits,
21080 size_t alignment_in_bits)
21082 METHOD_TYPE | ABSTRACT_TYPE_BASE | FUNCTION_TYPE),
21083 type_base(class_type->get_environment(), size_in_bits, alignment_in_bits),
21084 function_type(return_type, p, size_in_bits, alignment_in_bits),
21100 size_t size_in_bits,
21101 size_t alignment_in_bits)
21103 type_base(env, size_in_bits, alignment_in_bits),
21123 method_type::method_type(class_or_union_sptr class_type,
21125 size_t size_in_bits,
21126 size_t alignment_in_bits)
21128 METHOD_TYPE | ABSTRACT_TYPE_BASE | FUNCTION_TYPE),
21129 type_base(class_type->get_environment(), size_in_bits, alignment_in_bits),
21132 alignment_in_bits),
21143 class_or_union_sptr
21145 {
return class_or_union_sptr(priv_->class_type_);}
21158 priv_->class_type_ = t;
21186 {priv_->is_const = f;}
21193 {
return priv_->is_const;}
21203 struct function_decl::priv
21205 bool declared_inline_;
21210 interned_string id_;
21213 : declared_inline_(false),
21218 priv(function_type_sptr t,
21219 bool declared_inline,
21221 : declared_inline_(declared_inline),
21224 naked_type_(t.get())
21227 priv(function_type_sptr t,
21228 bool declared_inline,
21231 : declared_inline_(declared_inline),
21234 naked_type_(t.get()),
21256 bool declared_inline,
21258 const string& mangled_name,
21262 FUNCTION_DECL | ABSTRACT_DECL_BASE),
21263 decl_base(function_type->get_environment(), name, locus, mangled_name, vis),
21264 priv_(new priv(function_type, declared_inline, bind))
21293 type_base_sptr fn_type,
21294 bool declared_inline,
21296 const string& linkage_name,
21300 FUNCTION_DECL | ABSTRACT_DECL_BASE),
21301 decl_base(fn_type->get_environment(), name, locus, linkage_name, vis),
21302 priv_(new priv(dynamic_pointer_cast<
function_type>(fn_type),
21324 bool qualified_name)
const
21329 string result = mem_fn ?
"method ":
"function ";
21334 result +=
"virtual ";
21336 decl_base_sptr type;
21384 result += mem_fn->
get_type()->get_class_type()->get_qualified_name()
21396 if (mem_fn && i != end)
21402 for (; i != end; ++i)
21405 if (parm.get() != first_parm.get())
21407 if (parm->get_variadic_marker()
21412 type_base_sptr type = parm->get_type();
21423 result +=
" const";
21434 function_decl::parameters::const_iterator
21440 bool is_method =
dynamic_cast<const method_decl*
>(
this);
21453 const shared_ptr<function_type>
21455 {
return priv_->type_.lock();}
21470 {
return priv_->naked_type_;}
21473 function_decl::set_type(
const function_type_sptr& fn_type)
21475 priv_->type_ = fn_type;
21476 priv_->naked_type_ = fn_type.get();
21493 priv_->symbol_ = sym;
21508 {
return priv_->symbol_;}
21511 function_decl::is_declared_inline()
const
21512 {
return priv_->declared_inline_;}
21515 function_decl::get_binding()
const
21516 {
return priv_->binding_;}
21519 const shared_ptr<type_base>
21521 {
return get_type()->get_return_type();}
21524 const std::vector<shared_ptr<function_decl::parameter> >&
21526 {
return get_type()->get_parameters();}
21533 {
get_type()->append_parameter(parm);}
21541 for (std::vector<shared_ptr<parameter> >::const_iterator i = parms.begin();
21560 is_declared_inline(),
21580 is_declared_inline(),
21614 bool result =
true;
21618 if (t0 == t1 || *t0 == *t1)
21644 else if (s0 && s0 != s1)
21655 bool symbols_are_equal = (s0 && s1 && result);
21657 if (symbols_are_equal)
21669 bool decl_bases_different = !l.decl_base::operator==(r);
21676 if (decl_bases_different)
21686 if (!l.decl_base::operator==(r))
21696 if (l.is_declared_inline() != r.is_declared_inline()
21697 || l.get_binding() != r.get_binding())
21754 return equals(*
this, *o, 0);
21778 return hash_fn(*
this);
21793 if (priv_->id_.empty())
21798 string virtual_member_suffix;
21808 virtual_member_suffix +=
"/o";
21811 if (s->has_aliases())
21818 priv_->id_ = env.
intern(s->get_id_string());
21820 if (!virtual_member_suffix.empty())
21821 priv_->id_ = env.
intern(priv_->id_ + virtual_member_suffix);
21865 if (v.visit_begin(
this))
21868 if (type_base_sptr t =
get_type())
21872 return v.visit_end(
this);
21894 if (l.get() == r.get())
21917 struct function_decl::parameter::priv
21921 bool variadic_marker_;
21928 priv(type_base_sptr type,
21930 bool variadic_marker)
21933 variadic_marker_(variadic_marker)
21937 function_decl::parameter::parameter(
const type_base_sptr type,
21939 const string& name,
21940 const location& loc,
21942 : type_or_decl_base(type->get_environment(),
21943 FUNCTION_PARAMETER_DECL | ABSTRACT_DECL_BASE),
21944 decl_base(type->get_environment(), name, loc),
21945 priv_(new priv(type, index, is_variadic))
21947 runtime_type_instance(
this);
21950 function_decl::parameter::parameter(
const type_base_sptr type,
21952 const string& name,
21953 const location& loc,
21955 bool is_artificial)
21956 : type_or_decl_base(type->get_environment(),
21957 FUNCTION_PARAMETER_DECL | ABSTRACT_DECL_BASE),
21958 decl_base(type->get_environment(), name, loc),
21959 priv_(new priv(type, index, is_variadic))
21961 runtime_type_instance(
this);
21962 set_is_artificial(is_artificial);
21965 function_decl::parameter::parameter(
const type_base_sptr type,
21966 const string& name,
21967 const location& loc,
21969 bool is_artificial)
21970 : type_or_decl_base(type->get_environment(),
21971 FUNCTION_PARAMETER_DECL | ABSTRACT_DECL_BASE),
21972 decl_base(type->get_environment(), name, loc),
21973 priv_(new priv(type, 0, is_variadic))
21975 runtime_type_instance(
this);
21976 set_is_artificial(is_artificial);
21979 function_decl::parameter::parameter(
const type_base_sptr type,
21982 : type_or_decl_base(type->get_environment(),
21983 FUNCTION_PARAMETER_DECL | ABSTRACT_DECL_BASE),
21984 decl_base(type->get_environment(),
"", location()),
21985 priv_(new priv(type, index, variad))
21987 runtime_type_instance(
this);
21990 function_decl::parameter::~parameter() =
default;
21992 const type_base_sptr
21993 function_decl::parameter::get_type()
const
21994 {
return priv_->type_.lock();}
22021 if (get_variadic_marker()
22041 std::ostringstream o;
22042 o <<
"parameter-" << get_index();
22044 return env.
intern(o.str());
22048 function_decl::parameter::get_index()
const
22049 {
return priv_->index_;}
22052 function_decl::parameter::set_index(
unsigned i)
22053 {priv_->index_ = i;}
22057 function_decl::parameter::get_variadic_marker()
const
22058 {
return priv_->variadic_marker_;}
22084 bool result =
true;
22086 if ((l.get_variadic_marker() != r.get_variadic_marker())
22087 || (l.get_index() != r.get_index())
22088 || (!!l.get_type() != !!r.get_type()))
22093 if (l.get_index() != r.get_index())
22095 if (l.get_variadic_marker() != r.get_variadic_marker()
22096 || !!l.get_type() != !!r.get_type())
22105 if (l_type != r_type)
22123 function_decl::parameter::operator==(
const parameter& o)
const
22124 {
return equals(*
this, o, 0);}
22133 return function_decl::parameter::operator==(*p);
22179 if (v.visit_begin(
this))
22182 if (type_base_sptr t =
get_type())
22186 return v.visit_end(
this);
22197 return hash_fn_parm(
this);
22237 type_repr =
"void";
22243 string result = type_repr;
22244 string parm_name = get_name_id();
22246 if (!parm_name.empty())
22247 result +=
" " + parm_name;
22280 class_or_union::class_or_union(
const environment& env,
const string& name,
22281 size_t size_in_bits,
size_t align_in_bits,
22288 | ABSTRACT_DECL_BASE
22289 | ABSTRACT_SCOPE_TYPE_DECL
22290 | ABSTRACT_SCOPE_DECL),
22291 decl_base(env, name, locus, name, vis),
22292 type_base(env, size_in_bits, align_in_bits),
22294 priv_(new
priv(data_members, member_fns))
22296 for (member_types::iterator i = mem_types.begin();
22297 i != mem_types.end();
22302 for (data_members::iterator i = data_members.begin();
22303 i != data_members.end();
22308 for (member_functions::iterator i = member_fns.begin();
22309 i != member_fns.end();
22311 if (!
has_scope(static_pointer_cast<decl_base>(*i)))
22330 class_or_union::class_or_union(
const environment& env,
const string& name,
22331 size_t size_in_bits,
size_t align_in_bits,
22335 | ABSTRACT_DECL_BASE
22336 | ABSTRACT_SCOPE_TYPE_DECL
22337 | ABSTRACT_SCOPE_DECL),
22338 decl_base(env, name, locus, name, vis),
22339 type_base(env, size_in_bits, align_in_bits),
22352 class_or_union::class_or_union(
const environment& env,
const string& name,
22353 bool is_declaration_only)
22356 | ABSTRACT_DECL_BASE
22357 | ABSTRACT_SCOPE_TYPE_DECL
22358 | ABSTRACT_SCOPE_DECL),
22384 if (v.visit_begin(
this))
22393 if (!(*i)->traverse(v))
22403 if (!(*i)->traverse(v))
22413 if (!(*i)->traverse(v))
22420 for (member_function_templates::const_iterator i =
22424 if (!(*i)->traverse(v))
22431 for (member_class_templates::const_iterator i =
22435 if (!(*i)->traverse(v))
22443 bool result = v.visit_end(
this);
22472 type_base_sptr t =
is_type(decl);
22497 class_or_union * anon_dm_type =
22502 for (class_or_union::data_members::const_iterator it =
22591 if (t->get_is_anonymous())
22609 if (t->get_is_anonymous())
22627 if (t->get_is_anonymous())
22652 bool is_laid_out,
bool is_static,
22653 size_t offset_in_bits)
22657 priv_->data_members_.push_back(v);
22668 bool is_already_in =
false;
22669 for (data_members::const_iterator i =
22670 priv_->non_static_data_members_.begin();
22671 i != priv_->non_static_data_members_.end();
22675 is_already_in =
true;
22678 if (!is_already_in)
22679 priv_->non_static_data_members_.push_back(v);
22695 {
return priv_->data_members_;}
22710 if ((*i)->get_name() == name)
22722 if (
var_decl_sptr data_member = type->find_data_member(name))
22723 return data_member;
22737 if (!v->get_name().empty())
22745 if ((*it)->get_pretty_representation(
false,
true)
22746 == v->get_pretty_representation(
false,
true))
22773 if (v->get_name().empty())
22786 {
return priv_->non_static_data_members_;}
22804 bool is_static,
bool is_ctor,
22805 bool is_dtor,
bool is_const)
22817 priv_->member_functions_.push_back(f);
22821 if (!f->get_linkage_name().empty())
22822 priv_->mem_fns_map_[f->get_linkage_name()] = f;
22831 {
return priv_->member_functions_;}
22852 string_mem_fn_sptr_map_type::const_iterator i =
22853 priv_->mem_fns_map_.find(linkage_name);
22854 if (i == priv_->mem_fns_map_.end())
22856 return i->second.get();
22867 string_mem_fn_sptr_map_type::const_iterator i =
22868 priv_->mem_fns_map_.find(linkage_name);
22869 if (i == priv_->mem_fns_map_.end())
22895 string_mem_fn_ptr_map_type::const_iterator i =
22896 priv_->signature_2_mem_fn_map_.find(s);
22897 if (i == priv_->signature_2_mem_fn_map_.end())
22905 const member_function_templates&
22907 {
return priv_->member_function_templates_;}
22912 const member_class_templates&
22914 {
return priv_->member_class_templates_;}
22925 priv_->member_function_templates_.push_back(m);
22940 priv_->member_class_templates_.push_back(m);
22950 && priv_->data_members_.empty()
22951 && priv_->member_functions_.empty()
22952 && priv_->member_function_templates_.empty()
22953 && priv_->member_class_templates_.empty());
22972 else if (method_decl_sptr f = dynamic_pointer_cast<method_decl>(d))
22978 else if (member_function_template_sptr f =
22979 dynamic_pointer_cast<member_function_template>(d))
22981 else if (member_class_template_sptr c =
22982 dynamic_pointer_cast<member_class_template>(d))
22998 const class_or_union* op =
dynamic_cast<const class_or_union*
>(&other);
23004 const class_or_union *l = 0;
23011 const class_or_union *r = 0;
23031 return *
this == *o;
23072 if (l_is_decl_only || r_is_decl_only)
23074 const class_or_union* def1 = l_is_decl_only
23078 const class_or_union* def2 = r_is_decl_only
23082 if (!def1 || !def2)
23086 && l_is_decl_only && r_is_decl_only
23127 if (!!def1 != !!def2)
23135 if (!(l.decl_base::operator==(r)
23136 && l.type_base::operator==(r)))
23147 bool val = *def1 == *def2;
23156 if (!(l.decl_base::operator==(r) && l.type_base::operator==(r)))
23163 if (types_defined_same_linux_kernel_corpus_public(l, r))
23171 #define RETURN(value) \
23172 return return_comparison_result(l, r, value, \
23179 bool result =
true;
23193 for (class_or_union::data_members::const_iterator
23207 || (*d0)->get_type() == (*d1)->get_type())
23234 for (member_function_templates::const_iterator
23239 ++fn_tmpl_it0, ++fn_tmpl_it1)
23240 if (**fn_tmpl_it0 != **fn_tmpl_it1)
23265 for (member_class_templates::const_iterator
23270 ++cl_tmpl_it0, ++cl_tmpl_it1)
23271 if (**cl_tmpl_it0 != **cl_tmpl_it1)
23299 const method_decl_sptr& method)
23321 old_type->get_parameters(),
23322 old_type->get_is_const(),
23323 old_type->get_size_in_bits(),
23324 old_type->get_alignment_in_bits()));
23325 t->get_translation_unit()->bind_function_type_life_time(new_type);
23330 method->is_declared_inline(),
23334 method->get_binding()));
23335 new_method->set_symbol(method->
get_symbol());
23338 class_type->add_member_function(new_method,
23347 t->add_member_function(new_method,
23460 maybe_propagate_canonical_type(
const type_base& lhs_type,
23464 #if WITH_DEBUG_TYPE_CANONICALIZATION
23465 if (!env.priv_->use_canonical_type_comparison_)
23472 if (env.priv_->propagate_ct(lhs_type, rhs_type))
23483 struct class_decl::priv
23486 unordered_map<string, base_spec_sptr> bases_map_;
23492 : is_struct_(false)
23497 is_struct_(is_struct)
23502 : is_struct_(is_struct)
23533 size_t size_in_bits,
size_t align_in_bits,
23534 bool is_struct,
const location& locus,
23541 | ABSTRACT_TYPE_BASE
23542 | ABSTRACT_DECL_BASE
23543 | ABSTRACT_SCOPE_TYPE_DECL
23544 | ABSTRACT_SCOPE_DECL),
23545 decl_base(env, name, locus, name, vis),
23546 type_base(env, size_in_bits, align_in_bits),
23547 class_or_union(env, name, size_in_bits, align_in_bits,
23548 locus, vis, mbr_types, data_mbrs, mbr_fns),
23549 priv_(new priv(is_struct, bases))
23584 size_t size_in_bits,
size_t align_in_bits,
23585 bool is_struct,
const location& locus,
23591 | ABSTRACT_TYPE_BASE
23592 | ABSTRACT_DECL_BASE
23593 | ABSTRACT_SCOPE_TYPE_DECL
23594 | ABSTRACT_SCOPE_DECL),
23603 is_anonymous ? string() : name,
23605 type_base(env, size_in_bits, align_in_bits),
23606 class_or_union(env, name, size_in_bits, align_in_bits,
23607 locus, vis, mbr_types, data_mbrs, mbr_fns),
23608 priv_(new priv(is_struct, bases))
23630 size_t size_in_bits,
size_t align_in_bits,
23631 bool is_struct,
const location& locus,
23635 | ABSTRACT_TYPE_BASE
23636 | ABSTRACT_DECL_BASE
23637 | ABSTRACT_SCOPE_TYPE_DECL
23638 | ABSTRACT_SCOPE_DECL),
23639 decl_base(env, name, locus, name, vis),
23640 type_base(env, size_in_bits, align_in_bits),
23641 class_or_union(env, name, size_in_bits, align_in_bits,
23643 priv_(new priv(is_struct))
23667 size_t size_in_bits,
size_t align_in_bits,
23668 bool is_struct,
const location& locus,
23672 | ABSTRACT_TYPE_BASE
23673 | ABSTRACT_DECL_BASE
23674 | ABSTRACT_SCOPE_TYPE_DECL
23675 | ABSTRACT_SCOPE_DECL),
23684 is_anonymous ? string() : name,
23686 type_base(env, size_in_bits, align_in_bits),
23687 class_or_union(env, name, size_in_bits, align_in_bits,
23689 priv_(new priv(is_struct))
23705 bool is_struct,
bool is_declaration_only)
23708 | ABSTRACT_TYPE_BASE
23709 | ABSTRACT_DECL_BASE
23710 | ABSTRACT_SCOPE_TYPE_DECL
23711 | ABSTRACT_SCOPE_DECL),
23714 class_or_union(env, name, is_declaration_only),
23715 priv_(new priv(is_struct))
23730 for (class_decl::virtual_mem_fn_map_type::iterator i =
23731 priv_->virtual_mem_fns_map_.begin();
23732 i != priv_->virtual_mem_fns_map_.end();
23734 sort_virtual_member_functions(i->second);
23742 {priv_->is_struct_ = f;}
23749 {
return priv_->is_struct_;}
23757 priv_->bases_.push_back(b);
23758 priv_->bases_map_[b->get_base_class()->get_qualified_name()] = b;
23766 {
return priv_->bases_;}
23777 unordered_map<string, base_spec_sptr>::iterator i =
23778 priv_->bases_map_.find(qualified_name);
23780 if (i != priv_->bases_map_.end())
23781 return i->second->get_base_class();
23792 {
return priv_->virtual_mem_fns_;}
23811 {
return priv_->virtual_mem_fns_map_;}
23816 {sort_virtual_member_functions(priv_->virtual_mem_fns_);}
23837 bool qualified_name)
const
23839 string cl =
"class ";
23848 if (
internal && !
get_name().empty())
23856 string result = cl;
23857 if (qualified_name)
23866 class_decl::insert_member_decl(decl_base_sptr d)
23868 if (method_decl_sptr f = dynamic_pointer_cast<method_decl>(d))
23883 struct class_decl::base_spec::priv
23886 long offset_in_bits_;
23890 long offset_in_bits,
23893 offset_in_bits_(offset_in_bits),
23894 is_virtual_(is_virtual)
23912 long offset_in_bits,
23915 ABSTRACT_DECL_BASE),
23917 base->get_linkage_name(), base->get_visibility()),
23919 priv_(new priv(base, offset_in_bits, is_virtual))
23931 {
return priv_->base_class_.lock();}
23938 {
return priv_->is_virtual_;}
23945 {
return priv_->offset_in_bits_;}
23975 if (v.visit_begin(
this))
23978 get_base_class()->traverse(v);
23982 return v.visit_end(
this);
24002 class_decl::base_spec::base_spec(
const type_base_sptr& base,
24004 long offset_in_bits,
24007 ABSTRACT_DECL_BASE),
24013 priv_(new priv(dynamic_pointer_cast<
class_decl>(base),
24020 class_decl::base_spec::~base_spec() =
default;
24046 if (!l.member_base::operator==(r))
24072 return equals(*
this, *o, 0);
24090 return operator==(static_cast<const decl_base&>(*o));
24093 mem_fn_context_rel::~mem_fn_context_rel()
24113 method_decl::method_decl(
const string& name,
24115 bool declared_inline,
24117 const string& linkage_name,
24122 | ABSTRACT_DECL_BASE
24126 declared_inline, locus, linkage_name, vis, bind)
24150 method_decl::method_decl(
const string& name,
24151 function_type_sptr type,
24152 bool declared_inline,
24154 const string& linkage_name,
24159 | ABSTRACT_DECL_BASE
24161 decl_base(type->get_environment(), name, locus, linkage_name, vis),
24164 declared_inline, locus, linkage_name, vis, bind)
24187 method_decl::method_decl(
const string& name,
24188 type_base_sptr type,
24189 bool declared_inline,
24191 const string& linkage_name,
24196 | ABSTRACT_DECL_BASE
24198 decl_base(type->get_environment(), name, locus, linkage_name, vis),
24201 declared_inline, locus, linkage_name, vis, bind)
24220 class_or_union_sptr cl = t->get_class_type();
24222 cl->priv_->mem_fns_map_[l] = m;
24223 if (!old_lname.empty() && l != old_lname)
24225 if (method_decl_sptr m = cl->find_member_function_sptr(old_lname))
24228 cl->priv_->mem_fns_map_.erase(old_lname);
24234 method_decl::~method_decl()
24271 if (l.get() == r.get())
24328 struct virtual_member_function_less_than
24352 if (f_offset != s_offset)
return f_offset < s_offset;
24360 if ((!f_sym) != (!s_sym))
return !f_sym;
24361 if (f_sym && s_sym)
24363 fn = f_sym->get_id_string();
24364 sn = s_sym->get_id_string();
24365 if (fn != sn)
return fn < sn;
24371 if (fn != sn)
return fn < sn;
24377 if (fn != sn)
return fn < sn;
24381 string fn_filepath, sn_filepath;
24382 unsigned line = 0, column = 0;
24385 fn_loc.
expand(fn_filepath, line, column);
24387 sn_loc.expand(sn_filepath, line, column);
24388 return fn_filepath < sn_filepath;
24403 operator()(
const method_decl_sptr f,
24404 const method_decl_sptr s)
24405 {
return operator()(*f, *s);}
24414 virtual_member_function_less_than lt;
24415 std::stable_sort(mem_fns.begin(), mem_fns.end(), lt);
24444 size_t vtable_offset,
24445 bool is_static,
bool is_ctor,
24446 bool is_dtor,
bool is_const)
24449 is_dtor, is_const);
24457 sort_virtual_member_functions(klass->priv_->virtual_mem_fns_);
24476 class_decl::member_functions::const_iterator m;
24477 for (m = klass->priv_->virtual_mem_fns_.begin();
24478 m != klass->priv_->virtual_mem_fns_.end();
24480 if (m->get() == method.get())
24482 if (m == klass->priv_->virtual_mem_fns_.end())
24483 klass->priv_->virtual_mem_fns_.push_back(method);
24491 class_decl::virtual_mem_fn_map_type::iterator i =
24492 klass->priv_->virtual_mem_fns_map_.find(voffset);
24493 if (i == klass->priv_->virtual_mem_fns_map_.end())
24496 virtual_mem_fns_at_voffset.push_back(method);
24497 klass->priv_->virtual_mem_fns_map_[voffset] = virtual_mem_fns_at_voffset;
24501 for (m = i->second.begin() ; m != i->second.end(); ++m)
24502 if (m->get() == method.get())
24504 if (m == i->second.end())
24505 i->second.push_back(method);
24534 if ((*b)->get_is_virtual()
24535 || (*b)->get_base_class()->has_virtual_bases())
24564 ssize_t offset = -1;
24565 for (class_decl::virtual_mem_fn_map_type::const_iterator e =
24569 if (e->first > offset)
24582 return hash_class(
this);
24595 methods_equal_modulo_elf_symbol(
const method_decl_sptr& f,
24596 const method_decl_sptr& s)
24598 method_decl_sptr first = f, second = s;
24600 first->get_symbol();
24602 second->get_symbol();
24603 interned_string saved_first_linkage_name =
24604 first->get_linkage_name();
24605 interned_string saved_second_linkage_name =
24606 second->get_linkage_name();
24609 first->set_linkage_name(
"");
24611 second->set_linkage_name(
"");
24613 bool equal = *first == *second;
24615 first->set_symbol(saved_first_elf_symbol);
24616 first->set_linkage_name(saved_first_linkage_name);
24617 second->set_symbol(saved_second_elf_symbol);
24618 second->set_linkage_name(saved_second_linkage_name);
24639 method_matches_at_least_one_in_vector(
const method_decl_sptr& method,
24642 for (class_decl::member_functions::const_iterator i = fns.begin();
24651 if (methods_equal_modulo_elf_symbol(method, *i))
24667 maybe_cancel_propagated_canonical_type(
const class_or_union& t)
24669 const environment& env = t.get_environment();
24670 if (env.do_on_the_fly_canonicalization())
24671 if (
is_type(&t)->priv_->canonical_type_propagated())
24673 is_type(&t)->priv_->clear_propagated_canonical_type();
24674 env.priv_->remove_from_types_with_non_confirmed_propagated_ct(&t);
24707 bool result =
false;
24708 if (l.
get_environment().priv_->is_type_comparison_cached(l, r, result))
24716 static_cast<const class_or_union&>(r),
24720 bool result =
true;
24721 if (!
equals(static_cast<const class_or_union&>(l),
24722 static_cast<const class_or_union&>(r),
24734 if (!had_canonical_type)
24735 maybe_cancel_propagated_canonical_type(r);
24741 #define RETURN(value) CACHE_AND_RETURN_COMPARISON_RESULT(value)
24753 for (class_decl::base_specs::const_iterator
24765 (*b1)->get_base_class().get()))
24811 for (class_decl::virtual_mem_fn_map_type::const_iterator first_v_fn_entry =
24814 ++first_v_fn_entry)
24816 unsigned voffset = first_v_fn_entry->first;
24818 first_v_fn_entry->second;
24820 const class_decl::virtual_mem_fn_map_type::const_iterator
24832 second_v_fn_entry->second;
24834 bool matches =
false;
24835 for (class_decl::member_functions::const_iterator i =
24836 first_vfns.begin();
24837 i != first_vfns.end();
24839 if (method_matches_at_least_one_in_vector(*i, second_vfns))
24929 return *
this == *o;
24973 if (l.get() == r.get())
25005 operator==(
const class_or_union_sptr& l,
const class_or_union_sptr& r)
25007 if (l.get() == r.get())
25024 operator!=(
const class_or_union_sptr& l,
const class_or_union_sptr& r)
25044 if (v.visit_begin(
this))
25053 if (!(*i)->traverse(v))
25064 if (!(*i)->traverse(v))
25074 if (!(*i)->traverse(v))
25084 if (!(*i)->traverse(v))
25091 for (member_function_templates::const_iterator i =
25095 if (!(*i)->traverse(v))
25102 for (member_class_templates::const_iterator i =
25106 if (!(*i)->traverse(v))
25114 bool result = v.visit_end(
this);
25123 context_rel::~context_rel()
25127 member_base::operator==(
const member_base& o)
const
25147 if (l.get() == r.get())
25152 return *l ==
static_cast<const decl_base&
>(*r);
25194 member_function_template::operator==(
const member_base& other)
const
25201 if (!(is_constructor() == o.is_constructor()
25202 && is_const() == o.is_const()
25203 && member_base::operator==(o)))
25210 return ftdecl->function_tdecl::operator==(*other_ftdecl);
25229 const member_function_template_sptr& r)
25231 if (l.get() == r.get())
25250 const member_function_template_sptr& r)
25267 if (v.visit_begin(
this))
25274 return v.visit_end(
this);
25290 if (!member_base::operator==(o))
25293 return as_class_tdecl()->class_tdecl::operator==(o);
25307 if (!decl_base::operator==(other))
25309 return as_class_tdecl()->class_tdecl::operator==(other);
25323 return *
this == *o;
25336 const member_class_template_sptr& r)
25338 if (l.get() == r.get())
25356 const member_class_template_sptr& r)
25373 if (v.visit_begin(
this))
25380 return v.visit_end(
this);
25400 case private_access:
25403 case protected_access:
25406 case public_access:
25430 c->set_is_static(s);
25440 for (class_decl::data_members::iterator i =
25441 cl->priv_->non_static_data_members_.begin();
25442 i != cl->priv_->non_static_data_members_.end();
25445 if ((*i)->get_name() == v->get_name())
25447 cl->priv_->non_static_data_members_.erase(i);
25453 bool is_already_in_non_static_data_members =
false;
25454 for (class_or_union::data_members::iterator i =
25455 cl->priv_->non_static_data_members_.begin();
25456 i != cl->priv_->non_static_data_members_.end();
25459 if ((*i)->get_name() == v->get_name())
25461 is_already_in_non_static_data_members =
true;
25465 if (!is_already_in_non_static_data_members)
25469 for (class_or_union::data_members::const_iterator i =
25470 cl->priv_->data_members_.begin();
25471 i != cl->priv_->data_members_.end();
25474 if ((*i)->get_name() == v->get_name())
25481 cl->priv_->non_static_data_members_.push_back(var);
25522 size_t size_in_bits,
const location& locus,
25527 | ABSTRACT_TYPE_BASE
25528 | ABSTRACT_DECL_BASE),
25529 decl_base(env, name, locus, name, vis),
25531 class_or_union(env, name, size_in_bits, 0,
25532 locus, vis, mbr_types, data_mbrs, member_fns)
25558 size_t size_in_bits,
const location& locus,
25564 | ABSTRACT_TYPE_BASE
25565 | ABSTRACT_DECL_BASE),
25574 is_anonymous ? string() : name,
25577 class_or_union(env, name, size_in_bits, 0,
25578 locus, vis, mbr_types, data_mbrs, member_fns)
25596 size_t size_in_bits,
const location& locus,
25600 | ABSTRACT_TYPE_BASE
25601 | ABSTRACT_DECL_BASE
25602 | ABSTRACT_SCOPE_TYPE_DECL
25603 | ABSTRACT_SCOPE_DECL),
25604 decl_base(env, name, locus, name, vis),
25606 class_or_union(env, name, size_in_bits,
25627 size_t size_in_bits,
const location& locus,
25631 | ABSTRACT_TYPE_BASE
25632 | ABSTRACT_DECL_BASE
25633 | ABSTRACT_SCOPE_TYPE_DECL
25634 | ABSTRACT_SCOPE_DECL),
25643 is_anonymous ? string() : name,
25646 class_or_union(env, name, size_in_bits,
25662 const string& name,
25663 bool is_declaration_only)
25666 | ABSTRACT_TYPE_BASE
25667 | ABSTRACT_DECL_BASE
25668 | ABSTRACT_SCOPE_TYPE_DECL
25669 | ABSTRACT_SCOPE_DECL),
25672 class_or_union(env, name, is_declaration_only)
25696 bool qualified_name)
const
25701 if (
internal && !
get_name().empty())
25702 repr = string(
"union ") +
25712 if (qualified_name)
25749 return *
this == *o;
25763 return *
this == *o;
25796 if (v.visit_begin(
this))
25805 if (!(*i)->traverse(v))
25815 if (!(*i)->traverse(v))
25825 if (!(*i)->traverse(v))
25832 for (member_function_templates::const_iterator i =
25836 if (!(*i)->traverse(v))
25843 for (member_class_templates::const_iterator i =
25847 if (!(*i)->traverse(v))
25855 bool result = v.visit_end(
this);
25894 bool result =
false;
25895 if (l.
get_environment().priv_->is_type_comparison_cached(l, r, result))
25899 bool result =
equals(static_cast<const class_or_union&>(l),
25900 static_cast<const class_or_union&>(r),
25916 const method_decl_sptr& f)
25931 const class_or_union_sptr t = union_type;
25946 if (l.get() == r.get())
25970 class template_decl::priv
25974 std::list<template_parameter_sptr> parms_;
25987 {priv_->parms_.push_back(p);}
25993 const std::list<template_parameter_sptr>&
25995 {
return priv_->parms_;}
26008 const string& name,
26033 return *
this == *other;
26046 list<shared_ptr<template_parameter> >::const_iterator t0, t1;
26072 class template_parameter::priv
26078 mutable bool hashing_started_;
26079 mutable bool comparison_started_;
26087 template_decl_(enclosing_template_decl),
26088 hashing_started_(),
26089 comparison_started_()
26093 template_parameter::template_parameter(
unsigned index,
26095 : priv_(new priv(index, enclosing_template))
26099 template_parameter::get_index()
const
26100 {
return priv_->index_;}
26103 template_parameter::get_enclosing_template_decl()
const
26104 {
return priv_->template_decl_.lock();}
26107 template_parameter::get_hashing_has_started()
const
26108 {
return priv_->hashing_started_;}
26111 template_parameter::set_hashing_has_started(
bool f)
const
26112 {priv_->hashing_started_ = f;}
26117 if (get_index() != o.get_index())
26120 if (priv_->comparison_started_)
26123 bool result =
false;
26128 priv_->comparison_started_ =
true;
26130 if (!!get_enclosing_template_decl() != !!o.get_enclosing_template_decl())
26132 else if (get_enclosing_template_decl()
26133 && (*get_enclosing_template_decl()
26134 != *o.get_enclosing_template_decl()))
26139 priv_->comparison_started_ =
false;
26159 class type_tparameter::priv
26174 type_tparameter::type_tparameter(
unsigned index,
26176 const string& name,
26180 | ABSTRACT_TYPE_BASE
26182 decl_base(enclosing_tdecl->get_environment(), name, locus),
26183 type_base(enclosing_tdecl->get_environment(), 0, 0),
26184 type_decl(enclosing_tdecl->get_environment(), name, 0, 0, locus),
26199 if (!type_decl::operator==(other))
26219 if (!type_decl::operator==(other))
26239 if (!decl_base::operator==(other))
26275 {
return *
this ==
static_cast<const type_base&
>(other);}
26277 type_tparameter::~type_tparameter()
26281 class non_type_tparameter::priv
26291 priv(type_base_sptr type)
26309 non_type_tparameter::non_type_tparameter(
unsigned index,
26311 const string& name,
26312 type_base_sptr type,
26315 decl_base(type->get_environment(), name, locus,
""),
26317 priv_(new priv(type))
26325 const type_base_sptr
26327 {
return priv_->type_.lock();}
26336 return hash_tparm(
this);
26342 if (!decl_base::operator==(other))
26349 return (template_parameter::operator==(o)
26368 non_type_tparameter::~non_type_tparameter()
26374 class template_tparameter::priv
26388 template_tparameter::template_tparameter(
unsigned index,
26390 const string& name,
26394 | ABSTRACT_TYPE_BASE
26396 decl_base(enclosing_tdecl->get_environment(), name, locus),
26397 type_base(enclosing_tdecl->get_environment(), 0, 0),
26398 type_decl(enclosing_tdecl->get_environment(), name,
26399 0, 0, locus, name, VISIBILITY_DEFAULT),
26401 template_decl(enclosing_tdecl->get_environment(), name, locus),
26419 return (type_tparameter::operator==(o)
26438 return (type_tparameter::operator==(o)
26452 return *
this ==
static_cast<const type_base&
>(other);
26471 template_tparameter::~template_tparameter()
26479 class type_composition::priv
26503 type_composition::type_composition(
unsigned index,
26507 ABSTRACT_DECL_BASE),
26518 const type_base_sptr
26520 {
return priv_->type_.lock();}
26527 {priv_->type_ = t;}
26536 return hash_type_composition(
this);
26539 type_composition::~type_composition()
26548 class function_tdecl::priv
26560 : pattern_(pattern), binding_(bind)
26587 | ABSTRACT_SCOPE_DECL),
26591 priv_(new priv(bind))
26615 | ABSTRACT_SCOPE_DECL),
26620 priv_(new priv(pattern, bind))
26631 priv_->pattern_ = p;
26641 {
return priv_->pattern_;}
26648 {
return priv_->binding_;}
26660 return *
this == *o;
26674 return *
this == *o;
26712 if (!v.visit_begin(
this))
26719 return v.visit_end(
this);
26722 function_tdecl::~function_tdecl()
26730 class class_tdecl::priv
26741 : pattern_(pattern)
26760 | ABSTRACT_SCOPE_DECL),
26785 | ABSTRACT_SCOPE_DECL),
26790 priv_(new priv(pattern))
26801 priv_->pattern_ = p;
26811 {
return priv_->pattern_;}
26820 if (!(template_decl::operator==(o)
26821 && scope_decl::operator==(o)
26840 return *
this ==
static_cast<const decl_base&
>(o);
26848 {
return *
this ==
static_cast<const decl_base&
>(o);}
26864 if (v.visit_begin(
this))
26868 pattern->traverse(v);
26871 return v.visit_end(
this);
26874 class_tdecl::~class_tdecl()
26885 non_canonicalized_subtype_detector();
26888 non_canonicalized_subtype_detector(
type_base* type)
26890 has_non_canonical_type_()
26899 has_non_canonical_type()
const
26900 {
return has_non_canonical_type_;}
26905 visit_begin(function_decl* f)
26923 visit_begin(type_base* t)
26927 if (!t->get_canonical_type())
26931 has_non_canonical_type_ = t;
26946 visit_end(type_base* )
26948 if (has_non_canonical_type_)
26965 non_canonicalized_subtype_detector v(t.get());
26967 return v.has_non_canonical_type();
26983 const type_base_sptr t_v2)
26990 return (t1 != t2 && repr1 == repr2);
27001 env.priv_->extra_live_types_.push_back(t);
27037 string repr = v->get_pretty_representation(
true);
27038 std::hash<string> hash_string;
27039 h = hashing::combine_hashes(h, hash_string(repr));
27046 string repr = f->get_pretty_representation(
true);
27047 std::hash<string> hash_string;
27048 h = hashing::combine_hashes(h, hash_string(repr));
27053 type_base_sptr parm_type = p->get_type();
27055 std::hash<bool> hash_bool;
27056 std::hash<unsigned> hash_unsigned;
27058 h = hashing::combine_hashes(h, hash_unsigned(p->get_index()));
27059 h = hashing::combine_hashes(h, hash_bool(p->get_variadic_marker()));
27065 std::hash<size_t> hash_size;
27066 std::hash<bool> hash_bool;
27067 type_base_sptr type = bs->get_base_class();
27069 h = hashing::combine_hashes(h, hash_member(*bs));
27070 h = hashing::combine_hashes(h, hash_size(bs->get_offset_in_bits()));
27071 h = hashing::combine_hashes(h, hash_bool(bs->get_is_virtual()));
27078 result = d->get_hash();
27103 {
return hash_as_canonical_type_or_constant(t);}
27211 exemplar =
const_cast<type_base*
>(type);
27240 hash_as_canonical_type_or_constant(
const type_base *t)
27247 if (!canonical_type)
27265 if (canonical_type)
27266 return reinterpret_cast<size_t>(canonical_type);
27341 const type_base_sptr& second,
27342 bool indirect_type)
27374 bool indirect_type)
27376 if (!!first != !!second)
27388 if (
typeid(*first) !=
typeid(*second))
27404 if (ty1->is_lvalue() != ty2->is_lvalue())
27407 ty2->get_pointed_to_type(),
27414 if (!indirect_type)
27418 return ty1->get_name() == ty2->
get_name();
27424 if (!indirect_type)
27428 return (
get_name(ty1->get_underlying_type())
27436 && ty1->get_name() != ty2->
get_name())
27439 if (!indirect_type)
27442 || (ty1->get_non_static_data_members().size()
27446 for (class_or_union::data_members::const_iterator
27447 i = ty1->get_non_static_data_members().begin(),
27449 (i != ty1->get_non_static_data_members().end()
27456 dm2->get_type().get(),
27469 && ty1->get_name() != ty2->
get_name())
27472 if (!indirect_type)
27482 if (!indirect_type)
27485 || ty1->get_dimension_count() != ty2->get_dimension_count())
27519 if (ty1->get_parameters().size() != ty2->
get_parameters().size())
27522 for (function_type::parameters::const_iterator
27523 i = ty1->get_parameters().begin(),
27525 (i != ty1->get_parameters().end()
27555 const char* dm_name)
27583 return cou->find_data_member(dm);
27598 unsigned parm_index)
27605 if (parms.size() <= parm_index)
27608 return parms[parm_index].get();
27623 std::ostringstream o;
27626 o <<
"unnamed-enum";
27630 o <<
"-underlying-type-" << size;
27650 return data_member;
27670 for (; d != e; ++d)
27686 struct ir_node_visitor::priv
27692 : allow_visiting_already_visited_type_node(true)
27701 ir_node_visitor::~ir_node_visitor() =
default;
27710 {priv_->allow_visiting_already_visited_type_node = f;}
27719 {
return priv_->allow_visiting_already_visited_type_node;}
27739 size_t canonical_ptr_value =
reinterpret_cast<size_t>(canonical_type);
27740 priv_->visited_ir_nodes.insert(canonical_ptr_value);
27753 {priv_->visited_ir_nodes.clear();}
27773 size_t ptr_value =
reinterpret_cast<size_t>(canonical_type);
27774 pointer_set::iterator it = priv_->visited_ir_nodes.find(ptr_value);
27775 if (it == priv_->visited_ir_nodes.end())
27782 ir_node_visitor::visit_begin(
decl_base*)
27790 ir_node_visitor::visit_begin(scope_decl*)
27794 ir_node_visitor::visit_end(scope_decl*)
27798 ir_node_visitor::visit_begin(type_base*)
27802 ir_node_visitor::visit_end(type_base*)
27806 ir_node_visitor::visit_begin(scope_type_decl* t)
27807 {
return visit_begin(static_cast<type_base*>(t));}
27810 ir_node_visitor::visit_end(scope_type_decl* t)
27811 {
return visit_end(static_cast<type_base*>(t));}
27814 ir_node_visitor::visit_begin(type_decl* t)
27815 {
return visit_begin(static_cast<type_base*>(t));}
27818 ir_node_visitor::visit_end(type_decl* t)
27819 {
return visit_end(static_cast<type_base*>(t));}
27822 ir_node_visitor::visit_begin(namespace_decl* d)
27823 {
return visit_begin(static_cast<decl_base*>(d));}
27826 ir_node_visitor::visit_end(namespace_decl* d)
27827 {
return visit_end(static_cast<decl_base*>(d));}
27830 ir_node_visitor::visit_begin(qualified_type_def* t)
27831 {
return visit_begin(static_cast<type_base*>(t));}
27834 ir_node_visitor::visit_end(qualified_type_def* t)
27835 {
return visit_end(static_cast<type_base*>(t));}
27838 ir_node_visitor::visit_begin(pointer_type_def* t)
27839 {
return visit_begin(static_cast<type_base*>(t));}
27842 ir_node_visitor::visit_end(pointer_type_def* t)
27843 {
return visit_end(static_cast<type_base*>(t));}
27846 ir_node_visitor::visit_begin(reference_type_def* t)
27847 {
return visit_begin(static_cast<type_base*>(t));}
27850 ir_node_visitor::visit_end(reference_type_def* t)
27851 {
return visit_end(static_cast<type_base*>(t));}
27854 ir_node_visitor::visit_begin(array_type_def* t)
27855 {
return visit_begin(static_cast<type_base*>(t));}
27858 ir_node_visitor::visit_end(array_type_def* t)
27859 {
return visit_end(static_cast<type_base*>(t));}
27862 ir_node_visitor::visit_begin(array_type_def::subrange_type* t)
27863 {
return visit_begin(static_cast<type_base*>(t));}
27866 ir_node_visitor::visit_end(array_type_def::subrange_type* t)
27867 {
return visit_end(static_cast<type_base*>(t));}
27870 ir_node_visitor::visit_begin(enum_type_decl* t)
27871 {
return visit_begin(static_cast<type_base*>(t));}
27874 ir_node_visitor::visit_end(enum_type_decl* t)
27875 {
return visit_end(static_cast<type_base*>(t));}
27878 ir_node_visitor::visit_begin(typedef_decl* t)
27879 {
return visit_begin(static_cast<type_base*>(t));}
27882 ir_node_visitor::visit_end(typedef_decl* t)
27883 {
return visit_end(static_cast<type_base*>(t));}
27886 ir_node_visitor::visit_begin(function_type* t)
27887 {
return visit_begin(static_cast<type_base*>(t));}
27890 ir_node_visitor::visit_end(function_type* t)
27891 {
return visit_end(static_cast<type_base*>(t));}
27894 ir_node_visitor::visit_begin(var_decl* d)
27895 {
return visit_begin(static_cast<decl_base*>(d));}
27898 ir_node_visitor::visit_end(var_decl* d)
27899 {
return visit_end(static_cast<decl_base*>(d));}
27902 ir_node_visitor::visit_begin(function_decl* d)
27903 {
return visit_begin(static_cast<decl_base*>(d));}
27906 ir_node_visitor::visit_end(function_decl* d)
27907 {
return visit_end(static_cast<decl_base*>(d));}
27910 ir_node_visitor::visit_begin(function_decl::parameter* d)
27911 {
return visit_begin(static_cast<decl_base*>(d));}
27914 ir_node_visitor::visit_end(function_decl::parameter* d)
27915 {
return visit_end(static_cast<decl_base*>(d));}
27918 ir_node_visitor::visit_begin(function_tdecl* d)
27919 {
return visit_begin(static_cast<decl_base*>(d));}
27922 ir_node_visitor::visit_end(function_tdecl* d)
27923 {
return visit_end(static_cast<decl_base*>(d));}
27926 ir_node_visitor::visit_begin(class_tdecl* d)
27927 {
return visit_begin(static_cast<decl_base*>(d));}
27930 ir_node_visitor::visit_end(class_tdecl* d)
27931 {
return visit_end(static_cast<decl_base*>(d));}
27934 ir_node_visitor::visit_begin(class_or_union* t)
27935 {
return visit_begin(static_cast<type_base*>(t));}
27938 ir_node_visitor::visit_end(class_or_union* t)
27939 {
return visit_end(static_cast<type_base*>(t));}
27942 ir_node_visitor::visit_begin(class_decl* t)
27943 {
return visit_begin(static_cast<type_base*>(t));}
27946 ir_node_visitor::visit_end(class_decl* t)
27947 {
return visit_end(static_cast<type_base*>(t));}
27950 ir_node_visitor::visit_begin(union_decl* t)
27951 {
return visit_begin(static_cast<type_base*>(t));}
27954 ir_node_visitor::visit_end(union_decl* t)
27955 {
return visit_end(static_cast<type_base*>(t));}
27958 ir_node_visitor::visit_begin(class_decl::base_spec* d)
27959 {
return visit_begin(static_cast<decl_base*>(d));}
27962 ir_node_visitor::visit_end(class_decl::base_spec* d)
27963 {
return visit_end(static_cast<decl_base*>(d));}
27966 ir_node_visitor::visit_begin(member_function_template* d)
27967 {
return visit_begin(static_cast<decl_base*>(d));}
27970 ir_node_visitor::visit_end(member_function_template* d)
27971 {
return visit_end(static_cast<decl_base*>(d));}
27974 ir_node_visitor::visit_begin(member_class_template* d)
27975 {
return visit_begin(static_cast<decl_base*>(d));}
27978 ir_node_visitor::visit_end(member_class_template* d)
27979 {
return visit_end(static_cast<decl_base*>(d));}
27991 static __thread
size_t counter;
27993 std::ostringstream o;
28000 typedef unordered_map<
const function_decl*, string,
28001 function_decl::hash,
28020 static const string&
28021 fn_to_str(
const function_decl* fn,
28022 fns_to_str_map_type& m)
28024 fns_to_str_map_type::const_iterator i = m.find(fn);
28027 string s = get_next_string();
28048 fns_to_str(vector<function_decl*>::const_iterator begin,
28049 vector<function_decl*>::const_iterator end,
28050 fns_to_str_map_type& m,
28053 vector<function_decl*>::const_iterator i;
28054 for (i = begin; i != end; ++i)
28055 o <<
"'" << fn_to_str(*i, m) <<
"' ";
28081 fns_to_str(vector<function_decl*>::const_iterator a_begin,
28082 vector<function_decl*>::const_iterator a_end,
28083 vector<function_decl*>::const_iterator b_begin,
28084 vector<function_decl*>::const_iterator b_end,
28085 fns_to_str_map_type& m,
28088 fns_to_str(a_begin, a_end, m, o);
28090 fns_to_str(b_begin, b_end, m, o);
28114 fns_to_str(vector<function_decl*>::const_iterator a_begin,
28115 vector<function_decl*>::const_iterator a_end,
28116 vector<function_decl*>::const_iterator b_begin,
28117 vector<function_decl*>::const_iterator b_end,
28120 fns_to_str_map_type m;
28121 fns_to_str(a_begin, a_end, b_begin, b_end, m, o);
28143 std::string parent_qualified_name;
28152 if (!d->priv_->qualified_parent_name_.empty())
28158 d->priv_->qualified_name_ =
28159 env.
intern(d->priv_->qualified_parent_name_ +
"::" + d->
get_name());
28164 if (d->priv_->scoped_name_.empty())
28169 d->priv_->scoped_name_ =
28172 d->priv_->scoped_name_ =
28190 {
return do_update(d);}
28202 return do_update(d);
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.
elf_symbol_sptr get_next_common_instance() const
Get the next common instance of the current common symbol.
void remove_decl_from_scope(decl_base_sptr decl)
Remove a given decl from its scope.
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 member_base &o) const
Equality operator of the the member_class_template class.
const enumerators & get_sorted_enumerators() const
Get the lexicographically sorted vector of enumerators.
const string & get_name() const
Getter for the name of the current instance of enum_type_decl::enumerator.
void set_pattern(shared_ptr< function_decl > p)
Set a new pattern to the function template.
void set_is_declaration_only(bool f)
Set a flag saying if the enum_type_decl is a declaration-only enum_type_decl.
const vector< function_type_sptr > & get_live_fn_types() const
Get the vector of function types that are used in the current translation unit.
string to_string(bool internal=false) const
Return the string representation of the current instance of integral_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 ...
bool operator==(const std::string &l, const interned_string &r)
Equality operator.
virtual ~class_or_union()
Destrcutor of the class_or_union type.
The type of the private data of the function_type type.
string get_class_or_enum_flat_representation(const type_base &coe, const string &indent, bool one_line, bool internal, bool qualified_name)
Get the flat representation of an instance of enum_type_decl type.
const std::vector< parameter_sptr > & get_parameters() const
bool is_type(const type_or_decl_base &tod)
Test whether a declaration is a type.
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.
location_manager & get_loc_mgr()
Getter of the location manager for the current translation unit.
const canonical_type_sptr_set_type & get_canonical_types() const
the set of canonical types of the the current scope.
const member_class_templates & get_member_class_templates() const
Get the member class templates of this class.
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...
The abstraction of an array type.
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...
bool get_member_function_is_virtual(const function_decl &f)
Test if a given member function is virtual.
The abstraction of an enumerator.
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...
The base type of all declarations.
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.
friend bool get_member_is_static(const decl_base &d)
Gets a flag saying if a class member is static or not.
integral_type()
Default constructor of the integral_type.
scopes & get_member_scopes()
Getter for the scopes carried by the current scope.
enumerator & operator=(const enumerator &)
Assignment operator of the enum_type_decl::enumerator type.
virtual size_t get_num_anonymous_member_unions() const
Getter for the number of anonymous unions contained in this scope.
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.
virtual void on_canonical_type_set()
This method is invoked automatically right after the current instance of class_decl has been canonica...
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.
This header declares filters for the diff trees resulting from comparing ABI Corpora.
visibility get_visibility() const
Getter of the visibility of the current instance of elf_symbol.
const member_function_templates & get_member_function_templates() const
Get the member function templates of this class.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
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.
uint64_t get_unsigned_value()
Getter of the bound value as an unsigned value.
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 is_declaration_only_class_or_union_type(const type_base *t, bool look_through_decl_only)
Test wheter a type is a declaration-only class.
bool is_common_symbol() const
Return true if the symbol is a common one.
type_base_sptr peel_qualified_or_typedef_type(const type_base_sptr &t)
Return the leaf underlying type of a qualified or typedef type.
translation_unit::language get_language() const
Getter of the language that generated this type.
visibility
The visibility of the symbol.
const void * runtime_type_instance() const
Getter of the pointer to the runtime type sub-object of the current instance.
vector< type_base_wptr > type_base_wptrs_type
A convenience typedef for a vector of type_base_wptr.
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...
size_t operator()(const type_base_sptr &l) const
Hash a type by returning the pointer value of its canonical type.
void add_template_parameter(const template_parameter_sptr p)
Add a new template parameter to the current instance of template_decl.
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...
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...
This means that a given IR artifact has changes in some of its sub-types, with respect to the other a...
int64_t get_value() const
Getter for the value of enum_type_decl::enumerator.
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 has_no_base_nor_member() const
Return true iff the class has no entity in its scope.
parameters::const_iterator get_first_parm() const
Get the first parameter of the function.
friend void set_member_function_is_const(function_decl &, bool)
set the const-ness property of a member function.
bool has_no_member() const
virtual bool operator==(const type_base &) const
Equality operator.
const string & str() const
Getter for the version name.
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...
type_decl_sptr is_type_decl(const type_or_decl_base_sptr &t)
Test whether a type is a type_decl (a builtin type).
const type_decl * is_type_decl(const type_or_decl_base *t)
Test whether a type is a type_decl (a builtin type).
string get_enum_flat_representation(const enum_type_decl_sptr &enum_type, const string &indent, bool one_line, bool qualified_names)
Get the flat representation of an instance of enum_type_decl type.
bool canonicalization_is_done() const
Test if the canonicalization of types created out of the current environment is done.
string build_qualified_name(const scope_decl *scope, const string &name)
Build and return a qualified name from a name and its scope.
void set_qualified_name(const interned_string &) const
Setter for the qualified name.
bool is_variable() const
Test if the current instance of elf_symbol is a variable symbol or not.
The internal representation of an integral type.
bool is_constructed() const
Getter of the 'is_constructed" flag. It says if the translation unit is fully constructed or not...
Abstracts a member class template template.
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.
bool get_is_anonymous_or_has_anonymous_parent() const
bool is_c_language(translation_unit::language l)
Test if a language enumerator designates the C language.
virtual void set_alignment_in_bits(size_t)
Setter for the alignment of the type.
A type that introduces a scope.
typedef_decl_sptr get_naming_typedef() const
Getter for the naming typedef of the current decl.
virtual void set_linkage_name(const string &m)
Setter for the linkage name.
bool is_data_member(const var_decl &v)
Test if a var_decl is a data member.
void add_member_class_template(member_class_template_sptr m)
Append a member class template to the class_or_union.
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.
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.
bool is_class_type(const type_or_decl_base &t)
Test whether a type is a class.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representatin of the current declaration.
var_decl_sptr is_var_decl(const type_or_decl_base_sptr &decl)
Tests if a declaration is a variable declaration.
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...
decl_base_sptr is_decl_slow(const type_or_decl_base_sptr &t)
Test if an ABI artifact is a declaration.
interned_string get_id() const
Return an ID that tries to uniquely identify the function inside a program or a library.
shared_ptr< function_type > function_type_sptr
Convenience typedef for a shared pointer on a function_type.
const environment & get_environment() const
Getter of the environment used by the current instance of elf_symbol.
const interned_string & get_cached_name(bool internal=false) const
Get the name of the current function_type.
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...
bool is_member_function(const function_decl &f)
Test whether a function_decl is a member function.
virtual size_t get_alignment_in_bits() const
Getter of the alignment of the class_or_union type.
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
virtual ~function_decl()
Destructor of the function_decl type.
bool is_at_global_scope(const decl_base *decl)
Tests whether a given declaration is at global scope.
const vector< type_base_wptr > & get_types_sorted_by_name() const
Getter of all types types sorted by their pretty representation.
string get_pretty_representation(const method_type_sptr method, bool internal)
Get the pretty representation of a method type.
An abstraction helper for type declarations.
shared_ptr< method_type > method_type_sptr
Convenience typedef for shared pointer to method_type.
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.
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.
void add_member_type(type_base_sptr t)
Add a member type to the current instance of class_or_union.
void set_composed_type(type_base_sptr t)
Setter for the resulting composed type.
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.
type_maps & get_types()
Get the maps that associate a name to a certain kind of type.
The "long long" modifier.
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, get its pretty representation.
void set_cv_quals(CV cv_quals)
Setter of the const/value qualifiers bit field.
This is the abstraction of a set of translation units (themselves seen as bundles of unitary abi arte...
weak_ptr< function_type > function_type_wptr
Convenience typedef for a weak pointer on a function_type.
const function_type_sptr get_type() const
Return the type of the current instance of function_decl.
The base class of both types and declarations.
void set_path(const string &)
Set the path associated to the current instance of translation_unit.
virtual ~union_decl()
Destructor of the union_decl type.
const location & get_location() const
Get the location of a given declaration.
A declaration that introduces a scope.
const location & get_artificial_or_natural_location(const decl_base *decl)
Get the artificial location of a decl.
Definition of the private data of type_base.
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.
const environment & get_environment() const
Getter of the environment of the current translation_unit.
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.
Abstracts a reference type.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
bool is_declaration_only_class_or_union_type(const type_base_sptr &t, bool look_through_decl_only)
Test wheter a type is a declaration-only class.
virtual size_t get_hash() const
Return the hash value for the current instance.
void set_temporary_qualified_name(const interned_string &) const
Setter for the temporary qualified name of the current declaration.
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...
virtual size_t get_num_anonymous_member_enums() const
Get the number of anonymous member enums contained in this class.
~interned_string_pool()
Destructor.
void set_visibility(visibility v)
Setter for the visibility of the decl.
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.
The abstraction of a qualified type.
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 ...
A hashing functor for a function_decl::parameter.
access_specifier get_member_access_specifier(const decl_base &d)
Gets the access specifier for a class member.
const translation_units & get_translation_units() const
Return the list of translation units of the current corpus.
friend pointer_type_def * is_pointer_type(type_or_decl_base *)
Test whether a type is a pointer_type_def.
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.
bool get_is_artificial() const
Test if the location is artificial.
void set_member_function_is_virtual(function_decl &f, bool is_virtual)
Set the virtual-ness of a member function.
function_type_sptr is_function_type(const type_or_decl_base_sptr &t)
Test whether a type is a function_type.
Abstraction of a base specifier in a class declaration.
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...
interned_string create_string(const std::string &)
Create an interned string with a given value.
friend 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...
bool get_is_virtual() const
Getter of the "is-virtual" proprerty of the base class specifier.
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. ...
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
bool operator!=(const decl_base &o) const
Equality operator.
The base class of templates.
type_base_sptr peel_pointer_type(const type_base_sptr &type)
Return the leaf pointed-to type node of a pointer_type_def node.
This is the abstraction of the set of relevant artefacts (types, variable declarations, functions, templates, etc) bundled together into a translation unit.
void sort_types(const canonical_type_sptr_set_type &types, vector< type_base_sptr > &result)
Sort types in a hopefully stable manner.
virtual ~class_decl()
Destructor of the class_decl type.
bool has_string(const char *s) const
Test if the interned string pool already contains a string with a given value.
base_type
The possible base types of integral types. We might have forgotten many of these, so do not hesitate ...
virtual ~enum_type_decl()
Destructor for the enum type declaration.
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...
void set_translation_unit(translation_unit *)
Set the translation_unit this ABI artifact belongs to.
virtual bool traverse(ir_node_visitor &v)
Traverse a given IR node and its children, calling an visitor on each node.
enumerator()
Default constructor of the enum_type_decl::enumerator type.
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_...
shared_ptr< function_decl > get_pattern() const
Get the pattern of the function template.
method_decl * is_method_decl(const type_or_decl_base *d)
Test if a function_decl is actually a method_decl.
virtual ~environment()
Destructor for the environment type.
friend type_base * is_type(const type_or_decl_base *)
Test whether a declaration is a type.
ssize_t get_member_function_vtable_offset(const function_decl &f)
Get the vtable offset of a member function.
virtual ~method_type()
The destructor of method_type.
bool has_other_common_instances() const
Return true if this common common symbol has other common instances.
const type_base_sptr get_composed_type() const
Getter for the resulting composed type.
virtual bool operator==(const decl_base &) const
Equality operator of the reference_type_def type.
string as_string() const
Return a string representation of the sub range.
friend bool get_data_member_is_laid_out(const var_decl &m)
Test whether a data member is laid out.
A functor to hash instances of interned_string.
bool is_user_defined_type(const type_base *t)
Test if a type is user-defined.
const type_base_sptrs_type & get_member_types() const
Get the member types of this scope_decl.
bool type_node_has_been_visited(type_base *) const
Test if a given type node has been marked as visited.
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...
qualified_type_def_sptr is_qualified_type(const type_or_decl_base_sptr &t)
Test whether a type is a qualified_type_def.
parameters::const_iterator get_first_non_implicit_parm() const
Get the first parameter of the function.
const string get_type_pretty_representation() const
bool empty() const
Test if the current instance of interned_string is empty.
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.
Abstracts the type of a class member function.
shared_ptr< var_decl > var_decl_sptr
Convenience typedef for a shared pointer on a var_decl.
void set_member_function_is_const(function_decl &f, bool is_const)
set the const-ness property of a member function.
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.
const interned_string & get_qualified_parent_name() const
Return a copy of the qualified name of the parent of the current decl.
bool operator!=(const translation_unit_sptr &l, const translation_unit_sptr &r)
A deep inequality operator for pointers to translation units.
const type_base_sptr peel_qualified_type(const type_base_sptr &type)
Return the leaf underlying type of a qualified type.
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.
base_type get_base_type() const
Getter of the base type of the integral_type.
bool do_on_the_fly_canonicalization() const
Getter for the "on-the-fly-canonicalization" flag.
bool is_member_decl(const decl_base_sptr d)
Tests if a declaration is a class member.
var_decl_sptr has_flexible_array_data_member(const class_decl_sptr &klass)
Test if the last data member of a class is an array with non-finite data member.
namespace_decl * is_namespace(const decl_base *d)
Tests if a declaration is a namespace declaration.
int get_number_of_aliases() const
Get the number of aliases to this elf symbol.
void set_type(type t)
Setter for the type of the current instance of elf_symbol.
uint64_t get_absolute_data_member_offset(const var_decl &m)
Get the absolute offset of a data member.
string get_cv_quals_string_prefix() const
Compute and return the string prefix or suffix representing the qualifiers hold by the current instan...
type_decl * is_integral_type(const type_or_decl_base *t)
Test if a type is an integral type.
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
Abstraction of the declaration of a method.
const type_base_sptr get_type() const
Getter for the type of the template parameter.
const location & get_natural_or_artificial_location(const decl_base *decl)
Get the non-artificial (natural) location of a decl.
bool decl_only_class_equals_definition() const
Getter of the "decl-only-class-equals-definition" flag.
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.
std::vector< decl_base_sptr > declarations
Convenience typedef for a vector of decl_base_sptr.
void set_compilation_dir_path(const std::string &)
Set the path of the directory that was 'current' when the translation unit was compiled.
class_or_union * is_class_or_union_type(const type_or_decl_base *t)
Test if a type is a class_or_union.
decl_base * is_decl_slow(const type_or_decl_base *t)
Test if an ABI artifact is a declaration.
const declarations & get_member_decls() const
Getter for the member declarations carried by the current scope_decl.
shared_ptr< translation_unit > translation_unit_sptr
Convenience typedef for a shared pointer on a translation_unit type.
Abstracts a class declaration.
const interned_string & get_name() const
Getter for the name of the current decl.
const corpus * get_corpus() const
Get the corpus this translation unit is a member of.
shared_ptr< typedef_decl > typedef_decl_sptr
Convenience typedef for a shared pointer on a typedef_decl.
type_base_sptr get_underlying_type() const
Getter of the underlying type.
const string & get_name() const
Getter for the name of the elf_symbol.
change_kind
A bitfield that gives callers of abigail::ir::equals() some insight about how different two internal ...
virtual bool operator!=(const type_base &) const
Return true if both types equals.
The abstraction of the relationship between an entity and its containing scope (its context)...
unordered_set< uintptr_t > pointer_set
A convenience typedef for an unordered set of pointer values.
const member_functions & get_virtual_mem_fns() const
Get the virtual member functions of this class.
bool is_empty_or_has_empty_sub_namespaces() const
Test if the current namespace_decl is empty or contains empty namespaces itself.
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.
CV get_cv_quals() const
Getter of the const/volatile qualifier bit field.
size_t hash_type(const type_base *t)
Hash an ABI artifact that is either a type.
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 ...
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...
bool is_variadic() const
Test if the current instance of function_type is for a variadic function.
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...
bool is_suppressed() const
Getter for the 'is-suppressed' property.
var_decl_sptr clone() const
Create a new var_decl that is a clone of the current one.
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.
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...
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...
Abstraction of a member function context relationship. This relates a member function to its parent c...
const context_rel * get_context_rel() const
Getter for the context relationship.
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 type_base &) const
Return true if both types equals.
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.
canonical_types_map_type & get_canonical_types_map()
Getter the map of canonical types.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representation of the current instance of function_decl.
Declaration of types pertaining to the interned string pool used throughout Libabigail, for performance reasons.
function_decl_sptr is_function_decl(const type_or_decl_base_sptr &d)
Test whether a declaration is a function_decl.
void set_is_suppressed(bool is_suppressed)
Setter for the 'is-suppressed' property.
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.
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.
The "char32_t" base type.
bool hashing_started() const
Getter for the 'hashing_started' property.
bool operator!=(const enumerator &other) const
Inequality operator.
virtual bool operator==(const decl_base &) const
Equality operator between two scope_type_decl.
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.
std::ostream & operator<<(std::ostream &o, elf_symbol::type t)
Serialize an instance of symbol_type and stream it to a given output stream.
const std::string & get_absolute_path() const
Get the concatenation of the build directory and the relative path of the translation unit...
class_or_union_sptr get_class_type() const
Get the class type this method belongs to.
method_type * is_method_type(type_or_decl_base *t)
Test whether a type is a method_type.
function_decl::parameter * is_function_parameter(const type_or_decl_base *tod)
Test whether a declaration is a function_decl.
Abstracts a variable declaration.
virtual void remove_member_decl(decl_base_sptr)
Remove a given decl from the current class_or_union scope.
vector< type_base_sptr > member_types
Convenience typedef.
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.
virtual void set_size_in_bits(size_t)
Setter of the size of the class_or_union type.
void set_modifiers(modifiers_type)
Setter of the modifiers bitmap of the integral_type.
void set_index(size_t)
Setter for the index.
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 bool operator==(const decl_base &) const
Comparison operator for class_decl.
virtual size_t get_num_anonymous_member_unions() const
Get the number of anonymous member unions contained in this class.
Abstract a class template.
bool get_member_function_is_dtor(const function_decl &f)
Test whether a member function is a destructor.
Abstraction of a function parameter.
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.
virtual size_t get_hash() const
The virtual implementation of 'get_hash' for a function_decl.
virtual bool operator==(const decl_base &) const
Return true iff both namespaces and their members are equal.
friend uint64_t get_data_member_offset(const var_decl_sptr m)
Get the offset of a data member.
void set_name(const string &n)
Setter for the name of the decl.
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.
void remove_member_type(type_base_sptr t)
Remove a member type from the current class_or_union scope.
void set_class_type(const class_or_union_sptr &t)
Sets the class type of the current instance of method_type.
The private data of the environment type.
virtual size_t get_hash() const
Get the hash value of the current instance.
Abstract a member function template.
interned_string get_name_id() const
Get a name uniquely identifying the parameter in the function.
language get_language() const
Getter of the language of the source code of the translation unit.
binding get_binding() const
Getter of the binding of the variable.
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.
bool is_infinite() const
Test if the length of the subrange type is infinite.
access_specifier get_access_specifier() const
Getter for the access specifier of this member.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Build a pretty representation for an array_type_def::subrange_type.
bool operator!=(const template_parameter &) const
Inequality operator.
static string vector_as_string(const vector< subrange_sptr > &)
Return a string representation of a vector of subranges.
bool get_is_static() const
Abstracts a type template parameter.
bool elf_symbol_is_function(elf_symbol::type t)
Test if the type of an ELF symbol denotes a function symbol.
interned_string get_id() const
Return an ID that tries to uniquely identify the variable inside a program or a library.
type_base_sptr look_through_decl_only(const type_base_sptr &t)
If a type is is decl-only, then get its definition. Otherwise, just return the initial type...
shared_ptr< class_decl > get_pattern() const
Getter of the pattern of the template.
var_decl * is_var_decl(const type_or_decl_base *tod)
Tests if a declaration is a variable declaration.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Implementation for the virtual qualified name builder for qualified_type_def.
corpus::origin operator&=(corpus::origin &l, corpus::origin r)
Bitwise &= operator for the corpus::origin type.
weak_ptr< decl_base > decl_base_wptr
Convenience typedef for a weak pointer to a decl_base.
bool is_non_canonicalized_type(const type_base *t)
Test if a given type is allowed to be non canonicalized.
virtual size_t get_hash() const
Calculate the hash value for a class_decl::base_spec.
const decl_base_sptr get_earlier_declaration() const
If this decl_base is a definition, get its earlier declaration.
std::vector< enumerator > enumerators
Convenience typedef for a list of enumerator.
virtual void set_size_in_bits(size_t)
Setter for the size of the type.
void is_struct(bool f)
Set the "is-struct" flag of the class.
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...
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...
class_decl::base_spec * is_class_base_spec(const type_or_decl_base *tod)
Test if an ABI artifact is a class base specifier.
decl_base_sptr strip_useless_const_qualification(const qualified_type_def_sptr t)
Strip qualification from a qualified type, when it makes sense.
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...
type_base_sptr canonicalize(type_base_sptr t)
Compute the canonical type of a given type.
translation_unit * get_translation_unit(const shared_ptr< decl_base > decl)
Return the translation unit a declaration belongs to.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Build a pretty representation for a typedef_decl.
weak_ptr< type_base > type_base_wptr
Convenience typedef for a weak pointer on a type_base.
type_maps & get_type_per_loc_map()
Get the maps that associate a location string to a certain kind of type.
bool is_data_member_of_anonymous_class_or_union(const var_decl &d)
Test if a var_decl is a data member belonging to an anonymous type.
virtual bool operator==(const decl_base &) const
Comparison operator for class_decl::base_spec.
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_anonymous_data_member(var_decl *)
Set the containing anonymous data member of this data member context relationship. That means that the data member this relation belongs to is part of an anonymous data member.
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.
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 environment & get_environment() const
Getter of the environment of the current ABI artifact.
void insert_member_type(type_base_sptr t, declarations::iterator before)
Insert a member type.
virtual size_t get_num_anonymous_member_enums() const
Getter for the number of anonymous enums contained in this scope.
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...
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 std::string & get_compilation_dir_path() const
Get the path of the directory that was 'current' when the translation unit was compiled.
bool is_unique_type(const type_base_sptr &t)
Test if a type is unique in the entire environment.
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.
void expand(std::string &path, unsigned &line, unsigned &column) const
Expand the current location into a tripplet file path, line and column number.
vector< type_base_sptr > type_base_sptrs_type
Helper typedef for a vector of shared pointer to a type_base.
const data_members & get_non_static_data_members() const
Get the non-static data memebers of this class_or_union.
Private type to hold private members of translation_unit.
virtual bool operator==(const type_base &) const
Equality operator.
Abstracts a declaration for an enum type.
class_decl_sptr is_class_type(const type_or_decl_base_sptr &d)
Test whether a type is a 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.
typedef_decl_sptr is_typedef(const type_or_decl_base_sptr t)
Test whether a type is a typedef.
type_base * get_exemplar_type(const type_base *type)
For a given type, return its exemplar type.
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.
uint64_t get_data_member_offset(const var_decl &m)
Get the offset of a data member.
bool get_is_declaration_only() const
Test if a decl_base is a declaration-only decl.
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...
const member_functions & get_member_functions() const
Get the member functions of this class_or_union.
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...
string get_enum_flat_representation(const enum_type_decl &enum_type, const string &indent, bool one_line, bool qualified_names)
Get the flat representation of an instance of enum_type_decl type.
This class is to hold the value of the bound of a subrange. The value can be either signed or unsigne...
Toplevel namespace for libabigail.
const char * get_string(const char *s) const
Get a pointer to the interned string which has a given value.
const type_base_sptr & get_void_type() const
Get the unique type_decl that represents a "void" type for the current environment. This node must be the only one representing a void type in the system.
bool get_is_artificial() const
Getter of the flag that says if the artefact is artificial.
void set_member_function_is_dtor(function_decl &f, bool d)
Set the destructor-ness property of a member function.
Hasher for the scope_decl type.
type_base * type_has_non_canonicalized_subtype(type_base_sptr t)
Test if a type has sub-types that are non-canonicalized.
#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...
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.
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.
shared_ptr< scope_decl > scope_decl_sptr
Convenience typedef for a shared pointer on a scope_decl.
bool is_main_symbol() const
Tests whether this symbol is the main symbol.
const type_base_sptrs_type & get_sorted_member_types() const
Get the sorted member types of this scope_decl.
void set_pointed_to_type(type_base_sptr &pointed_to_type)
Setter of the pointed_to type of the current reference type.
bool is_destructor() const
Getter for the 'is-destructor' property.
const function_type * is_function_type(const type_or_decl_base *t)
Test whether a type is a function_type.
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...
void set_member_function_is_ctor(function_decl &f, bool c)
Setter for the is_ctor property of the member function.
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
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...
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.
void set_signedness(enum signedness s)
Setter of the signedness (unsigned VS signed) of the bound value.
shared_ptr< function_decl::parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
shared_ptr< function_decl > function_decl_sptr
Convenience typedef for a shared pointer on a function_decl.
decl_base * is_decl(const type_or_decl_base *d)
Test if an ABI artifact is a declaration.
enum_type_decl * get_enum_type() const
Getter for the enum type that this enumerator is for.
bool elf_symbol_is_variable(elf_symbol::type t)
Test if the type of an ELF symbol denotes a function symbol.
virtual ~template_decl()
Destructor.
bool is_enumerator_present_in_enum(const enum_type_decl::enumerator &enr, const enum_type_decl &enom)
Test if a given enumerator is found present in an enum.
bool operator==(const translation_unit_sptr &l, const translation_unit_sptr &r)
A deep comparison operator for pointers to translation units.
std::vector< parameter_sptr > parameters
Convenience typedef for a vector of parameter_sptr.
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...
virtual bool operator==(const decl_base &) const
Return true iff both scopes have the same names and have the same member decls.
const enum_type_decl * is_enum_type(const type_or_decl_base *d)
Test if a decl is an enum_type_decl.
virtual size_t get_alignment_in_bits() const
Return the alignment of the typedef.
virtual const interned_string & get_qualified_name(bool internal=false) const
Get the qualified name of a given variable or data member.
std::vector< parameter_sptr > parameters
Convenience typedef for a vector of parameter_sptr.
const method_type_sptr get_type() const
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...
Abstracts a union type declaration.
void set_definition_of_declaration(const decl_base_sptr &)
Set the definition of this declaration-only decl_base.
virtual size_t get_size_in_bits() const
Getter for the size of the type.
shared_ptr< parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
bool empty() const
Test if the type_maps is empty.
class_decl_sptr get_base_class() const
Get the base class referred to by the current base class specifier.
enum signedness get_signedness() const
Getter of the signedness (unsigned VS signed) of the bound value.
elf_symbol_sptr get_alias_from_name(const string &name) const
From the aliases of the current symbol, lookup one with a given name.
weak_ptr< elf_symbol > elf_symbol_wptr
A convenience typedef for a weak pointer to elf_symbol.
void clear_qualified_name()
Clear the qualified name of this decl.
void set_unsigned(uint64_t v)
Setter of the bound value as unsigned.
size_t hash_type_or_decl(const type_or_decl_base *tod)
Hash an ABI artifact that is either a type or a decl.
shared_ptr< function_tdecl > function_tdecl_sptr
Convenience typedef for a shared pointer on a function_tdecl.
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.
scope_decl * get_scope() const
Return the type containing the current decl, if any.
shared_ptr< base_spec > base_spec_sptr
Convenience typedef.
virtual void on_canonical_type_set()
This method is invoked automatically right after the current instance of class_decl has been canonica...
void set_corpus(corpus *)
Set the corpus this translation unit is a member of.
class_or_union * is_at_class_scope(const decl_base_sptr decl)
Tests whether a given decl is at class scope.
This contains the private implementation of the suppression engine of libabigail. ...
type_base_sptr get_return_type() const
Getter for the return type of the current instance of function_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...
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...
const parameters & get_parameters() const
Getter for the set of parameters of the current intance of function_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.
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.
void set_is_in_ksymtab(bool is_in_ksymtab)
Setter of the 'is-in-ksymtab' property.
bool mark_dependant_types_compared_until(const type_base &r)
In the stack of the current types being compared (as part of type canonicalization), mark all the types that comes after a certain one as NOT being eligible to the canonical type propagation optimization.
friend bool equals(const decl_base &, const decl_base &, change_kind *)
Compares two instances of decl_base.
size_t get_index() const
Getter for the index.
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 &o) const
Comparison operator for function_decl.
bool is_void_type(const type_base_sptr &) const
Test if a given type is a void type as defined in the current environment.
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...
void add_member_function_template(member_function_template_sptr)
Append a member function template to the class_or_union.
bool has_aliases() const
Check if the current elf_symbol has an alias.
Abstraction for a function declaration.
bool is_constructor() const
Getter for the 'is-constructor' property.
pointer_type_def_sptr is_pointer_type(const type_or_decl_base_sptr &t)
Test whether a type is a pointer_type_def.
std::vector< scope_decl_sptr > scopes
Convenience typedef for a vector of scope_decl_sptr.
void append_parameter(parameter_sptr parm)
Append a new parameter to the vector of parameters of the current instance of function_type.
bool is_anonymous_type(const type_base_sptr &t)
Test if a given type is anonymous.
bool is_ada_language(translation_unit::language l)
Test if a language enumerator designates the Ada language.
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.
interned_string_pool()
Default constructor.
typedef_decl_sptr clone_typedef(const typedef_decl_sptr &t)
Clone a typedef type.
virtual bool operator!=(const type_base &) const
Inequality operator.
bool is_struct() const
Test if the class is a struct.
qualified_type_def_sptr clone_qualified_type(const qualified_type_def_sptr &t)
Clone a qualifiend type.
bool is_template_parm_composition_type(const shared_ptr< decl_base > decl)
Tests whether a decl is a template parameter composition type.
string get_debug_representation(const type_or_decl_base *artifact)
Get the textual representation of a type for debugging purposes.
Types of the main internal representation of libabigail.
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
std::ostream & operator<<(std::ostream &o, const interned_string &s)
Streaming operator.
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. ...
virtual size_t get_num_anonymous_member_classes() const
Getter for the number of anonymous classes contained in this scope.
union_decl_sptr is_union_type(const shared_ptr< type_or_decl_base > &t)
Test if a type is a union_decl.
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
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 operator!=(const version &o) const
Inequality operator.
parameters::const_iterator get_first_non_implicit_parm() const
Getter for the first non-implicit parameter of a function decl.
modifiers_type
The modifiers of the base types above. Several modifiers can be combined for a given base type...
const interned_string & get_cached_pretty_representation(bool internal=false) const
Get the pretty representation of the current type.
bool is_defined() const
Test if the current instance of elf_symbol is defined or not.
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...
virtual bool operator==(const decl_base &) const
Equality operator for qualified types.
#define ABG_RETURN_FALSE
A macro used to return the "false" boolean from DIE comparison routines.
const var_decl_sptr find_anonymous_data_member(const var_decl_sptr &) const
Find an anonymous data member in the class.
const interned_string & get_linkage_name() const
Getter for the mangled name.
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Implementation of the virtual "get_qualified_name" method.
The base type of class_decl and union_decl.
bool get_is_in_public_symbol_table() const
Test if the decl is defined in a ELF symbol table as a public symbol.
void set_is_anonymous(bool)
Set the "is_anonymous" flag of the current declaration.
type
The type of a symbol.
const decl_base * get_type_declaration(const type_base *t)
Get the declaration for a given type.
const type_base * peel_qualified_type(const type_base *type)
Return the leaf underlying type of a qualified type.
The source location of a token.
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(), this function ensures that the member function is added to the specific vectors and maps of virtual member function of its class.
The base of an entity of the intermediate representation that is to be traversed. ...
A hashing functor fo instances and pointers of function_decl.
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
binding get_binding() const
Getter for the binding of the current instance of elf_symbol.
void set_location(const location &l)
Set the location for a given declaration.
unordered_map< ssize_t, member_functions > virtual_mem_fn_map_type
Convenience typedef.
The hashing functor for function_type.
type_base_sptr find_member_type(const string &name) const
Find a member type of a given name, inside the current scope_decl.
weak_ptr< class_decl > class_decl_wptr
Convenience typedef for a weak pointer on a class_decl.
virtual bool operator==(const type_base &) const
Return true iff both type declarations are equal.
void set_upper_bound(int64_t ub)
Setter of the upper bound of the subrange type.
friend bool equals(const class_decl &, const class_decl &, change_kind *)
Compares two instances of class_decl.
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.
shared_ptr< type_or_decl_base > type_or_decl_base_sptr
A convenience typedef for a shared_ptr to type_or_decl_base.
string translation_unit_language_to_string(translation_unit::language l)
Converts a translation_unit::language enumerator into a string.
shared_ptr< type_decl > type_decl_sptr
Convenience typedef for a shared pointer on a type_decl.
Abstracts non type template parameters.
location get_location(const type_base_sptr &type)
Get the location of the declaration of a given type.
void set_member_is_static(decl_base &d, bool s)
Sets the static-ness property of a class member.
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_decls_alias(const function_decl &f1, const function_decl &f2)
Test if two function declarations are aliases.
virtual size_t get_hash() const
Return the hash value for the current instance.
This is a type that aggregates maps of all the kinds of types that are supported by libabigail...
void mark_types_as_being_compared(T &l, T &r)
Mark a pair of types as being compared.
type_base_sptr get_underlying_type() const
Getter of the underlying type of the typedef.
unordered_map< string, string * > pool_map_type
Convenience typedef for a map of string -> string*.
bool is_variadic_parameter_type(const type_base *) const
Test if a type is a variadic parameter type as defined in the current environment.
bool is_public() const
Test if the current instance of elf_symbol is public or not.
bool get_is_const() const
Getter of the "is-const" property of method_type.
Abstraction of an elf symbol.
type_base * get_canonical_type(const char *name, unsigned index)
Get a given canonical type which has a given "string representation".
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
This is an abstraction of the set of resources necessary to manage several aspects of the internal re...
virtual bool operator==(const decl_base &) const
Equality operator.
Abstract a function template declaration.
The abstraction for a data member context relationship. This relates a data member to its parent clas...
interned_string get_method_type_name(const method_type &fn_type, bool internal)
Get the name of a given method type and return a copy of it.
bool 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.
type_base * get_naked_pointed_to_type() const
Getter of a naked pointer to the pointed-to type.
virtual void remove_member_decl(decl_base_sptr member)
Remove a declaration from the current scope.
vector< method_decl_sptr > member_functions
Convenience typedef.
type_base_sptr lookup_type(const type_base_sptr &t, const corpus &corp)
Look into a given corpus to find a type.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
void set_return_type(type_base_sptr t)
Setter of the return type of the current instance of function_type.
bool elf_symbols_alias(const elf_symbol &s1, const elf_symbol &s2)
Test if two symbols alias.
unordered_map< interned_string, bool, hash_interned_string > interned_string_bool_map_type
Convenience typedef for a map of interned_string -> bool.
bool operator==(const translation_unit &) const
Compare the current translation unit against another one.
decl_base_sptr look_through_decl_only(const decl_base &d)
If a decl is decl-only get its definition. Otherwise, just return nil.
const type_base * peel_typedef_type(const type_base *type)
Return the leaf underlying type node of a typedef_decl node.
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.
void add_alias(const elf_symbol_sptr &)
Add an alias to the current elf symbol.
void unmark_types_as_being_compared(T &l, T &r)
Mark a pair of types as being not compared anymore.
virtual ~decl_base()
Destructor of the decl_base type.
uint64_t get_length() const
Getter of the length of the subrange type.
shared_ptr< reference_type_def > reference_type_def_sptr
Convenience typedef for a shared pointer on a reference_type_def.
type_base_sptr get_underlying_type() const
Getter of the underlying type of the subrange, that is, the type that defines the range...
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...
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_...
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:
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
void set_member_access_specifier(decl_base &d, access_specifier a)
Sets the access specifier for a class member.
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.
array_type_def_sptr is_typedef_of_array(const type_base_sptr &t)
Test if a type is a typedef of an array.
The "bool" base type in C++ or "_Bool" in C11.
shared_ptr< elf_symbol > elf_symbol_sptr
A convenience typedef for a shared pointer to elf_symbol.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse virtual function.
decl_base * debug(const decl_base *artifact)
Emit a textual representation of an artifact to std error stream for debugging purposes.
std::shared_ptr< regex_t > regex_t_sptr
A convenience typedef for a shared pointer of regex_t.
#define ABG_ASSERT(cond)
This is a wrapper around the 'assert' glibc call. It allows for its argument to have side effects...
virtual bool operator==(const decl_base &) const
Equality operator.
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 ...
interned_string intern(const string &) const
Do intern a string.
void mark_type_node_as_visited(type_base *)
Mark a given type node as having been visited.
virtual bool traverse(ir_node_visitor &)
Traverses an instance of function_type, visiting all the sub-types and decls that it might contain...
void set_signed(int64_t v)
Setter of the bound value as signed.
translation_unit::language get_language() const
Get the language of the array.
string get_anon_dm_reliable_name(bool qualified=true) const
Get a name that is valid even for an anonymous data member.
bool operator!=(const translation_unit &) const
Inequality operator.
#define ABG_RETURN(value)
A macro used to return from DIE comparison routines.
bool is_default() const
Getter for the 'is_default' property of the version.
bool get_data_member_is_laid_out(const var_decl &m)
Test whether a data member is laid out.
function_decl_sptr clone() const
Create a new instance of function_decl that is a clone of the current one.
bool try_canonical_compare(const T *l, const T *r)
Compare two types by comparing their canonical types if present.
const std::vector< subrange_sptr > & get_subranges() const
Get the array's subranges.
bool is_cplus_plus_language(translation_unit::language l)
Test if a language enumerator designates the C++ language.
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...
Hasher for the non_type_tparameter type.
int64_t get_upper_bound() const
Getter of the upper bound of the subrange type.
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.
type_base * peel_qualified_or_typedef_type(const type_base *type)
Return the leaf underlying type of a qualified or typedef type.
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.
type_base_sptr lookup_type_per_location(const interned_string &loc, const corpus &corp)
Lookup a type from a corpus, by its location.
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
void set_binding(binding b)
Setter for the binding of the current instance of elf_symbol.
virtual void set_alignment_in_bits(size_t)
Setter of the alignment of the class type.
virtual size_t get_size_in_bits() const
Return the size of the typedef.
bool is_union_type(const type_or_decl_base &t)
Test if a type is a union_decl.
virtual bool operator==(const decl_base &) const
Comparison operator for union_decl.
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.
array_type_def_sptr is_array_type(const type_or_decl_base_sptr &type)
Test if a type is an array_type_def.
void sort_virtual_mem_fns()
Sort the virtual member functions by their virtual index.
void set_parameters(const parameters &p)
Setter for the parameters of the current instance of function_type.
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.
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.
function_decl * is_function_decl(const type_or_decl_base *d)
Test whether a declaration is a function_decl.
const type_base_sptr get_type() const
Getter of the type of the variable.
bool is_global_scope(const shared_ptr< scope_decl >scope)
Tests whether if a given scope is the global scope.
void set_member_function_vtable_offset(function_decl &f, ssize_t s)
Set the vtable offset of a member function.
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 ...
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.
void set_symbol(const elf_symbol_sptr &sym)
This sets the underlying ELF symbol for the current function decl.
const elf_symbol_sptr get_main_symbol() const
Get the main symbol of an alias chain.
const declarations & get_sorted_member_decls() const
Getter for the sorted member declarations carried by the current scope_decl.
const type_base_sptr peel_array_type(const type_base_sptr &type)
Return the leaf element type of an array.
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 has_vtable() const
Test if the current instance has a vtable.
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
const abg_compat::optional< uint32_t > & get_crc() const
Getter of the 'crc' property.
const abg_compat::optional< std::string > & get_namespace() const
Getter of the 'namespace' property.
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 elf_symbol &) const
Test if two main symbols are textually equal, or, if they have aliases that are textually equal...
bool operator==(const enumerator &other) const
Equality operator.
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.
bool is_template_parameter(const shared_ptr< decl_base > decl)
Tests whether a decl is a template parameter.
The abstraction of a pointer type.
friend enum access_specifier get_member_access_specifier(const decl_base &d)
Gets the access specifier for a class member.
binding
The binding of a symbol.
shared_ptr< class_tdecl > class_tdecl_sptr
Convenience typedef for a shared pointer on a class_tdecl.
void forget_visited_type_nodes()
Un-mark all visited type nodes.
type_or_decl_kind
This is a bitmap type which instance is meant to contain the runtime type of a given ABI artifact...
void set_underlying_type(const type_base_sptr &)
Setter of the underlying type.
void set_earlier_declaration(const decl_base_sptr &)
set the earlier declaration of this decl_base definition.
array_type_def * is_array_type(const type_or_decl_base *type)
Test if a type is an array_type_def.
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...
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
corpus::origin operator|(corpus::origin l, corpus::origin r)
Bitwise | operator for the corpus::origin type.
class_or_union * is_at_class_scope(const decl_base &decl)
Tests whether a given decl is at class scope.
visibility get_visibility() const
Getter for the visibility of the decl.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Build and return the pretty representation of this variable.
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.
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...
virtual size_t get_hash() const
Get the hash value for the current instance.
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
scope_decl_sptr is_scope_decl(const decl_base_sptr &d)
Test if a declaration is a scope_decl.
shared_ptr< namespace_decl > namespace_decl_sptr
Convenience typedef for a shared pointer on namespace_decl.
bool is_function() const
Test if the current instance of elf_symbol is a function symbol or not.
long get_offset_in_bits() const
Getter of the offset of the base.
bool get_member_function_is_ctor(const function_decl &f)
Test whether a member function is a constructor.
lookup_entity_kind
This enum describe the kind of entity to lookup, while using the lookup API.
bool is_anonymous_data_member(const var_decl &d)
Test if a var_decl is an anonymous data member.
decl_base_sptr is_decl(const type_or_decl_base_sptr &d)
Test if an ABI artifact is a declaration.
type_base_sptr get_canonical_type() const
Getter of the canonical type of the current instance of type_base.
virtual bool operator!=(const decl_base &) const
Inequality operator.
decl_base_sptr get_type_declaration(const type_base_sptr t)
Get the declaration for a given type.
virtual size_t get_size_in_bits() const
Getter of the size of the class_or_union type.
void set_is_constructed(bool)
Setter of the 'is_constructed" flag. It says if the translation unit is fully constructed or not...
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
bool is_anonymous_or_typedef_named(const decl_base &d)
Test if a given decl is anonymous or has a naming typedef.
The base class for the visitor type hierarchy used for traversing a translation unit.
ssize_t get_biggest_vtable_offset() const
Get the highest vtable offset of all the virtual methods of the class.
bool operator==(const version &o) const
Compares the current version against another one.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
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.
type_decl_sptr is_integral_type(const type_or_decl_base_sptr &t)
Test if a type is an integral type.
Equality functor for instances of function_decl.
const interned_string & peek_qualified_name() const
Getter for the qualified name.
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.
A basic type declaration that introduces no scope.
shared_ptr< enum_type_decl > enum_type_decl_sptr
Convenience typedef for shared pointer to a enum_type_decl.
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...
virtual bool traverse(ir_node_visitor &)
Traverse the the ABI artifact.
const config & get_config() const
Getter of the general configuration object.
string demangle_cplus_mangled_name(const string &mangled_name)
Demangle a C++ mangled name and return the resulting string.
virtual bool is_infinite() const
shared_ptr< class_decl > class_decl_sptr
Convenience typedef for a shared pointer on a class_decl.
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.
bool is_const() const
Getter for the 'is-const' property.
Hasher for the class_decl type.
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the decl.
const type_base_sptr get_return_type() const
int64_t get_signed_value() const
Getter of the bound value as a signed value.
const interned_string & peek_temporary_qualified_name() const
Getter of the temporary qualified name of the current declaration.
A hashing functor for instances and pointers of var_decl.
version & operator=(const version &o)
Assign a version to the current one.
class_decl_sptr find_base_class(const string &) const
Find a base class of a given qualified name for the current class.
virtual ~template_parameter()
Destructor.
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.
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...
virtual size_t get_size_in_bits() const
Get the size of the qualified type def.
qualified_type_def * is_qualified_type(const type_or_decl_base *t)
Test whether a type is a reference_type_def.
modifiers_type get_modifiers() const
Getter of the modifiers bitmap of the integral_type.
interned_string get_function_type_name(const function_type &fn_type, bool internal)
Get the name of a given function type and return a copy of it.
decl_base_sptr insert_member_decl(decl_base_sptr member)
Insert a data member to this class_or_union type.
shared_ptr< ir_traversable_base > ir_traversable_base_sptr
Convenience typedef for a shared pointer to ir_traversable_base.
version & get_version() const
Getter for the version of the current instanc of elf_symbol.
const std::list< template_parameter_sptr > & get_template_parameters() const
Get the list of template parameters of the current instance of template_decl.
const type_base_sptr get_element_type() const
Getter of the type of an array element.
Hasher for the type_composition type.
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.
The base class for member types, data members and member functions. Its purpose is mainly to carry th...
const enumerators & get_enumerators() const
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...
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...
bool is_function_template_pattern(const shared_ptr< decl_base > decl)
Test whether a decl is the pattern of a function template.
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...
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.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
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.
bool visiting() const
This should returns false before and after the node has been visiting. During the visiting of the nod...
bool match(const regex_t_sptr &r, const std::string &str)
See if a string matches a regex.
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the parameter.
const translation_unit * get_translation_unit() const
Get the translation_unit this ABI artifact belongs to.
language
The language of the translation unit.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
void set_is_const(bool)
Setter of the "is-const" property of method_type.
const environment & get_environment() const
Getter of the enviroment of the corpus.
bool is_template_decl(const decl_base_sptr &decl)
Tests whether a decl is a template.
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 ...
uint64_t get_var_size_in_bits(const var_decl_sptr &v)
Get the size of a given variable.
#define CACHE_COMPARISON_RESULT_AND_RETURN(value)
Cache the result of a comparison between too artifacts (l & r) and return immediately.
const string & get_qualified_name(bool internal=false) const
Getter for the qualified name of the current instance of enum_type_decl::enumerator. The first invocation of the method builds the qualified name, caches it and return a reference to the cached qualified name. Subsequent invocations just return the cached value.
virtual bool operator==(const decl_base &) const
Equality operator.
void maybe_fixup_members_of_anon_data_member(var_decl_sptr &anon_dm)
Fixup the members of the type of an anonymous data member.
type_base_sptr get_underlying_type() const
Return the underlying type of the enum.
void set_enum_type(enum_type_decl *)
Setter for the enum type that this enumerator is for.
const type_base_sptr lookup_type_in_scope(const string &fqn, const scope_decl_sptr &skope)
Lookup a type in a scope.
void set_naming_typedef(const typedef_decl_sptr &)
Set the naming typedef of the current instance of decl_base.
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.
bool is_at_template_scope(const shared_ptr< decl_base > decl)
Tests whether a given decl is at template scope.
A deleter for shared pointers that ... doesn't delete the object managed by the shared pointer...
bool debug_equals(const type_or_decl_base *l, const type_or_decl_base *r)
Test if two ABI artifacts are equal.
void set_artificial_location(const location &)
Setter of the artificial location of the artificat.
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...
corpus::origin operator|=(corpus::origin &l, corpus::origin r)
Bitwise |= operator for the corpus::origin type.
integral_type::modifiers_type operator~(integral_type::modifiers_type l)
Bitwise one's complement operator for integral_type::modifiers_type.
virtual bool operator==(const decl_base &) const
Comparison operator of var_decl.
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.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
typedef_decl_sptr lookup_typedef_type_per_location(const string &loc, const corpus &corp)
Lookup a typedef_decl from a corpus, by its location.
void set_size(size_t)
Setter of the size of the symbol.
void set_binding(binding b)
Setter of the binding of the variable.
This means that a given IR artifact has a local type change.
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 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:
This abstracts the global scope of a given translation unit.
bool has_virtual_bases() const
Test if the current instance of class_decl has at least one virtual base.
bool get_has_anonymous_parent() const
Get the "has_anonymous_parent" flag of the current declaration.
vector< type_base_sptr > * get_canonical_types(const char *name)
Get the vector of canonical types which have a given "string representation".
const scope_decl_sptr & get_global_scope() const
Getter of the the global scope of the translation unit.
virtual bool operator==(const decl_base &) const
Equality operator.
friend class_decl * is_class_type(const type_or_decl_base *)
Test whether a type is a class.
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...
size_t get_size() const
Getter of the size of the symbol.
const global_scope * get_global_scope(const shared_ptr< decl_base > decl)
Return the global scope as seen by a given declaration.
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.
virtual void set_scope(scope_decl *)
Setter of the scope of the current decl.
A predicate for deep equality of instances of shared_ptr
void set_pointed_to_type(const type_base_sptr &)
Set the pointed-to type of the pointer.
bool get_member_is_static(const decl_base &d)
Gets a flag saying if a class member is static or not.
void set_language(language l)
Setter of the language of the source code of the translation unit.
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.
bool find_iterator_for_member(const decl_base *, declarations::iterator &)
Find a member of the current scope and return an iterator on it.
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_...
The abstraction of an interned string.
reference_type_def_sptr is_reference_type(const type_or_decl_base_sptr &t)
Test whether a type is a reference_type_def.
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
elf_symbol_sptr update_main_symbol(const std::string &)
Update the main symbol for a group of aliased symbols.
bool get_is_anonymous() const
Test if the current declaration is anonymous.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representation of the current instance of type_decl.
virtual bool traverse(ir_node_visitor &)
Default implementation of traversal for types. This function does nothing. It must be implemented by ...
string get_string_representation_of_cv_quals(const qualified_type_def::CV cv_quals)
Get the string representation of a CV qualifier bitmap.
std::vector< subrange_sptr > subranges_type
Convenience typedef for a vector of subrange_sptr.
elf_symbol_sptr get_next_alias() const
Get the next alias of the current symbol.
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...
friend void set_member_access_specifier(decl_base &d, access_specifier a)
Sets the access specifier for a class member.
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Implementation for the virtual qualified name builder for type_decl.
Abstraction for an array range type, like in Ada, or just for an array dimension like in C or C++...
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
const type_maps & get_types() const
Getter of the types of the current translation_unit.
size_t vtable_offset() const
Getter for the vtable offset property.
virtual const interned_string & get_scoped_name() const
Return the scoped name of the decl.
void set_underlying_type(const type_base_sptr &)
Setter ofthe underlying type of the typedef.
ir_node_visitor()
Default Constructor of the ir_node_visitor type.
The abstraction of the version of an ELF symbol.
virtual bool operator==(const type_base &) const
Equality operator for function_type.
const type_base_sptrs_type & get_sorted_canonical_types() const
Return a vector of sorted canonical types of the current scope.
const std::string & get_path() const
Get the path of the current translation unit.
const typedef_decl * is_typedef(const type_or_decl_base *t)
Test whether a type is a typedef.
virtual size_t get_num_anonymous_member_classes() const
Get the number of anonymous member classes contained in this class.
bool get_member_function_is_const(const function_decl &f)
Test whether a member function is const.
The hashing functor for class_decl::base_spec.
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.
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, reference_type_def, or array_type_def node.
bool is_empty() const
Test if the current scope is empty.
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.
void append_parameters(std::vector< parameter_sptr > &parms)
Append a vector of parameters to the type of this function.
namespace_decl_sptr is_namespace(const decl_base_sptr &d)
Tests if a declaration is a namespace declaration.
bound_value()
Default constructor of the array_type_def::subrange_type::bound_value class.
type_base_sptr peel_reference_type(const type_base_sptr &type)
Return the leaf pointed-to type node of a reference_type_def node.
void maybe_update_types_lookup_map(const function_type_sptr &fn_type)
Update the map that associates the fully qualified name of a function type with the type itself...
bool member_function_has_vtable_offset(const function_decl &f)
Test if a virtual member function has a vtable offset set.
const corpus_group * get_group() const
Getter of the group this corpus is a member of.
enum_type_decl_sptr is_enum_type(const type_or_decl_base_sptr &d)
Test if a decl is an enum_type_decl.
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...
const data_members & get_data_members() const
Get the data members of this class_or_union.
reference_type_def * is_reference_type(type_or_decl_base *t)
Test whether a type is a reference_type_def.
Abstracts a template template parameter.
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.
void set_symbol(const elf_symbol_sptr &sym)
Sets the underlying ELF symbol for the current variable.
array_type_def_sptr clone_array(const array_type_def_sptr &array)
Clone an array type.
This type abstracts the configuration information of the library.
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.
This means that a given IR artifact has a local non-type change. That is a change that is carried by ...
bool types_are_compatible(const decl_base_sptr d1, const decl_base_sptr d2)
Test if two types are equal modulo a typedef.
bool is_in_ksymtab() const
Getter of the 'is-in-ksymtab' property.
bool has_artificial_location() const
Test if the current ABI artifact carries an artificial location.
scope_decl * is_scope_decl(decl_base *d)
Test if a declaration is a scope_decl.
void set_is_artificial(bool)
Setter of the flag that says if the artefact is artificial.
void set_name(const string &n)
Setter for the name of the current intance of elf_symbol.
vector< var_decl_sptr > data_members
Convenience typedef.
const interned_string & get_node_name(var_decl_sptr node)
Gets the name of a var_decl node.
bool is_anonymous_data_member(const decl_base &d)
Test if a decl is an anonymous data member.
void fqn_to_components(const string &fqn, list< string > &comps)
Decompose a fully qualified name into the list of its components.
location & get_artificial_location() const
Getter of the artificial location of the artifact.
void set_value(int64_t v)
Setter for the value of enum_type_decl::enumerator.
access_specifier
Access specifier for class members.
The private data and functions of the abigail::ir::corpus type.
void set_visibility(visibility v)
Setter of the visibility of the current instance of elf_symbol.
type_base_sptr is_type(const type_or_decl_base_sptr &tod)
Test whether a declaration is a type.
void set_namespace(const abg_compat::optional< std::string > &ns)
Setter of the 'namespace' property.
environment()
Default constructor of the environment 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...
shared_ptr< template_decl > template_decl_sptr
Convenience typedef for a shared pointer to template_decl.
void set_data_member_is_laid_out(var_decl_sptr m, bool l)
Set a flag saying if a data member is laid out.
void append_parameter(parameter_sptr parm)
Append a parameter to the type of this function.
var_decl_sptr get_last_data_member(const class_or_union &klass)
Get the last data member of a class type.
type_base * get_naked_canonical_type() const
Getter of the canonical type pointer.
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.
void set_element_type(const type_base_sptr &element_type)
Setter of the type of array element.
const decl_base * get_naked_definition_of_declaration() const
If this decl_base is declaration-only, get its definition, if any.
void set_type(type_base_sptr &)
Setter of the type of the variable.
bool operator==(const bound_value &) const
Equality operator of the bound value.
virtual bool operator==(const decl_base &o) const
Equality operator.
bool is_typedef_ptr_or_ref_to_decl_only_class_or_union_type(const type_base *t)
Test if a type is a typedef, pointer or reference to a decl-only class/union.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
const type_base * get_naked_type() const
Getter of the type of the variable.
const corpus * get_corpus() const
Get the corpus this ABI artifact belongs to.
The hashing functor for member_base.
type get_type() const
Getter for the type of the current instance of elf_symbol.
void set_name(const string &n)
Setter for the name of enum_type_decl::enumerator.
bool is_variadic() const
Return true iff the function takes a variable number of parameters.
Wrappers around regex types and functions.
const function_decl::parameter * get_function_parameter(const decl_base *fun, unsigned parm_index)
Get the function parameter designated by its index.
binding get_binding() const
Get the binding of the function template.
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...
shared_ptr< template_parameter > template_parameter_sptr
Convenience typedef for shared pointer to template parameter.
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.
std::string operator+(const interned_string &s1, const std::string &s2)
Concatenation operator.
bool equals(const decl_base &l, const decl_base &r, change_kind *k)
Compares two instances of decl_base.
bool has_scope(const decl_base &d)
Tests if a declaration has got a scope.
corpus::origin operator&(corpus::origin l, corpus::origin r)
Bitwise & operator for the corpus::origin type.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
The abstraction of a typedef declaration.
virtual bool operator==(const decl_base &) const
Return true iff both scopes have the same names and have the same member decls.
friend void set_member_is_static(decl_base &d, bool s)
Sets the static-ness property of a class member.
This abstracts a composition of types based on template type parameters. The result of the compositio...
friend bool get_member_function_is_virtual(const function_decl &f)
Test if a given member function is virtual.
const string & get_id_string() const
Get a string that is representative of a given elf_symbol.
const type_base_sptr get_pointed_to_type() const
Getter of the pointed-to type.
vector< base_spec_sptr > base_specs
Convenience typedef.
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...
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
type_base_sptr clone_array_tree(const type_base_sptr t)
Clone a type tree made of an array or a typedef of array.
pointer_type_def * is_pointer_type(type_or_decl_base *t)
Test whether a type is a pointer_type_def.
virtual bool traverse(ir_node_visitor &v)
Traverse the diff sub-tree under the current instance function_decl.
bool parse_integral_type(const string &type_name, integral_type &type)
Parse an integral type from a string.
virtual size_t get_alignment_in_bits() const
Getter for the alignment of the type.
virtual size_t get_hash() const
Return the hash value for the current instance of scope_decl.
interned_string get_type_name() const
friend void set_member_function_is_virtual(function_decl &, bool)
Set the virtual-ness of a member function.
int64_t get_lower_bound() const
Getter of the lower bound of the subrange type.
void set_address_size(char)
Setter of the address size in this translation unit.
const type_base_sptr & get_variadic_parameter_type() const
Get a type_decl instance that represents a the type of a variadic function parameter. This node must be the only one representing a variadic parameter type in the system.
const function_type * get_naked_type() const
Fast getter of the type of the current instance of function_decl.
const class_or_union_sptr data_member_has_anonymous_type(const var_decl &d)
Test if a data member has annonymous type or not.
bool has_virtual_member_functions() const
Test if the current instance of class_decl has virtual member functions.
virtual void append_subranges(const std::vector< subrange_sptr > &subs)
Append subranges from the vector.
static string & get_variadic_parameter_type_name()
Getter of the name of the variadic parameter type.
Base class for a template parameter. Client code should use the more specialized type_template_parame...
void debug_comp_stack(const environment &env)
Emit a trace of the two comparison operands stack on the standard error stream.
string expand(void) const
Expand the location into a string.
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...
void set_data_member_offset(var_decl_sptr m, uint64_t o)
Set the offset of a data member into its containing class.
void set_lower_bound(int64_t lb)
Setter of the lower bound.
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.
shared_ptr< subrange_type > subrange_sptr
Convenience typedef for a shared pointer on a function_decl::subrange.
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 ...
const var_decl * get_anonymous_data_member() const
Return a non-nil value if this data member context relationship has an anonymous data member...
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.
namespace_decl(const environment &env, const string &name, const location &locus, visibility vis=VISIBILITY_DEFAULT)
Constructor.
virtual void set_linkage_name(const string &)
Set the linkage name of the method.
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...
bool class_or_union_types_of_same_kind(const class_or_union_sptr &first, const class_or_union_sptr &second)
Test if two class or union types are of the same kind.
shared_ptr< array_type_def > array_type_def_sptr
Convenience typedef for a shared pointer on a array_type_def.
bool equals_modulo_cv_qualifier(const array_type_def *l, const array_type_def *r)
Test if two variables are equals modulo CV qualifiers.
shared_ptr< pointer_type_def > pointer_type_def_sptr
Convenience typedef for a shared pointer on a pointer_type_def.
location get_location(const decl_base_sptr &decl)
Get the location of a given declaration.
void set_crc(const abg_compat::optional< uint32_t > &crc)
Setter of the 'crc' property.
unsigned get_value() const
Get the value of the location.
method_type_sptr is_method_type(const type_or_decl_base_sptr &t)
Test whether a type is a method_type.
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...
type_base_sptr peel_typedef_type(const type_base_sptr &type)
Return the leaf underlying type node of a typedef_decl node.
const decl_base_sptr get_definition_of_declaration() const
If this decl_base is declaration-only, get its definition, if any.
virtual bool operator==(const decl_base &) const
Return true iff both instances of pointer_type_def are equal.
bool operator==(const integral_type &) const
Equality operator for the integral_type.
const type_base * is_void_pointer_type_equivalent(const type_base *type)
Test if a type is equivalent to a pointer to void type.
bool does_alias(const elf_symbol &) const
Test if the current symbol aliases another one.
char get_address_size() const
Getter of the address size in this translation unit.
bool is_empty() const
Tests whether if the current translation unit contains ABI artifacts or not.
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.
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 method_decl * find_member_function(const string &mangled_name) const
Find a method, using its linkage name as a key.
scope_decl * get_type_scope(const type_base_sptr &t)
Get the scope of a given type.
virtual bool operator==(const decl_base &) const
Comparison operator for the function_tdecl type.
void add_common_instance(const elf_symbol_sptr &)
Add a common instance to the current common elf symbol.
Abstraction of a function type.
weak_ptr< template_decl > template_decl_wptr
Convenience typedef for a weak pointer to template_decl.
enum type_or_decl_kind kind() const
Getter for the "kind" property of type_or_decl_base type.
string build_name(bool, bool internal=false) const
Build the name of the current instance of qualified type.
void set_pattern(class_decl_sptr p)
Setter of the pattern of the template.
function_decl::parameter_sptr is_function_parameter(const type_or_decl_base_sptr tod)
Test whether an ABI artifact is a function_decl.
The entry point to manage locations.
method_decl_sptr find_member_function_sptr(const string &mangled_name)
Find a method, using its linkage name as a key.
void set_version(const version &v)
Setter for the version of the current instance of elf_symbol.
CV
Bit field values representing the cv qualifiers of the underlying type.
virtual ~type_or_decl_base()
The destructor of the type_or_decl_base type.
bool is_member_type(const type_base_sptr &t)
Tests if a type is a class member.
visibility
ELF visibility.
void add_base_specifier(shared_ptr< base_spec > b)
Add a base specifier to this class.
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.
bool is_java_language(translation_unit::language l)
Test if a language enumerator designates the Java language.
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, defined as public (global or weak).
const var_decl_sptr find_data_member(const string &) const
Find a data member of a given name in the current class_or_union.
shared_ptr< exported_decls_builder > exported_decls_builder_sptr
Convenience typedef for shared_ptr.
The abstraction of a namespace declaration.
const base_specs & get_base_specifiers() const
Get the base specifiers for this class.
bool is_comparison_cycle_detected(T &l, T &r)
Detect if a recursive comparison cycle is detected while structurally comparing two types (a...