20#include <unordered_map>
24#include "abg-internal.h"
26ABG_BEGIN_EXPORT_DECLARATIONS
33ABG_END_EXPORT_DECLARATIONS
68using std::unordered_map;
69using std::dynamic_pointer_cast;
70using std::static_pointer_cast;
77struct interned_string_pool::priv
97{
return priv_->map.find(s) != priv_->map.end();}
108 unordered_map<string, string*>::const_iterator i =
110 if (i == priv_->map.end())
113 return i->second->c_str();
125 string*& result = priv_->map[str_value];
126 if (!result && !str_value.empty())
127 result =
new string(str_value);
134 for (pool_map_type::iterator i = priv_->map.begin();
135 i != priv_->map.end();
152{
return r.operator==(l);}
155operator!=(
const std::string& l,
const interned_string& r)
170 o << static_cast<std::string>(s);
186{
return static_cast<std::string
>(s1) + s2;}
200{
return s1 +
static_cast<std::string
>(s2);}
206hash_as_canonical_type_or_constant(
const type_base *t);
209has_generic_anonymous_internal_type_name(
const decl_base *d);
211static interned_string
212get_generic_anonymous_internal_type_name(
const decl_base *d);
215get_internal_real_type_name(
const type_base*);
218update_qualified_name(decl_base * d);
221update_qualified_name(decl_base_sptr d);
223static interned_string
224pointer_declaration_name(
const type_base* ptr,
225 const string& variable_name,
226 bool qualified,
bool internal);
228static interned_string
229pointer_declaration_name(
const type_base_sptr& ptr,
230 const string& variable_name,
231 bool qualified,
bool internal);
233static interned_string
234ptr_to_mbr_declaration_name(
const ptr_to_mbr_type* ptr,
235 const string& variable_name,
236 bool qualified,
bool internal);
238static interned_string
240 const string& variable_name,
241 bool qualified,
bool internal);
243static interned_string
244array_declaration_name(
const array_type_def* array,
245 const string& variable_name,
246 bool qualified,
bool internal);
248static interned_string
250 const string& variable_name,
251 bool qualified,
bool internal);
254stream_pretty_representation_of_fn_parms(
const function_type& fn_type,
255 ostream& o,
bool qualified,
258add_outer_pointer_to_fn_type_expr(
const type_base* pointer_to_fn,
259 const string& input,
bool qualified,
263add_outer_pointer_to_fn_type_expr(
const type_base_sptr& pointer_to_fn,
264 const string& input,
bool qualified,
268add_outer_pointer_to_array_type_expr(
const type_base* pointer_to_ar,
269 const string& input,
bool qualified,
273add_outer_pointer_to_array_type_expr(
const type_base_sptr& pointer_to_ar,
274 const string& input,
bool qualified,
278add_outer_ptr_to_mbr_type_expr(
const ptr_to_mbr_type* p,
279 const string& input,
bool qualified,
284 const string& input,
bool qualified,
288add_outer_pointer_to_ptr_to_mbr_type_expr(
const type_base* p,
290 bool qualified,
bool internal);
294 const type_base& right);
298 const type_base& right);
315 env.priv_->push_composite_type_comparison_operands(&left, &right);
336 env.priv_->pop_composite_type_comparison_operands(&left, &right);
346{
return t.priv_->canonical_type_index;}
381 if (c && t->get_corpus())
386 if (t->get_corpus()->get_group() == g.get())
391 if (t->get_corpus() == c.get())
400class expanded_location
412 expanded_location(
const string& path,
unsigned line,
unsigned column)
413 : path_(path), line_(line), column_(column)
419 return (path_ == l.path_
421 && column_ && l.column_);
425 operator<(
const expanded_location& l)
const
429 else if (path_ > l.path_)
434 else if (line_ > l.line_)
437 return column_ < l.column_;
454 if (!get_location_manager())
475 unsigned line = 0, column = 0;
476 expand(path, line, column);
478 std::ostringstream o;
479 o << path <<
":" << line <<
":" << column;
483struct location_manager::priv
489 std::vector<expanded_location> locs;
492location_manager::location_manager()
496location_manager::~location_manager() =
default;
511 expanded_location l(file_path, line, col);
515 priv_->locs.push_back(l);
516 return location(priv_->locs.size(),
this);
533 unsigned& column)
const
537 expanded_location &l = priv_->locs[
location.value_ - 1];
550struct type_maps::priv
564 mutable vector<type_base_wptr> sorted_types_;
567type_maps::type_maps()
571type_maps::~type_maps() =
default;
596{
return priv_->basic_types_;}
603{
return priv_->basic_types_;}
610{
return priv_->class_types_;}
617{
return priv_->class_types_;}
624{
return priv_->union_types_;}
631{
return priv_->union_types_;}
638{
return priv_->enum_types_;}
645{
return priv_->enum_types_;}
652{
return priv_->typedef_types_;}
659{
return priv_->typedef_types_;}
665{
return priv_->qualified_types_;}
671{
return priv_->qualified_types_;}
678{
return priv_->pointer_types_;}
685{
return priv_->ptr_to_mbr_types_;}
692{
return priv_->ptr_to_mbr_types_;}
699{
return priv_->pointer_types_;}
706{
return priv_->reference_types_;}
713{
return priv_->reference_types_;}
720{
return priv_->array_types_;}
727{
return priv_->array_types_;}
734{
return priv_->subrange_types_;}
741{
return priv_->subrange_types_;}
748{
return priv_->function_types_;}
755{
return priv_->function_types_;}
774 if (l == 0 && r == 0)
779 return l_repr < r_repr;
793 operator()(
const type_base_sptr &l,
const type_base_sptr &r)
const
794 {
return operator()(l.get(), r.get());}
808 {
return operator()(type_base_sptr(l), type_base_sptr(r));}
811#ifdef WITH_DEBUG_SELF_COMPARISON
827notify_equality_failed(
const type_or_decl_base &l __attribute__((unused)),
828 const type_or_decl_base &r __attribute__((unused)))
845notify_equality_failed(
const type_or_decl_base *l __attribute__((unused)),
846 const type_or_decl_base *r __attribute__((unused)))
849#define ABG_RETURN_EQUAL(l, r) \
853 notify_equality_failed(l, r); \
859#define ABG_RETURN_FALSE \
862 notify_equality_failed(l, r); \
866#define ABG_RETURN(value) \
869 if (value == false) \
870 notify_equality_failed(l, r); \
876#define ABG_RETURN_FALSE return false
877#define ABG_RETURN(value) return (value)
878#define ABG_RETURN_EQUAL(l, r) return ((l) == (r));
899 return dynamic_cast<T*
>(type);
916#if WITH_DEBUG_TYPE_CANONICALIZATION
936 if (env.priv_->use_canonical_type_comparison_)
940 ABG_RETURN_EQUAL(lc, rc);
949 if (l_hash != r_hash)
960 ABG_RETURN_EQUAL(lc, rc);
968 if (l_hash != r_hash)
991 bool result = l.priv_->comparison_started(l, r);
1031#define RETURN_TRUE_IF_COMPARISON_CYCLE_DETECTED(l, r) \
1034 if (is_comparison_cycle_detected(l, r)) \
1052 l.priv_->mark_as_being_compared(l, r);
1087 l.priv_->unmark_as_being_compared(l, r);
1133#define CACHE_AND_RETURN_COMPARISON_RESULT(value) \
1136 bool res = return_comparison_result(l, r, value); \
1137 l.get_environment().priv_->cache_type_comparison_result(l, r, res); \
1145#define CACHE_COMPARISON_RESULT_AND_RETURN(value) \
1148 l.get_environment().priv_->cache_type_comparison_result(l, r, value); \
1156const vector<type_base_wptr>&
1159 if (priv_->sorted_types_.empty())
1161 istring_type_base_wptrs_map_type::const_iterator i;
1162 vector<type_base_wptr>::const_iterator j;
1165 for (j = i->second.begin(); j != i->second.end(); ++j)
1166 priv_->sorted_types_.push_back(*j);
1169 for (j = i->second.begin(); j != i->second.end(); ++j)
1170 priv_->sorted_types_.push_back(*j);
1173 for (j = i->second.begin(); j != i->second.end(); ++j)
1174 priv_->sorted_types_.push_back(*j);
1177 for (j = i->second.begin(); j != i->second.end(); ++j)
1178 priv_->sorted_types_.push_back(*j);
1181 for (j = i->second.begin(); j != i->second.end(); ++j)
1182 priv_->sorted_types_.push_back(*j);
1184 type_name_comp comp;
1185 sort(priv_->sorted_types_.begin(), priv_->sorted_types_.end(), comp);
1188 return priv_->sorted_types_;
1207 const std::string& path,
1209 : priv_(new
priv(env))
1211 priv_->path_ = path;
1212 priv_->address_size_ = address_size;
1234 if (!priv_->global_scope_)
1236 priv_->global_scope_.reset
1238 priv_->global_scope_->set_translation_unit
1241 return priv_->global_scope_;
1249{
return priv_->types_;}
1256{
return priv_->types_;}
1263const vector<function_type_sptr>&
1265{
return priv_->live_fn_types_;}
1272{
return priv_->env_;}
1279{
return priv_->language_;}
1286{priv_->language_ = l;}
1299{
return priv_->path_;}
1310{priv_->path_ = a_path;}
1323{
return priv_->comp_dir_path_;}
1334{priv_->comp_dir_path_ = d;}
1343 if (priv_->abs_path_.empty())
1346 if (!priv_->path_.empty())
1348 if (!priv_->comp_dir_path_.empty())
1350 path = priv_->comp_dir_path_;
1353 path += priv_->path_;
1355 priv_->abs_path_ = path;
1358 return priv_->abs_path_;
1377{
return priv_->corp;}
1393{
return priv_->loc_mgr_;}
1401{
return priv_->loc_mgr_;}
1410 if (!priv_->global_scope_)
1420{
return priv_->address_size_;}
1427{priv_->address_size_= a;}
1443{
return priv_->is_constructed_;}
1459{priv_->is_constructed_ = f;}
1498 const_cast<translation_unit*
>(
this)->priv_->live_fn_types_.push_back(ftype);
1531translation_unit::~translation_unit()
1544 case translation_unit::LANG_UNKNOWN:
1545 return "LANG_UNKNOWN";
1546 case translation_unit::LANG_Cobol74:
1547 return "LANG_Cobol74";
1548 case translation_unit::LANG_Cobol85:
1549 return "LANG_Cobol85";
1550 case translation_unit::LANG_C89:
1552 case translation_unit::LANG_C99:
1554 case translation_unit::LANG_C11:
1556 case translation_unit::LANG_C17:
1558 case translation_unit::LANG_C23:
1560 case translation_unit::LANG_C:
1562 case translation_unit::LANG_C_plus_plus_03:
1563 return "LANG_C_plus_plus_03";
1564 case translation_unit::LANG_C_plus_plus_11:
1565 return "LANG_C_plus_plus_11";
1566 case translation_unit::LANG_C_plus_plus_14:
1567 return "LANG_C_plus_plus_14";
1568 case translation_unit::LANG_C_plus_plus_17:
1569 return "LANG_C_plus_plus_17";
1570 case translation_unit::LANG_C_plus_plus_20:
1571 return "LANG_C_plus_plus_20";
1572 case translation_unit::LANG_C_plus_plus_23:
1573 return "LANG_C_plus_plus_23";
1574 case translation_unit::LANG_C_plus_plus:
1575 return "LANG_C_plus_plus";
1576 case translation_unit::LANG_OCaml:
1577 return "LANG_OCaml";
1578 case translation_unit::LANG_Zig:
1580 case translation_unit::LANG_ObjC:
1582 case translation_unit::LANG_ObjC_plus_plus:
1583 return "LANG_ObjC_plus_plus";
1584 case translation_unit::LANG_D:
1586 case translation_unit::LANG_Go:
1588 case translation_unit::LANG_Rust:
1590 case translation_unit::LANG_Fortran77:
1591 return "LANG_Fortran77";
1592 case translation_unit::LANG_Fortran90:
1593 return "LANG_Fortran90";
1594 case translation_unit::LANG_Fortran95:
1595 return "LANG_Fortran95";
1596 case translation_unit::LANG_Fortran18:
1597 return "LANG_Fortran18";
1598 case translation_unit::LANG_Fortran23:
1599 return "LANG_Fortran23";
1600 case translation_unit::LANG_Ada83:
1601 return "LANG_Ada83";
1602 case translation_unit::LANG_Ada95:
1603 return "LANG_Ada95";
1604 case translation_unit::LANG_Ada2005:
1605 return "LANG_Ada2005";
1606 case translation_unit::LANG_Ada2012:
1607 return "LANG_Ada2012";
1608 case translation_unit::LANG_Pascal83:
1609 return "LANG_Pascal83";
1610 case translation_unit::LANG_Modula2:
1611 return "LANG_Modula2";
1612 case translation_unit::LANG_Java:
1614 case translation_unit::LANG_Kotlin:
1615 return "LANG_Kotlin";
1616 case translation_unit::LANG_C_sharp:
1617 return "LANG_C_sharp";
1618 case translation_unit::LANG_Python:
1619 return "LANG_Python";
1620 case translation_unit::LANG_Ruby:
1622 case translation_unit::LANG_PLI:
1624 case translation_unit::LANG_UPC:
1626 case translation_unit::LANG_Mips_Assembler:
1627 return "LANG_Mips_Assembler";
1628 case translation_unit::LANG_Assembly:
1629 return "LANG_Assembly";
1630 case translation_unit::LANG_Crystal:
1631 return "LANG_Crystal";
1632 case translation_unit::LANG_HIP:
1634 case translation_unit::LANG_Mojo:
1636 case translation_unit::LANG_GLSL:
1638 case translation_unit::LANG_GLSL_ES:
1639 return "LANG_GLSL_ES";
1640 case translation_unit::LANG_HLSL:
1642 case translation_unit::LANG_OpenCL_CPP:
1643 return "LANG_OpenCL_CPP";
1644 case translation_unit::LANG_CPP_for_OpenCL:
1645 return "LANG_CPP_for_OpenCL";
1646 case translation_unit::LANG_SYCL:
1648 case translation_unit::LANG_Odin:
1650 case translation_unit::LANG_P4:
1652 case translation_unit::LANG_Metal:
1653 return "LANG_Metal";
1654 case translation_unit::LANG_Move:
1656 case translation_unit::LANG_Hylo:
1660 return "LANG_UNKNOWN";
1672 if (l ==
"LANG_Cobol74")
1673 return translation_unit::LANG_Cobol74;
1674 else if (l ==
"LANG_Cobol85")
1675 return translation_unit::LANG_Cobol85;
1676 else if (l ==
"LANG_C89")
1677 return translation_unit::LANG_C89;
1678 else if (l ==
"LANG_C99")
1679 return translation_unit::LANG_C99;
1680 else if (l ==
"LANG_C11")
1681 return translation_unit::LANG_C11;
1682 else if (l ==
"LANG_C17")
1683 return translation_unit::LANG_C17;
1684 else if (l ==
"LANG_C23")
1685 return translation_unit::LANG_C23;
1686 else if (l ==
"LANG_C")
1687 return translation_unit::LANG_C;
1688 else if (l ==
"LANG_C_plus_plus_03")
1689 return translation_unit::LANG_C_plus_plus_03;
1690 else if (l ==
"LANG_C_plus_plus_11")
1691 return translation_unit::LANG_C_plus_plus_11;
1692 else if (l ==
"LANG_C_plus_plus_14")
1693 return translation_unit::LANG_C_plus_plus_14;
1694 else if (l ==
"LANG_C_plus_plus_17")
1695 return translation_unit::LANG_C_plus_plus_17;
1696 else if (l ==
"LANG_C_plus_plus_20")
1697 return translation_unit::LANG_C_plus_plus_20;
1698 else if (l ==
"LANG_C_plus_plus_23")
1699 return translation_unit::LANG_C_plus_plus_23;
1700 else if (l ==
"LANG_C_plus_plus")
1701 return translation_unit::LANG_C_plus_plus;
1702 else if (l ==
"LANG_OCaml")
1703 return translation_unit::LANG_OCaml;
1704 else if (l ==
"LANG_ObjC")
1705 return translation_unit::LANG_ObjC;
1706 else if (l ==
"LANG_ObjC_plus_plus")
1707 return translation_unit::LANG_ObjC_plus_plus;
1708 else if (l ==
"LANG_Zig")
1709 return translation_unit::LANG_Zig;
1710 else if (l ==
"LANG_Metal")
1711 return translation_unit::LANG_Metal;
1712 else if (l ==
"LANG_Fortran77")
1713 return translation_unit::LANG_Fortran77;
1714 else if (l ==
"LANG_Fortran90")
1715 return translation_unit::LANG_Fortran90;
1716 else if (l ==
"LANG_Fortran95")
1717 return translation_unit::LANG_Fortran95;
1718 else if (l ==
"LANG_Fortran18")
1719 return translation_unit::LANG_Fortran23;
1720 else if (l ==
"LANG_Ada83")
1721 return translation_unit::LANG_Ada83;
1722 else if (l ==
"LANG_Ada95")
1723 return translation_unit::LANG_Ada95;
1724 else if (l ==
"LANG_Ada2005")
1725 return translation_unit::LANG_Ada2005;
1726 else if (l ==
"LANG_Ada2012")
1727 return translation_unit::LANG_Ada2012;
1728 else if (l ==
"LANG_Pascal83")
1729 return translation_unit::LANG_Pascal83;
1730 else if (l ==
"LANG_Modula2")
1731 return translation_unit::LANG_Modula2;
1732 else if (l ==
"LANG_Java")
1733 return translation_unit::LANG_Java;
1734 else if (l ==
"LANG_Kotlin")
1735 return translation_unit::LANG_Kotlin;
1736 else if (l ==
"LANG_PLI")
1737 return translation_unit::LANG_PLI;
1738 else if (l ==
"LANG_UPC")
1739 return translation_unit::LANG_UPC;
1740 else if (l ==
"LANG_D")
1741 return translation_unit::LANG_D;
1742 else if (l ==
"LANG_Go")
1743 return translation_unit::LANG_Go;
1744 else if (l ==
"LANG_Rust")
1745 return translation_unit::LANG_Rust;
1746 else if (l ==
"LANG_Python")
1747 return translation_unit::LANG_Python;
1748 else if (l ==
"LANG_Ruby")
1749 return translation_unit::LANG_Ruby;
1750 else if (l ==
"LANG_Mips_Assembler")
1751 return translation_unit::LANG_Mips_Assembler;
1752 else if (l ==
"LANG_Assembly")
1753 return translation_unit::LANG_Assembly;
1754 else if (l ==
"LANG_Crystal")
1755 return translation_unit::LANG_Crystal;
1756 else if (l ==
"LANG_HIP")
1757 return translation_unit::LANG_HIP;
1758 else if (l ==
"LANG_C_sharp")
1759 return translation_unit::LANG_C_sharp;
1760 else if (l ==
"LANG_Mojo")
1761 return translation_unit::LANG_Mojo;
1762 else if (l ==
"LANG_GLSL")
1763 return translation_unit::LANG_GLSL;
1764 else if (l ==
"LANG_GLSL_ES")
1765 return translation_unit::LANG_GLSL_ES;
1766 else if (l ==
"LANG_HLSL")
1767 return translation_unit::LANG_HLSL;
1768 else if (l ==
"LANG_OpenCL_CPP")
1769 return translation_unit::LANG_OpenCL_CPP;
1770 else if (l ==
"LANG_CPP_for_OpenCL")
1771 return translation_unit::LANG_CPP_for_OpenCL;
1772 else if (l ==
"LANG_SYCL")
1773 return translation_unit::LANG_SYCL;
1774 else if (l ==
"LANG_Odin")
1775 return translation_unit::LANG_Odin;
1776 else if (l ==
"LANG_P4")
1777 return translation_unit::LANG_P4;
1778 else if (l ==
"LANG_Move")
1779 return translation_unit::LANG_Move;
1780 else if (l ==
"LANG_Hylo")
1781 return translation_unit::LANG_Hylo;
1783 return translation_unit::LANG_UNKNOWN;
1794 return (l == translation_unit::LANG_C89
1795 || l == translation_unit::LANG_C99
1796 || l == translation_unit::LANG_C11
1797 || l == translation_unit::LANG_C17
1798 || l == translation_unit::LANG_C23
1799 || l == translation_unit::LANG_C);
1810 return (l == translation_unit::LANG_C_plus_plus_03
1811 || l == translation_unit::LANG_C_plus_plus_11
1812 || l == translation_unit::LANG_C_plus_plus_14
1813 || l == translation_unit::LANG_C_plus_plus_20
1814 || l == translation_unit::LANG_C_plus_plus_23
1815 || l == translation_unit::LANG_C_plus_plus);
1825{
return l == translation_unit::LANG_Java;}
1835 return (l == translation_unit::LANG_Ada83
1836 || l == translation_unit::LANG_Ada95
1837 || l == translation_unit::LANG_Ada2005
1838 || l == translation_unit::LANG_Ada2012);
1851 if (l.get() == r.get())
1874struct elf_symbol::priv
1914 bool is_in_ksymtab_;
1917 bool is_suppressed_;
1932 is_in_ksymtab_(false),
1935 is_suppressed_(false)
1938 priv(
const environment& e,
1946 const elf_symbol::version& ve,
1968 is_common_ = type_ == COMMON_TYPE;
2002elf_symbol::elf_symbol(
const environment& e,
2078 elf_symbol_sptr sym(
new elf_symbol(e, i, s, n, t, b, d, c, ve, vi,
2080 sym->priv_->main_symbol_ = sym;
2139{
return priv_->env_;}
2146{
return priv_->index_;}
2160{
return priv_->name_;}
2169 priv_->id_string_.clear();
2177{
return priv_->type_;}
2191{
return priv_->size_;}
2198{priv_->size_ = size;}
2205{
return priv_->binding_;}
2212{priv_->binding_ = b;}
2219{
return priv_->version_;}
2227 priv_->version_ = v;
2228 priv_->id_string_.clear();
2237{priv_->visibility_ = v;}
2245{
return priv_->visibility_;}
2253{
return priv_->is_defined_;}
2261{priv_->is_defined_ = d;}
2314{
return priv_->is_in_ksymtab_;}
2329{
return priv_->crc_;}
2343{
return priv_->namespace_;}
2350{priv_->namespace_ = ns;}
2359{
return priv_->is_suppressed_;}
2398{
return priv_->main_symbol_.lock();}
2405{
return priv_->main_symbol_.lock();}
2419{
return priv_->next_alias_.lock();}
2439 a = a->get_next_alias())
2462 a && !a->is_main_symbol();
2463 a = a->get_next_alias())
2465 if (a->get_next_alias()->is_main_symbol())
2473 last_alias->priv_->next_alias_ = alias;
2476 priv_->next_alias_ = alias;
2506 a = a->get_next_alias())
2507 if (a->get_name() == name)
2517 priv_->main_symbol_ = new_main;
2519 a = a->get_next_alias())
2520 a->priv_->main_symbol_ = new_main;
2530{
return priv_->is_common_;}
2561{
return priv_->next_common_instance_.lock();}
2576 ABG_ASSERT(!common->has_other_common_instances());
2585 c = c->get_next_common_instance())
2590 last_common_instance = c;
2595 last_common_instance->priv_->next_common_instance_ = common;
2598 priv_->next_common_instance_ = common;
2618 if (priv_->id_string_.empty())
2630 priv_->id_string_ = s;
2633 return priv_->id_string_;
2650 a = a->get_next_alias())
2651 if (a->get_name() == name)
2668 a && a.get() != a->get_main_symbol().get();
2669 a = a->get_next_alias())
2670 if (textually_equals(*
this, *a))
2687 bool include_symbol_itself)
const
2691 if (include_symbol_itself)
2694 vector<elf_symbol_sptr> aliases;
2695 compute_aliases_for_elf_symbol(*
this, syms, aliases);
2696 if (!aliases.empty() && include_symbol_itself)
2699 for (vector<elf_symbol_sptr>::const_iterator i = aliases.begin();
2703 if (i != aliases.begin())
2705 result += (*i)->get_id_string();
2720 vector<elf_symbol_sptr> aliases;
2721 if (include_symbol_itself)
2726 a = a->get_next_alias())
2727 aliases.push_back(a);
2730 for (vector<elf_symbol_sptr>::const_iterator i = aliases.begin();
2734 if (i != aliases.begin())
2736 result += (*i)->get_id_string();
2756 name.clear(), ver.clear();
2758 string::size_type i =
id.find(
'@');
2759 if (i == string::npos)
2765 name =
id.substr(0, i);
2771 string::size_type j =
id.find(
'@', i);
2772 if (j == string::npos)
2799 bool are_equal = textually_equals(*
this, other);
2820 a && !a->is_main_symbol();
2821 a = a->get_next_alias())
2845 return *lhs == *rhs;
2871compute_aliases_for_elf_symbol(
const elf_symbol& sym,
2873 vector<elf_symbol_sptr>& aliases)
2877 for (; a && !a->is_main_symbol(); a = a->get_next_alias())
2878 aliases.push_back(a);
2880 for (string_elf_symbols_map_type::const_iterator i = symtab.begin();
2883 for (elf_symbols::const_iterator j = i->second.begin();
2884 j != i->second.end();
2889 s && !s->is_main_symbol();
2890 s = s->get_next_alias())
2891 aliases.push_back(s);
2894 s && !s->is_main_symbol();
2895 s = s->get_next_alias())
2897 aliases.push_back(*j);
2942 case elf_symbol::NOTYPE_TYPE:
2943 repr =
"unspecified symbol type";
2945 case elf_symbol::OBJECT_TYPE:
2946 repr =
"variable symbol type";
2948 case elf_symbol::FUNC_TYPE:
2949 repr =
"function symbol type";
2951 case elf_symbol::SECTION_TYPE:
2952 repr =
"section symbol type";
2954 case elf_symbol::FILE_TYPE:
2955 repr =
"file symbol type";
2957 case elf_symbol::COMMON_TYPE:
2958 repr =
"common data object symbol type";
2960 case elf_symbol::TLS_TYPE:
2961 repr =
"thread local data object symbol type";
2963 case elf_symbol::GNU_IFUNC_TYPE:
2964 repr =
"indirect function symbol type";
2968 std::ostringstream s;
2969 s <<
"unknown symbol type (" << (char)t <<
')';
2992 case elf_symbol::LOCAL_BINDING:
2993 repr =
"local binding";
2995 case elf_symbol::GLOBAL_BINDING:
2996 repr =
"global binding";
2998 case elf_symbol::WEAK_BINDING:
2999 repr =
"weak binding";
3001 case elf_symbol::GNU_UNIQUE_BINDING:
3002 repr =
"GNU unique binding";
3006 std::ostringstream s;
3007 s <<
"unknown binding (" << (
unsigned char) b <<
")";
3030 case elf_symbol::DEFAULT_VISIBILITY:
3031 repr =
"default visibility";
3033 case elf_symbol::PROTECTED_VISIBILITY:
3034 repr =
"protected visibility";
3036 case elf_symbol::HIDDEN_VISIBILITY:
3037 repr =
"hidden visibility";
3039 case elf_symbol::INTERNAL_VISIBILITY:
3040 repr =
"internal visibility";
3044 std::ostringstream s;
3045 s <<
"unknown visibility (" << (
unsigned char) v <<
")";
3067 t = elf_symbol::NOTYPE_TYPE;
3068 else if (s ==
"object-type")
3069 t = elf_symbol::OBJECT_TYPE;
3070 else if (s ==
"func-type")
3071 t = elf_symbol::FUNC_TYPE;
3072 else if (s ==
"section-type")
3073 t = elf_symbol::SECTION_TYPE;
3074 else if (s ==
"file-type")
3075 t = elf_symbol::FILE_TYPE;
3076 else if (s ==
"common-type")
3077 t = elf_symbol::COMMON_TYPE;
3078 else if (s ==
"tls-type")
3079 t = elf_symbol::TLS_TYPE;
3080 else if (s ==
"gnu-ifunc-type")
3081 t = elf_symbol::GNU_IFUNC_TYPE;
3099 if (s ==
"local-binding")
3100 b = elf_symbol::LOCAL_BINDING;
3101 else if (s ==
"global-binding")
3102 b = elf_symbol::GLOBAL_BINDING;
3103 else if (s ==
"weak-binding")
3104 b = elf_symbol::WEAK_BINDING;
3105 else if (s ==
"gnu-unique-binding")
3106 b = elf_symbol::GNU_UNIQUE_BINDING;
3124 if (s ==
"default-visibility")
3125 v = elf_symbol::DEFAULT_VISIBILITY;
3126 else if (s ==
"protected-visibility")
3127 v = elf_symbol::PROTECTED_VISIBILITY;
3128 else if (s ==
"hidden-visibility")
3129 v = elf_symbol::HIDDEN_VISIBILITY;
3130 else if (s ==
"internal-visibility")
3131 v = elf_symbol::INTERNAL_VISIBILITY;
3146{
return t == elf_symbol::FUNC_TYPE;}
3156{
return t == elf_symbol::OBJECT_TYPE;}
3160struct elf_symbol::version::priv
3166 : is_default_(false)
3169 priv(
const string& v,
3176elf_symbol::version::version()
3183elf_symbol::version::version(
const string& v,
3185 : priv_(new priv(v, is_default))
3189 : priv_(new priv(v.str(), v.is_default()))
3193elf_symbol::version::~version() =
default;
3198elf_symbol::version::operator
const string&()
const
3199{
return priv_->version_;}
3206{
return priv_->version_;}
3213{priv_->version_ = s;}
3220{
return priv_->is_default_;}
3227{priv_->is_default_ = f;}
3230elf_symbol::version::is_empty()
const
3231{
return str().empty();}
3240{
return str() == o.
str();}
3269struct dm_context_rel::priv
3272 size_t offset_in_bits_;
3275 priv(
bool is_static =
false)
3276 : is_laid_out_(!is_static),
3278 anonymous_data_member_()
3281 priv(
bool is_laid_out,
size_t offset_in_bits)
3282 : is_laid_out_(is_laid_out),
3283 offset_in_bits_(offset_in_bits),
3284 anonymous_data_member_()
3288dm_context_rel::dm_context_rel()
3293dm_context_rel::dm_context_rel(scope_decl* s,
3295 size_t offset_in_bits,
3298 : context_rel(s, a, is_static),
3299 priv_(new priv(is_laid_out, offset_in_bits))
3302dm_context_rel::dm_context_rel(scope_decl* s)
3308dm_context_rel::get_is_laid_out()
const
3309{
return priv_->is_laid_out_;}
3312dm_context_rel::set_is_laid_out(
bool f)
3313{priv_->is_laid_out_ = f;}
3316dm_context_rel::get_offset_in_bits()
const
3317{
return priv_->offset_in_bits_;}
3320dm_context_rel::set_offset_in_bits(
size_t o)
3321{priv_->offset_in_bits_ = o;}
3324dm_context_rel::operator==(
const dm_context_rel& o)
const
3326 if (!context_rel::operator==(o))
3329 return (priv_->is_laid_out_ == o.priv_->is_laid_out_
3330 && priv_->offset_in_bits_ == o.priv_->offset_in_bits_);
3334dm_context_rel::operator!=(
const dm_context_rel& o)
const
3345{
return priv_->anonymous_data_member_;}
3355{priv_->anonymous_data_member_ = anon_dm;}
3357dm_context_rel::~dm_context_rel()
3383{
return priv_->canonical_types_;}
3427 unsigned l1 = 0, l2 = 0, c1 = 0, c2 = 0;
3449 vector<type_base_sptr>& result)
3452 result.push_back(t);
3455 std::stable_sort(result.begin(), result.end(), comp);
3467const type_base_sptr&
3470 if (!priv_->void_type_)
3471 priv_->void_type_.reset(
new type_decl(*
this,
3474 return priv_->void_type_;
3486const type_base_sptr&
3489 if (!priv_->void_pointer_type_)
3492 return priv_->void_pointer_type_;
3505const type_base_sptr&
3508 if (!priv_->variadic_marker_type_)
3509 priv_->variadic_marker_type_.
3512 return priv_->variadic_marker_type_;
3521 static string variadic_parameter_type_name =
"variadic parameter type";
3522 return variadic_parameter_type_name;
3532{
return priv_->canonicalization_is_done_;}
3547 priv_->canonicalization_is_done_ = f;
3548 if (priv_->canonicalization_is_done_)
3559{
return priv_->canonicalization_started_;}
3568{priv_->canonicalization_started_ = f;}
3592{
return priv_->decl_only_class_equals_definition_;}
3617{priv_->decl_only_class_equals_definition_ = f;}
3722{
return const_cast<environment*
>(
this)->priv_->string_pool_.create_string(s);}
3729{
return priv_->config_;}
3739{
return priv_->analyze_exported_interfaces_only_.has_value();}
3752{priv_->analyze_exported_interfaces_only_ = f;}
3765{
return priv_->analyze_exported_interfaces_only_.value_or(
false);}
3767#ifdef WITH_DEBUG_SELF_COMPARISON
3780environment::set_self_comparison_debug_input(
const corpus_sptr& c)
3782 self_comparison_debug_is_on(
true);
3783 if (priv_->first_self_comparison_corpus_.expired())
3784 priv_->first_self_comparison_corpus_ = c;
3785 else if (priv_->second_self_comparison_corpus_.expired()
3786 && c.get() != corpus_sptr(priv_->first_self_comparison_corpus_).get())
3787 priv_->second_self_comparison_corpus_ = c;
3800environment::get_self_comparison_debug_inputs(corpus_sptr& first_corpus,
3801 corpus_sptr& second_corpus)
3803 first_corpus = priv_->first_self_comparison_corpus_.lock();
3804 second_corpus = priv_->second_self_comparison_corpus_.lock();
3811environment::self_comparison_debug_is_on(
bool f)
3812{priv_->self_comparison_debug_on_ = f;}
3819environment::self_comparison_debug_is_on()
const
3820{
return priv_->self_comparison_debug_on_;}
3823#ifdef WITH_DEBUG_TYPE_CANONICALIZATION
3830environment::debug_type_canonicalization_is_on(
bool flag)
3831{priv_->debug_type_canonicalization_ = flag;}
3839environment::debug_type_canonicalization_is_on()
const
3840{
return priv_->debug_type_canonicalization_;}
3848environment::debug_die_canonicalization_is_on(
bool flag)
3849{priv_->debug_die_canonicalization_ = flag;}
3857environment::debug_die_canonicalization_is_on()
const
3858{
return priv_->debug_die_canonicalization_;}
3874const vector<type_base_sptr>*
3901 if (!types ||index >= types->size())
3903 return (*types)[index].get();
3906#ifdef WITH_DEBUG_SELF_COMPARISON
3916const unordered_map<string, uintptr_t>&
3917environment::get_type_id_canonical_type_map()
const
3918{
return priv_->get_type_id_canonical_type_map();}
3929unordered_map<string, uintptr_t>&
3930environment::get_type_id_canonical_type_map()
3931{
return priv_->get_type_id_canonical_type_map();}
3946const unordered_map<uintptr_t, string>&
3947environment::get_pointer_type_id_map()
const
3948{
return priv_->get_pointer_type_id_map();}
3963unordered_map<uintptr_t, string>&
3964environment::get_pointer_type_id_map()
3965{
return priv_->get_pointer_type_id_map();}
3983environment::get_type_id_from_pointer(uintptr_t ptr)
const
3984{
return priv_->get_type_id_from_pointer(ptr);}
4002environment::get_type_id_from_type(
const type_base *t)
const
4003{
return priv_->get_type_id_from_type(t);}
4020environment::get_canonical_type_from_type_id(
const char* type_id)
const
4021{
return priv_->get_canonical_type_from_type_id(type_id);}
4035 (
static_cast<unsigned>(l) |
static_cast<unsigned>(r));
4055 (
static_cast<unsigned>(l) &
static_cast<unsigned>(r));
4076 :priv_(new
priv(e, k))
4092{
return priv_->is_artificial_;}
4104{priv_->is_artificial_ = f;}
4115{
return priv_->kind();}
4135{
return priv_->rtti_;}
4144{
return priv_->rtti_;}
4156 priv_->type_or_decl_ptr_ = t;
4158 priv_->type_or_decl_ptr_ = d;
4181{
return priv_->type_or_decl_ptr_;}
4192{
return priv_->hash_value_;}
4195type_or_decl_base::set_hash_value(
hash_t h)
const
4196{priv_->set_hash_value(h);}
4203{
return priv_->env_;}
4221{priv_->artificial_location_ = l;}
4239{
return priv_->artificial_location_;}
4247 return (priv_->artificial_location_
4248 && priv_->artificial_location_.get_is_artificial());
4279{priv_->translation_unit_ = tu;}
4288{
return priv_->translation_unit_;}
4320 *dr =
dynamic_cast<const decl_base*
>(r);
4329 *tr =
dynamic_cast<const type_base*
>(r);
4374struct decl_base::priv
4376 bool in_pub_sym_tab_;
4404 decl_base_sptr declaration_;
4406 decl_base* naked_definition_of_declaration_;
4407 bool is_declaration_only_;
4411 : in_pub_sym_tab_(false),
4412 is_anonymous_(true),
4414 visibility_(VISIBILITY_DEFAULT),
4415 naked_definition_of_declaration_(),
4416 is_declaration_only_(false)
4419 priv(interned_string name, interned_string linkage_name,
visibility vis)
4420 : in_pub_sym_tab_(false),
4423 qualified_name_(name),
4424 linkage_name_(linkage_name),
4426 naked_definition_of_declaration_(),
4427 is_declaration_only_(false)
4429 is_anonymous_ = name_.
empty();
4454 const string& linkage_name,
4457 priv_(new priv(e.intern(name), e.intern(linkage_name), vis))
4481 priv_(new priv(name, linkage_name, vis))
4508{
return priv_->qualified_name_;}
4517{priv_->qualified_name_.clear();}
4524{priv_->qualified_name_ = n;}
4537{
return priv_->temporary_qualified_name_;}
4551{priv_->temporary_qualified_name_ = n;}
4558{
return priv_->context_;}
4565{
return priv_->context_;}
4569{priv_->context_ = c;}
4578{
return priv_->in_pub_sym_tab_;}
4586{priv_->in_pub_sym_tab_ = f;}
4606{
return priv_->location_;}
4648 priv_->location_ = l;
4658 priv_->is_anonymous_ = n.empty();
4669{
return priv_->is_anonymous_;}
4679{priv_->is_anonymous_ = f;}
4716{
return priv_->naming_typedef_;}
4744 &&
is_type(
this)->get_naked_canonical_type() ==
nullptr);
4746 priv_->naming_typedef_ = t;
4753 update_qualified_name(
this);
4761{
return priv_->linkage_name_;}
4770 priv_->linkage_name_ = env.
intern(m);
4778{
return priv_->visibility_;}
4785{priv_->visibility_ = v;}
4794 if (priv_->context_)
4795 return priv_->context_->get_scope();
4805{
return priv_->qualified_parent_name_;}
4812{
return priv_->name_;}
4847 bool qualified_name)
const
4851 && has_generic_anonymous_internal_type_name(
this))
4862 string name = get_generic_anonymous_internal_type_name(
this);
4898 if (priv_->internal_cached_repr_.empty())
4903 return priv_->internal_cached_repr_;
4906 if (priv_->cached_repr_.empty())
4912 return priv_->cached_repr_;
4932{
return priv_->qualified_name_;}
4946{
return priv_->scoped_name_;}
4954{
return priv_->declaration_;}
4963 if (d && d->get_is_declaration_only())
4964 priv_->declaration_ = d;
4974{
return priv_->definition_of_declaration_.lock();}
4990{
return priv_->naked_definition_of_declaration_;}
4997{
return priv_->is_declaration_only_;}
5007 bool update_types_lookup_map = !f && priv_->is_declaration_only_;
5009 priv_->is_declaration_only_ = f;
5011 if (update_types_lookup_map)
5014 scope_decl::declarations::iterator i;
5015 if (s->find_iterator_for_member(
this, i))
5025 return static_cast<change_kind>(
static_cast<unsigned>(l)
5026 |
static_cast<unsigned>(r));
5032 return static_cast<change_kind>(
static_cast<unsigned>(l)
5033 &
static_cast<unsigned>(r));
5080 bool member_types_or_functions =
5084 if (member_types_or_functions)
5093 la = r1->get_access_specifier();
5094 ra = r2->get_access_specifier();
5095 r1->set_access_specifier(no_access);
5096 r2->set_access_specifier(no_access);
5099 bool rels_are_different = *r1 != *r2;
5101 if (member_types_or_functions)
5104 r1->set_access_specifier(la);
5105 r2->set_access_specifier(ra);
5108 if (rels_are_different)
5143 if (!l_linkage_name.
empty() && !r_linkage_name.
empty())
5145 if (l_linkage_name != r_linkage_name)
5185 bool decls_are_same = (ln == rn);
5187 if (!decls_are_same)
5210{
return equals(*
this, other, 0);}
5249 if (!priv_->context_)
5252 priv_->context_->set_scope(scope);
5270 case decl_base::VISIBILITY_NONE:
5273 case decl_base::VISIBILITY_DEFAULT:
5276 case decl_base::VISIBILITY_PROTECTED:
5279 case decl_base::VISIBILITY_HIDDEN:
5282 case decl_base::VISIBILITY_INTERNAL:
5302 case decl_base::BINDING_NONE:
5305 case decl_base::BINDING_LOCAL:
5308 case decl_base::BINDING_GLOBAL:
5311 case decl_base::BINDING_WEAK:
5334 if (l.get() == r.get())
5370 if (l.get() == r.get())
5456{
return dynamic_pointer_cast<scope_decl>(d);}
5522 return c->get_access_specifier();
5552 c->set_access_specifier(a);
5582 return c->get_is_static();
5724 var_decl_sptr first = *klass->get_non_static_data_members().begin();
5745 if (!klass ||!data_member)
5748 for (class_or_union::data_members::const_iterator it =
5752 if (**it == *data_member)
5821 bool result =
false;
5839 dms[member->get_name()] = member;
6048 return class_or_union_sptr();
6057const class_or_union_sptr
6062 if (cou->get_is_anonymous())
6065 return class_or_union_sptr();
6074const class_or_union_sptr
6079 return class_or_union_sptr();
6088const class_or_union_sptr
6103 return class_or_union_sptr();
6128 for (
auto anon_dm_m : cl->get_non_static_data_members())
6175 ctxt_rel->set_offset_in_bits(o);
6190 return ctxt_rel->get_offset_in_bits();
6280 const var_decl *containing_anonymous_data_member =
6283 uint64_t containing_anonymous_data_member_offset = 0;
6284 if (containing_anonymous_data_member)
6285 containing_anonymous_data_member_offset =
6288 return (ctxt_rel->get_offset_in_bits()
6290 containing_anonymous_data_member_offset);
6318 type_base_sptr t = v->get_type();
6321 return t->get_size_in_bits();
6335 ctxt_rel->set_is_laid_out(l);
6350 return ctxt_rel->get_is_laid_out();
6611set_member_function_vtable_offset(
function_decl& f, ssize_t s)
6633{
return set_member_function_vtable_offset(*f, s);}
6652 return ctxt->is_virtual();
6679set_member_function_is_virtual(
function_decl& f,
bool is_virtual)
6689 ctxt->is_virtual(is_virtual);
6702 set_member_function_is_virtual(*fn, is_virtual);
6721 set_member_function_vtable_offset(fn, voffset);
6722 set_member_function_is_virtual(fn, is_virtual);
6753 set_member_function_vtable_offset(fn, voffset);
6754 set_member_function_is_virtual(fn, is_virtual);
6791 if (!cl->get_canonical_type())
6797 type_base_sptr t = type;
6808 ty->get_size_in_bits(),
6809 ty->get_alignment_in_bits(),
6810 ty->get_location()));
6818 ty->get_size_in_bits(),
6819 ty->get_alignment_in_bits(),
6820 ty->get_location()));
6829 ty->get_location()));
6835 t.reset(
new array_type_def(p, ty->get_subranges(), ty->get_location()));
6840 for (function_decl::parameters::const_iterator i =
6841 ty->get_parameters().begin();
6842 i != ty->get_parameters().end();
6853 p->get_variadic_marker(),
6854 p->get_is_artificial()));
6855 parm.push_back(stripped);
6860 parm, ty->get_is_const(),
6861 ty->get_size_in_bits(),
6862 ty->get_alignment_in_bits()));
6867 for (function_decl::parameters::const_iterator i =
6868 ty->get_parameters().begin();
6869 i != ty->get_parameters().end();
6880 p->get_variadic_marker(),
6881 p->get_is_artificial()));
6882 parm.push_back(stripped);
6887 ty->get_size_in_bits(),
6888 ty->get_alignment_in_bits()));
6891 if (!t->get_translation_unit())
6892 t->set_translation_unit(type->get_translation_unit());
6897 return t->get_canonical_type() ? t->get_canonical_type() : t;
6920 decl_base_sptr result = t;
6921 type_base_sptr u = t->get_underlying_type();
6924 if ((t->get_cv_quals() & qualified_type_def::CV_CONST
6926 || (t->get_cv_quals() & qualified_type_def::CV_CONST
6928 || t->get_cv_quals() == qualified_type_def::CV_NONE)
6974static qualified_type_def_sptr
6975strip_redundant_quals_from_underyling_types(
const qualified_type_def_sptr& t,
6984 qualified_type_def_sptr underlying_qualified_type =
6992 currated_quals &= ~redundant_quals;
6993 t->set_cv_quals(currated_quals);
6997 redundant_quals |= currated_quals;
6999 qualified_type_def_sptr result = t;
7000 if (underlying_qualified_type)
7004 strip_redundant_quals_from_underyling_types(underlying_qualified_type,
7038strip_redundant_quals_from_underyling_types(
const qualified_type_def_sptr& t)
7044 strip_redundant_quals_from_underyling_types(t, redundant_quals);
7071 return t->get_underlying_type();
7125 return t->get_pointed_to_type();
7181 return t->get_pointed_to_type();
7306 if (t->get_cv_quals() == qualified_type_def::CV_CONST)
7339 return q->get_underlying_type();
7388 type_base_sptr type = t;
7411 type_base_sptr typ = type;
7473 bool peel_qual_type)
7512 bool peel_qual_type)
7550 vector<array_type_def::subrange_sptr> subranges;
7552 for (vector<array_type_def::subrange_sptr>::const_iterator i =
7553 array->get_subranges().begin();
7554 i != array->get_subranges().end();
7560 (*i)->get_lower_bound(),
7561 (*i)->get_upper_bound(),
7562 (*i)->get_underlying_type(),
7563 (*i)->get_location(),
7564 (*i)->get_language()));
7565 subrange->is_non_finite((*i)->is_non_finite());
7568 subranges.push_back(subrange);
7573 subranges, array->get_location()));
7596 (
new typedef_decl(t->get_name(), t->get_underlying_type(),
7597 t->get_location(), t->get_linkage_name(),
7598 t->get_visibility()));
7614qualified_type_def_sptr
7620 qualified_type_def_sptr result
7622 t->get_cv_quals(), t->get_location()));
7634static type_base_sptr
7635clone_typedef_array_qualified_type(type_base_sptr type)
7641 type_base_sptr result;
7650 return type_base_sptr();
7673 type_base_sptr result = clone_typedef_array_qualified_type(t);
7676 type_base_sptr subtree;
7680 clone_typedef_array_qualified_type(type->get_underlying_type());
7684 type->set_underlying_type(subtree);
7690 clone_typedef_array_qualified_type(type->get_element_type());
7694 type->set_element_type(subtree);
7704 clone_typedef_array_qualified_type(t->get_underlying_type());
7711 t->set_underlying_type (s);
7720 clone_typedef_array_qualified_type(t->get_underlying_type());
7727 t->set_underlying_type(s);
7735 type_base_sptr e = t->get_element_type();
7739 clone_typedef_array_qualified_type(e);
7745 t->set_element_type(s);
7764 ::qualified_name_setter setter;
7772update_qualified_name(decl_base_sptr d)
7773{
return update_qualified_name(d.get());}
7793{
return reinterpret_cast<size_t>(l);}
7795struct scope_decl::priv
7804 bool clear_sorted_member_types_cache_ =
false;
7841{
return priv_->canonical_types_;}
7859 if (priv_->sorted_canonical_types_.empty())
7861 for (canonical_type_sptr_set_type::const_iterator e =
7865 priv_->sorted_canonical_types_.push_back(*e);
7868 std::stable_sort(priv_->sorted_canonical_types_.begin(),
7869 priv_->sorted_canonical_types_.end(),
7872 return priv_->sorted_canonical_types_;
7882{
return priv_->members_;}
7891{
return priv_->members_;}
7902 if (priv_->sorted_members_.empty())
7907 priv_->sorted_members_.push_back(*i);
7909 std::stable_sort(priv_->sorted_members_.begin(),
7910 priv_->sorted_members_.end(),
7913 return priv_->sorted_members_;
7928 if (t->get_is_anonymous())
7946 if (t->get_is_anonymous())
7964 if (t->get_is_anonymous())
7975{
return priv_->member_scopes_;}
7982{
return priv_->member_scopes_;}
8004maybe_set_translation_unit(
const decl_base_sptr& decl,
8021 decl->set_translation_unit(tu);
8038 member->set_scope(
this);
8039 priv_->members_.push_back(member);
8042 priv_->member_types_.push_back(
is_type(member));
8043 priv_->clear_sorted_member_types_cache_ =
true;
8047 priv_->member_scopes_.push_back(m);
8049 update_qualified_name(member);
8052 maybe_set_translation_unit(member, tu);
8064{
return priv_->member_types_;}
8079 return type_base_sptr();
8089 declarations::iterator before)
8095 priv_->member_types_.push_back(t);
8096 priv_->clear_sorted_member_types_cache_=
true;
8132 for (
auto i = priv_->member_types_.begin();
8133 i != priv_->member_types_.end();
8138 priv_->member_types_.erase(i);
8151 if (priv_->clear_sorted_member_types_cache_)
8153 priv_->sorted_member_types_.clear();
8154 priv_->clear_sorted_member_types_cache_ =
false;
8157 if (priv_->sorted_member_types_.empty())
8159 unordered_set<type_base_sptr> canonical_pointer_types;
8163 priv_->sorted_member_types_.push_back(t);
8164 else if (
auto c = t->get_canonical_type())
8165 canonical_pointer_types.insert(c);
8167 canonical_pointer_types.insert(t);
8170 for (
auto t : canonical_pointer_types)
8171 priv_->sorted_member_types_.push_back(t);
8174 std::stable_sort(priv_->sorted_member_types_.begin(),
8175 priv_->sorted_member_types_.end(),
8181 priv_->clear_sorted_member_types_cache_ =
true;
8183 return priv_->sorted_member_types_;
8199 declarations::iterator before)
8203 member->set_scope(
this);
8204 priv_->members_.insert(before, member);
8207 priv_-> member_scopes_.push_back(m);
8209 update_qualified_name(member);
8212 maybe_set_translation_unit(member, tu);
8225 for (declarations::iterator i = priv_->members_.begin();
8226 i != priv_->members_.end();
8231 priv_->members_.erase(i);
8241 for (scopes::iterator i = priv_->member_scopes_.begin();
8242 i != priv_->member_scopes_.end();
8247 priv_->member_scopes_.erase(i);
8253 member->set_scope(
nullptr);
8254 member->set_translation_unit(
nullptr);
8281 if (!l.decl_base::operator==(r))
8290 scope_decl::declarations::const_iterator i, j;
8332 return equals(*
this, *other, 0);
8347 if (l.get() == r.get())
8373 declarations::iterator& i)
8388 if ((*it).get() == decl)
8408 declarations::iterator& i)
8425 if (v.visit_begin(
this))
8428 for (scope_decl::declarations::const_iterator i =
8432 if (!(*i)->traverse(v))
8436 return v.visit_end(
this);
8439scope_decl::~scope_decl()
8455 if (scope && decl && !decl->
get_scope())
8495 scope_decl::declarations::iterator before,
8498 if (scope && decl && !decl->
get_scope())
8517 scope_decl::declarations::iterator before,
8527 | ABSTRACT_DECL_BASE
8528 | ABSTRACT_SCOPE_DECL),
8531 translation_unit_(tu)
8533 runtime_type_instance(
this);
8552 return scope ?
dynamic_cast<global_scope*
> (scope) : 0;
8659 if (cv_quals & qualified_type_def::CV_RESTRICT)
8661 if (cv_quals & qualified_type_def::CV_CONST)
8667 if (cv_quals & qualified_type_def::CV_VOLATILE)
8719{
return get_name(tod.get(), qualified);}
8737 string qualified_name;
8741 if (qualified_name.empty())
8742 qualified_name = name;
8744 qualified_name = qualified_name +
"::" + name;
8746 return qualified_name;
8781 location loc = decl->get_location();
8785 if (c->get_is_declaration_only() && c->get_definition_of_declaration())
8788 loc = c->get_location();
8846has_generic_anonymous_internal_type_name(
const decl_base *d)
8863static interned_string
8864get_generic_anonymous_internal_type_name(
const decl_base *d)
8866 ABG_ASSERT(has_generic_anonymous_internal_type_name(d));
8868 const environment&env = d->get_environment();
8870 interned_string result;
8903get_internal_real_type_name(
const type_base* t)
8913 name = int_type.to_string(
true);
8956 r += get_generic_anonymous_internal_type_name(d);
8966 return env.
intern(get_internal_real_type_name(t));
8975 internal, qualified));
9014 bool qualified,
bool internal)
9017 string tn =
get_type_name(pointed_to_type, qualified, internal);
9036 bool lvalue_reference,
9037 bool qualified,
bool internal)
9041 string name =
get_type_name(pointed_to_type, qualified, internal);
9042 if (lvalue_reference)
9067 bool qualified,
bool internal)
9069 const environment& env = underlying_type->get_environment();
9072 string name =
get_type_name(underlying_type, qualified, internal);
9074 if (quals_repr.empty() && internal)
9086 if (!quals_repr.empty())
9095 name = quals_repr +
" " + name;
9152 std::ostringstream o;
9161 stream_pretty_representation_of_fn_parms(fn_type, o,
9164 return env.
intern(o.str());
9183 c->get_exported_decls_builder();
9184 if (b->fn_id_maps_to_several_fns(fn))
9240 std::ostringstream o;
9259 o <<
" (" << class_type->get_qualified_name(internal) <<
"::*) ";
9260 stream_pretty_representation_of_fn_parms(fn_type, o,
9264 return env.
intern(o.str());
9430 std::ostringstream o;
9448 std::ostringstream o;
9503 const string& indent,
9506 bool qualified_names)
9509 string local_indent =
" ";
9514 if (!internal && clazz->is_struct())
9520 repr = indent +
"union";
9553 for (class_or_union::data_members::const_iterator dm = dmems.begin();
9557 if (dm != dmems.begin())
9562 real_indent =
"\n" + indent + local_indent;
9569 real_indent, one_line, internal, qualified_names);
9574 if (dm != dmems.begin())
9575 repr += real_indent;
9576 repr += (*dm)->get_pretty_representation(internal,
9581 real_indent+ (*dm)->get_pretty_representation(internal,
9590 repr += indent +
"}";
9618 const string& indent,
9621 bool qualified_names)
9625 internal, qualified_names);
9647 const string& indent,
9650 bool qualified_names)
9679 const string& indent,
bool one_line,
9680 bool qualified_names)
9683 std::ostringstream o;
9684 string local_indent =
" ";
9686 repr = indent +
"enum ";
9689 o << (qualified_names
9703 o << enumerator.get_name() +
"=" << enumerator.get_value() <<
", ";
9707 o <<
"\n" + indent <<
"}";
9738 const string& indent,
bool one_line,
9739 bool qualified_names)
9745 one_line, qualified_names);
9770 const string& indent,
bool one_line,
9771 bool qualified_names)
9800 const string& indent,
9803 bool qualified_name)
9809 internal, qualified_name);
9838 std::ostringstream o;
9853 o <<
" :" << std::endl;
9857 if (b->get_is_virtual())
9859 o << b->get_base_class()->get_qualified_name()
9863 o << std::hex << *h << std::dec;
9874 <<
" // translation unit: "
9879 <<
" // @: " << std::hex <<
is_type(c)
9885 o << std::hex << *h << std::dec;
9895 << member_type->get_pretty_representation(
false,
9898 if (member_type->get_canonical_type())
9900 o <<
" // uses canonical type: '@"
9901 << std::hex << member_type->get_canonical_type().get() <<
"'";
9904 o << std::hex << *h << std::dec;
9924 if (t && t->get_canonical_type())
9925 o <<
" // uses canonical type '@"
9926 << std::hex << t->get_canonical_type().get() <<
"'";
9931 o << std::hex << *h << std::dec;
9942 o <<
" // virtual member functions\n\n";
9951 o << std::hex << *h << std::dec;
9954 o <<
";" << std::endl;
9958 o <<
"};" << std::endl;
9964 string name = e->get_qualified_name();
9965 std::ostringstream o;
9966 o <<
"enum " << name
9968 << e->get_underlying_type()->get_pretty_representation(
false,
9972 <<
" // size in bits: " << e->get_size_in_bits() <<
"\n"
9973 <<
" // is-declaration-only: " << e->get_is_declaration_only() <<
"\n"
9975 <<
" // translation unit: "
9976 << e->get_translation_unit()->get_absolute_path() <<
"\n"
9977 <<
" // @: " << std::hex <<
is_type(e)
9978 <<
", @canonical: " << e->get_canonical_type().get() << std::dec <<
"\n"
9983 o << std::hex << *h << std::dec;
9989 for (
const auto &enom : e->get_enumerators())
9990 o <<
" " << enom.get_name() <<
" = " << enom.get_value() <<
",\n";
9998 std::ostringstream o;
9999 o << t->get_pretty_representation(
true,
10006 return artifact->get_pretty_representation(
true,
10105 return const_cast<type_base*
>(artifact);
10122 return const_cast<decl_base*
>(artifact);
10152debug_comp_vec(
const vector<const type_base*>& vect, std::ostringstream& o)
10154 for (
auto t : vect)
10156 o <<
"|" << t->get_pretty_representation()
10157 <<
"@" << std::hex << t << std::dec;
10169print_comp_stack(
const environment& env)
10171 std::ostringstream o;
10172 o <<
"left-operands: ";
10173 debug_comp_vec(env.priv_->left_type_comp_operands_, o);
10174 o <<
"\n" <<
"right-operands: ";
10175 debug_comp_vec(env.priv_->right_type_comp_operands_, o);
10188 std::cerr << print_comp_stack(env);
10189 std::cerr << std::endl;
10224{
return dynamic_cast<const decl_base*
>(t);}
10242{
return dynamic_pointer_cast<decl_base>(t);}
10263 || (fc->get_qualified_name() != sc->get_qualified_name())
10264 || (fc->get_size_in_bits() != sc->get_size_in_bits())
10265 || (fc->get_data_members().size() != sc->get_data_members().size()))
10272 for (
auto f_decl_it = fc->get_data_members().begin(),
10273 s_decl_it = sc->get_data_members().begin();
10274 (f_decl_it != fc->get_data_members().end()
10275 && s_decl_it != sc->get_data_members().end());
10276 ++f_decl_it, ++s_decl_it)
10279 type_base_sptr dm1_type = dm1->get_type(), dm2_type = dm2->get_type();
10281 if (*dm1_type != *dm2_type
10287 for (
auto f_bs_it = fc->get_base_specifiers().begin(),
10288 s_bs_it = sc->get_base_specifiers().end();
10289 (f_bs_it != fc->get_base_specifiers().end()
10290 && s_bs_it != sc->get_base_specifiers().end());
10291 ++f_bs_it, ++s_bs_it)
10294 if ((f_bs->get_is_virtual() != s_bs->get_is_virtual())
10295 || (f_bs->get_offset_in_bits() != s_bs->get_offset_in_bits()))
10298 class_decl_sptr fb = f_bs->get_base_class(), sb = s_bs->get_base_class();
10303 if (fc->has_vtable() != sc->has_vtable())
10307 if (fc->has_vtable())
10309 if (fc->get_virtual_mem_fns().size() > sc->get_virtual_mem_fns().size())
10313 for (
auto it1 = fc->get_virtual_mem_fns().begin(),
10314 it2 = sc->get_virtual_mem_fns().begin();
10315 (it1 != fc->get_virtual_mem_fns().end()
10316 && it2 != sc->get_virtual_mem_fns().end());
10319 method_decl_sptr method1 = *it1;
10320 method_decl_sptr method2 = *it2;
10325 method2->get_type()))
10353 if (!type1 || !type2)
10356 if (type1 == type2 || *type1 == *type2)
10362 if (t1 && t2 && *t1 == *t2)
10386 type_base_sptr e1 = a1->get_element_type();
10387 type_base_sptr e2 = a2->get_element_type();
10391 if ((a1->get_size_in_bits() != a2->get_size_in_bits())
10392 || (a1->get_dimension_count() != a2->get_dimension_count())
10404 fn_type2->get_return_type()))
10411 if (fn_type1->get_parameters().size()
10412 != fn_type2->get_parameters().size())
10415 for (
auto p1 = fn_type1->get_first_non_implicit_parm(),
10416 p2 = fn_type2->get_first_non_implicit_parm();
10417 (p1 != fn_type1->get_parameters().end()
10418 && p2 != fn_type2->get_parameters().end());
10421 (*p2)->get_type()))
10445 const decl_base_sptr d2)
10603 const string& name)
10608 if (!containing_class_or_union)
10625{
return (decl &&
dynamic_cast<template_decl*
>(decl->get_scope()));}
10635 return (decl && (dynamic_pointer_cast<type_tparameter>(decl)
10636 || dynamic_pointer_cast<non_type_tparameter>(decl)
10637 || dynamic_pointer_cast<template_tparameter>(decl)));
10667{
return dynamic_pointer_cast<function_decl>(d);}
10690{
return dynamic_pointer_cast<function_decl::parameter>(tod);}
10701 if (d && (d->
kind() & type_or_decl_base::ABSTRACT_DECL_BASE))
10703 if (!(d->
kind() & type_or_decl_base::ABSTRACT_TYPE_BASE))
10729{
return dynamic_pointer_cast<decl_base>(d);}
10751{
return dynamic_pointer_cast<decl_base>(t);}
10761 if (
dynamic_cast<const type_base*
>(&tod))
10774 if (t && (t->
kind() & type_or_decl_base::ABSTRACT_TYPE_BASE))
10788{
return dynamic_pointer_cast<type_base>(tod);}
10820 if (!cou->get_naming_typedef())
10862{
return dynamic_cast<const type_decl*
>(t);}
10870{
return dynamic_pointer_cast<type_decl>(t);}
10964{
return dynamic_pointer_cast<typedef_decl>(t);}
11045{
return dynamic_pointer_cast<enum_type_decl>(d);}
11099 if (t->
kind() & type_or_decl_base::CLASS_TYPE)
11113{
return dynamic_pointer_cast<class_decl>(d);}
11135 if (array->is_non_finite())
11205 if (array->get_subranges().size() == 1
11206 && array->get_subranges()[0]->get_length() == 1)
11276 return klass->get_is_declaration_only();
11325shared_ptr<class_or_union>
11327{
return dynamic_pointer_cast<class_or_union>(t);}
11356 const class_or_union_sptr& second)
11386{
return dynamic_pointer_cast<union_decl>(t);}
11400 bool look_through_qualifiers)
11406 if (look_through_qualifiers)
11424 bool look_through_qualifiers)
11426 type_base_sptr type =
is_type(t);
11427 if (look_through_qualifiers)
11429 return dynamic_pointer_cast<pointer_type_def>(type);
11572 bool look_through_qualifiers)
11578 if (look_through_qualifiers)
11595 bool look_through_qualifiers)
11599 if (look_through_qualifiers)
11616 bool look_through_qualifiers)
11618 type_base_sptr type =
is_type(t);
11619 if (look_through_qualifiers)
11621 return dynamic_pointer_cast<reference_type_def>(type);
11632 bool look_through_qualifiers)
11635 if (look_through_qualifiers)
11652 bool look_through_qualifiers)
11654 type_base_sptr type =
is_type(t);
11655 if (look_through_qualifiers)
11657 return dynamic_pointer_cast<ptr_to_mbr_type>(type);
11731const type_base_sptr
11734 type_base_sptr nil;
11738 if (t->get_environment().get_void_pointer_type().get() == t.get())
11767qualified_type_def_sptr
11769{
return dynamic_pointer_cast<qualified_type_def>(t);}
11779{
return dynamic_pointer_cast<function_type>(t);}
11809{
return dynamic_pointer_cast<method_type>(t);}
11889 decl_base_sptr decl;
11896 while (decl->get_is_declaration_only()
11897 && decl->get_definition_of_declaration())
11898 decl = decl->get_definition_of_declaration();
11965 decl_base_sptr d =
is_decl(t);
11990{
return dynamic_pointer_cast<var_decl>(decl);}
11999{
return dynamic_pointer_cast<namespace_decl>(d);}
12033 && dynamic_pointer_cast<function_decl>(decl)
12044 bool look_through_qualifiers)
12048 if (look_through_qualifiers)
12060 bool look_through_qualifiers)
12062 type_base_sptr t =
is_type(type);
12064 if (look_through_qualifiers)
12066 return dynamic_pointer_cast<array_type_def>(t);
12075qualified_type_def_sptr
12079 return qualified_type_def_sptr();
12149{
return dynamic_pointer_cast<array_type_def::subrange_type>(type);}
12159{
return decl && dynamic_pointer_cast<template_decl>(decl);}
12165 LOOKUP_ENTITY_TYPE,
12197find_next_delim_in_cplus_type(
const string& fqn,
12201 int angle_count = 0;
12202 bool found =
false;
12204 for (; i < fqn.size(); ++i)
12208 else if (fqn[i] ==
'>')
12210 else if (i + 1 < fqn.size()
12213 && fqn[i+1] ==
':')
12230 list<string>& comps)
12232 string::size_type fqn_size = fqn.size(), comp_begin = 0, comp_end = fqn_size;
12235 if (!find_next_delim_in_cplus_type(fqn, comp_begin, comp_end))
12236 comp_end = fqn_size;
12238 string comp = fqn.substr(comp_begin, comp_end - comp_begin);
12239 comps.push_back(comp);
12241 comp_begin = comp_end + 2;
12242 if (comp_begin >= fqn_size)
12258 for (list<string>::const_iterator c = comps.begin();
12261 if (c == comps.begin())
12264 result +=
"::" + *c;
12279template<
typename T>
12281iterator_is_last(T& container,
12282 typename T::const_iterator i)
12284 typename T::const_iterator next = i;
12286 return (next == container.end());
12303lookup_types_in_map(
const interned_string& type_name,
12306 istring_type_base_wptrs_map_type::const_iterator i = type_map.find(type_name);
12307 if (i != type_map.end())
12328template <
class TypeKind>
12329static shared_ptr<TypeKind>
12330lookup_type_in_map(
const interned_string& type_name,
12333 istring_type_base_wptrs_map_type::const_iterator i = type_map.find(type_name);
12334 if (i != type_map.end())
12338 for (
auto j : i->second)
12340 type_base_sptr t(j);
12341 decl_base_sptr d =
is_decl(t);
12342 if (d && !d->get_is_declaration_only())
12343 return dynamic_pointer_cast<TypeKind>(type_base_sptr(j));
12348 return dynamic_pointer_cast<TypeKind>(type_base_sptr(i->second.back()));
12350 return shared_ptr<TypeKind>();
12367 return lookup_type_in_map<type_decl>(type_name,
12426 return lookup_type_in_map<class_decl>(type_name,
12444 return lookup_type_in_map<union_decl>(type_name,
12479 union_decl_sptr result = lookup_type_in_map<union_decl>(loc, m);
12512 return lookup_type_in_map<enum_type_decl>(type_name,
12551 return lookup_type_in_map<typedef_decl>(type_name,
12587qualified_type_def_sptr
12592 return lookup_type_in_map<qualified_type_def>(type_name,
12611qualified_type_def_sptr
12638 return lookup_type_in_map<pointer_type_def>(type_name,
12700 return lookup_type_in_map<reference_type_def>(type_name,
12719 bool lvalue_reference,
12744 return lookup_type_in_map<array_type_def>(type_name,
12764 return lookup_type_in_map<function_type>(type_name,
12810const type_base_sptr
12814 type_base_sptr result;
12853const type_base_sptr
12877const type_base_sptr
12881 list<string> comps;
12894const decl_base_sptr
12898 list<string> comps;
12914template<
typename NodeKind>
12926{
return node->get_name();}
12946{
return node->get_name();}
12955template<
typename NodeKind>
12956static decl_base_sptr
12957convert_node_to_decl(shared_ptr<NodeKind> node);
12970template<
typename NodeKind>
12972lookup_node_in_scope(
const list<string>& fqn,
12976 shared_ptr<NodeKind> node;
12977 bool it_is_last =
false;
12980 for (list<string>::const_iterator c = fqn.begin(); c != fqn.end(); ++c)
12983 it_is_last = iterator_is_last(fqn, c);
12984 for (scope_decl::declarations::const_iterator m =
12985 cur_scope->get_member_decls().begin();
12986 m != cur_scope->get_member_decls().end();
12992 scope = dynamic_pointer_cast<scope_decl>(*m);
12993 if (scope && scope->get_name() == *c)
13002 node = dynamic_pointer_cast<NodeKind>(*m);
13006 dynamic_pointer_cast<class_decl>(node))
13007 if (cl->get_is_declaration_only()
13008 && !cl->get_definition_of_declaration())
13010 resulting_decl = node;
13015 if (!new_scope && !resulting_decl)
13016 return decl_base_sptr();
13017 cur_scope = new_scope;
13020 return resulting_decl;
13041const type_base_sptr
13044{
return is_type(lookup_node_in_scope<type_base>(comps, scope));}
13068static const type_base_sptr
13070 const vector<scope_decl*>& access_path,
13073 vector<scope_decl*> a = access_path;
13074 type_base_sptr result;
13079 first_scope = a.back();
13087 for (scope_decl::declarations::const_iterator i =
13091 if (
is_type(*i) && (*i)->get_name() == n)
13099 first_scope = a.back();
13100 interned_string scope_name, cur_scope_name = first_scope->
get_name();
13101 for (scope_decl::scopes::const_iterator i =
13106 scope_name = (*i)->get_name();
13107 if (scope_name == cur_scope_name)
13133static const type_base_sptr
13135 const scope_decl* scope)
13138 return type_base_sptr();
13142 vector<scope_decl*> access_path;
13143 for (scope_decl* s = type_decl->get_scope(); s != 0; s = s->get_scope())
13145 access_path.push_back(s);
13171const type_base_sptr
13186const decl_base_sptr
13189{
return is_var_decl(lookup_node_in_scope<var_decl>(comps, skope));}
13202template<
typename NodeKind>
13204lookup_node_in_translation_unit(
const list<string>& fqn,
13222{
return is_type(lookup_node_in_translation_unit<type_base>(fqn, tu));}
13242{
return is_class_type(lookup_node_in_translation_unit<class_decl>(fqn, tu));}
13255lookup_basic_type_through_translation_units(
const interned_string& type_name,
13256 const corpus& abi_corpus)
13260 for (translation_units::const_iterator tu =
13280static union_decl_sptr
13281lookup_union_type_through_translation_units(
const interned_string& type_name,
13282 const corpus & abi_corpus)
13284 union_decl_sptr result;
13286 for (translation_units::const_iterator tu =
13287 abi_corpus.get_translation_units().begin();
13288 tu != abi_corpus.get_translation_units().end();
13307lookup_enum_type_through_translation_units(
const interned_string& type_name,
13308 const corpus & abi_corpus)
13312 for (translation_units::const_iterator tu =
13313 abi_corpus.get_translation_units().begin();
13314 tu != abi_corpus.get_translation_units().end();
13331lookup_typedef_type_through_translation_units(
const interned_string& type_name,
13332 const corpus & abi_corpus)
13336 for (translation_units::const_iterator tu =
13337 abi_corpus.get_translation_units().begin();
13338 tu != abi_corpus.get_translation_units().end();
13355static qualified_type_def_sptr
13356lookup_qualified_type_through_translation_units(
const interned_string& t_name,
13357 const corpus & abi_corpus)
13359 qualified_type_def_sptr result;
13361 for (translation_units::const_iterator tu =
13362 abi_corpus.get_translation_units().begin();
13363 tu != abi_corpus.get_translation_units().end();
13381lookup_pointer_type_through_translation_units(
const interned_string& type_name,
13382 const corpus & abi_corpus)
13386 for (translation_units::const_iterator tu =
13387 abi_corpus.get_translation_units().begin();
13388 tu != abi_corpus.get_translation_units().end();
13406lookup_reference_type_through_translation_units(
const interned_string& t_name,
13407 const corpus & abi_corpus)
13411 for (translation_units::const_iterator tu =
13412 abi_corpus.get_translation_units().begin();
13413 tu != abi_corpus.get_translation_units().end();
13431lookup_array_type_through_translation_units(
const interned_string& type_name,
13432 const corpus & abi_corpus)
13436 for (translation_units::const_iterator tu =
13437 abi_corpus.get_translation_units().begin();
13438 tu != abi_corpus.get_translation_units().end();
13456lookup_function_type_through_translation_units(
const interned_string& type_name,
13457 const corpus & abi_corpus)
13461 for (translation_units::const_iterator tu =
13462 abi_corpus.get_translation_units().begin();
13463 tu != abi_corpus.get_translation_units().end();
13481 const corpus& abi_corpus)
13483 type_base_sptr result;
13485 for (translation_units::const_iterator tu =
13506 const string& tu_path,
13509 string_tu_map_type::const_iterator i = corp.priv_->path_tu_map.find(tu_path);
13510 if (i == corp.priv_->path_tu_map.end())
13511 return type_base_sptr();
13540 for (translation_units::const_iterator i =
13586 result = lookup_type_in_map<type_decl>(qualified_name, m);
13588 result = lookup_basic_type_through_translation_units(qualified_name, corp);
13608 result = lookup_type_in_map<type_decl>(loc, m);
13699 class_decl_sptr result = lookup_type_in_map<class_decl>(qualified_name, m);
13717 return lookup_types_in_map(qualified_name, m);
13743 for (
auto type : *v)
13745 type_base_sptr t(type);
13747 if (c->get_is_declaration_only()
13748 && !c->get_definition_of_declaration())
13749 result.push_back(type);
13752 return !result.empty();
13768 return lookup_types_in_map(qualified_name, m);
13849 union_decl_sptr result = lookup_type_in_map<union_decl>(type_name, m);
13851 result = lookup_union_type_through_translation_units(type_name, corp);
13930 lookup_type_in_map<enum_type_decl>(qualified_name, m);
13932 result = lookup_enum_type_through_translation_units(qualified_name, corp);
13950 return lookup_types_in_map(qualified_name, m);
14055 lookup_type_in_map<typedef_decl>(qualified_name, m);
14057 result = lookup_typedef_type_through_translation_units(qualified_name,
14152qualified_type_def_sptr
14167qualified_type_def_sptr
14173 qualified_type_def_sptr result =
14174 lookup_type_in_map<qualified_type_def>(qualified_name, m);
14177 result = lookup_qualified_type_through_translation_units(qualified_name,
14219 lookup_type_in_map<pointer_type_def>(qualified_name, m);
14221 result = lookup_pointer_type_through_translation_units(qualified_name,
14269 lookup_type_in_map<reference_type_def>(qualified_name, m);
14271 result = lookup_reference_type_through_translation_units(qualified_name,
14318 lookup_type_in_map<array_type_def>(qualified_name, m);
14320 result = lookup_array_type_through_translation_units(qualified_name, corp);
14389 lookup_type_in_map<function_type>(qualified_name, m);
14391 result = lookup_function_type_through_translation_units(qualified_name,
14414 type_base_sptr result;
14447 type_base_sptr result;
14495 return type_base_sptr();
14512template<
typename TypeKind>
14516 bool use_type_name_as_key =
true)
14520 if (use_type_name_as_key)
14522 else if (
location l = type->get_location())
14524 string str = l.expand();
14525 s = type->get_environment().intern(str);
14528 istring_type_base_wptrs_map_type::iterator i = types_map.find(s);
14529 bool result =
false;
14531 if (i == types_map.end())
14533 types_map[s].push_back(type);
14537 i->second.push_back(type);
14558 bool use_type_name_as_key)
14562 bool update_qname_map =
true;
14563 if (type->get_is_declaration_only())
14569 is_class_type(class_type->get_definition_of_declaration()))
14573 if (!update_qname_map)
14577 if (use_type_name_as_key)
14579 string qname = type->get_qualified_name();
14580 s = type->get_environment().intern(qname);
14582 else if (
location l = type->get_location())
14584 string str = l.expand();
14585 s = type->get_environment().intern(str);
14588 bool result =
false;
14589 istring_type_base_wptrs_map_type::iterator i = map.find(s);
14590 if (i == map.end())
14592 map[s].push_back(type);
14596 i->second.push_back(type);
14622 bool result =
false;
14624 istring_type_base_wptrs_map_type::iterator i = types_map.find(s);
14625 if (i == types_map.end())
14627 types_map[s].push_back(type);
14631 i->second.push_back(type);
14651 maybe_update_types_lookup_map<type_decl>
14654 if (
corpus *type_corpus = basic_type->get_corpus())
14656 maybe_update_types_lookup_map<type_decl>
14658 type_corpus->priv_->get_types().basic_types());
14660 maybe_update_types_lookup_map<type_decl>
14662 type_corpus->get_type_per_loc_map().basic_types(),
14667 maybe_update_types_lookup_map<type_decl>
14669 group->priv_->get_types().basic_types());
14671 maybe_update_types_lookup_map<type_decl>
14673 group->get_type_per_loc_map().basic_types(),
14698 if (
corpus *type_corpus = class_type->get_corpus())
14702 type_corpus->priv_->get_types().class_types());
14706 type_corpus->get_type_per_loc_map().class_types(),
14713 group->priv_->get_types().class_types());
14717 group->get_type_per_loc_map().class_types(),
14738 maybe_update_types_lookup_map<union_decl>
14741 if (
corpus *type_corpus = union_type->get_corpus())
14743 maybe_update_types_lookup_map<union_decl>
14745 type_corpus->priv_->get_types().union_types());
14747 maybe_update_types_lookup_map<union_decl>
14749 type_corpus->get_type_per_loc_map().union_types(),
14754 maybe_update_types_lookup_map<union_decl>
14756 group->priv_->get_types().union_types());
14758 maybe_update_types_lookup_map<union_decl>
14760 group->get_type_per_loc_map().union_types(),
14781 maybe_update_types_lookup_map<enum_type_decl>
14784 if (
corpus *type_corpus = enum_type->get_corpus())
14786 maybe_update_types_lookup_map<enum_type_decl>
14788 type_corpus->priv_->get_types().enum_types());
14790 maybe_update_types_lookup_map<enum_type_decl>
14792 type_corpus->get_type_per_loc_map().enum_types(),
14797 maybe_update_types_lookup_map<enum_type_decl>
14799 group->priv_->get_types().enum_types());
14801 maybe_update_types_lookup_map<enum_type_decl>
14803 group->get_type_per_loc_map().enum_types(),
14825 maybe_update_types_lookup_map<typedef_decl>
14828 if (
corpus *type_corpus = typedef_type->get_corpus())
14830 maybe_update_types_lookup_map<typedef_decl>
14832 type_corpus->priv_->get_types().typedef_types());
14834 maybe_update_types_lookup_map<typedef_decl>
14836 type_corpus->get_type_per_loc_map().typedef_types(),
14841 maybe_update_types_lookup_map<typedef_decl>
14843 group->priv_->get_types().typedef_types());
14845 maybe_update_types_lookup_map<typedef_decl>
14847 group->get_type_per_loc_map().typedef_types(),
14868 maybe_update_types_lookup_map<qualified_type_def>
14871 if (
corpus *type_corpus = qualified_type->get_corpus())
14873 maybe_update_types_lookup_map<qualified_type_def>
14875 type_corpus->priv_->get_types().qualified_types());
14879 maybe_update_types_lookup_map<qualified_type_def>
14881 group->priv_->get_types().qualified_types());
14901 maybe_update_types_lookup_map<pointer_type_def>
14904 if (
corpus *type_corpus = pointer_type->get_corpus())
14906 maybe_update_types_lookup_map<pointer_type_def>
14908 type_corpus->priv_->get_types().pointer_types());
14912 maybe_update_types_lookup_map<pointer_type_def>
14914 group->priv_->get_types().pointer_types());
14934 maybe_update_types_lookup_map<ptr_to_mbr_type>
14937 if (
corpus *type_corpus = ptr_to_member->get_corpus())
14939 maybe_update_types_lookup_map<ptr_to_mbr_type>
14941 type_corpus->priv_->get_types().ptr_to_mbr_types());
14945 maybe_update_types_lookup_map<ptr_to_mbr_type>
14947 group->priv_->get_types().ptr_to_mbr_types());
14967 maybe_update_types_lookup_map<reference_type_def>
14970 if (
corpus *type_corpus = reference_type->get_corpus())
14972 maybe_update_types_lookup_map<reference_type_def>
14974 type_corpus->priv_->get_types().reference_types());
14978 maybe_update_types_lookup_map<reference_type_def>
14980 group->priv_->get_types().reference_types());
15000 maybe_update_types_lookup_map<array_type_def>
15003 if (
corpus *type_corpus = array_type->get_corpus())
15005 maybe_update_types_lookup_map<array_type_def>
15007 type_corpus->priv_->get_types().array_types());
15009 maybe_update_types_lookup_map<array_type_def>
15011 type_corpus->get_type_per_loc_map().array_types(),
15016 maybe_update_types_lookup_map<array_type_def>
15018 group->priv_->get_types().array_types());
15020 maybe_update_types_lookup_map<array_type_def>
15022 group->get_type_per_loc_map().array_types(),
15044 maybe_update_types_lookup_map<array_type_def::subrange_type>
15047 if (
corpus *type_corpus = subrange_type->get_corpus())
15049 maybe_update_types_lookup_map<array_type_def::subrange_type>
15051 type_corpus->priv_->get_types().subrange_types());
15053 maybe_update_types_lookup_map<array_type_def::subrange_type>
15055 type_corpus->get_type_per_loc_map().subrange_types(),
15058 if (
corpus *group = subrange_type->get_corpus())
15060 maybe_update_types_lookup_map<array_type_def::subrange_type>
15062 group->priv_->get_types().subrange_types());
15064 maybe_update_types_lookup_map<array_type_def::subrange_type>
15066 group->get_type_per_loc_map().subrange_types(),
15091 if (
corpus *type_corpus = fn_type->get_corpus())
15095 type_corpus->priv_->get_types().function_types());
15097 if (
corpus *group = fn_type->get_corpus())
15101 group->priv_->get_types().function_types());
15194 type_base_sptr result;
15202 type_base_sptr underlying_type =
15205 if (underlying_type)
15208 qual->get_cv_quals(),
15209 qual->get_location()));
15214 type_base_sptr pointed_to_type =
15217 if (pointed_to_type)
15220 p->get_size_in_bits(),
15221 p->get_alignment_in_bits(),
15222 p->get_location()));
15227 type_base_sptr pointed_to_type =
15229 if (pointed_to_type)
15233 r->get_size_in_bits(),
15234 r->get_alignment_in_bits(),
15235 r->get_location()));
15249 tu.priv_->synthesized_types_.push_back(result);
15282 type_base_sptr result_return_type;
15287 if (!result_return_type)
15291 type_base_sptr parm_type;
15293 for (function_type::parameters::const_iterator i =
15298 type_base_sptr t = (*i)->get_type();
15305 (*i)->get_location(),
15306 (*i)->get_variadic_marker(),
15307 (*i)->get_is_artificial()));
15308 parms.push_back(parm);
15311 class_or_union_sptr class_type;
15323 result_fn_type.reset(
new method_type(result_return_type,
15335 tu.priv_->synthesized_types_.push_back(result_fn_type);
15339 return result_fn_type;
15350 if (mangled_name.empty())
15355 char * str = abi::__cxa_demangle(mangled_name.c_str(),
15356 NULL, &l, &status);
15357 string demangled_name = mangled_name;
15361 demangled_name = str;
15365 return demangled_name;
15390global_scope::~global_scope()
15411types_defined_same_linux_kernel_corpus_public(
const type_base& t1,
15412 const type_base& t2)
15414 const corpus *t1_corpus = t1.get_corpus(), *t2_corpus = t2.get_corpus();
15415 string t1_file_path, t2_file_path;
15419 if (!(t1_corpus && t2_corpus
15420 && t1_corpus == t2_corpus
15421 && (t1_corpus->get_origin() & corpus::LINUX_KERNEL_BINARY_ORIGIN)
15426 class_or_union *c1 = 0, *c2 = 0;
15432 if ((c1 && c1->get_is_anonymous() && !c1->get_naming_typedef())
15433 || (c2 && c2->get_is_anonymous() && !c2->get_naming_typedef()))
15440 && c1->get_is_anonymous() && c1->get_naming_typedef()
15441 && c2->get_is_anonymous() && c2->get_naming_typedef())
15442 if (c1->get_naming_typedef()->get_name()
15443 != c2->get_naming_typedef()->get_name())
15449 if (e1->get_is_anonymous() || e2->get_is_anonymous())
15459 if (c1->get_is_declaration_only() != c2->get_is_declaration_only())
15461 if (c1->get_environment().decl_only_class_equals_definition())
15471 if (t1.get_size_in_bits() != t2.get_size_in_bits())
15480 l = c1->get_location();
15482 l =
dynamic_cast<const decl_base&
>(t1).
get_location();
15484 unsigned line = 0, col = 0;
15486 l.
expand(t1_file_path, line, col);
15488 l = c2->get_location();
15490 l =
dynamic_cast<const decl_base&
>(t2).
get_location();
15492 l.
expand(t2_file_path, line, col);
15495 if (t1_file_path.empty() || t2_file_path.empty())
15498 if (t1_file_path == t2_file_path)
15534compare_types_during_canonicalization(
const type_base& canonical_type,
15535 const type_base& candidate_type)
15537#ifdef WITH_DEBUG_TYPE_CANONICALIZATION
15538 const environment& env = canonical_type.get_environment();
15539 if (env.debug_type_canonicalization_is_on())
15541 bool canonical_equality =
false, structural_equality =
false;
15542 env.priv_->allow_type_comparison_results_caching(
false);
15543 env.priv_->use_canonical_type_comparison_ =
false;
15544 structural_equality = canonical_type == candidate_type;
15545 env.priv_->use_canonical_type_comparison_ =
true;
15546 canonical_equality = canonical_type == candidate_type;
15547 env.priv_->allow_type_comparison_results_caching(
true);
15548 if (canonical_equality != structural_equality)
15550 std::cerr <<
"structural & canonical equality different for type: "
15551 << canonical_type.get_pretty_representation(
true,
true)
15555 return structural_equality;
15558 return canonical_type == candidate_type;
15582compare_canonical_type_against_candidate(
const type_base& canonical_type,
15583 const type_base& candidate_type)
15585 environment& env =
const_cast<environment&
>(canonical_type.get_environment());
15603 bool saved_decl_only_class_equals_definition =
15604 env.decl_only_class_equals_definition();
15608 env.decl_only_class_equals_definition(
false);
15609 env.priv_->allow_type_comparison_results_caching(
true);
15610 bool equal = (types_defined_same_linux_kernel_corpus_public(canonical_type,
15612 || compare_types_during_canonicalization(canonical_type,
15617 env.priv_->clear_type_comparison_results_cache();
15618 env.priv_->allow_type_comparison_results_caching(
false);
15619 env.decl_only_class_equals_definition
15620 (saved_decl_only_class_equals_definition);
15645compare_canonical_type_against_candidate(
const type_base* canonical_type,
15646 const type_base* candidate_type)
15648 return compare_canonical_type_against_candidate(*canonical_type,
15673compare_canonical_type_against_candidate(
const type_base_sptr& canonical_type,
15674 const type_base_sptr& candidate_type)
15676 return compare_canonical_type_against_candidate(canonical_type.get(),
15677 candidate_type.get());
15697static type_base_sptr
15698candidate_matches_a_canonical_type_hash(
const vector<type_base_sptr>& cncls,
15701 if (type.get_corpus()
15702 && type.get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN
15711 for (
const auto& c : cncls)
15717 if (compare_canonical_type_against_candidate(*c, type))
15721 for (
const auto& c : cncls)
15726 if (compare_canonical_type_against_candidate(*c, type))
15776type_base::get_canonical_type_for(type_base_sptr t)
15785 return type_base_sptr();
15791 bool decl_only_class_equals_definition =
15804 if (decl_only_class_equals_definition)
15807 return type_base_sptr();
15810 if (t->get_canonical_type())
15811 return t->get_canonical_type();
15832 string repr = t->get_cached_pretty_representation(
true);
15837 type_base_sptr canonical_type_present_in_corpus;
15841 type_base_sptr result;
15842 environment::canonical_types_map_type::iterator i = types.find(repr);
15844 if (i == types.end())
15846 vector<type_base_sptr> v;
15853 vector<type_base_sptr> &v = i->second;
15858 result = candidate_matches_a_canonical_type_hash(v, *t);
15866 for (vector<type_base_sptr>::const_reverse_iterator it = v.rbegin();
15867 !result && it != v.rend();
15870 bool equal = compare_canonical_type_against_candidate(*it, t);
15877#ifdef WITH_DEBUG_SELF_COMPARISON
15878 if (env.self_comparison_debug_is_on())
15882 corpus_sptr corp1, corp2;
15883 env.get_self_comparison_debug_inputs(corp1, corp2);
15885 && corp1->get_origin() != corp2->get_origin()
15886 && corp2->get_origin() & corpus::NATIVE_XML_ORIGIN)
15897 check_canonical_type_from_abixml_during_self_comp(t,
15903 uintptr_t should_have_canonical_type = 0;
15904 string type_id = env.get_type_id_from_type(t.get());
15905 if (type_id.empty())
15906 type_id =
"type-id-<not-found>";
15908 should_have_canonical_type =
15909 env.get_canonical_type_from_type_id(type_id.c_str());
15910 std::cerr <<
"error: wrong canonical type for '"
15919 <<
"'. Should have had canonical type: "
15921 << should_have_canonical_type
15928 uintptr_t ptr_val =
reinterpret_cast<uintptr_t
>(t.get());
15929 string type_id = env.get_type_id_from_pointer(ptr_val);
15930 if (type_id.empty())
15931 type_id =
"type-id-<not-found>";
15948 std::cerr <<
"error: wrong induced canonical type for '"
15950 <<
"' from second corpus"
15951 <<
", ptr: " << std::hex << t.get()
15952 <<
" type-id: " << type_id
15954 << *t->hash_value()
15964 if (t_hash != result_hash)
15966 std::cerr <<
"error: type hash mismatch"
15967 <<
" between type: '"
15973 << *t->hash_value()
15974 <<
" and its computed canonical type @"
15979 << *result->hash_value()
15994 t->priv_->canonical_type_index = v.size();
16023maybe_adjust_canonical_type(
const type_base_sptr& canonical,
16024 const type_base_sptr& type)
16026 if (type->get_naked_canonical_type())
16034 if (canonical_class
16035 && canonical_class.get() != cl.get())
16039 for (class_decl::member_functions::const_iterator i =
16040 cl->get_member_functions().begin();
16041 i != cl->get_member_functions().end();
16043 if ((*i)->get_symbol())
16046 find_member_function((*i)->get_linkage_name()))
16056 if (canonical_class->get_corpus()
16057 && cl->get_corpus()
16058 && (cl->get_corpus() == canonical_class->get_corpus()))
16072 for (
const auto& data_member : cl->get_data_members())
16079 const auto& canonical_data_member =
16080 canonical_class->find_data_member(data_member->get_name());
16081 if (!canonical_data_member)
16090 if (!canonical_data_member->get_symbol())
16091 canonical_data_member->set_symbol(sym);
16107 canonical_class = cl;
16110 if (canonical_class)
16112 if (
auto abi_corpus = canonical_class->get_corpus())
16114 for (
auto& fn : canonical_class->get_member_functions())
16118 if (sym->is_defined() && sym->is_public())
16120 fn->set_is_in_public_symbol_table(
true);
16121 auto b = abi_corpus->get_exported_decls_builder();
16122 b->maybe_add_fn_to_exported_fns(fn.get());
16124 else if (!sym->is_defined())
16125 abi_corpus->get_undefined_functions().insert(fn.get());
16137 if (type->get_is_artificial() != canonical->get_is_artificial())
16138 canonical->set_is_artificial(
false);
16168 if (t->get_canonical_type())
16169 return t->get_canonical_type();
16171 if (do_log && show_stats)
16172 std::cerr <<
"Canonicalization of type '"
16173 << t->get_pretty_representation(
true,
true)
16174 <<
"/@#" << std::hex << t.get() <<
": ";
16178 if (do_log && show_stats)
16180 type_base_sptr canonical = type_base::get_canonical_type_for(t);
16182 if (do_log && show_stats)
16185 if (do_log && show_stats)
16186 std::cerr << tmr <<
"\n";
16188 maybe_adjust_canonical_type(canonical, t);
16190 t->priv_->canonical_type = canonical;
16191 t->priv_->naked_canonical_type = canonical.get();
16194 if (!t->priv_->canonical_type_index)
16195 t->priv_->canonical_type_index = canonical->priv_->canonical_type_index;
16198 if (type_base_sptr d =
is_type(cl->get_earlier_declaration()))
16199 if ((canonical = d->get_canonical_type()))
16201 d->priv_->canonical_type = canonical;
16202 d->priv_->naked_canonical_type = canonical.get();
16219 if (type_base_sptr c =
is_type(scope)->get_canonical_type())
16234 t->on_canonical_type_set();
16245 priv_->definition_of_declaration_ = d;
16247 if (type_base_sptr canonical_type =
is_type(d)->get_canonical_type())
16248 t->priv_->canonical_type = canonical_type;
16250 priv_->naked_definition_of_declaration_ =
const_cast<decl_base*
>(d.get());
16260 priv_(new
priv(s, a))
16274 return do_hash(
this);
16286{
return priv_->canonical_type.lock();}
16302{
return priv_->naked_canonical_type;}
16329 if (priv_->internal_cached_repr_.
empty())
16334 return priv_->internal_cached_repr_;
16337 if (priv_->cached_repr_.
empty())
16343 return priv_->cached_repr_;
16381{
return equals(*
this, other, 0);}
16398{priv_->size_in_bits = s;}
16405{
return priv_->size_in_bits;}
16412{priv_->alignment_in_bits = a;}
16419{
return priv_->alignment_in_bits;}
16435 v.visit_begin(
this);
16436 bool result = v.visit_end(
this);
16442type_base::~type_base()
16461 static_cast<unsigned>(r));
16476 static_cast<unsigned>(r));
16533parse_real_type_modifier(
const string& word,
16536 if (word ==
"signed")
16538 else if (word ==
"unsigned")
16540 else if (word ==
"short")
16542 else if (word ==
"long")
16544 else if (word ==
"long long")
16562parse_base_real_type(
const string& type_name,
16565 if (type_name ==
"int")
16567 else if (type_name ==
"char")
16569 else if (type_name ==
"bool" || type_name ==
"_Bool")
16571 else if (type_name ==
"double")
16573 else if (type_name ==
"float")
16575 else if (type_name ==
"char16_t")
16577 else if (type_name ==
"char32_t")
16579 else if (type_name ==
"wchar_t")
16581 else if (type_name ==
"__ARRAY_SIZE_TYPE__")
16583 else if (type_name ==
"sizetype")
16584 base = real_type::SIZE_BASE_TYPE;
16585 else if (type_name ==
"ssizetype")
16586 base = real_type::SSIZE_BASE_TYPE;
16587 else if (type_name ==
"bitsizetype")
16588 base = real_type::BIT_SIZE_BASE_TYPE;
16589 else if (type_name ==
"sbitsizetype")
16590 base = real_type::SBIT_SIZE_BASE_TYPE;
16614 string input = type_name;
16615 string::size_type len = input.length();
16616 string::size_type cur_pos = 0, prev_pos = 0;
16617 string cur_word, prev_word;
16620 while (cur_pos < len)
16622 if (cur_pos < len && isspace(input[cur_pos]))
16625 while (cur_pos < len && isspace(input[cur_pos]));
16627 prev_pos = cur_pos;
16628 cur_pos = input.find(
' ', prev_pos);
16629 prev_word = cur_word;
16630 cur_word = input.substr(prev_pos, cur_pos - prev_pos);
16633 && cur_word ==
"long"
16634 && prev_word !=
"long")
16636 if (cur_pos < len && isspace(input[cur_pos]))
16639 while (cur_pos < len && isspace(input[cur_pos]));
16640 prev_pos = cur_pos;
16642 cur_pos = input.find(
' ', prev_pos);
16643 string saved_prev_word = prev_word;
16644 prev_word = cur_word;
16645 cur_word = input.substr(prev_pos, cur_pos - prev_pos);
16646 if (cur_word ==
"long")
16647 cur_word =
"long long";
16650 cur_pos = prev_pos;
16651 cur_word = prev_word;
16652 prev_word = saved_prev_word;
16656 if (!parse_real_type_modifier(cur_word, modifiers))
16658 if (!parse_base_real_type(cur_word, base))
16689 real_type int_type(base_type, modifiers);
16696 : base_(INT_BASE_TYPE),
16697 modifiers_(NO_MODIFIER)
16706 : base_(b), modifiers_(m)
16714 : base_(INT_BASE_TYPE),
16715 modifiers_(NO_MODIFIER)
16733{
return modifiers_;}
16750{
return base_ == other.base_ && modifiers_ == other.modifiers_;}
16768 result +=
"signed ";
16770 result +=
"unsigned ";
16781 result +=
"short ";
16785 result +=
"long long ";
16796 result +=
"double";
16800 result +=
"char16_t";
16802 result +=
"char32_t";
16804 result +=
"wchar_t";
16806 result +=
"__ARRAY_SIZE_TYPE__";
16807 else if (base_ == SIZE_BASE_TYPE)
16808 result +=
"sizetype";
16809 else if (base_ == SSIZE_BASE_TYPE)
16810 result +=
"ssizetype";
16811 else if (base_ == BIT_SIZE_BASE_TYPE)
16812 result +=
"bitsizetype";
16813 else if (base_ == SBIT_SIZE_BASE_TYPE)
16814 result +=
"sbitsizetype";
16823real_type::operator string()
const
16824{
return to_string();}
16847 const string& name,
16848 size_t size_in_bits,
16849 size_t alignment_in_bits,
16851 const string& linkage_name,
16856 | ABSTRACT_TYPE_BASE
16857 | ABSTRACT_DECL_BASE),
16858 decl_base(env, name, locus, linkage_name, vis),
16859 type_base(env, size_in_bits, alignment_in_bits)
16865 real_type int_type(base_type, modifiers);
16870 string real_type_name = int_type;
16918 bool result =
false;
16949 return *
this == *other;
16977 return *
this == other;
17023 if (l.get() == r.get())
17051 bool internal)
const
17075 if (decl_base::priv_->internal_qualified_name_.
empty())
17076 decl_base::priv_->internal_qualified_name_ =
17077 env.
intern(get_internal_real_type_name(
this));
17078 return decl_base::priv_->internal_qualified_name_;
17082 decl_base::priv_->temporary_internal_qualified_name_ =
17083 env.
intern(get_internal_real_type_name(
this));
17084 return decl_base::priv_->temporary_internal_qualified_name_;
17110 bool qualified_name)
const
17114 return get_internal_real_type_name(
this);
17116 if (qualified_name)
17134 v.visit_begin(
this);
17135 bool result = v.visit_end(
this);
17141type_decl::~type_decl()
17161 const string& name,
17162 size_t size_in_bits,
17163 size_t alignment_in_bits,
17167 ABSTRACT_SCOPE_TYPE_DECL
17168 | ABSTRACT_TYPE_BASE
17169 | ABSTRACT_DECL_BASE),
17171 type_base(env, size_in_bits, alignment_in_bits),
17240 return *
this == *other;
17264 if (v.visit_begin(
this))
17267 for (scope_decl::declarations::const_iterator i =
17271 if (!(*i)->traverse(v))
17276 bool result = v.visit_end(
this);
17282scope_type_decl::~scope_type_decl()
17298 const string& name,
17309 | ABSTRACT_DECL_BASE
17310 | ABSTRACT_SCOPE_DECL),
17336 bool qualified_name)
const
17378 if (!ns->is_empty_or_has_empty_sub_namespaces())
17399 if (v.visit_begin(
this))
17402 scope_decl::declarations::const_iterator i;
17408 dynamic_pointer_cast<ir_traversable_base>(*i);
17410 if (!t->traverse (v))
17415 return v.visit_end(
this);
17418namespace_decl::~namespace_decl()
17427class qualified_type_def::priv
17438 weak_ptr<type_base> underlying_type_;
17441 : cv_quals_(CV_NONE)
17446 : cv_quals_(quals),
17447 underlying_type_(t)
17499qualified_type_def::qualified_type_def(type_base_sptr type,
17504 | ABSTRACT_TYPE_BASE
17505 | ABSTRACT_DECL_BASE),
17506 type_base(type->get_environment(), type->get_size_in_bits(),
17507 type->get_alignment_in_bits()),
17508 decl_base(type->get_environment(),
"", locus,
"",
17509 dynamic_pointer_cast<
decl_base>(type)->get_visibility()),
17510 priv_(new priv(quals, type))
17529 | ABSTRACT_TYPE_BASE
17530 | ABSTRACT_DECL_BASE),
17534 priv_(new priv(quals))
17571 s = ut->get_size_in_bits();
17600 bool result =
true;
17667 return *
this == *other;
17685 return *
this == *other;
17700 bool internal)
const
17728 if (priv_->temporary_internal_name_.empty())
17729 priv_->temporary_internal_name_ =
17731 return priv_->temporary_internal_name_;
17747 if (priv_->internal_name_.empty())
17748 priv_->internal_name_ =
17751 return priv_->internal_name_;
17780 if (v.visit_begin(
this))
17787 bool result = v.visit_end(
this);
17792qualified_type_def::~qualified_type_def()
17799{
return priv_->cv_quals_;}
17804{priv_->cv_quals_ = cv_quals;}
17818{
return priv_->underlying_type_.lock();}
17827 priv_->underlying_type_ = t;
17837 scope_decl::declarations::iterator i;
17838 if (s->find_iterator_for_member(
this, i))
17853operator==(
const qualified_type_def_sptr& l,
const qualified_type_def_sptr& r)
17855 if (l.get() == r.get())
17871operator!=(
const qualified_type_def_sptr& l,
const qualified_type_def_sptr& r)
17879 (
static_cast<unsigned>(lhs) |
static_cast<unsigned>(rhs));
17903 (
static_cast<unsigned>(lhs) &
static_cast<unsigned>(rhs));
17925 case qualified_type_def::CV_NONE:
17928 case qualified_type_def::CV_CONST:
17931 case qualified_type_def::CV_VOLATILE:
17934 case qualified_type_def::CV_RESTRICT:
17948struct pointer_type_def::priv
17955 priv(
const type_base_sptr& t)
17957 naked_pointed_to_type_(t.get())
17961 : naked_pointed_to_type_()
17986pointer_type_def::pointer_type_def(
const type_base_sptr& pointed_to,
17987 size_t size_in_bits,
17988 size_t align_in_bits,
17992 | ABSTRACT_TYPE_BASE
17993 | ABSTRACT_DECL_BASE),
17994 type_base(pointed_to->get_environment(), size_in_bits, align_in_bits),
17995 decl_base(pointed_to->get_environment(),
"", locus,
""),
17996 priv_(new priv(pointed_to))
18002 const environment& env = pointed_to->get_environment();
18003 decl_base_sptr pto = dynamic_pointer_cast<decl_base>(pointed_to);
18004 string name = (pto ? pto->get_name() : string(
"void")) +
"*";
18022pointer_type_def::pointer_type_def(
const environment& env,
size_t size_in_bits,
18023 size_t alignment_in_bits,
18027 | ABSTRACT_TYPE_BASE
18028 | ABSTRACT_DECL_BASE),
18029 type_base(env, size_in_bits, alignment_in_bits),
18034 string name = string(
"void") +
"*";
18059 priv_->pointed_to_type_ = t;
18060 priv_->naked_pointed_to_type_ = t.get();
18065 decl_base_sptr pto = dynamic_pointer_cast<decl_base>(t);
18066 string name = (pto ? pto->get_name() : string(
"void")) +
"*";
18098 bool result = p1 == p2;
18140 return *
this == *o;
18161const type_base_sptr
18163{
return priv_->pointed_to_type_.lock();}
18170{
return priv_->naked_pointed_to_type_;}
18208 if (priv_->internal_qualified_name_.empty())
18209 if (pointed_to_type)
18210 priv_->internal_qualified_name_ =
18211 pointer_declaration_name(
this,
18218 return priv_->internal_qualified_name_;
18226 if (pointed_to_type)
18227 if (priv_->temp_internal_qualified_name_.empty())
18228 priv_->temp_internal_qualified_name_ =
18229 pointer_declaration_name(
this,
18236 return priv_->temp_internal_qualified_name_;
18245 (pointer_declaration_name(
this,
18257 if (pointed_to_type)
18259 (pointer_declaration_name(
this,
18284 if (v.visit_begin(
this))
18292 bool result = v.visit_end(
this);
18297pointer_type_def::~pointer_type_def()
18314 if (l.get() == r.get())
18342struct reference_type_def::priv
18350 priv(
const type_base_sptr& t,
bool is_lvalue)
18352 is_lvalue_(is_lvalue)
18355 priv(
bool is_lvalue)
18356 : is_lvalue_(is_lvalue)
18385reference_type_def::reference_type_def(
const type_base_sptr pointed_to,
18387 size_t size_in_bits,
18388 size_t align_in_bits,
18392 | ABSTRACT_TYPE_BASE
18393 | ABSTRACT_DECL_BASE),
18394 type_base(pointed_to->get_environment(), size_in_bits, align_in_bits),
18395 decl_base(pointed_to->get_environment(),
"", locus,
""),
18396 priv_(new priv(pointed_to, lvalue))
18402 decl_base_sptr pto = dynamic_pointer_cast<decl_base>(pointed_to);
18407 name = string(pto->get_name()) +
"&";
18415 const environment& env = pointed_to->get_environment();
18439reference_type_def::reference_type_def(
const environment& env,
bool lvalue,
18440 size_t size_in_bits,
18441 size_t alignment_in_bits,
18445 | ABSTRACT_TYPE_BASE
18446 | ABSTRACT_DECL_BASE),
18447 type_base(env, size_in_bits, alignment_in_bits),
18449 priv_(new priv(lvalue))
18452 string name =
"void&";
18481 priv_->pointed_to_type_ = pointed_to_type;
18483 decl_base_sptr pto;
18485 {pto = dynamic_pointer_cast<decl_base>(pointed_to_type);}
18492 string name = string(pto->get_name()) +
"&";
18522 if (l.is_lvalue() != r.is_lvalue())
18528 type_base_sptr p1 = l.get_pointed_to_type(), p2 = r.get_pointed_to_type();
18529 bool result = p1 == p2;
18568 return *
this == *other;
18583 return *
this == *other;
18587reference_type_def::get_pointed_to_type()
const
18588{
return priv_->pointed_to_type_.lock();}
18591reference_type_def::is_lvalue()
const
18592{
return priv_->is_lvalue_;}
18622 type_base_sptr pointed_to_type = get_pointed_to_type();
18629 if (priv_->internal_qualified_name_.empty())
18630 if (pointed_to_type)
18631 priv_->internal_qualified_name_ =
18639 return priv_->internal_qualified_name_;
18647 if (pointed_to_type)
18648 if (priv_->temp_internal_qualified_name_.empty())
18649 priv_->temp_internal_qualified_name_ =
18657 return priv_->temp_internal_qualified_name_;
18677 if (pointed_to_type)
18707 bool qualified_name)
const
18711 (get_pointed_to_type()),
18735 if (v.visit_begin(
this))
18738 if (type_base_sptr t = get_pointed_to_type())
18743 bool result = v.visit_end(
this);
18748reference_type_def::~reference_type_def()
18765 if (l.get() == r.get())
18793struct ptr_to_mbr_type::priv
18797 type_base_sptr dm_type_;
18800 type_base_sptr containing_type_;
18807 priv(
const type_base_sptr& dm_type,
const type_base_sptr& containing_type)
18808 : dm_type_(dm_type),
18809 containing_type_(containing_type)
18831 const type_base_sptr& member_type,
18832 const type_base_sptr& containing_type,
18833 size_t size_in_bits,
18834 size_t alignment_in_bits,
18837 POINTER_TO_MEMBER_TYPE
18838 | ABSTRACT_TYPE_BASE
18839 | ABSTRACT_DECL_BASE),
18840 type_base(env, size_in_bits, alignment_in_bits),
18842 priv_(new priv(member_type, containing_type))
18879const type_base_sptr&
18881{
return priv_->dm_type_;}
18888const type_base_sptr&
18890{
return priv_->containing_type_;}
18920 return *
this == *other;
18935 return *
this == *other;
18947 bool internal)
const
18966 if (priv_->internal_qualified_name_.empty())
18967 priv_->internal_qualified_name_ =
18968 ptr_to_mbr_declaration_name(
this,
"",
18971 return priv_->internal_qualified_name_;
18975 priv_->temp_internal_qualified_name_ =
18976 ptr_to_mbr_declaration_name(
this,
"",
true, internal);
18977 return priv_->temp_internal_qualified_name_;
18983 (ptr_to_mbr_declaration_name(
this,
"",
true,
19005 if (v.visit_begin(
this))
19016 bool result = v.visit_end(
this);
19048 bool result =
true;
19050 if (!(l.decl_base::operator==(r)))
19089array_type_def::subrange_type::~subrange_type() =
default;
19098 : s_(UNSIGNED_SIGNEDNESS)
19107 : s_(UNSIGNED_SIGNEDNESS)
19116 : s_(SIGNED_SIGNEDNESS)
19124enum array_type_def::subrange_type::bound_value::signedness
19148{
return v_.unsigned_;}
19156 s_ = UNSIGNED_SIGNEDNESS;
19166 s_ = SIGNED_SIGNEDNESS;
19178 return s_ == v.s_ && v_.unsigned_ == v.v_.unsigned_;
19183struct array_type_def::subrange_type::priv
19193 : upper_bound_(ub), language_(l), infinite_(false)
19196 priv(bound_value lb, bound_value ub,
19198 : lower_bound_(lb), upper_bound_(ub),
19199 language_(l), infinite_(false)
19202 priv(bound_value lb, bound_value ub,
const type_base_sptr &u,
19204 : lower_bound_(lb), upper_bound_(ub), underlying_type_(u),
19205 language_(l), infinite_(false)
19224 const string& name,
19227 const type_base_sptr& utype,
19230 :
type_or_decl_base(env, SUBRANGE_TYPE | ABSTRACT_TYPE_BASE | ABSTRACT_DECL_BASE),
19237 priv_(new priv(lower_bound, upper_bound, utype, l))
19257 const string& name,
19262 :
type_or_decl_base(env, SUBRANGE_TYPE | ABSTRACT_TYPE_BASE | ABSTRACT_DECL_BASE),
19265 priv_(new priv(lower_bound, upper_bound, l))
19283 const string& name,
19287 :
type_or_decl_base(env, SUBRANGE_TYPE | ABSTRACT_TYPE_BASE | ABSTRACT_DECL_BASE),
19288 type_base(env, upper_bound.get_unsigned_value(), 0),
19290 priv_(new priv(upper_bound, l))
19315{
return priv_->underlying_type_.lock();}
19324 ABG_ASSERT(priv_->underlying_type_.expired());
19325 priv_->underlying_type_ = u;
19335{
return priv_->upper_bound_.get_signed_value();}
19342{
return priv_->lower_bound_.get_signed_value();}
19349{priv_->upper_bound_ = ub;}
19356{priv_->lower_bound_ = lb;}
19373 if (get_upper_bound() >= get_lower_bound())
19374 return get_upper_bound() - get_lower_bound() + 1;
19383{
return priv_->infinite_;}
19391{priv_->infinite_ = f;}
19398{
return priv_->language_;}
19406 std::ostringstream o;
19410 type_base_sptr underlying_type = get_underlying_type();
19411 if (underlying_type)
19413 o <<
"range "<< get_lower_bound() <<
" .. " << get_upper_bound();
19418 o <<
"[" << get_length() <<
"]";
19433 for (vector<subrange_sptr>::const_iterator i = v.begin();
19436 r += (*i)->as_string();
19465 bool result =
true;
19520 return *
this == *other;
19588 repr +=
"<anonymous range>";
19590 repr +=
"<range " +
get_name() +
">";
19591 repr += as_string();
19609 if (v.visit_begin(
this))
19612 if (type_base_sptr u = get_underlying_type())
19617 bool result = v.visit_end(
this);
19624struct array_type_def::priv
19631 priv(type_base_sptr t)
19636 : element_type_(t), subranges_(subs)
19656array_type_def::array_type_def(
const type_base_sptr e_type,
19657 const std::vector<subrange_sptr>& subs,
19661 | ABSTRACT_TYPE_BASE
19662 | ABSTRACT_DECL_BASE),
19665 priv_(new priv(e_type))
19689 const std::vector<subrange_sptr>& subs,
19693 | ABSTRACT_TYPE_BASE
19694 | ABSTRACT_DECL_BASE),
19722array_type_def::update_size()
19724 type_base_sptr e = priv_->element_type_.lock();
19727 size_t s = e->get_size_in_bits();
19731 s *= sub->get_length();
19739array_type_def::get_subrange_representation()
const
19765 bool qualified_name)
const
19767 return array_declaration_name(
this,
"",
19768 qualified_name, internal);
19793 std::vector<array_type_def::subrange_sptr > this_subs = l.
get_subranges();
19794 std::vector<array_type_def::subrange_sptr > other_subs = r.
get_subranges();
19796 bool result =
true;
19797 if (this_subs.size() != other_subs.size())
19806 std::vector<array_type_def::subrange_sptr >::const_iterator i,j;
19807 for (i = this_subs.begin(), j = other_subs.begin();
19808 i != this_subs.end() && j != other_subs.end();
19855 std::vector<array_type_def::subrange_sptr > this_subs = l->
get_subranges();
19856 std::vector<array_type_def::subrange_sptr > other_subs = r->
get_subranges();
19858 if (this_subs.size() != other_subs.size())
19861 std::vector<array_type_def::subrange_sptr >::const_iterator i,j;
19862 for (i = this_subs.begin(), j = other_subs.begin();
19863 i != this_subs.end() && j != other_subs.end();
19873 if (*first_element_type != *second_element_type)
19929 return *l_ptt == *r_ptt;
19951 const std::vector<subrange_sptr>& subranges =
19954 if (subranges.empty())
19955 return translation_unit::LANG_C11;
19956 return subranges.front()->get_language();
19975 return *
this == *other;
19981const type_base_sptr
19983{
return priv_->element_type_.lock();}
19999 priv_->element_type_ = element_type;
20010 for (
const auto &sub : subs)
20011 priv_->subranges_.push_back(sub);
20023 if (priv_->subranges_.empty())
20026 for (std::vector<shared_ptr<subrange_type> >::const_iterator i =
20027 priv_->subranges_.begin();
20028 i != priv_->subranges_.end();
20030 if ((*i)->is_non_finite())
20037array_type_def::get_dimension_count()
const
20038{
return priv_->subranges_.size();}
20069 if (priv_->internal_qualified_name_.empty())
20070 priv_->internal_qualified_name_ =
20071 array_declaration_name(
this,
"",
20074 return priv_->internal_qualified_name_;
20078 priv_->temp_internal_qualified_name_ =
20079 array_declaration_name(
this,
"",
20081 return priv_->temp_internal_qualified_name_;
20098 (array_declaration_name(
this,
"",
20122 if (v.visit_begin(
this))
20130 bool result = v.visit_end(
this);
20136array_type_def::get_location()
const
20140const std::vector<array_type_def::subrange_sptr>&
20142{
return priv_->subranges_;}
20144array_type_def::~array_type_def()
20151class enum_type_decl::priv
20153 type_base_sptr underlying_type_;
20162 priv(type_base_sptr underlying_type,
20164 : underlying_type_(underlying_type),
20182enum_type_decl::enum_type_decl(
const string& name,
20184 type_base_sptr underlying_type,
20186 const string& linkage_name,
20190 | ABSTRACT_TYPE_BASE
20191 | ABSTRACT_DECL_BASE),
20192 type_base(underlying_type->get_environment(),
20193 underlying_type->get_size_in_bits(),
20194 underlying_type->get_alignment_in_bits()),
20195 decl_base(underlying_type->get_environment(),
20196 name, locus, linkage_name, vis),
20197 priv_(new priv(underlying_type, enums))
20203 e->set_enum_type(
this);
20223{
return priv_->underlying_type_;}
20228{
return priv_->enumerators_;}
20233{
return priv_->enumerators_;}
20241 if (priv_->sorted_enumerators_.empty())
20246 priv_->sorted_enumerators_.push_back(*e);
20248 std::sort(priv_->sorted_enumerators_.begin(),
20249 priv_->sorted_enumerators_.end(),
20253 if (l.get_name() == r.get_name())
20254 return l.get_value() < r.get_value();
20255 return (l.get_name() < r.get_name());
20259 return priv_->sorted_enumerators_;
20277 if (e.get_value() == value)
20301 if (e.get_name() == name)
20329 bool qualified_name)
const
20331 string r =
"enum ";
20361 if (v.visit_begin(
this))
20369 bool result = v.visit_end(
this);
20391 bool result =
false;
20401 enum_type_decl::enumerators::const_iterator i, j;
20434 if (!(l.decl_base::operator==(r) && l.type_base::operator==(r)))
20439 if (!l.decl_base::operator==(r))
20441 if (!l.type_base::operator==(r))
20513is_enumerator_value_present_in_enum(
const enum_type_decl::enumerator &enr,
20514 const enum_type_decl &enom,
20515 vector<enum_type_decl::enumerator>& redundant_enrs)
20517 bool found =
false;
20518 for (
const auto &e : enom.get_enumerators())
20519 if (enumerators_values_are_equal(e, enr))
20523 redundant_enrs.push_back(e);
20541is_enumerator_value_redundant(
const enum_type_decl::enumerator &enr,
20542 const enum_type_decl &enom)
20544 vector<enum_type_decl::enumerator> redundant_enrs;
20545 if (is_enumerator_value_present_in_enum(enr, enom, redundant_enrs))
20547 if (!redundant_enrs.empty())
20575 bool result =
true;
20591 if (!!def1 != !!def2)
20621 if (!(def1->decl_base::operator==(*def2)
20622 && def1->type_base::operator==(*def2)))
20627 if (!def1->decl_base::operator==(*def2))
20629 if (!def1->type_base::operator==(*def2))
20707 && (!is_enumerator_value_redundant(e, *def2)
20708 || !is_enumerator_value_redundant(e, *def1)))
20722 && (!is_enumerator_value_redundant(e, *def1)
20723 || !is_enumerator_value_redundant(e, *def2)))
20765 return *
this == *other;
20780 if (l.get() == r.get())
20782 decl_base_sptr o = r;
20799class enum_type_decl::enumerator::priv
20803 string qualified_name_;
20814 priv(
const string& name,
20816 enum_type_decl* e = 0)
20828enum_type_decl::enumerator::~enumerator() =
default;
20839 : priv_(new priv(name, value))
20846 : priv_(new priv(other.
get_name(),
20848 other.get_enum_type()))
20873 bool names_equal =
true;
20875 return names_equal && (get_value() == other.
get_value());
20894{
return priv_->name_;}
20912 if (priv_->qualified_name_.empty())
20914 priv_->qualified_name_ =
20915 get_enum_type()->get_qualified_name(internal)
20919 return priv_->qualified_name_;
20935{
return priv_->value_;}
20949{
return priv_->enum_type_;}
20956{priv_->enum_type_ = e;}
20962struct typedef_decl::priv
20966 priv(
const type_base_sptr& t)
20967 : underlying_type_(t)
20982typedef_decl::typedef_decl(
const string& name,
20983 const type_base_sptr underlying_type,
20985 const string& linkage_name,
20989 | ABSTRACT_TYPE_BASE
20990 | ABSTRACT_DECL_BASE),
20995 name, locus, linkage_name, vis),
20996 priv_(new priv(underlying_type))
21012typedef_decl::typedef_decl(
const string& name,
21015 const string& mangled_name,
21019 | ABSTRACT_TYPE_BASE
21020 | ABSTRACT_DECL_BASE),
21023 decl_base(env, name, locus, mangled_name, vis),
21024 priv_(new priv(nullptr))
21099 bool result =
true;
21103 if (!(l.decl_base::operator==(r)))
21150 return *
this == *other;
21172 bool qualified_name)
const
21175 string result =
"typedef ";
21176 if (qualified_name)
21189{
return priv_->underlying_type_.lock();}
21197 priv_->underlying_type_ = t;
21211 bool internal)
const
21229 return decl_base::priv_->internal_qualified_name_;
21231 return decl_base::priv_->qualified_name_;
21250 if (v.visit_begin(
this))
21258 bool result = v.visit_end(
this);
21263typedef_decl::~typedef_decl()
21269struct var_decl::priv
21282 priv(type_base_sptr t,
21285 naked_type_(t.get()),
21296 naked_type_ = t.get();
21313var_decl::var_decl(
const string& name,
21314 type_base_sptr type,
21316 const string& linkage_name,
21320 VAR_DECL | ABSTRACT_DECL_BASE),
21321 decl_base(type->get_environment(), name, locus, linkage_name, vis),
21322 priv_(new priv(type, bind))
21330const type_base_sptr
21332{
return priv_->type_.lock();}
21339{priv_->set_type(t);}
21350{
return priv_->naked_type_;}
21357{
return priv_->binding_;}
21364{priv_->binding_ = b;}
21380 priv_->symbol_ = sym;
21395{
return priv_->symbol_;}
21464 bool result =
true;
21477 else if (s0 && !textually_equals(*s0, *s1, k))
21483 bool symbols_are_equal = (s0 && s1 && result);
21485 if (symbols_are_equal)
21494 bool decl_bases_different = !l.decl_base::operator==(r);
21495 const_cast<var_decl&
>(l).set_qualified_name(n1);
21496 const_cast<var_decl&
>(r).set_qualified_name(n2);
21498 if (decl_bases_different)
21508 if (!l.decl_base::operator==(r))
21557 bool result =
true;
21593 return equals(*
this, *other, 0);
21608 if (priv_->id_.empty())
21613 sym_str = s->get_id_string();
21618 priv_->id_ = env.
intern(repr);
21619 if (!sym_str.empty())
21620 priv_->id_ = env.
intern(priv_->id_ +
"{" + sym_str +
"}");
21687 result =
"static ";
21691 bool member_of_anonymous_class =
false;
21694 member_of_anonymous_class =
true;
21703 if (member_of_anonymous_class || !qualified_name)
21710 string quals_repr =
21712 if (!quals_repr.empty())
21713 name = quals_repr +
" " + name;
21717 name = string(
" ") + name;
21719 result += array_declaration_name(t, name, qualified_name, internal);
21721 result += pointer_declaration_name(t, name, qualified_name, internal);
21723 result += pointer_declaration_name(t, name, qualified_name, internal);
21725 result += ptr_to_mbr_declaration_name(t, name,
21740 "",
true, internal);
21746 "",
true, internal);
21749 && (member_of_anonymous_class || !qualified_name))
21765 && (member_of_anonymous_class || !qualified_name))
21819 if (v.visit_begin(
this))
21822 if (type_base_sptr t =
get_type())
21826 return v.visit_end(
this);
21829var_decl::~var_decl()
21844 priv_->cached_name_.clear();
21845 priv_->internal_cached_name_.clear();
21865function_type::function_type(type_base_sptr return_type,
21867 size_t size_in_bits,
21868 size_t alignment_in_bits)
21870 FUNCTION_TYPE | ABSTRACT_TYPE_BASE),
21871 type_base(return_type->get_environment(), size_in_bits, alignment_in_bits),
21872 priv_(new
priv(parms, return_type))
21876 for (parameters::size_type i = 0, j = 1;
21877 i < priv_->parms_.size();
21880 if (i == 0 && priv_->parms_[i]->get_is_artificial())
21887 priv_->parms_[i]->set_index(j);
21898function_type::function_type(type_base_sptr return_type,
21899 size_t size_in_bits,
size_t alignment_in_bits)
21901 FUNCTION_TYPE | ABSTRACT_TYPE_BASE),
21902 type_base(return_type->get_environment(), size_in_bits, alignment_in_bits),
21903 priv_(new
priv(return_type))
21918 size_t size_in_bits,
21919 size_t alignment_in_bits)
21921 type_base(env, size_in_bits, alignment_in_bits),
21947{
return priv_->return_type_.lock();}
21955{priv_->return_type_ = t;}
21964{
return priv_->parms_;}
22007 for (parameters::size_type i = 0, j = 1;
22008 i < priv_->parms_.size();
22011 if (i == 0 && priv_->parms_[i]->get_is_artificial())
22018 priv_->parms_[i]->set_index(j);
22029 parm->set_index(priv_->parms_.size());
22030 priv_->parms_.push_back(parm);
22044 return (!priv_->parms_.empty()
22045 && priv_->parms_.back()->get_variadic_marker());
22077#define RETURN(value) CACHE_AND_RETURN_COMPARISON_RESULT(value)
22086 bool cached_result =
false;
22094 bool result =
true;
22096 if (!l.type_base::operator==(r))
22107 l_class = m->get_class_type().get();
22110 r_class = m->get_class_type().get();
22114 if (!!l_class != !!r_class)
22124 != r_class->get_qualified_name()))
22141 bool compare_result_types =
true;
22142 string l_rt_name = l_return_type_decl
22145 string r_rt_name = r_return_type_decl
22151 (r_class && (r_class->get_qualified_name() == r_rt_name)))
22152 compare_result_types =
false;
22154 if (compare_result_types)
22178 if (l_rt_name != r_rt_name)
22187 vector<shared_ptr<function_decl::parameter> >::const_iterator i,j;
22228function_type::parameters::const_iterator
22234 bool is_method =
dynamic_cast<const method_type*
>(
this);
22238 if (is_method && (*i)->get_is_artificial())
22250function_type::parameters::const_iterator
22277 if (priv_->internal_cached_name_.empty())
22278 priv_->internal_cached_name_ =
22280 return priv_->internal_cached_name_;
22284 priv_->temp_internal_cached_name_ =
22286 return priv_->temp_internal_cached_name_;
22293 if (priv_->cached_name_.empty())
22294 priv_->cached_name_ =
22296 return priv_->cached_name_;
22300 priv_->cached_name_ =
22302 return priv_->cached_name_;
22363 if (v.visit_begin(
this))
22366 bool keep_going =
true;
22370 if (!t->traverse(v))
22371 keep_going =
false;
22378 if (type_base_sptr parm_type = (*i)->get_type())
22379 if (!parm_type->traverse(v))
22384 return v.visit_end(
this);
22387function_type::~function_type()
22393struct method_type::priv
22395 class_or_union_wptr class_type_;
22423method_type::method_type (type_base_sptr return_type,
22424 class_or_union_sptr class_type,
22425 const std::vector<function_decl::parameter_sptr>& p,
22427 size_t size_in_bits,
22428 size_t alignment_in_bits)
22430 METHOD_TYPE | ABSTRACT_TYPE_BASE | FUNCTION_TYPE),
22431 type_base(class_type->get_environment(), size_in_bits, alignment_in_bits),
22432 function_type(return_type, p, size_in_bits, alignment_in_bits),
22463method_type::method_type(type_base_sptr return_type,
22464 type_base_sptr class_type,
22465 const std::vector<function_decl::parameter_sptr>& p,
22467 size_t size_in_bits,
22468 size_t alignment_in_bits)
22470 METHOD_TYPE | ABSTRACT_TYPE_BASE | FUNCTION_TYPE),
22471 type_base(class_type->get_environment(), size_in_bits, alignment_in_bits),
22472 function_type(return_type, p, size_in_bits, alignment_in_bits),
22488 size_t size_in_bits,
22489 size_t alignment_in_bits)
22491 type_base(env, size_in_bits, alignment_in_bits),
22511method_type::method_type(class_or_union_sptr class_type,
22513 size_t size_in_bits,
22514 size_t alignment_in_bits)
22516 METHOD_TYPE | ABSTRACT_TYPE_BASE | FUNCTION_TYPE),
22517 type_base(class_type->get_environment(), size_in_bits, alignment_in_bits),
22520 alignment_in_bits),
22547{
return class_or_union_sptr(priv_->class_type_);}
22560 priv_->class_type_ = t;
22588{priv_->is_const = f;}
22595{
return priv_->is_const;}
22611 if (!first_parm->get_is_artificial())
22614 type_base_sptr this_ptr_type = first_parm->get_type();
22622 type_base_sptr candidate_class_type =
22642struct function_decl::priv
22644 bool declared_inline_;
22652 : declared_inline_(false),
22658 bool declared_inline,
22660 : declared_inline_(declared_inline),
22663 naked_type_(t.get())
22667 bool declared_inline,
22670 : declared_inline_(declared_inline),
22673 naked_type_(t.get()),
22695 bool declared_inline,
22697 const string& mangled_name,
22701 FUNCTION_DECL | ABSTRACT_DECL_BASE),
22732 type_base_sptr fn_type,
22733 bool declared_inline,
22735 const string& linkage_name,
22739 FUNCTION_DECL | ABSTRACT_DECL_BASE),
22740 decl_base(fn_type->get_environment(), name, locus, linkage_name, vis),
22741 priv_(new priv(dynamic_pointer_cast<
function_type>(fn_type),
22763 bool qualified_name)
const
22768 string fn_prefix = mem_fn ?
"method ":
"function ";
22774 fn_prefix +=
"virtual ";
22776 decl_base_sptr return_type;
22783 return_type = mem_fn
22794 internal) +
" " + result;
22797 result = add_outer_pointer_to_fn_type_expr(p, result,
22802 result = add_outer_pointer_to_array_type_expr(p, result,
22809 return fn_prefix + result;
22839 result += mem_fn->
get_type()->get_class_type()->get_qualified_name()
22845 std::ostringstream fn_parms;
22846 stream_pretty_representation_of_fn_parms(*
get_type(),
22850 result += fn_parms.str();
22855 result +=
" const";
22866function_decl::parameters::const_iterator
22872 bool is_method =
dynamic_cast<const method_decl*
>(
this);
22885const shared_ptr<function_type>
22887{
return priv_->type_.lock();}
22902{
return priv_->naked_type_;}
22907 priv_->type_ = fn_type;
22908 priv_->naked_type_ = fn_type.get();
22925 priv_->symbol_ = sym;
22940{
return priv_->symbol_;}
22947{
return priv_->declared_inline_;}
22954{priv_->declared_inline_ = value;}
22957function_decl::get_binding()
const
22958{
return priv_->binding_;}
22961const shared_ptr<type_base>
22963{
return get_type()->get_return_type();}
22966const std::vector<shared_ptr<function_decl::parameter> >&
22968{
return get_type()->get_parameters();}
22975{
get_type()->append_parameter(parm);}
22983 for (std::vector<shared_ptr<parameter> >::const_iterator i = parms.begin();
23056 bool result =
true;
23060 if (t0 == t1 || *t0 == *t1)
23086 else if (s0 && s0 != s1)
23097 bool symbols_are_equal = (s0 && s1 && result);
23099 if (symbols_are_equal)
23111 bool decl_bases_different = !l.decl_base::operator==(r);
23118 if (decl_bases_different)
23128 if (!l.decl_base::operator==(r))
23140 if (l.get_binding() != r.get_binding())
23197 return equals(*
this, *o, 0);
23224 if (priv_->id_.empty())
23229 string virtual_member_suffix;
23239 virtual_member_suffix +=
"/o";
23242 if (s->has_aliases())
23249 priv_->id_ = env.
intern(s->get_id_string());
23251 if (!virtual_member_suffix.empty())
23252 priv_->id_ = env.
intern(priv_->id_ + virtual_member_suffix);
23296 if (v.visit_begin(
this))
23299 if (type_base_sptr t =
get_type())
23303 return v.visit_end(
this);
23325 if (l.get() == r.get())
23348struct function_decl::parameter::priv
23352 bool variadic_marker_;
23359 priv(type_base_sptr type,
23361 bool variadic_marker)
23364 variadic_marker_(variadic_marker)
23368function_decl::parameter::parameter(
const type_base_sptr type,
23370 const string& name,
23371 const location& loc,
23373 : type_or_decl_base(type->get_environment(),
23374 FUNCTION_PARAMETER_DECL | ABSTRACT_DECL_BASE),
23375 decl_base(type->get_environment(), name, loc),
23376 priv_(new priv(type, index, is_variadic))
23378 runtime_type_instance(
this);
23381function_decl::parameter::parameter(
const type_base_sptr type,
23383 const string& name,
23384 const location& loc,
23386 bool is_artificial)
23387 : type_or_decl_base(type->get_environment(),
23388 FUNCTION_PARAMETER_DECL | ABSTRACT_DECL_BASE),
23389 decl_base(type->get_environment(), name, loc),
23390 priv_(new priv(type, index, is_variadic))
23392 runtime_type_instance(
this);
23393 set_is_artificial(is_artificial);
23396function_decl::parameter::parameter(
const type_base_sptr type,
23397 const string& name,
23398 const location& loc,
23400 bool is_artificial)
23401 : type_or_decl_base(type->get_environment(),
23402 FUNCTION_PARAMETER_DECL | ABSTRACT_DECL_BASE),
23403 decl_base(type->get_environment(), name, loc),
23404 priv_(new priv(type, 0, is_variadic))
23406 runtime_type_instance(
this);
23407 set_is_artificial(is_artificial);
23410function_decl::parameter::parameter(
const type_base_sptr type,
23413 : type_or_decl_base(type->get_environment(),
23414 FUNCTION_PARAMETER_DECL | ABSTRACT_DECL_BASE),
23415 decl_base(type->get_environment(),
"", location()),
23416 priv_(new priv(type, index, variad))
23418 runtime_type_instance(
this);
23421function_decl::parameter::~parameter() =
default;
23423const type_base_sptr
23424function_decl::parameter::get_type()
const
23425{
return priv_->type_.lock();}
23452 if (get_variadic_marker()
23472 std::ostringstream o;
23473 o <<
"parameter-" << get_index();
23475 return env.
intern(o.str());
23479function_decl::parameter::get_index()
const
23480{
return priv_->index_;}
23483function_decl::parameter::set_index(
unsigned i)
23484{priv_->index_ = i;}
23488function_decl::parameter::get_variadic_marker()
const
23489{
return priv_->variadic_marker_;}
23515 bool result =
true;
23517 if ((l.get_variadic_marker() != r.get_variadic_marker())
23518 || (l.get_index() != r.get_index())
23519 || (!!l.get_type() != !!r.get_type()))
23524 if (l.get_index() != r.get_index())
23526 if (l.get_variadic_marker() != r.get_variadic_marker()
23527 || !!l.get_type() != !!r.get_type())
23534 type_base_sptr l_type = l.get_type();
23535 type_base_sptr r_type = r.get_type();
23537 if (l_type != r_type)
23555function_decl::parameter::operator==(
const parameter& o)
const
23556{
return equals(*
this, o, 0);}
23565 return function_decl::parameter::operator==(*p);
23611 if (v.visit_begin(
this))
23614 if (type_base_sptr t =
get_type())
23618 return v.visit_end(
this);
23651 bool qualified_name)
const
23658 type_repr =
"void";
23664 string result = type_repr;
23665 string parm_name = get_name_id();
23667 if (!parm_name.empty())
23668 result +=
" " + parm_name;
23702 size_t size_in_bits,
size_t align_in_bits,
23709 | ABSTRACT_DECL_BASE
23710 | ABSTRACT_SCOPE_TYPE_DECL
23711 | ABSTRACT_SCOPE_DECL),
23712 decl_base(env, name, locus, name, vis),
23713 type_base(env, size_in_bits, align_in_bits),
23717 for (member_types::iterator i = mem_types.begin();
23718 i != mem_types.end();
23729 for (member_functions::iterator i = member_fns.begin();
23730 i != member_fns.end();
23732 if (!
has_scope(static_pointer_cast<decl_base>(*i)))
23752 size_t size_in_bits,
size_t align_in_bits,
23756 | ABSTRACT_DECL_BASE
23757 | ABSTRACT_SCOPE_TYPE_DECL
23758 | ABSTRACT_SCOPE_DECL),
23759 decl_base(env, name, locus, name, vis),
23760 type_base(env, size_in_bits, align_in_bits),
23774 bool is_declaration_only)
23777 | ABSTRACT_DECL_BASE
23778 | ABSTRACT_SCOPE_TYPE_DECL
23779 | ABSTRACT_SCOPE_DECL),
23799 hash_t h = do_hash(
this);
23820 if (v.visit_begin(
this))
23829 if (!(*i)->traverse(v))
23839 if (!(*i)->traverse(v))
23849 if (!(*i)->traverse(v))
23856 for (member_function_templates::const_iterator i =
23860 if (!(*i)->traverse(v))
23867 for (member_class_templates::const_iterator i =
23871 if (!(*i)->traverse(v))
23879 bool result = v.visit_end(
this);
23908 type_base_sptr t =
is_type(decl);
23938 for (class_or_union::data_members::const_iterator it =
24027 if (t->get_is_anonymous())
24045 if (t->get_is_anonymous())
24063 if (t->get_is_anonymous())
24088 bool is_laid_out,
bool is_static,
24089 size_t offset_in_bits)
24093 priv_->data_members_.push_back(v);
24102 bool is_already_in =
false;
24105 for (
const auto& s_dm: priv_->static_data_members_)
24109 is_already_in =
true;
24113 if (!is_already_in)
24114 priv_->static_data_members_.push_back(v);
24120 for (data_members::const_iterator i =
24121 priv_->non_static_data_members_.begin();
24122 i != priv_->non_static_data_members_.end();
24126 is_already_in =
true;
24129 if (!is_already_in)
24130 priv_->non_static_data_members_.push_back(v);
24146{
return priv_->data_members_;}
24161 if ((*i)->get_name() == name)
24173 if (
var_decl_sptr data_member = type->find_data_member(name))
24174 return data_member;
24188 if (!v->get_name().empty())
24196 if ((*it)->get_pretty_representation(
false,
true)
24197 == v->get_pretty_representation(
false,
true))
24224 if (v->get_name().empty())
24237{
return priv_->non_static_data_members_;}
24245{
return priv_->static_data_members_;}
24263 bool is_static,
bool is_ctor,
24264 bool is_dtor,
bool is_const)
24276 priv_->member_functions_.push_back(f);
24280 if (!f->get_linkage_name().empty())
24281 priv_->mem_fns_map_[f->get_linkage_name()] = f;
24290{
return priv_->member_functions_;}
24311 string_mem_fn_sptr_map_type::const_iterator i =
24312 priv_->mem_fns_map_.find(linkage_name);
24313 if (i == priv_->mem_fns_map_.end())
24315 return i->second.get();
24326 string_mem_fn_sptr_map_type::const_iterator i =
24327 priv_->mem_fns_map_.find(linkage_name);
24328 if (i == priv_->mem_fns_map_.end())
24354 string_mem_fn_ptr_map_type::const_iterator i =
24355 priv_->signature_2_mem_fn_map_.find(s);
24356 if (i == priv_->signature_2_mem_fn_map_.end())
24364const member_function_templates&
24366{
return priv_->member_function_templates_;}
24371const member_class_templates&
24373{
return priv_->member_class_templates_;}
24384 priv_->member_function_templates_.push_back(m);
24399 priv_->member_class_templates_.push_back(m);
24409 && priv_->data_members_.empty()
24410 && priv_->member_functions_.empty()
24411 && priv_->member_function_templates_.empty()
24412 && priv_->member_class_templates_.empty());
24431 else if (method_decl_sptr f = dynamic_pointer_cast<method_decl>(d))
24437 else if (member_function_template_sptr f =
24438 dynamic_pointer_cast<member_function_template>(d))
24440 else if (member_class_template_sptr c =
24441 dynamic_pointer_cast<member_class_template>(d))
24490 return *
this == *o;
24531 if (l_is_decl_only || r_is_decl_only)
24541 if (!def1 || !def2)
24545 && l_is_decl_only && r_is_decl_only
24584 if (!!def1 != !!def2)
24592 if (!(l.decl_base::operator==(r)
24593 && l.type_base::operator==(r)))
24604 bool val = *def1 == *def2;
24613 if (!(l.decl_base::operator==(r) && l.type_base::operator==(r)))
24620 if (types_defined_same_linux_kernel_corpus_public(l, r))
24628#define RETURN(value) \
24629 return return_comparison_result(l, r, value);
24635 bool result =
true;
24649 for (class_or_union::data_members::const_iterator
24663 || (*d0)->get_type() == (*d1)->get_type())
24690 for (member_function_templates::const_iterator
24695 ++fn_tmpl_it0, ++fn_tmpl_it1)
24696 if (**fn_tmpl_it0 != **fn_tmpl_it1)
24721 for (member_class_templates::const_iterator
24726 ++cl_tmpl_it0, ++cl_tmpl_it1)
24727 if (**cl_tmpl_it0 != **cl_tmpl_it1)
24755 const method_decl_sptr& method)
24777 old_type->get_parameters(),
24778 old_type->get_is_const(),
24779 old_type->get_size_in_bits(),
24780 old_type->get_alignment_in_bits()));
24781 t->get_translation_unit()->bind_function_type_life_time(new_type);
24790 method->get_binding()));
24791 new_method->set_symbol(method->
get_symbol());
24794 class_type->add_member_function(new_method,
24803 t->add_member_function(new_method,
24820struct class_decl::priv
24823 unordered_map<string, base_spec_sptr> bases_map_;
24829 : is_struct_(false)
24870 size_t size_in_bits,
size_t align_in_bits,
24871 bool is_struct,
const location& locus,
24878 | ABSTRACT_TYPE_BASE
24879 | ABSTRACT_DECL_BASE
24880 | ABSTRACT_SCOPE_TYPE_DECL
24881 | ABSTRACT_SCOPE_DECL),
24882 decl_base(env, name, locus, name, vis),
24883 type_base(env, size_in_bits, align_in_bits),
24885 locus, vis, mbr_types, data_mbrs, mbr_fns),
24886 priv_(new priv(is_struct, bases))
24921 size_t size_in_bits,
size_t align_in_bits,
24922 bool is_struct,
const location& locus,
24928 | ABSTRACT_TYPE_BASE
24929 | ABSTRACT_DECL_BASE
24930 | ABSTRACT_SCOPE_TYPE_DECL
24931 | ABSTRACT_SCOPE_DECL),
24940 is_anonymous ? string() : name,
24942 type_base(env, size_in_bits, align_in_bits),
24944 locus, vis, mbr_types, data_mbrs, mbr_fns),
24945 priv_(new priv(is_struct, bases))
24967 size_t size_in_bits,
size_t align_in_bits,
24968 bool is_struct,
const location& locus,
24972 | ABSTRACT_TYPE_BASE
24973 | ABSTRACT_DECL_BASE
24974 | ABSTRACT_SCOPE_TYPE_DECL
24975 | ABSTRACT_SCOPE_DECL),
24976 decl_base(env, name, locus, name, vis),
24977 type_base(env, size_in_bits, align_in_bits),
24980 priv_(new priv(is_struct))
25004 size_t size_in_bits,
size_t align_in_bits,
25005 bool is_struct,
const location& locus,
25009 | ABSTRACT_TYPE_BASE
25010 | ABSTRACT_DECL_BASE
25011 | ABSTRACT_SCOPE_TYPE_DECL
25012 | ABSTRACT_SCOPE_DECL),
25021 is_anonymous ? string() : name,
25023 type_base(env, size_in_bits, align_in_bits),
25026 priv_(new priv(is_struct))
25042 bool is_struct,
bool is_declaration_only)
25045 | ABSTRACT_TYPE_BASE
25046 | ABSTRACT_DECL_BASE
25047 | ABSTRACT_SCOPE_TYPE_DECL
25048 | ABSTRACT_SCOPE_DECL),
25052 priv_(new priv(is_struct))
25067 for (class_decl::virtual_mem_fn_map_type::iterator i =
25068 priv_->virtual_mem_fns_map_.begin();
25069 i != priv_->virtual_mem_fns_map_.end();
25071 sort_virtual_member_functions(i->second);
25079{priv_->is_struct_ = f;}
25086{
return priv_->is_struct_;}
25094 priv_->bases_.push_back(b);
25095 priv_->bases_map_[b->get_base_class()->get_qualified_name()] = b;
25103{
return priv_->bases_;}
25114 unordered_map<string, base_spec_sptr>::iterator i =
25115 priv_->bases_map_.find(qualified_name);
25117 if (i != priv_->bases_map_.end())
25118 return i->second->get_base_class();
25129{
return priv_->virtual_mem_fns_;}
25148{
return priv_->virtual_mem_fns_map_;}
25153{sort_virtual_member_functions(priv_->virtual_mem_fns_);}
25174 bool qualified_name)
const
25176 string cl =
"class ";
25185 if (internal && !
get_name().empty())
25193 string result = cl;
25194 if (qualified_name)
25203class_decl::insert_member_decl(decl_base_sptr d)
25205 if (method_decl_sptr f = dynamic_pointer_cast<method_decl>(d))
25220struct class_decl::base_spec::priv
25223 long offset_in_bits_;
25227 long offset_in_bits,
25230 offset_in_bits_(offset_in_bits),
25231 is_virtual_(is_virtual)
25249 long offset_in_bits,
25252 ABSTRACT_DECL_BASE),
25254 base->get_linkage_name(), base->get_visibility()),
25256 priv_(new priv(base, offset_in_bits, is_virtual))
25282{
return priv_->base_class_.lock();}
25289{
return priv_->is_virtual_;}
25296{
return priv_->offset_in_bits_;}
25316 if (v.visit_begin(
this))
25319 get_base_class()->traverse(v);
25323 return v.visit_end(
this);
25343class_decl::base_spec::base_spec(
const type_base_sptr& base,
25345 long offset_in_bits,
25348 ABSTRACT_DECL_BASE),
25354 priv_(new priv(dynamic_pointer_cast<
class_decl>(base),
25361class_decl::base_spec::~base_spec() =
default;
25387 if (!l.member_base::operator==(r))
25413 return equals(*
this, *o, 0);
25434mem_fn_context_rel::~mem_fn_context_rel()
25454method_decl::method_decl(
const string& name,
25456 bool declared_inline,
25458 const string& linkage_name,
25463 | ABSTRACT_DECL_BASE
25467 declared_inline, locus, linkage_name, vis, bind)
25491method_decl::method_decl(
const string& name,
25493 bool declared_inline,
25495 const string& linkage_name,
25500 | ABSTRACT_DECL_BASE
25502 decl_base(type->get_environment(), name, locus, linkage_name, vis),
25505 declared_inline, locus, linkage_name, vis, bind)
25528method_decl::method_decl(
const string& name,
25529 type_base_sptr type,
25530 bool declared_inline,
25532 const string& linkage_name,
25537 | ABSTRACT_DECL_BASE
25539 decl_base(type->get_environment(), name, locus, linkage_name, vis),
25542 declared_inline, locus, linkage_name, vis, bind)
25561 class_or_union_sptr cl = t->get_class_type();
25563 cl->priv_->mem_fns_map_[l] = m;
25564 if (!old_lname.empty() && l != old_lname)
25566 if (method_decl_sptr m = cl->find_member_function_sptr(old_lname))
25569 cl->priv_->mem_fns_map_.erase(old_lname);
25575method_decl::~method_decl()
25612 if (l.get() == r.get())
25665{
return dynamic_pointer_cast<method_decl>(d);}
25669struct virtual_member_function_less_than
25693 if (f_offset != s_offset)
return f_offset < s_offset;
25699 if (fn != sn)
return fn < sn;
25705 if ((!f_sym) != (!s_sym))
return !f_sym;
25706 if (f_sym && s_sym)
25708 fn = f_sym->get_id_string();
25709 sn = s_sym->get_id_string();
25710 if (fn != sn)
return fn < sn;
25717 if (fn != sn)
return fn < sn;
25721 string fn_filepath, sn_filepath;
25722 unsigned line = 0, column = 0;
25725 fn_loc.
expand(fn_filepath, line, column);
25727 sn_loc.expand(sn_filepath, line, column);
25728 return fn_filepath < sn_filepath;
25743 operator()(
const method_decl_sptr f,
25744 const method_decl_sptr s)
25745 {
return operator()(*f, *s);}
25754 virtual_member_function_less_than lt;
25755 std::stable_sort(mem_fns.begin(), mem_fns.end(), lt);
25784 size_t vtable_offset,
25785 bool is_static,
bool is_ctor,
25786 bool is_dtor,
bool is_const)
25789 is_dtor, is_const);
25796 sort_virtual_member_functions(klass->priv_->virtual_mem_fns_);
25815 class_decl::member_functions::const_iterator m;
25816 for (m = klass->priv_->virtual_mem_fns_.begin();
25817 m != klass->priv_->virtual_mem_fns_.end();
25819 if (m->get() == method.get()
25820 || (*m)->get_linkage_name() == method->get_linkage_name())
25822 if (m == klass->priv_->virtual_mem_fns_.end())
25823 klass->priv_->virtual_mem_fns_.push_back(method);
25831 class_decl::virtual_mem_fn_map_type::iterator i =
25832 klass->priv_->virtual_mem_fns_map_.find(voffset);
25833 if (i == klass->priv_->virtual_mem_fns_map_.end())
25836 virtual_mem_fns_at_voffset.push_back(method);
25837 klass->priv_->virtual_mem_fns_map_[voffset] = virtual_mem_fns_at_voffset;
25841 for (m = i->second.begin() ; m != i->second.end(); ++m)
25842 if (m->get() == method.get()
25843 || (*m)->get_linkage_name() == method->get_linkage_name())
25845 if (m == i->second.end())
25846 i->second.push_back(method);
25875 if ((*b)->get_is_virtual()
25876 || (*b)->get_base_class()->has_virtual_bases())
25905 ssize_t offset = -1;
25906 for (class_decl::virtual_mem_fn_map_type::const_iterator e =
25910 if (e->first > offset)
25940methods_equal_modulo_elf_symbol(
const method_decl_sptr& f,
25941 const method_decl_sptr& s)
25943 method_decl_sptr first = f, second = s;
25945 first->get_symbol();
25947 second->get_symbol();
25949 first->get_linkage_name();
25951 second->get_linkage_name();
25954 first->set_linkage_name(
"");
25956 second->set_linkage_name(
"");
25958 bool equal = *first == *second;
25960 first->set_symbol(saved_first_elf_symbol);
25961 first->set_linkage_name(saved_first_linkage_name);
25962 second->set_symbol(saved_second_elf_symbol);
25963 second->set_linkage_name(saved_second_linkage_name);
25984method_matches_at_least_one_in_vector(
const method_decl_sptr& method,
25987 for (class_decl::member_functions::const_iterator i = fns.begin();
25996 if (methods_equal_modulo_elf_symbol(method, *i))
26029 bool result =
false;
26030 if (l.
get_environment().priv_->is_type_comparison_cached(l, r, result))
26041 bool result =
true;
26055#define RETURN(value) CACHE_AND_RETURN_COMPARISON_RESULT(value)
26067 for (class_decl::base_specs::const_iterator
26079 (*b1)->get_base_class().get()))
26125 for (class_decl::virtual_mem_fn_map_type::const_iterator first_v_fn_entry =
26128 ++first_v_fn_entry)
26130 unsigned voffset = first_v_fn_entry->first;
26132 first_v_fn_entry->second;
26134 const class_decl::virtual_mem_fn_map_type::const_iterator
26146 second_v_fn_entry->second;
26148 bool matches =
false;
26149 for (class_decl::member_functions::const_iterator i =
26150 first_vfns.begin();
26151 i != first_vfns.end();
26153 if (method_matches_at_least_one_in_vector(*i, second_vfns))
26247 return *
this == *o;
26291 if (l.get() == r.get())
26323operator==(
const class_or_union_sptr& l,
const class_or_union_sptr& r)
26325 if (l.get() == r.get())
26342operator!=(
const class_or_union_sptr& l,
const class_or_union_sptr& r)
26362 if (v.visit_begin(
this))
26371 if (!(*i)->traverse(v))
26382 if (!(*i)->traverse(v))
26392 if (!(*i)->traverse(v))
26402 if (!(*i)->traverse(v))
26409 for (member_function_templates::const_iterator i =
26413 if (!(*i)->traverse(v))
26420 for (member_class_templates::const_iterator i =
26424 if (!(*i)->traverse(v))
26432 bool result = v.visit_end(
this);
26441context_rel::~context_rel()
26445member_base::operator==(
const member_base& o)
const
26465 if (l.get() == r.get())
26470 return *l ==
static_cast<const decl_base&
>(*r);
26509{
return dynamic_pointer_cast<class_decl::base_spec>(tod);}
26512member_function_template::operator==(
const member_base& other)
const
26519 if (!(is_constructor() == o.is_constructor()
26520 && is_const() == o.is_const()
26521 && member_base::operator==(o)))
26528 return ftdecl->function_tdecl::operator==(*other_ftdecl);
26547 const member_function_template_sptr& r)
26549 if (l.get() == r.get())
26568 const member_function_template_sptr& r)
26585 if (v.visit_begin(
this))
26592 return v.visit_end(
this);
26608 if (!member_base::operator==(o))
26611 return as_class_tdecl()->class_tdecl::operator==(o);
26625 if (!decl_base::operator==(other))
26627 return as_class_tdecl()->class_tdecl::operator==(other);
26641 return *
this == *o;
26654 const member_class_template_sptr& r)
26656 if (l.get() == r.get())
26674 const member_class_template_sptr& r)
26691 if (v.visit_begin(
this))
26698 return v.visit_end(
this);
26718 case private_access:
26721 case protected_access:
26724 case public_access:
26748 c->set_is_static(s);
26758 for (
const auto& dm : cl->get_data_members())
26759 if (dm->get_name() == v->get_name())
26770 for (class_decl::data_members::iterator i =
26771 cl->priv_->non_static_data_members_.begin();
26772 i != cl->priv_->non_static_data_members_.end();
26775 if ((*i)->get_name() == v->get_name())
26777 cl->priv_->non_static_data_members_.erase(i);
26784 bool already_in_static_dms =
false;
26785 for (
const auto& s_dm : cl->priv_->static_data_members_)
26786 if (s_dm->get_name() == v->get_name())
26788 already_in_static_dms =
true;
26791 if (!already_in_static_dms)
26792 cl->priv_->static_data_members_.push_back(var);
26797 for (class_or_union::data_members::iterator i =
26798 cl->priv_->static_data_members_.begin();
26799 i != cl->priv_->static_data_members_.end();
26801 if ((*i)->get_name() == v->get_name())
26803 cl->priv_->static_data_members_.erase(i);
26809 bool is_already_in_non_static_data_members =
false;
26810 for (
const auto& ns_dm : cl->priv_->non_static_data_members_)
26811 if (ns_dm->get_name() == v->get_name())
26813 is_already_in_non_static_data_members =
true;
26816 if (!is_already_in_non_static_data_members)
26817 cl->priv_->non_static_data_members_.push_back(var);
26857 size_t size_in_bits,
const location& locus,
26862 | ABSTRACT_TYPE_BASE
26863 | ABSTRACT_DECL_BASE),
26864 decl_base(env, name, locus, name, vis),
26867 locus, vis, mbr_types, data_mbrs, member_fns)
26893 size_t size_in_bits,
const location& locus,
26899 | ABSTRACT_TYPE_BASE
26900 | ABSTRACT_DECL_BASE),
26909 is_anonymous ? string() : name,
26913 locus, vis, mbr_types, data_mbrs, member_fns)
26931 size_t size_in_bits,
const location& locus,
26935 | ABSTRACT_TYPE_BASE
26936 | ABSTRACT_DECL_BASE
26937 | ABSTRACT_SCOPE_TYPE_DECL
26938 | ABSTRACT_SCOPE_DECL),
26939 decl_base(env, name, locus, name, vis),
26962 size_t size_in_bits,
const location& locus,
26966 | ABSTRACT_TYPE_BASE
26967 | ABSTRACT_DECL_BASE
26968 | ABSTRACT_SCOPE_TYPE_DECL
26969 | ABSTRACT_SCOPE_DECL),
26978 is_anonymous ? string() : name,
26997 const string& name,
26998 bool is_declaration_only)
27001 | ABSTRACT_TYPE_BASE
27002 | ABSTRACT_DECL_BASE
27003 | ABSTRACT_SCOPE_TYPE_DECL
27004 | ABSTRACT_SCOPE_DECL),
27045 bool qualified_name)
const
27050 if (internal && !
get_name().empty())
27051 repr = string(
"union ") +
27061 if (qualified_name)
27098 return *
this == *o;
27112 return *
this == *o;
27145 if (v.visit_begin(
this))
27154 if (!(*i)->traverse(v))
27164 if (!(*i)->traverse(v))
27174 if (!(*i)->traverse(v))
27181 for (member_function_templates::const_iterator i =
27185 if (!(*i)->traverse(v))
27192 for (member_class_templates::const_iterator i =
27196 if (!(*i)->traverse(v))
27204 bool result = v.visit_end(
this);
27243 bool result =
false;
27244 if (l.
get_environment().priv_->is_type_comparison_cached(l, r, result))
27265 const method_decl_sptr& f)
27280 const class_or_union_sptr t = union_type;
27295 if (l.get() == r.get())
27319class template_decl::priv
27323 std::list<template_parameter_sptr> parms_;
27336{priv_->parms_.push_back(p);}
27342const std::list<template_parameter_sptr>&
27344{
return priv_->parms_;}
27357 const string& name,
27382 return *
this == *other;
27395 list<shared_ptr<template_parameter> >::const_iterator t0, t1;
27421class template_parameter::priv
27427 mutable bool hashing_started_;
27428 mutable bool comparison_started_;
27436 template_decl_(enclosing_template_decl),
27437 hashing_started_(),
27438 comparison_started_()
27442template_parameter::template_parameter(
unsigned index,
27444 : priv_(new priv(index, enclosing_template))
27448template_parameter::get_index()
const
27449{
return priv_->index_;}
27452template_parameter::get_enclosing_template_decl()
const
27453{
return priv_->template_decl_.lock();}
27459 if (get_index() != o.get_index())
27462 if (priv_->comparison_started_)
27465 bool result =
false;
27470 priv_->comparison_started_ =
true;
27472 if (!!get_enclosing_template_decl() != !!o.get_enclosing_template_decl())
27474 else if (get_enclosing_template_decl()
27475 && (*get_enclosing_template_decl()
27476 != *o.get_enclosing_template_decl()))
27481 priv_->comparison_started_ =
false;
27501class type_tparameter::priv
27516type_tparameter::type_tparameter(
unsigned index,
27518 const string& name,
27522 | ABSTRACT_TYPE_BASE
27524 decl_base(enclosing_tdecl->get_environment(), name, locus),
27525 type_base(enclosing_tdecl->get_environment(), 0, 0),
27526 type_decl(enclosing_tdecl->get_environment(), name, 0, 0, locus),
27541 if (!type_decl::operator==(other))
27561 if (!type_decl::operator==(other))
27581 if (!decl_base::operator==(other))
27617{
return *
this ==
static_cast<const type_base&
>(other);}
27619type_tparameter::~type_tparameter()
27623class non_type_tparameter::priv
27633 priv(type_base_sptr type)
27651non_type_tparameter::non_type_tparameter(
unsigned index,
27653 const string& name,
27654 type_base_sptr type,
27657 decl_base(type->get_environment(), name, locus,
""),
27659 priv_(new priv(type))
27667const type_base_sptr
27669{
return priv_->type_.lock();}
27675 if (!decl_base::operator==(other))
27682 return (template_parameter::operator==(o)
27701non_type_tparameter::~non_type_tparameter()
27707class template_tparameter::priv
27721template_tparameter::template_tparameter(
unsigned index,
27723 const string& name,
27727 | ABSTRACT_TYPE_BASE
27729 decl_base(enclosing_tdecl->get_environment(), name, locus),
27730 type_base(enclosing_tdecl->get_environment(), 0, 0),
27731 type_decl(enclosing_tdecl->get_environment(), name,
27732 0, 0, locus, name, VISIBILITY_DEFAULT),
27734 template_decl(enclosing_tdecl->get_environment(), name, locus),
27752 return (type_tparameter::operator==(o)
27771 return (type_tparameter::operator==(o)
27785 return *
this ==
static_cast<const type_base&
>(other);
27804template_tparameter::~template_tparameter()
27812class type_composition::priv
27836type_composition::type_composition(
unsigned index,
27840 ABSTRACT_DECL_BASE),
27851const type_base_sptr
27853{
return priv_->type_.lock();}
27862type_composition::~type_composition()
27871class function_tdecl::priv
27883 : pattern_(pattern), binding_(bind)
27910 | ABSTRACT_SCOPE_DECL),
27914 priv_(new priv(bind))
27938 | ABSTRACT_SCOPE_DECL),
27943 priv_(new priv(pattern, bind))
27954 priv_->pattern_ = p;
27964{
return priv_->pattern_;}
27971{
return priv_->binding_;}
27983 return *
this == *o;
27997 return *
this == *o;
28010 && template_decl::operator==(o)
28011 && scope_decl::operator==(o)
28035 if (!v.visit_begin(
this))
28042 return v.visit_end(
this);
28045function_tdecl::~function_tdecl()
28053class class_tdecl::priv
28064 : pattern_(pattern)
28083 | ABSTRACT_SCOPE_DECL),
28108 | ABSTRACT_SCOPE_DECL),
28113 priv_(new priv(pattern))
28124 priv_->pattern_ = p;
28134{
return priv_->pattern_;}
28143 if (!(template_decl::operator==(o)
28144 && scope_decl::operator==(o)
28163 return *
this ==
static_cast<const decl_base&
>(o);
28171{
return *
this ==
static_cast<const decl_base&
>(o);}
28187 if (v.visit_begin(
this))
28191 pattern->traverse(v);
28194 return v.visit_end(
this);
28197class_tdecl::~class_tdecl()
28208 non_canonicalized_subtype_detector();
28211 non_canonicalized_subtype_detector(
type_base* type)
28213 has_non_canonical_type_()
28222 has_non_canonical_type()
const
28223 {
return has_non_canonical_type_;}
28228 visit_begin(function_decl* f)
28246 visit_begin(type_base* t)
28250 if (!t->get_canonical_type())
28254 has_non_canonical_type_ = t;
28269 visit_end(type_base* )
28271 if (has_non_canonical_type_)
28288 non_canonicalized_subtype_detector v(t.get());
28290 return v.has_non_canonical_type();
28306 const type_base_sptr t_v2)
28313 return (t1 != t2 && repr1 == repr2);
28324 env.priv_->extra_live_types_.push_back(t);
28359 result =
reinterpret_cast<size_t>(g);
28361 result =
reinterpret_cast<size_t>(s);
28367 string repr = v->get_pretty_representation(
true);
28368 std::hash<string> hash_string;
28376 string repr = f->get_pretty_representation(
true);
28377 std::hash<string> hash_string;
28383 type_base_sptr parm_type = p->get_type();
28385 std::hash<bool> hash_bool;
28386 std::hash<unsigned> hash_unsigned;
28395 std::hash<size_t> hash_size;
28396 std::hash<bool> hash_bool;
28397 type_base_sptr type = bs->get_base_class();
28434{
return hash_as_canonical_type_or_constant(t);}
28461 if (d->type_or_decl_base::priv_->get_hashing_state()
28463 return d->type_or_decl_base::priv_->hash_value_;
28466 return artefact.priv_->hash_value_;
28568 exemplar =
const_cast<type_base*
>(type);
28597hash_as_canonical_type_or_constant(
const type_base *t)
28604 if (!canonical_type)
28622 if (canonical_type)
28623 return reinterpret_cast<size_t>(canonical_type);
28698 const type_base_sptr& second,
28699 bool indirect_type)
28731 bool indirect_type)
28733 if (!!first != !!second)
28745 if (
typeid(*first) !=
typeid(*second))
28761 if (ty1->is_lvalue() != ty2->is_lvalue())
28764 ty2->get_pointed_to_type(),
28783 if (!indirect_type)
28787 return ty1->get_name() == ty2->
get_name();
28793 if (!indirect_type)
28797 return (
get_name(ty1->get_underlying_type())
28805 && ty1->get_name() != ty2->
get_name())
28808 if (!indirect_type)
28811 || (ty1->get_non_static_data_members().size()
28815 for (class_or_union::data_members::const_iterator
28816 i = ty1->get_non_static_data_members().begin(),
28818 (i != ty1->get_non_static_data_members().end()
28825 dm2->get_type().get(),
28838 && ty1->get_name() != ty2->
get_name())
28841 if (!indirect_type)
28850 if (!indirect_type)
28853 || ty1->get_dimension_count() != ty2->get_dimension_count())
28873 for (
auto r1 = ty1->get_subranges().begin(),
28874 r2 = ty1->get_subranges().begin();
28875 (r1 != ty1->get_subranges().end()
28878 if ((*r1)->get_length() != (*r2)->get_length())
28913 if (ty1->get_parameters().size() != ty2->
get_parameters().size())
28916 for (function_type::parameters::const_iterator
28917 i = ty1->get_parameters().begin(),
28919 (i != ty1->get_parameters().end()
28949 const char* dm_name)
28977 return cou->find_data_member(dm);
28992 unsigned parm_index)
28999 if (parms.size() <= parm_index)
29002 return parms[parm_index].get();
29017 std::ostringstream o;
29020 o <<
"unnamed-enum";
29024 o <<
"-underlying-type-" << size;
29044 return data_member;
29064 for (; d != e; ++d)
29085stream_pretty_representation_of_fn_parms(
const function_type& fn_type,
29086 ostream& o,
bool qualified,
29094 type_base_sptr type;
29101 if (i != first_parm)
29104 type = parm->get_type();
29167add_outer_pointer_to_fn_type_expr(
const type_base* p,
29168 const string& input,
29169 bool qualified,
bool internal)
29175 string star_or_ref;
29188 if (!pointed_to_fn)
29191 if (pointed_to_fn->priv_->is_pretty_printing())
29201 pointed_to_fn->priv_->set_is_pretty_printing();
29203 std::ostringstream left, right, inner;
29205 inner <<
"(" << star_or_ref << input <<
")";
29207 type_base_sptr type;
29208 stream_pretty_representation_of_fn_parms(*pointed_to_fn, right,
29209 qualified, internal);
29211 type_base_sptr return_type = pointed_to_fn->get_return_type();
29220 result = left.str() +
" " + inner.str() + right.str();
29224 string inner_string = inner.str() + right.str();
29225 result = add_outer_pointer_to_fn_type_expr(p, inner_string,
29226 qualified, internal);
29230 string inner_string = inner.str() + right.str();
29231 result = add_outer_pointer_to_array_type_expr(p, inner_string,
29232 qualified, internal);
29240 pointed_to_fn->priv_->unset_is_pretty_printing();
29291add_outer_pointer_to_fn_type_expr(
const type_base_sptr& p,
29292 const string& input,
29293 bool qualified,
bool internal)
29294{
return add_outer_pointer_to_fn_type_expr(p.get(), input, qualified, internal);}
29347add_outer_pointer_to_array_type_expr(
const type_base* p,
29348 const string& input,
bool qualified,
29354 string star_or_ref;
29355 type_base_sptr pointed_to_type;
29359 pointed_to_type = ptr->get_pointed_to_type();
29364 pointed_to_type = ref->get_pointed_to_type();
29372 std::ostringstream left, right, inner;
29373 inner <<
"(" << star_or_ref << input <<
")";
29374 right << array->get_subrange_representation();
29377 type_base_sptr array_element_type = array->get_element_type();
29383 left <<
get_type_name(array_element_type, qualified, internal);
29384 result = left.str() + inner.str() + right.str();
29389 string r = inner.str() + right.str();
29390 result = add_outer_pointer_to_fn_type_expr(p, r, qualified, internal);
29395 string inner_string = inner.str() + right.str();
29396 result = add_outer_pointer_to_array_type_expr(p, inner_string,
29397 qualified, internal);
29456add_outer_pointer_to_array_type_expr(
const type_base_sptr& pointer_to_ar,
29457 const string& input,
bool qualified,
29459{
return add_outer_pointer_to_array_type_expr(pointer_to_ar.get(),
29460 input, qualified, internal);}
29508add_outer_ptr_to_mbr_type_expr(
const ptr_to_mbr_type* p,
29509 const string& input,
bool qualified,
29515 std::ostringstream left, right, inner;
29516 type_base_sptr void_type = p->get_environment().get_void_type();
29517 string containing_type_name =
get_type_name(p->get_containing_type(),
29518 qualified, internal);
29519 type_base_sptr mbr_type = p->get_member_type();
29523 inner <<
"(" << containing_type_name <<
"::*" << input <<
")";
29524 stream_pretty_representation_of_fn_parms(*fn_type, right,
29525 qualified, internal);
29528 return_type = void_type;
29535 left <<
get_type_name(return_type, qualified, internal) <<
" ";;
29536 result = left.str() + inner.str() + right.str();
29540 string inner_str = inner.str() + right.str();
29541 result = pointer_declaration_name(p, inner_str, qualified, internal);
29545 string inner_str = inner.str() + right.str();
29546 result = add_outer_ptr_to_mbr_type_expr(p, inner_str,
29547 qualified, internal);
29554 inner <<
"(" << containing_type_name <<
"::*" << input <<
")";
29555 stream_pretty_representation_of_fn_parms(*fn_type, right,
29556 qualified, internal);
29557 string inner_str = inner.str() + right.str();
29558 result = add_outer_ptr_to_mbr_type_expr(ptr_mbr_type, inner_str,
29559 qualified, internal);
29563 left <<
get_type_name(p->get_member_type(), qualified, internal) <<
" ";
29564 inner << containing_type_name <<
"::*" << input;
29565 result = left.str()+ inner.str();
29585 string d1_name, d2_name;
29602 return d1_name != d2_name;
29625 const type_base_sptr& s)
29632 && (f->get_size_in_bits() == s->get_size_in_bits())
29633 && (f->get_alignment_in_bits() == s->get_alignment_in_bits()))
29661 const decl_base_sptr& s)
29712 const string& input,
bool qualified,
29714{
return add_outer_ptr_to_mbr_type_expr(p.get(), input, qualified, internal);}
29734add_outer_pointer_to_ptr_to_mbr_type_expr(
const type_base* p,
29735 const string& input,
bool qualified,
29741 string star_or_ref;
29742 type_base_sptr pointed_to_type;
29746 pointed_to_type = ptr->get_pointed_to_type();
29751 pointed_to_type= ref->get_pointed_to_type();
29755 if (!pointed_to_type)
29760 if (!pointed_to_ptr_to_mbr)
29763 std::ostringstream inner;
29764 inner << star_or_ref << input;
29765 string result = add_outer_ptr_to_mbr_type_expr(pointed_to_ptr_to_mbr,
29767 qualified, internal);
29784static interned_string
29785pointer_declaration_name(
const type_base* ptr,
29786 const string& idname,
29787 bool qualified,
bool internal)
29790 return interned_string();
29792 type_base_sptr pointed_to_type;
29793 string star_or_ref;
29796 pointed_to_type = p->get_pointed_to_type();
29801 pointed_to_type = p->get_pointed_to_type();
29805 if (!pointed_to_type)
29806 return interned_string();
29819 if (!idname.empty())
29826 result = add_outer_pointer_to_fn_type_expr(ptr, idname,
29827 qualified, internal);
29829 result = add_outer_pointer_to_array_type_expr(ptr, idname,
29830 qualified, internal);
29832 result = add_outer_pointer_to_ptr_to_mbr_type_expr(ptr, idname,
29833 qualified, internal);
29837 return ptr->get_environment().intern(result);
29854static interned_string
29855pointer_declaration_name(
const type_base_sptr& ptr,
29856 const string& variable_name,
29857 bool qualified,
bool internal)
29858{
return pointer_declaration_name(ptr.get(), variable_name,
29859 qualified, internal);}
29874static interned_string
29875array_declaration_name(
const array_type_def* array,
29876 const string& variable_name,
29877 bool qualified,
bool internal)
29880 return interned_string();
29882 type_base_sptr e_type = array->get_element_type();
29883 string e_type_repr =
29891 std::ostringstream o;
29892 if (!variable_name.empty())
29893 o << variable_name <<
" is ";
29895 << array->get_subrange_representation()
29896 <<
") of " << e_type_repr;
29907 result = e_type_repr;
29908 if (!variable_name.empty())
29909 result += variable_name;
29910 result += array->get_subrange_representation();
29914 string s = variable_name + array->get_subrange_representation();
29915 result = pointer_declaration_name(p, s, qualified, internal);
29919 string s = variable_name + array->get_subrange_representation();
29920 result = ptr_to_mbr_declaration_name(p, s, qualified, internal);
29925 return array->get_environment().intern(result);
29941static interned_string
29943 const string& variable_name,
29944 bool qualified,
bool internal)
29945{
return array_declaration_name(array.get(), variable_name,
29946 qualified, internal);}
29961static interned_string
29962ptr_to_mbr_declaration_name(
const ptr_to_mbr_type* ptr,
29963 const string& variable_name,
29964 bool qualified,
bool internal)
29967 return interned_string();
29969 string input = variable_name;
29970 string result = add_outer_ptr_to_mbr_type_expr(ptr, input,
29971 qualified, internal);
29972 return ptr->get_environment().intern(result);
29988static interned_string
29990 const string& variable_name,
29991 bool qualified,
bool internal)
29993 return ptr_to_mbr_declaration_name(ptr.get(), variable_name,
29994 qualified, internal);
30013struct ir_node_visitor::priv
30028ir_node_visitor::~ir_node_visitor() =
default;
30037{priv_->allow_visiting_already_visited_type_node = f;}
30046{
return priv_->allow_visiting_already_visited_type_node;}
30067 canonical_type = p;
30071 size_t canonical_ptr_value =
reinterpret_cast<size_t>(canonical_type);
30072 priv_->visited_ir_nodes.insert(canonical_ptr_value);
30085{priv_->visited_ir_nodes.clear();}
30106 canonical_type = p;
30110 size_t ptr_value =
reinterpret_cast<size_t>(canonical_type);
30111 pointer_set::iterator it = priv_->visited_ir_nodes.find(ptr_value);
30112 if (it == priv_->visited_ir_nodes.end())
30119ir_node_visitor::visit_begin(
decl_base*)
30127ir_node_visitor::visit_begin(scope_decl*)
30131ir_node_visitor::visit_end(scope_decl*)
30135ir_node_visitor::visit_begin(type_base*)
30139ir_node_visitor::visit_end(type_base*)
30143ir_node_visitor::visit_begin(scope_type_decl* t)
30144{
return visit_begin(
static_cast<type_base*
>(t));}
30147ir_node_visitor::visit_end(scope_type_decl* t)
30148{
return visit_end(
static_cast<type_base*
>(t));}
30151ir_node_visitor::visit_begin(type_decl* t)
30152{
return visit_begin(
static_cast<type_base*
>(t));}
30155ir_node_visitor::visit_end(type_decl* t)
30156{
return visit_end(
static_cast<type_base*
>(t));}
30159ir_node_visitor::visit_begin(namespace_decl* d)
30160{
return visit_begin(
static_cast<decl_base*
>(d));}
30163ir_node_visitor::visit_end(namespace_decl* d)
30164{
return visit_end(
static_cast<decl_base*
>(d));}
30167ir_node_visitor::visit_begin(qualified_type_def* t)
30168{
return visit_begin(
static_cast<type_base*
>(t));}
30171ir_node_visitor::visit_end(qualified_type_def* t)
30172{
return visit_end(
static_cast<type_base*
>(t));}
30175ir_node_visitor::visit_begin(pointer_type_def* t)
30176{
return visit_begin(
static_cast<type_base*
>(t));}
30179ir_node_visitor::visit_end(pointer_type_def* t)
30180{
return visit_end(
static_cast<type_base*
>(t));}
30183ir_node_visitor::visit_begin(reference_type_def* t)
30184{
return visit_begin(
static_cast<type_base*
>(t));}
30187ir_node_visitor::visit_end(reference_type_def* t)
30188{
return visit_end(
static_cast<type_base*
>(t));}
30191ir_node_visitor::visit_begin(ptr_to_mbr_type* t)
30192{
return visit_begin(
static_cast<type_base*
>(t));}
30195ir_node_visitor::visit_end(ptr_to_mbr_type* t)
30196{
return visit_end(
static_cast<type_base*
>(t));}
30199ir_node_visitor::visit_begin(array_type_def* t)
30200{
return visit_begin(
static_cast<type_base*
>(t));}
30203ir_node_visitor::visit_end(array_type_def* t)
30204{
return visit_end(
static_cast<type_base*
>(t));}
30207ir_node_visitor::visit_begin(array_type_def::subrange_type* t)
30208{
return visit_begin(
static_cast<type_base*
>(t));}
30211ir_node_visitor::visit_end(array_type_def::subrange_type* t)
30212{
return visit_end(
static_cast<type_base*
>(t));}
30215ir_node_visitor::visit_begin(enum_type_decl* t)
30216{
return visit_begin(
static_cast<type_base*
>(t));}
30219ir_node_visitor::visit_end(enum_type_decl* t)
30220{
return visit_end(
static_cast<type_base*
>(t));}
30223ir_node_visitor::visit_begin(typedef_decl* t)
30224{
return visit_begin(
static_cast<type_base*
>(t));}
30227ir_node_visitor::visit_end(typedef_decl* t)
30228{
return visit_end(
static_cast<type_base*
>(t));}
30231ir_node_visitor::visit_begin(function_type* t)
30232{
return visit_begin(
static_cast<type_base*
>(t));}
30235ir_node_visitor::visit_end(function_type* t)
30236{
return visit_end(
static_cast<type_base*
>(t));}
30239ir_node_visitor::visit_begin(var_decl* d)
30240{
return visit_begin(
static_cast<decl_base*
>(d));}
30243ir_node_visitor::visit_end(var_decl* d)
30244{
return visit_end(
static_cast<decl_base*
>(d));}
30247ir_node_visitor::visit_begin(function_decl* d)
30248{
return visit_begin(
static_cast<decl_base*
>(d));}
30251ir_node_visitor::visit_end(function_decl* d)
30252{
return visit_end(
static_cast<decl_base*
>(d));}
30255ir_node_visitor::visit_begin(function_decl::parameter* d)
30256{
return visit_begin(
static_cast<decl_base*
>(d));}
30259ir_node_visitor::visit_end(function_decl::parameter* d)
30260{
return visit_end(
static_cast<decl_base*
>(d));}
30263ir_node_visitor::visit_begin(function_tdecl* d)
30264{
return visit_begin(
static_cast<decl_base*
>(d));}
30267ir_node_visitor::visit_end(function_tdecl* d)
30268{
return visit_end(
static_cast<decl_base*
>(d));}
30271ir_node_visitor::visit_begin(class_tdecl* d)
30272{
return visit_begin(
static_cast<decl_base*
>(d));}
30275ir_node_visitor::visit_end(class_tdecl* d)
30276{
return visit_end(
static_cast<decl_base*
>(d));}
30279ir_node_visitor::visit_begin(class_or_union* t)
30280{
return visit_begin(
static_cast<type_base*
>(t));}
30283ir_node_visitor::visit_end(class_or_union* t)
30284{
return visit_end(
static_cast<type_base*
>(t));}
30287ir_node_visitor::visit_begin(class_decl* t)
30288{
return visit_begin(
static_cast<type_base*
>(t));}
30291ir_node_visitor::visit_end(class_decl* t)
30292{
return visit_end(
static_cast<type_base*
>(t));}
30295ir_node_visitor::visit_begin(union_decl* t)
30296{
return visit_begin(
static_cast<type_base*
>(t));}
30299ir_node_visitor::visit_end(union_decl* t)
30300{
return visit_end(
static_cast<type_base*
>(t));}
30303ir_node_visitor::visit_begin(class_decl::base_spec* d)
30304{
return visit_begin(
static_cast<decl_base*
>(d));}
30307ir_node_visitor::visit_end(class_decl::base_spec* d)
30308{
return visit_end(
static_cast<decl_base*
>(d));}
30311ir_node_visitor::visit_begin(member_function_template* d)
30312{
return visit_begin(
static_cast<decl_base*
>(d));}
30315ir_node_visitor::visit_end(member_function_template* d)
30316{
return visit_end(
static_cast<decl_base*
>(d));}
30319ir_node_visitor::visit_begin(member_class_template* d)
30320{
return visit_begin(
static_cast<decl_base*
>(d));}
30323ir_node_visitor::visit_end(member_class_template* d)
30324{
return visit_end(
static_cast<decl_base*
>(d));}
30336 static __thread
size_t counter;
30338 std::ostringstream o;
30344struct function_decl_hash
30346 size_t operator()(
const function_decl* f)
const
30347 {
return reinterpret_cast<size_t>(f);}
30350 {
return operator()(f.get());}
30355typedef unordered_map<
const function_decl*, string,
30356 function_decl_hash,
30375static const string&
30379 fns_to_str_map_type::const_iterator i = m.find(fn);
30382 string s = get_next_string();
30403fns_to_str(vector<function_decl*>::const_iterator begin,
30404 vector<function_decl*>::const_iterator end,
30408 vector<function_decl*>::const_iterator i;
30409 for (i = begin; i != end; ++i)
30410 o <<
"'" << fn_to_str(*i, m) <<
"' ";
30436fns_to_str(vector<function_decl*>::const_iterator a_begin,
30437 vector<function_decl*>::const_iterator a_end,
30438 vector<function_decl*>::const_iterator b_begin,
30439 vector<function_decl*>::const_iterator b_end,
30443 fns_to_str(a_begin, a_end, m, o);
30445 fns_to_str(b_begin, b_end, m, o);
30469fns_to_str(vector<function_decl*>::const_iterator a_begin,
30470 vector<function_decl*>::const_iterator a_end,
30471 vector<function_decl*>::const_iterator b_begin,
30472 vector<function_decl*>::const_iterator b_end,
30476 fns_to_str(a_begin, a_end, b_begin, b_end, m, o);
30498 std::string parent_qualified_name;
30507 if (!d->priv_->qualified_parent_name_.empty())
30513 d->priv_->qualified_name_ =
30514 env.
intern(d->priv_->qualified_parent_name_ +
"::" + d->
get_name());
30522 d->priv_->internal_qualified_name_ = d->priv_->qualified_name_;
30524 if (d->priv_->scoped_name_.empty())
30529 d->priv_->scoped_name_ =
30532 d->priv_->scoped_name_ =
30550{
return do_update(d);}
30562 return do_update(d);
This header declares filters for the diff trees resulting from comparing ABI Corpora.
The private data and functions of the abigail::ir::corpus type.
#define ABG_RETURN_FALSE
A macro used to return the "false" boolean from DIE comparison routines.
#define ABG_RETURN(value)
A macro used to return from DIE comparison routines.
#define ABG_ASSERT(cond)
This is a wrapper around the 'assert' glibc call. It allows for its argument to have side effects,...
Declaration of types pertaining to the interned string pool used throughout Libabigail,...
This contains the private implementation of the suppression engine of libabigail.
#define CACHE_COMPARISON_RESULT_AND_RETURN(value)
Cache the result of a comparison between too artifacts (l & r) and return immediately.
#define RETURN_TRUE_IF_COMPARISON_CYCLE_DETECTED(l, r)
This macro is to be used while comparing composite types that might recursively refer to themselves....
Types of the main internal representation of libabigail.
Wrappers around regex types and functions.
This type abstracts the configuration information of the library.
bool has_string(const char *s) const
Test if the interned string pool already contains a string with a given value.
const char * get_string(const char *s) const
Get a pointer to the interned string which has a given value.
interned_string create_string(const std::string &)
Create an interned string with a given value.
interned_string_pool()
Default constructor.
~interned_string_pool()
Destructor.
The abstraction of an interned string.
bool empty() const
Test if the current instance of interned_string is empty.
This class is to hold the value of the bound of a subrange. The value can be either signed or unsigne...
void set_signed(int64_t v)
Setter of the bound value as signed.
void set_signedness(enum signedness s)
Setter of the signedness (unsigned VS signed) of the bound value.
enum signedness get_signedness() const
Getter of the signedness (unsigned VS signed) of the bound value.
int64_t get_signed_value() const
Getter of the bound value as a signed value.
bool operator==(const bound_value &) const
Equality operator of the bound value.
uint64_t get_unsigned_value()
Getter of the bound value as an unsigned value.
bound_value()
Default constructor of the array_type_def::subrange_type::bound_value class.
void set_unsigned(uint64_t v)
Setter of the bound value as unsigned.
Abstraction for an array range type, like in Ada, or just for an array dimension like in C or C++.
void set_lower_bound(int64_t lb)
Setter of the lower bound.
bool is_non_finite() const
Test if the length of the subrange type is infinite.
void set_upper_bound(int64_t ub)
Setter of the upper bound of the subrange type.
void set_underlying_type(const type_base_sptr &)
Setter of the underlying type of the subrange, that is, the type that defines the range.
string as_string() const
Return a string representation of the sub range.
virtual hash_t hash_value() const
Return the hash value of the current IR node.
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
bool operator!=(const decl_base &o) const
Equality operator.
int64_t get_upper_bound() const
Getter of the upper bound of the subrange type.
type_base_sptr get_underlying_type() const
Getter of the underlying type of the subrange, that is, the type that defines the range.
virtual bool operator==(const decl_base &) const
Equality operator.
int64_t get_lower_bound() const
Getter of the lower bound of the subrange type.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Build a pretty representation for an array_type_def::subrange_type.
static string vector_as_string(const vector< subrange_sptr > &)
Return a string representation of a vector of subranges.
uint64_t get_length() const
Getter of the length of the subrange type.
translation_unit::language get_language() const
Getter of the language that generated this type.
The abstraction of an array type.
virtual bool is_non_finite() const
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Build and return the qualified name of the current instance of the array_type_def.
virtual hash_t hash_value() const
Return the hash value of the current IR node.
const type_base_sptr get_element_type() const
Getter of the type of an array element.
void set_element_type(const type_base_sptr &element_type)
Setter of the type of array element.
shared_ptr< subrange_type > subrange_sptr
Convenience typedef for a shared pointer on a function_decl::subrange.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
const std::vector< subrange_sptr > & get_subranges() const
Get the array's subranges.
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
std::vector< subrange_sptr > subranges_type
Convenience typedef for a vector of subrange_sptr.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representation of the current instance of array_type_def.
translation_unit::language get_language() const
Get the language of the array.
virtual void append_subranges(const std::vector< subrange_sptr > &subs)
Append subranges from the vector.
Abstraction of a base specifier in a class declaration.
class_decl_sptr get_base_class() const
Get the base class referred to by the current base class specifier.
bool get_is_virtual() const
Getter of the "is-virtual" proprerty of the base class specifier.
long get_offset_in_bits() const
Getter of the offset of the base.
virtual hash_t hash_value() const
Return the hash value of the current IR node.
virtual bool traverse(ir_node_visitor &)
Traverses an instance of class_decl::base_spec, visiting all the sub-types and decls that it might co...
virtual bool operator==(const decl_base &) const
Comparison operator for class_decl::base_spec.
Abstracts a class declaration.
void is_struct(bool f)
Set the "is-struct" flag of the class.
bool has_virtual_member_functions() const
Test if the current instance of class_decl has virtual member functions.
const virtual_mem_fn_map_type & get_virtual_mem_fns_map() const
Get the map that associates a virtual table offset to the virtual member functions with that virtual ...
bool is_struct() const
Test if the class is a struct.
virtual hash_t hash_value() const
Return the hash value of the current IR node.
const base_specs & get_base_specifiers() const
Get the base specifiers for this class.
virtual ~class_decl()
Destructor of the class_decl type.
virtual void on_canonical_type_set()
This method is invoked automatically right after the current instance of class_decl has been canonica...
bool has_vtable() const
Test if the current instance has a vtable.
ssize_t get_biggest_vtable_offset() const
Get the highest vtable offset of all the virtual methods of the class.
bool has_virtual_bases() const
Test if the current instance of class_decl has at least one virtual base.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
shared_ptr< base_spec > base_spec_sptr
Convenience typedef.
void add_base_specifier(shared_ptr< base_spec > b)
Add a base specifier to this class.
const member_functions & get_virtual_mem_fns() const
Get the virtual member functions of this class.
void sort_virtual_mem_fns()
Sort the virtual member functions by their virtual index.
friend bool equals(const class_decl &, const class_decl &, change_kind *)
Compares two instances of class_decl.
virtual bool operator==(const decl_base &) const
Comparison operator for class_decl.
class_decl_sptr find_base_class(const string &qualified_name) const
Find a base class of a given qualified name for the current class.
bool has_no_base_nor_member() const
Return true iff the class has no entity in its scope.
vector< base_spec_sptr > base_specs
Convenience typedef.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Getter of the pretty representation of the current instance of class_decl.
The base type of class_decl and union_decl.
virtual size_t get_num_anonymous_member_classes() const
Get the number of anonymous member classes contained in this class.
void add_member_function(method_decl_sptr f, access_specifier a, bool is_static, bool is_ctor, bool is_dtor, bool is_const)
Add a member function.
const var_decl_sptr find_anonymous_data_member(const var_decl_sptr &) const
Find an anonymous data member in the class.
const member_functions & get_member_functions() const
Get the member functions of this class_or_union.
virtual void remove_member_decl(decl_base_sptr)
Remove a given decl from the current class_or_union scope.
const member_function_templates & get_member_function_templates() const
Get the member function templates of this class.
virtual size_t get_size_in_bits() const
Getter of the size of the class_or_union type.
virtual size_t get_num_anonymous_member_unions() const
Get the number of anonymous member unions contained in this class.
void add_member_function_template(member_function_template_sptr)
Append a member function template to the class_or_union.
unordered_map< ssize_t, member_functions > virtual_mem_fn_map_type
Convenience typedef.
vector< method_decl_sptr > member_functions
Convenience typedef.
const data_members & get_data_members() const
Get the data members of this class_or_union.
virtual hash_t hash_value() const
Return the hash value of the current IR node.
void add_data_member(var_decl_sptr v, access_specifier a, bool is_laid_out, bool is_static, size_t offset_in_bits)
Add a data member to the current instance of class_or_union.
const method_decl * find_member_function_from_signature(const string &s) const
Find a method (member function) using its signature (pretty representation) as a key.
method_decl_sptr find_member_function_sptr(const string &mangled_name)
Find a method, using its linkage name as a key.
virtual void set_size_in_bits(size_t)
Setter of the size of the class_or_union type.
decl_base_sptr insert_member_decl(decl_base_sptr member)
Insert a data member to this class_or_union type.
virtual decl_base_sptr add_member_decl(const decl_base_sptr &)
Add a member declaration to the current instance of class_or_union. The member declaration can be eit...
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
void add_member_class_template(member_class_template_sptr m)
Append a member class template to the class_or_union.
const data_members & get_non_static_data_members() const
Get the non-static data members of this class_or_union.
const method_decl * find_member_function(const string &mangled_name) const
Find a method, using its linkage name as a key.
const data_members & get_static_data_members() const
Get the static data memebers of this class_or_union.
void maybe_fixup_members_of_anon_data_member(var_decl_sptr &anon_dm)
Fixup the members of the type of an anonymous data member.
vector< var_decl_sptr > data_members
Convenience typedef.
virtual ~class_or_union()
Destrcutor of the class_or_union type.
bool has_no_member() const
virtual bool operator==(const decl_base &) const
Equality operator.
friend void set_member_is_static(decl_base &d, bool s)
Sets the static-ness property of a class member.
virtual size_t get_alignment_in_bits() const
Getter of the alignment of the class_or_union type.
const member_class_templates & get_member_class_templates() const
Get the member class templates of this class.
virtual void set_alignment_in_bits(size_t)
Setter of the alignment of the class type.
vector< type_base_sptr > member_types
Convenience typedef.
virtual size_t get_num_anonymous_member_enums() const
Get the number of anonymous member enums contained in this class.
const var_decl_sptr find_data_member(const string &) const
Find a data member of a given name in the current class_or_union.
Abstract a class template.
shared_ptr< class_decl > get_pattern() const
Getter of the pattern of the template.
void set_pattern(class_decl_sptr p)
Setter of the pattern of the template.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
virtual bool operator==(const decl_base &) const
Return true iff both scopes have the same names and have the same member decls.
The abstraction of the relationship between an entity and its containing scope (its context)....
This is the abstraction of a set of translation units (themselves seen as bundles of unitary abi arte...
shared_ptr< exported_decls_builder > exported_decls_builder_sptr
Convenience typedef for shared_ptr<exported_decls_builder>.
const translation_units & get_translation_units() const
Return the list of translation units of the current corpus.
origin get_origin() const
Getter for the origin of the corpus.
type_maps & get_types()
Get the maps that associate a name to a certain kind of type.
type_maps & get_type_per_loc_map()
Get the maps that associate a location string to a certain kind of type.
const corpus_group * get_group() const
Getter of the group this corpus is a member of.
const environment & get_environment() const
Getter of the enviroment of the corpus.
The base type of all declarations.
void set_definition_of_declaration(const decl_base_sptr &)
Set the definition of this declaration-only decl_base.
void set_is_declaration_only(bool f)
Set a flag saying if the enum_type_decl is a declaration-only enum_type_decl.
virtual bool operator!=(const decl_base &) const
Inequality operator.
const interned_string & get_cached_pretty_representation(bool internal=false) const
Get the pretty representation of the current decl.
scope_decl * get_scope() const
Return the type containing the current decl, if any.
void set_qualified_name(const interned_string &) const
Setter for the qualified name.
void set_is_in_public_symbol_table(bool)
Set the flag saying if this decl is from a symbol that is in a public symbols table,...
friend bool get_member_is_static(const decl_base &d)
Gets a flag saying if a class member is static or not.
const decl_base_sptr get_earlier_declaration() const
If this decl_base is a definition, get its earlier declaration.
virtual void set_linkage_name(const string &m)
Setter for the linkage name.
const decl_base * get_naked_definition_of_declaration() const
If this decl_base is declaration-only, get its definition, if any.
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the decl.
void clear_qualified_name()
Clear the qualified name of this decl.
virtual void set_name(const string &n)
Setter for the name of the decl.
const location & get_location() const
Get the location of a given declaration.
typedef_decl_sptr get_naming_typedef() const
Getter for the naming typedef of the current decl.
virtual const interned_string & get_name() const
Getter for the name of the current decl.
virtual void set_scope(scope_decl *)
Setter of the scope of the current decl.
const interned_string & peek_qualified_name() const
Getter for the qualified name.
const context_rel * get_context_rel() const
Getter for the context relationship.
bool get_is_anonymous() const
Test if the current declaration is anonymous.
friend decl_base_sptr add_decl_to_scope(decl_base_sptr decl, scope_decl *scpe)
Appends a declaration to a given scope, if the declaration doesn't already belong to one and if the d...
virtual const interned_string & get_scoped_name() const
Return the scoped name of the decl.
const decl_base_sptr get_definition_of_declaration() const
If this decl_base is declaration-only, get its definition, if any.
friend void set_member_access_specifier(decl_base &d, access_specifier a)
Sets the access specifier for a class member.
void set_naming_typedef(const typedef_decl_sptr &)
Set the naming typedef of the current instance of decl_base.
void set_location(const location &l)
Set the location for a given declaration.
void set_is_anonymous(bool)
Set the "is_anonymous" flag of the current declaration.
void set_visibility(visibility v)
Setter for the visibility of the decl.
void set_temporary_qualified_name(const interned_string &) const
Setter for the temporary qualified name of the current declaration.
visibility get_visibility() const
Getter for the visibility of the decl.
visibility
ELF visibility.
bool get_is_declaration_only() const
Test if a decl_base is a declaration-only decl.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
void set_earlier_declaration(const decl_base_sptr &)
set the earlier declaration of this decl_base definition.
const interned_string & get_linkage_name() const
Getter for the mangled name.
friend enum access_specifier get_member_access_specifier(const decl_base &d)
Gets the access specifier for a class member.
friend bool get_member_function_is_virtual(const function_decl &f)
Test if a given member function is virtual.
virtual ~decl_base()
Destructor of the decl_base type.
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
const interned_string & get_qualified_parent_name() const
Return a copy of the qualified name of the parent of the current decl.
bool get_is_anonymous_or_has_anonymous_parent() const
bool get_has_anonymous_parent() const
Get the "has_anonymous_parent" flag of the current declaration.
bool get_is_in_public_symbol_table() const
Test if the decl is defined in a ELF symbol table as a public symbol.
friend bool equals(const decl_base &, const decl_base &, change_kind *)
Compares two instances of decl_base.
const interned_string & peek_temporary_qualified_name() const
Getter of the temporary qualified name of the current declaration.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representatin of the current declaration.
The abstraction for a data member context relationship. This relates a data member to its parent clas...
const var_decl * get_anonymous_data_member() const
Return a non-nil value if this data member context relationship has an anonymous data member....
void set_anonymous_data_member(var_decl *)
Set the containing anonymous data member of this data member context relationship....
The abstraction of the version of an ELF symbol.
version & operator=(const version &o)
Assign a version to the current one.
bool operator==(const version &o) const
Compares the current version against another one.
bool is_default() const
Getter for the 'is_default' property of the version.
const string & str() const
Getter for the version name.
bool operator!=(const version &o) const
Inequality operator.
Abstraction of an elf symbol.
const abg_compat::optional< std::string > & get_namespace() const
Getter of the 'namespace' property.
elf_symbol_sptr get_alias_which_equals(const elf_symbol &other) const
In the list of aliases of a given elf symbol, get the alias that equals this current symbol.
elf_symbol_sptr get_next_common_instance() const
Get the next common instance of the current common symbol.
type get_type() const
Getter for the type of the current instance of elf_symbol.
const elf_symbol_sptr get_main_symbol() const
Get the main symbol of an alias chain.
void set_is_in_ksymtab(bool is_in_ksymtab)
Setter of the 'is-in-ksymtab' property.
bool has_aliases() const
Check if the current elf_symbol has an alias.
void set_name(const string &n)
Setter for the name of the current intance of elf_symbol.
bool is_suppressed() const
Getter for the 'is-suppressed' property.
binding
The binding of a symbol.
int get_number_of_aliases() const
Get the number of aliases to this elf symbol.
string get_aliases_id_string(const string_elf_symbols_map_type &symtab, bool include_symbol_itself=true) const
Return a comma separated list of the id of the current symbol as well as the id string of its aliases...
void set_binding(binding b)
Setter for the binding of the current instance of elf_symbol.
void add_common_instance(const elf_symbol_sptr &)
Add a common instance to the current common elf symbol.
void add_alias(const elf_symbol_sptr &)
Add an alias to the current elf symbol.
void set_is_suppressed(bool is_suppressed)
Setter for the 'is-suppressed' property.
bool is_variable() const
Test if the current instance of elf_symbol is a variable symbol or not.
elf_symbol_sptr update_main_symbol(const std::string &)
Update the main symbol for a group of aliased symbols.
void set_size(size_t)
Setter of the size of the symbol.
const string & get_name() const
Getter for the name of the elf_symbol.
binding get_binding() const
Getter for the binding of the current instance of elf_symbol.
static bool get_name_and_version_from_id(const string &id, string &name, string &ver)
Given the ID of a symbol, get the name and the version of said symbol.
bool is_function() const
Test if the current instance of elf_symbol is a function symbol or not.
type
The type of a symbol.
void set_version(const version &v)
Setter for the version of the current instance of elf_symbol.
const abg_compat::optional< uint32_t > & get_crc() const
Getter of the 'crc' property.
void set_visibility(visibility v)
Setter of the visibility of the current instance of elf_symbol.
bool does_alias(const elf_symbol &) const
Test if the current symbol aliases another one.
bool is_main_symbol() const
Tests whether this symbol is the main symbol.
void set_crc(const abg_compat::optional< uint32_t > &crc)
Setter of the 'crc' property.
static elf_symbol_sptr create(const environment &e, size_t i, size_t s, const string &n, type t, binding b, bool d, bool c, const version &ve, visibility vi, bool is_in_ksymtab=false, const abg_compat::optional< uint32_t > &crc={}, const abg_compat::optional< std::string > &ns={}, bool is_suppressed=false)
Factory of instances of elf_symbol.
visibility
The visibility of the symbol.
version & get_version() const
Getter for the version of the current instanc of elf_symbol.
bool is_common_symbol() const
Return true if the symbol is a common one.
void set_index(size_t)
Setter for the index.
visibility get_visibility() const
Getter of the visibility of the current instance of elf_symbol.
bool has_other_common_instances() const
Return true if this common common symbol has other common instances.
size_t get_index() const
Getter for the index.
const string & get_id_string() const
Get a string that is representative of a given elf_symbol.
elf_symbol_sptr get_alias_from_name(const string &name) const
From the aliases of the current symbol, lookup one with a given name.
const environment & get_environment() const
Getter of the environment used by the current instance of elf_symbol.
void set_type(type t)
Setter for the type of the current instance of elf_symbol.
bool is_public() const
Test if the current instance of elf_symbol is public or not.
bool is_in_ksymtab() const
Getter of the 'is-in-ksymtab' property.
size_t get_size() const
Getter of the size of the symbol.
bool is_defined() const
Test if the current instance of elf_symbol is defined or not.
void set_namespace(const abg_compat::optional< std::string > &ns)
Setter of the 'namespace' property.
elf_symbol_sptr get_next_alias() const
Get the next alias of the current symbol.
bool operator==(const elf_symbol &) const
Test if two main symbols are textually equal, or, if they have aliases that are textually equal.
The abstraction of an enumerator.
enumerator()
Default constructor of the enum_type_decl::enumerator type.
bool operator!=(const enumerator &other) const
Inequality operator.
void set_name(const string &n)
Setter for the name of enum_type_decl::enumerator.
enum_type_decl * get_enum_type() const
Getter for the enum type that this enumerator is for.
const string & get_name() const
Getter for the name of the current instance of enum_type_decl::enumerator.
void set_enum_type(enum_type_decl *)
Setter for the enum type that this enumerator is for.
void set_value(int64_t v)
Setter for the value of enum_type_decl::enumerator.
const string & get_qualified_name(bool internal=false) const
Getter for the qualified name of the current instance of enum_type_decl::enumerator....
int64_t get_value() const
Getter for the value of enum_type_decl::enumerator.
bool operator==(const enumerator &other) const
Equality operator.
enumerator & operator=(const enumerator &)
Assignment operator of the enum_type_decl::enumerator type.
Abstracts a declaration for an enum type.
std::vector< enumerator > enumerators
Convenience typedef for a list of enumerator.
virtual hash_t hash_value() const
Return the hash value of the current IR node.
virtual ~enum_type_decl()
Destructor for the enum type declaration.
const enumerators & get_enumerators() const
bool find_enumerator_by_value(int64_t value, enum_type_decl::enumerator &result)
Find an enumerator by its value.
const enumerators & get_sorted_enumerators() const
Get the lexicographically sorted vector of enumerators.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
type_base_sptr get_underlying_type() const
Return the underlying type of the enum.
bool find_enumerator_by_name(const string &name, enum_type_decl::enumerator &result)
Find an enumerator by its name.
virtual bool operator==(const decl_base &) const
Equality operator.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representation of the current instance of enum_type_decl.
This is an abstraction of the set of resources necessary to manage several aspects of the internal re...
bool decl_only_class_equals_definition() const
Getter of the "decl-only-class-equals-definition" flag.
bool is_void_pointer_type(const type_base_sptr &) const
Test if a given type is the same as the void pointer type of the environment.
std::unordered_map< string, std::vector< type_base_sptr > > canonical_types_map_type
A convenience typedef for a map of canonical types. The key is the pretty representation string of a ...
bool user_set_analyze_exported_interfaces_only() const
Getter for a property that says if the user actually did set the analyze_exported_interfaces_only() p...
const vector< type_base_sptr > * get_canonical_types(const char *name) const
Get the vector of canonical types which have a given "string representation".
const type_base_sptr & get_void_type() const
Get the unique type_decl that represents a "void" type for the current environment....
bool is_variadic_parameter_type(const type_base *) const
Test if a type is a variadic parameter type as defined in the current environment.
static string & get_variadic_parameter_type_name()
Getter of the name of the variadic parameter type.
const type_base_sptr & get_void_pointer_type() const
Getter of the "pointer-to-void" IR node that is shared across the ABI corpus. This node must be the o...
const config & get_config() const
Getter of the general configuration object.
environment()
Default constructor of the environment type.
bool canonicalization_is_done() const
Test if the canonicalization of types created out of the current environment is done.
type_base * get_canonical_type(const char *name, unsigned index)
Get a given canonical type which has a given "string representation".
const type_base_sptr & get_variadic_parameter_type() const
Get a type_decl instance that represents a the type of a variadic function parameter....
bool is_void_type(const type_base_sptr &) const
Test if a given type is a void type as defined in the current environment.
virtual ~environment()
Destructor for the environment type.
bool canonicalization_started() const
Getter of a flag saying if the canonicalization process has started or not.
interned_string intern(const string &) const
Do intern a string.
bool analyze_exported_interfaces_only() const
Getter for the property that controls if we are to restrict the analysis to the types that are only r...
canonical_types_map_type & get_canonical_types_map()
Getter the map of canonical types.
Abstraction of a function parameter.
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Compute the qualified name of the parameter.
interned_string get_type_name() const
interned_string get_name_id() const
Get a name uniquely identifying the parameter in the function.
const string get_type_pretty_representation() const
virtual bool traverse(ir_node_visitor &v)
Traverse the diff sub-tree under the current instance function_decl.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Compute and return a copy of the pretty representation of the current function parameter.
Abstraction for a function declaration.
shared_ptr< parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
string get_pretty_representation_of_declarator(bool internal=false) const
Compute and return the pretty representation for the part of the function declaration that starts at ...
const function_type * get_naked_type() const
Fast getter of the type of the current instance of function_decl.
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
void append_parameters(std::vector< parameter_sptr > &parms)
Append a vector of parameters to the type of this function.
bool is_variadic() const
Return true iff the function takes a variable number of parameters.
parameters::const_iterator get_first_non_implicit_parm() const
Getter for the first non-implicit parameter of a function decl.
const function_type_sptr get_type() const
Return the type of the current instance of function_decl.
function_decl(const string &name, function_type_sptr function_type, bool declared_inline, const location &locus, const string &mangled_name, visibility vis, binding bind)
Constructor of the function_decl.
const type_base_sptr get_return_type() const
function_decl_sptr clone() const
Create a new instance of function_decl that is a clone of the current one.
const std::vector< parameter_sptr > & get_parameters() const
void append_parameter(parameter_sptr parm)
Append a parameter to the type of this function.
void set_symbol(const elf_symbol_sptr &sym)
This sets the underlying ELF symbol for the current function decl.
virtual ~function_decl()
Destructor of the function_decl type.
const elf_symbol_sptr & get_symbol() const
Gets the the underlying ELF symbol for the current variable, that was set using function_decl::set_sy...
virtual bool operator==(const decl_base &o) const
Comparison operator for function_decl.
std::vector< parameter_sptr > parameters
Convenience typedef for a vector of parameter_sptr.
bool is_declared_inline() const
Test if the function was declared inline.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representation of the current instance of function_decl.
interned_string get_id() const
Return an ID that tries to uniquely identify the function inside a program or a library.
Abstract a function template declaration.
binding get_binding() const
Get the binding of the function template.
void set_pattern(shared_ptr< function_decl > p)
Set a new pattern to the function template.
shared_ptr< function_decl > get_pattern() const
Get the pattern of the function template.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
virtual bool operator==(const decl_base &) const
Comparison operator for the function_tdecl type.
Abstraction of a function type.
shared_ptr< function_decl::parameter > parameter_sptr
Convenience typedef for a shared pointer on a function_decl::parameter.
virtual hash_t hash_value() const
Return the hash value of the current IR node.
virtual bool traverse(ir_node_visitor &)
Traverses an instance of function_type, visiting all the sub-types and decls that it might contain.
bool is_variadic() const
Test if the current instance of function_type is for a variadic function.
parameters::const_iterator get_first_parm() const
Get the first parameter of the function.
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
virtual bool operator==(const type_base &) const
Equality operator for function_type.
void append_parameter(parameter_sptr parm)
Append a new parameter to the vector of parameters of the current instance of function_type.
void set_parameters(const parameters &p)
Setter for the parameters of the current instance of function_type.
const interned_string & get_cached_name(bool internal=false) const
Get the name of the current function_type.
const parameter_sptr get_parm_at_index_from_first_non_implicit_parm(size_t) const
Get the Ith parameter of the vector of parameters of the current instance of function_type.
type_base_sptr get_return_type() const
Getter for the return type of the current instance of function_type.
void set_return_type(type_base_sptr t)
Setter of the return type of the current instance of function_type.
parameters::const_iterator get_first_non_implicit_parm() const
Get the first parameter of the function.
const parameters & get_parameters() const
Getter for the set of parameters of the current intance of function_type.
std::vector< parameter_sptr > parameters
Convenience typedef for a vector of parameter_sptr.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Return a copy of the pretty representation of the current function_type.
This abstracts the global scope of a given translation unit.
The base class for the visitor type hierarchy used for traversing a translation unit.
bool allow_visiting_already_visited_type_node() const
Get if the walker using this visitor is allowed to re-visit a type node that was previously visited o...
bool type_node_has_been_visited(type_base *) const
Test if a given type node has been marked as visited.
void forget_visited_type_nodes()
Un-mark all visited type nodes.
ir_node_visitor()
Default Constructor of the ir_node_visitor type.
void mark_type_node_as_visited(type_base *)
Mark a given type node as having been visited.
The entry point to manage locations.
location create_new_location(const std::string &fle, size_t lne, size_t col)
Insert the triplet representing a source locus into our internal vector of location triplet....
void expand_location(const location &location, std::string &path, unsigned &line, unsigned &column) const
Given an instance of location type, return the triplet {path,line,column} that represents the source ...
The source location of a token.
bool get_is_artificial() const
Test if the location is artificial.
unsigned get_value() const
Get the value of the location.
string expand(void) const
Expand the location into a string.
void expand(std::string &path, unsigned &line, unsigned &column) const
Expand the current location into a tripplet file path, line and column number.
Abstraction of a member function context relationship. This relates a member function to its parent c...
bool is_constructor() const
Getter for the 'is-constructor' property.
bool is_const() const
Getter for the 'is-const' property.
size_t vtable_offset() const
Getter for the vtable offset property.
bool is_destructor() const
Getter for the 'is-destructor' property.
The base class for member types, data members and member functions. Its purpose is mainly to carry th...
access_specifier get_access_specifier() const
Getter for the access specifier of this member.
bool get_is_static() const
Abstracts a member class template template.
virtual bool operator==(const member_base &o) const
Equality operator of the the member_class_template class.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
Abstract a member function template.
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
Abstraction of the declaration of a method.
friend void set_member_function_is_const(function_decl &, bool)
set the const-ness property of a member function.
virtual void set_linkage_name(const string &)
Set the linkage name of the method.
const method_type_sptr get_type() const
Abstracts the type of a class member function.
void set_class_type(const class_or_union_sptr &t)
Sets the class type of the current instance of method_type.
virtual hash_t hash_value() const
Return the hash value of the current IR node.
void set_is_const(bool)
Setter of the "is-const" property of method_type.
bool get_is_for_static_method() const
Test if the current method type is for a static method or not.
virtual ~method_type()
The destructor of method_type.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Return a copy of the pretty representation of the current method_type.
class_or_union_sptr get_class_type() const
Get the class type this method belongs to.
bool get_is_const() const
Getter of the "is-const" property of method_type.
The abstraction of a namespace declaration.
bool is_empty_or_has_empty_sub_namespaces() const
Test if the current namespace_decl is empty or contains empty namespaces itself.
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
namespace_decl(const environment &env, const string &name, const location &locus, visibility vis=VISIBILITY_DEFAULT)
Constructor.
virtual bool operator==(const decl_base &) const
Return true iff both namespaces and their members are equal.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Build and return a copy of the pretty representation of the namespace.
Abstracts non type template parameters.
const type_base_sptr get_type() const
Getter for the type of the template parameter.
virtual bool operator==(const decl_base &) const
Return true iff the two decls have the same name.
The abstraction of a pointer type.
void set_pointed_to_type(const type_base_sptr &)
Set the pointed-to type of the pointer.
virtual void get_qualified_name(interned_string &, bool internal=false) const
Build and return the qualified name of the current instance of pointer_type_def.
virtual hash_t hash_value() const
Return the hash value of the current IR node.
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
virtual bool operator==(const decl_base &) const
Return true iff both instances of pointer_type_def are equal.
const type_base_sptr get_pointed_to_type() const
Getter of the pointed-to type.
type_base * get_naked_pointed_to_type() const
Getter of a naked pointer to the pointed-to type.
The abstraction of a pointer-to-member type.
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Get the qualified name for the current ptr_to_mbr_type.
virtual const interned_string & get_name() const
Getter of the name of the current ptr-to-mbr-type.
virtual hash_t hash_value() const
Return the hash value of the current IR node.
const type_base_sptr & get_containing_type() const
Getter of the type containing the member pointed-to by the current ptr_to_mbr_type.
bool operator==(const ptr_to_mbr_type &) const
Equality operator for the current ptr_to_mbr_type.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function for ptr_to_mbr_type.
const type_base_sptr & get_member_type() const
Getter of the member type of the current ptr_to_mbr_type.
virtual ~ptr_to_mbr_type()
Desctructor for ptr_to_mbr_type.
The abstraction of a qualified type.
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Implementation for the virtual qualified name builder for qualified_type_def.
void set_underlying_type(const type_base_sptr &)
Setter of the underlying type.
virtual size_t get_size_in_bits() const
Get the size of the qualified type def.
virtual hash_t hash_value() const
Return the hash value of the current IR node.
string get_cv_quals_string_prefix() const
Compute and return the string prefix or suffix representing the qualifiers hold by the current instan...
CV
Bit field values representing the cv qualifiers of the underlying type.
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
void set_cv_quals(CV cv_quals)
Setter of the const/value qualifiers bit field.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
CV get_cv_quals() const
Getter of the const/volatile qualifier bit field.
type_base_sptr get_underlying_type() const
Getter of the underlying type.
virtual bool operator==(const decl_base &) const
Equality operator for qualified types.
string build_name(bool, bool internal=false) const
Build the name of the current instance of qualified type.
The internal representation of an integral type.
void set_modifiers(modifiers_type)
Setter of the modifiers bitmap of the real_type.
string to_string(bool internal=false) const
Return the string representation of the current instance of real_type.
base_type get_base_type() const
Getter of the base type of the real_type.
bool operator==(const real_type &) const
Equality operator for the real_type.
real_type()
Default constructor of the real_type.
modifiers_type
The modifiers of the base types above. Several modifiers can be combined for a given base type....
@ LONG_LONG_MODIFIER
The "long long" modifier.
@ LONG_MODIFIER
The "long" modifier.
@ SIGNED_MODIFIER
The "signed" modifier.
@ UNSIGNED_MODIFIER
The "unsigned" modier.
@ SHORT_MODIFIER
The "short" modifier.
base_type
The possible base types of integral types. We might have forgotten many of these, so do not hesitate ...
@ WCHAR_T_BASE_TYPE
The "wchar_t" base type.
@ CHAR32_T_BASE_TYPE
The "char32_t" base type.
@ FLOAT_BASE_TYPE
The "float" base type.
@ BOOL_BASE_TYPE
The "bool" base type in C++ or "_Bool" in C11.
@ CHAR_BASE_TYPE
The "char" base type.
@ CHAR16_T_BASE_TYPE
The "char16_t base type.
@ INT_BASE_TYPE
The "int" base type.
@ ARRAY_SIZE_BASE_TYPE
The aray size type used by Clang.
@ DOUBLE_BASE_TYPE
The "double" base type.
modifiers_type get_modifiers() const
Getter of the modifiers bitmap of the real_type.
Abstracts a reference type.
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Build and return the qualified name of the current instance of the reference_type_def.
virtual hash_t hash_value() const
Return the hash value of the current IR node.
virtual void on_canonical_type_set()
This function is automatically invoked whenever an instance of this type is canonicalized.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
void set_pointed_to_type(type_base_sptr &pointed_to_type)
Setter of the pointed_to type of the current reference type.
virtual bool operator==(const decl_base &) const
Equality operator of the reference_type_def type.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representation of the current instance of reference_type_def.
A declaration that introduces a scope.
virtual size_t get_num_anonymous_member_classes() const
Getter for the number of anonymous classes contained in this scope.
void remove_member_type(type_base_sptr t)
Remove a member type from the current class_or_union scope.
void insert_member_type(type_base_sptr t, declarations::iterator before)
Insert a member type.
void add_member_type(type_base_sptr t)
Add a member type to the current instance of class_or_union.
virtual size_t get_num_anonymous_member_unions() const
Getter for the number of anonymous unions contained in this scope.
scopes & get_member_scopes()
Getter for the scopes carried by the current scope.
std::vector< scope_decl_sptr > scopes
Convenience typedef for a vector of scope_decl_sptr.
bool is_empty() const
Test if the current scope is empty.
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
const type_base_sptrs_type & get_member_types() const
Get the member types of this scope_decl.
decl_base_sptr insert_member_decl(decl_base_sptr member, declarations::iterator before)
Insert a member decl to this scope, right before an element pointed to by a given iterator....
std::vector< decl_base_sptr > declarations
Convenience typedef for a vector of decl_base_sptr.
const type_base_sptrs_type & get_sorted_canonical_types() const
Return a vector of sorted canonical types of the current scope.
bool find_iterator_for_member(const decl_base *, declarations::iterator &)
Find a member of the current scope and return an iterator on it.
virtual void remove_member_decl(decl_base_sptr member)
Remove a declaration from the current scope.
virtual decl_base_sptr add_member_decl(const decl_base_sptr &member)
Add a member decl to this scope. Note that user code should not use this, but rather use add_decl_to_...
type_base_sptr find_member_type(const string &name) const
Find a member type of a given name, inside the current scope_decl.
const declarations & get_member_decls() const
Getter for the member declarations carried by the current scope_decl.
const canonical_type_sptr_set_type & get_canonical_types() const
@eturn the set of canonical types of the the current scope.
const type_base_sptrs_type & get_sorted_member_types() const
Get the sorted member types of this scope_decl.
friend decl_base_sptr add_decl_to_scope(decl_base_sptr decl, scope_decl *scope)
Appends a declaration to a given scope, if the declaration doesn't already belong to one and if the d...
virtual bool operator==(const decl_base &) const
Return true iff both scopes have the same names and have the same member decls.
const declarations & get_sorted_member_decls() const
Getter for the sorted member declarations carried by the current scope_decl.
virtual size_t get_num_anonymous_member_enums() const
Getter for the number of anonymous enums contained in this scope.
A type that introduces a scope.
virtual bool traverse(ir_node_visitor &)
Traverses an instance of scope_type_decl, visiting all the sub-types and decls that it might contain.
virtual bool operator==(const decl_base &) const
Equality operator between two scope_type_decl.
The base class of templates.
const std::list< template_parameter_sptr > & get_template_parameters() const
Get the list of template parameters of the current instance of template_decl.
virtual ~template_decl()
Destructor.
void add_template_parameter(const template_parameter_sptr p)
Add a new template parameter to the current instance of template_decl.
virtual bool operator==(const decl_base &o) const
Equality operator.
Base class for a template parameter. Client code should use the more specialized type_template_parame...
virtual ~template_parameter()
Destructor.
bool operator!=(const template_parameter &) const
Inequality operator.
Abstracts a template template parameter.
virtual bool operator==(const type_base &) const
Equality operator.
This is the abstraction of the set of relevant artefacts (types, variable declarations,...
void set_address_size(char)
Setter of the address size in this translation unit.
const std::string & get_absolute_path() const
Get the concatenation of the build directory and the relative path of the translation unit.
void set_is_constructed(bool)
Setter of the 'is_constructed" flag. It says if the translation unit is fully constructed or not.
bool operator==(const translation_unit &) const
Compare the current translation unit against another one.
const corpus * get_corpus() const
Get the corpus this translation unit is a member of.
char get_address_size() const
Getter of the address size in this translation unit.
const std::string & get_compilation_dir_path() const
Get the path of the directory that was 'current' when the translation unit was compiled.
void set_corpus(corpus *)
Set the corpus this translation unit is a member of.
void set_language(language l)
Setter of the language of the source code of the translation unit.
void bind_function_type_life_time(function_type_sptr) const
Ensure that the life time of a function type is bound to the life time of the current translation uni...
const scope_decl_sptr & get_global_scope() const
Getter of the the global scope of the translation unit.
bool is_empty() const
Tests whether if the current translation unit contains ABI artifacts or not.
bool is_constructed() const
Getter of the 'is_constructed" flag. It says if the translation unit is fully constructed or not.
const std::string & get_path() const
Get the path of the current translation unit.
void set_compilation_dir_path(const std::string &)
Set the path of the directory that was 'current' when the translation unit was compiled.
location_manager & get_loc_mgr()
Getter of the location manager for the current translation unit.
void set_path(const string &)
Set the path associated to the current instance of translation_unit.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse virtual function.
language
The language of the translation unit.
bool operator!=(const translation_unit &) const
Inequality operator.
const vector< function_type_sptr > & get_live_fn_types() const
Get the vector of function types that are used in the current translation unit.
const environment & get_environment() const
Getter of the environment of the current translation_unit.
const type_maps & get_types() const
Getter of the types of the current translation_unit.
language get_language() const
Getter of the language of the source code of the translation unit.
bool visiting() const
This should returns false before and after the node has been visiting. During the visiting of the nod...
An abstraction helper for type declarations.
const interned_string & get_cached_pretty_representation(bool internal=false) const
Get the pretty representation of the current type.
type_base * get_naked_canonical_type() const
Getter of the canonical type pointer.
virtual size_t get_size_in_bits() const
Getter for the size of the type.
virtual hash_t hash_value() const
Return the hash value of the current IR node.
virtual bool traverse(ir_node_visitor &)
Default implementation of traversal for types. This function does nothing. It must be implemented by ...
virtual void on_canonical_type_set()
This method is invoked automatically right after the current instance of class_decl has been canonica...
virtual void set_size_in_bits(size_t)
Setter for the size of the type.
virtual bool operator!=(const type_base &) const
Inequality operator.
virtual bool operator==(const type_base &) const
Return true iff both type declarations are equal.
virtual size_t get_alignment_in_bits() const
Getter for the alignment of the type.
virtual void set_alignment_in_bits(size_t)
Setter for the alignment of the type.
type_base_sptr get_canonical_type() const
Getter of the canonical type of the current instance of type_base.
This abstracts a composition of types based on template type parameters. The result of the compositio...
const type_base_sptr get_composed_type() const
Getter for the resulting composed type.
void set_composed_type(type_base_sptr t)
Setter for the resulting composed type.
A basic type declaration that introduces no scope.
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Implementation for the virtual qualified name builder for type_decl.
virtual hash_t hash_value() const
Return the hash value of the current IR node.
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
virtual bool operator!=(const type_base &) const
Return true if both types equals.
virtual bool operator==(const type_base &) const
Return true if both types equals.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Get the pretty representation of the current instance of type_decl.
This is a type that aggregates maps of all the kinds of types that are supported by libabigail.
istring_type_base_wptrs_map_type & typedef_types()
Getter for the map that associates the name of a typedef to the vector of instances of typedef_decl_s...
istring_type_base_wptrs_map_type & function_types()
Getter for the map that associates the name of a function type to the vector of instances of function...
istring_type_base_wptrs_map_type & reference_types()
Getter for the map that associates the name of a reference type to the vector of instances of referen...
const istring_type_base_wptrs_map_type & class_types() const
Getter for the map that associates the name of a class type to the vector of instances of class_decl_...
istring_type_base_wptrs_map_type & union_types()
Getter for the map that associates the name of a union type to the vector of instances of union_decl_...
istring_type_base_wptrs_map_type & array_types()
Getter for the map that associates the name of an array type to the vector of instances of array_type...
istring_type_base_wptrs_map_type & enum_types()
Getter for the map that associates the name of an enum type to the vector of instances of enum_type_d...
bool empty() const
Test if the type_maps is empty.
istring_type_base_wptrs_map_type & qualified_types()
Getter for the map that associates the name of a qualified type to the vector of instances of qualifi...
istring_type_base_wptrs_map_type & ptr_to_mbr_types()
Getter for the map that associates the name of a pointer-to-member type to the vector of instances of...
const vector< type_base_wptr > & get_types_sorted_by_name() const
Getter of all types types sorted by their pretty representation.
istring_type_base_wptrs_map_type & pointer_types()
Getter for the map that associates the name of a pointer type to the vector of instances of pointer_t...
const istring_type_base_wptrs_map_type & basic_types() const
Getter for the map that associates the name of a basic type to the vector instances of type_decl_sptr...
const istring_type_base_wptrs_map_type & subrange_types() const
Getter for the map that associates the name of a subrange type to the vector of instances of array_ty...
The base class of both types and declarations.
void set_translation_unit(translation_unit *)
Set the translation_unit this ABI artifact belongs to.
bool get_is_artificial() const
Getter of the flag that says if the artefact is artificial.
virtual ~type_or_decl_base()
The destructor of the type_or_decl_base type.
location & get_artificial_location() const
Getter of the artificial location of the artifact.
bool has_artificial_location() const
Test if the current ABI artifact carries an artificial location.
const corpus * get_corpus() const
Get the corpus this ABI artifact belongs to.
friend hash_t set_or_get_cached_hash_value(const T &type_or_decl)
Set the hash value of an IR node and return it.
virtual hash_t hash_value() const
Return the hash value of the current IR node.
enum type_or_decl_kind kind() const
Getter for the "kind" property of type_or_decl_base type.
void set_is_artificial(bool)
Setter of the flag that says if the artefact is artificial.
virtual bool traverse(ir_node_visitor &)
Traverse the the ABI artifact.
const void * runtime_type_instance() const
Getter of the pointer to the runtime type sub-object of the current instance.
friend class_decl * is_class_type(const type_or_decl_base *)
Test whether a type is a class.
friend hash_t peek_hash_value(const type_or_decl_base &)
Get the hash value associated to an IR node.
const void * type_or_decl_base_pointer() const
Getter of the pointer to either the type_base sub-object of the current instance if it's a type,...
friend decl_base * is_decl(const type_or_decl_base *d)
Test if an ABI artifact is a declaration.
void set_artificial_location(const location &)
Setter of the artificial location of the artificat.
type_or_decl_kind
This is a bitmap type which instance is meant to contain the runtime type of a given ABI artifact....
const environment & get_environment() const
Getter of the environment of the current ABI artifact.
friend type_base * is_type(const type_or_decl_base *)
Test whether a declaration is a type.
const translation_unit * get_translation_unit() const
Get the translation_unit this ABI artifact belongs to.
Abstracts a type template parameter.
virtual bool operator==(const type_base &) const
Equality operator.
The abstraction of a typedef declaration.
virtual void get_qualified_name(interned_string &qualified_name, bool internal=false) const
Implementation of the virtual "get_qualified_name" method.
void set_underlying_type(const type_base_sptr &)
Setter ofthe underlying type of the typedef.
virtual size_t get_size_in_bits() const
Return the size of the typedef.
virtual hash_t hash_value() const
Return the hash value of the current IR node.
virtual bool traverse(ir_node_visitor &)
This implements the ir_traversable_base::traverse pure virtual function.
type_base_sptr get_underlying_type() const
Getter of the underlying type of the typedef.
virtual bool operator==(const decl_base &) const
Equality operator.
virtual size_t get_alignment_in_bits() const
Return the alignment of the typedef.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Build a pretty representation for a typedef_decl.
Abstracts a union type declaration.
virtual hash_t hash_value() const
Return the hash value of the current IR node.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
virtual bool operator==(const decl_base &) const
Comparison operator for union_decl.
virtual ~union_decl()
Destructor of the union_decl type.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Getter of the pretty representation of the current instance of union_decl.
Abstracts a variable declaration.
binding get_binding() const
Getter of the binding of the variable.
void set_type(type_base_sptr &)
Setter of the type of the variable.
void set_binding(binding b)
Setter of the binding of the variable.
friend uint64_t get_data_member_offset(const var_decl_sptr m)
Get the offset of a data member.
var_decl_sptr clone() const
Create a new var_decl that is a clone of the current one.
virtual const interned_string & get_qualified_name(bool internal=false) const
Get the qualified name of a given variable or data member.
const type_base * get_naked_type() const
Getter of the type of the variable.
friend bool get_data_member_is_laid_out(const var_decl &m)
Test whether a data member is laid out.
const type_base_sptr get_type() const
Getter of the type of the variable.
virtual bool traverse(ir_node_visitor &v)
This implements the ir_traversable_base::traverse pure virtual function.
string get_anon_dm_reliable_name(bool qualified=true) const
Get a name that is valid even for an anonymous data member.
void set_symbol(const elf_symbol_sptr &sym)
Sets the underlying ELF symbol for the current variable.
const elf_symbol_sptr & get_symbol() const
Gets the the underlying ELF symbol for the current variable, that was set using var_decl::set_symbol(...
virtual bool operator==(const decl_base &) const
Comparison operator of var_decl.
virtual string get_pretty_representation(bool internal=false, bool qualified_name=true) const
Build and return the pretty representation of this variable.
interned_string get_id() const
Return an ID that tries to uniquely identify the variable inside a program or a library.
bool is_decl_only_class_with_size_change(const class_or_union &first, const class_or_union &second)
Test if two classes that are decl-only (have the decl-only flag and carry no data members) but are di...
hash_t combine_hashes(hash_t val1, hash_t val2)
Combine two hash values to produce a third hash value.
hash_t hash(uint64_t v, uint64_t seed)
Hash an integer value and combine it with a hash previously computed.
@ HASHING_FINISHED_STATE
Hashing of given IR node started and is now done. If an ABI artifact is in this state,...
const type_base * is_void_pointer_type_equivalent(const type_base &type)
Test if a type is equivalent to a pointer to void type.
real_type::modifiers_type operator~(real_type::modifiers_type l)
Bitwise one's complement operator for real_type::modifiers_type.
shared_ptr< reference_type_def > reference_type_def_sptr
Convenience typedef for a shared pointer on a reference_type_def.
bool is_declaration_only_class_or_union_type(const type_base_sptr &t, bool look_through_decl_only)
Test wheter a type is a declaration-only class.
bool enum_has_non_name_change(const enum_type_decl &l, const enum_type_decl &r, change_kind *k)
Test if two enums differ, but not by a name change.
const type_base_wptrs_type * lookup_class_types(const string &qualified_name, const corpus &corp)
Look into a given corpus to find the class type*s* that have a given qualified name.
const type_base_sptr lookup_type_in_scope(const string &fqn, const scope_decl_sptr &skope)
Lookup a type in a scope.
bool is_non_canonicalized_type(const type_base *t)
Test if a given type is allowed to be non canonicalized.
bool get_member_function_is_dtor(const function_decl &f)
Test whether a member function is a destructor.
const type_base * peel_qualified_type(const type_base *type)
Return the leaf underlying type of a qualified type.
hash_t peek_hash_value(const type_or_decl_base &artefact)
Get the hash value associated to an IR node.
shared_ptr< method_type > method_type_sptr
Convenience typedef for shared pointer to method_type.
size_t hash_type(const type_base *t)
Hash an ABI artifact that is a type.
void fqn_to_components(const string &fqn, list< string > &comps)
Decompose a fully qualified name into the list of its components.
var_decl_sptr get_last_data_member(const class_or_union &klass)
Get the last data member of a class type.
bool is_anonymous_or_typedef_named(const decl_base &d)
Test if a given decl is anonymous or has a naming typedef.
bool is_typedef_of_maybe_qualified_class_or_union_type(const type_base_sptr &t)
Test if a type is a typedef of a class or union type, or a typedef of a qualified class or union type...
decl_base_sptr add_decl_to_scope(decl_base_sptr decl, const scope_decl_sptr &scope)
Appends a declaration to a given scope, if the declaration doesn't already belong to a scope.
function_decl_sptr is_function_decl(const type_or_decl_base_sptr &d)
Test whether a declaration is a function_decl.
class_decl_sptr is_class_type(const type_or_decl_base_sptr &d)
Test whether a type is a class.
bool is_template_parm_composition_type(const shared_ptr< decl_base > decl)
Tests whether a decl is a template parameter composition type.
type_base_sptr canonicalize(type_base_sptr t, bool do_log, bool show_stats)
Compute the canonical type of a given type.
bool get_member_is_static(const decl_base &d)
Gets a flag saying if a class member is static or not.
pointer_type_def_sptr is_pointer_to_npaf_type(const type_base_sptr &t)
Test if we are looking at a pointer to a neither-a-pointer-to-an-array-nor-a-function type.
bool debug_equals(const type_or_decl_base *l, const type_or_decl_base *r)
Test if two ABI artifacts are equal.
decl_base * debug(const decl_base *artifact)
Emit a textual representation of an artifact to std error stream for debugging purposes.
shared_ptr< function_decl > function_decl_sptr
Convenience typedef for a shared pointer on a function_decl.
access_specifier
Access specifier for class members.
size_t get_canonical_type_index(const type_base &t)
Getter of the canonical type index of a given type.
pointer_type_def_sptr lookup_pointer_type(const interned_string &qualified_name, const corpus &corp)
Look into a given corpus to find a pointer type which has a given qualified name.
class_decl_sptr lookup_class_type(const interned_string &qualified_name, const corpus &corp)
Look into a given corpus to find a class type which has a given qualified name.
interned_string get_type_name(const type_base &t, bool qualified, bool internal)
Get the name of a given type and return a copy of it.
bool function_decls_alias(const function_decl &f1, const function_decl &f2)
Test if two function declarations are aliases.
pointer_type_def_sptr is_pointer_to_array_type(const type_base_sptr &t)
Test if a type is a pointer to array type.
bool type_is_suitable_for_hash_computing(const type_base &)
Test if we should attempt to compute a hash value for a given type.
shared_ptr< class_tdecl > class_tdecl_sptr
Convenience typedef for a shared pointer on a class_tdecl.
bool maybe_update_types_lookup_map< function_type >(const function_type_sptr &type, istring_type_base_wptrs_map_type &types_map, bool)
This is the specialization for type function_type of the function template:
weak_ptr< function_type > function_type_wptr
Convenience typedef for a weak pointer on a function_type.
type_base_sptr lookup_class_or_typedef_type(const string &qualified_name, const corpus &corp)
Look into a corpus to find a class, union or typedef type which has a given qualified name.
ssize_t get_member_function_vtable_offset(const function_decl &f)
Get the vtable offset of a member function.
reference_type_def_sptr lookup_reference_type(const interned_string &qualified_name, const corpus &corp)
Look into a given corpus to find a reference type which has a given qualified name.
type_decl_sptr lookup_basic_type_per_location(const string &loc, const corpus &corp)
Lookup a type_decl type from a given corpus, by its location.
ptr_to_mbr_type_sptr is_ptr_to_mbr_type(const type_or_decl_base_sptr &t, bool look_through_qualifiers)
Test whether a type is a ptr_to_mbr_type_sptr.
class_decl_sptr is_compatible_with_class_type(const decl_base_sptr &t)
Test if a type is a class. This function looks through typedefs.
corpus::origin operator|=(corpus::origin &l, corpus::origin r)
Bitwise |= operator for the corpus::origin type.
vector< type_base_wptr > type_base_wptrs_type
A convenience typedef for a vector of type_base_wptr.
const type_base_sptr is_void_pointer_type(const type_base_sptr &t)
Test if a type is a pointer to void type.
bool operator==(const union_decl_sptr &l, const union_decl_sptr &r)
Turn equality of shared_ptr of union_decl into a deep equality; that is, make it compare the pointed ...
void fixup_virtual_member_function(method_decl_sptr method)
When a virtual member function has seen its virtualness set by set_member_function_is_virtual(),...
void pop_composite_type_comparison_operands(const type_base &left, const type_base &right)
Pop a pair of operands from the stack of operands to the current type comparison.
bool equals_modulo_cv_qualifier(const array_type_def *l, const array_type_def *r)
Test if two array types are equals modulo CV qualifiers.
const type_base_wptrs_type * lookup_enum_types(const string &qualified_name, const corpus &corp)
Look into a given corpus to find the enum type*s* that have a given qualified name.
const scope_decl * is_scope_decl(const decl_base *d)
Test if a declaration is a scope_decl.
qualified_type_def_sptr clone_qualified_type(const qualified_type_def_sptr &t)
Clone a qualifiend type.
string get_class_or_union_flat_representation(const class_or_union_sptr &cou, const string &indent, bool one_line, bool internal, bool qualified_names)
Get the flat representation of an instance of class_or_union type.
bool is_type(const type_or_decl_base &tod)
Test whether a declaration is a type.
union_decl_sptr lookup_union_type(const string &type_name, const corpus &corp)
Look into a given corpus to find a union type which has a given qualified name.
bool is_anonymous_data_member(const decl_base &d)
Test if a decl is an anonymous data member.
bool is_template_parameter(const shared_ptr< decl_base > decl)
Tests whether a decl is a template parameter.
translation_unit * get_translation_unit(const type_or_decl_base_sptr &decl)
Return the translation unit a declaration belongs to.
bool is_anonymous_data_member(const var_decl &d)
Test if a var_decl is an anonymous data member.
string translation_unit_language_to_string(translation_unit::language l)
Converts a translation_unit::language enumerator into a string.
weak_ptr< type_base > type_base_wptr
Convenience typedef for a weak pointer on a type_base.
type_decl_sptr is_integral_type(const type_or_decl_base_sptr &t)
Test if a type is an integral type.
type_base_sptr peel_reference_type(const type_base_sptr &type)
Return the leaf pointed-to type node of a reference_type_def node.
class_decl::base_spec * is_class_base_spec(const type_or_decl_base *tod)
Test if an ABI artifact is a class base specifier.
bool has_scope(const decl_base &d)
Tests if a declaration has got a scope.
scope_decl * get_type_scope(const type_base_sptr &t)
Get the scope of a given type.
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.
T * maybe_get_canonical_type(T *t)
Get the canonical type of a given type T* as a T*.
shared_ptr< elf_symbol > elf_symbol_sptr
A convenience typedef for a shared pointer to elf_symbol.
typedef_decl_sptr lookup_typedef_type(const interned_string &qualified_name, const corpus &corp)
Look into a given corpus to find a typedef type which has a given qualified name.
type_base_sptr lookup_type_from_translation_unit(const string &type_name, const string &tu_path, const corpus &corp)
Lookup a type from a given translation unit present in a give corpus.
var_decl_sptr get_data_member(type_base *clazz, const char *member_name)
Get a given data member, referred to by its name, of a class type.
type_base * get_exemplar_type(const type_base *type)
For a given type, return its exemplar type.
type_base_sptr lookup_type_through_scopes(const list< string > &fqn, const translation_unit &tu)
Lookup a type from a translation unit by walking its scopes in sequence and by looking into them.
location get_location(const decl_base_sptr &decl)
Get the location of a given declaration.
const typedef_decl * is_typedef(const type_or_decl_base *t)
Test whether a type is a typedef.
bool type_originates_from_corpus(type_base_sptr t, corpus_sptr &c)
Test if a type originates from a corpus.
bool parse_real_type(const string &type_name, real_type &type)
Parse a real type from a string.
type_base_sptr look_through_decl_only_type(const type_base_sptr &t)
If a type is is decl-only, then get its definition. Otherwise, just return the initial type.
void remove_decl_from_scope(decl_base_sptr decl)
Remove a given decl from its scope.
type_base_sptr peel_qualified_or_typedef_type(const type_base_sptr &t)
Return the leaf underlying type of a qualified or typedef type.
bool odr_is_relevant(const type_or_decl_base &artifact)
By looking at the language of the TU a given ABI artifact belongs to, test if the ONE Definition Rule...
array_type_def_sptr clone_array(const array_type_def_sptr &array)
Clone an array type.
enum_type_decl_sptr lookup_enum_type_per_location(const string &loc, const corpus &corp)
Look up an enum_type_decl from a given corpus, by its location.
change_kind
A bitfield that gives callers of abigail::ir::equals() some insight about how different two internal ...
@ LOCAL_TYPE_CHANGE_KIND
This means that a given IR artifact has a local type change.
@ SUBTYPE_CHANGE_KIND
This means that a given IR artifact has changes in some of its sub-types, with respect to the other a...
@ LOCAL_NON_TYPE_CHANGE_KIND
This means that a given IR artifact has a local non-type change. That is a change that is carried by ...
var_decl_sptr find_last_data_member_matching_regexp(const class_or_union &t, const regex::regex_t_sptr ®ex)
Find the last data member of a class or union which name matches a regular expression.
const ptr_to_mbr_type * is_ptr_to_mbr_type(const type_or_decl_base *t, bool look_through_qualifiers)
Test whether a type is a ptr_to_mbr_type.
const var_decl_sptr get_first_non_anonymous_data_member(const var_decl_sptr anon_dm)
Get the first non-anonymous data member of a given anonymous data member.
class_decl_sptr lookup_class_type_through_scopes(const list< string > &fqn, const translation_unit &tu)
Lookup a class type from a translation unit by walking its scopes in sequence and by looking into the...
shared_ptr< class_or_union > is_class_or_union_type(const shared_ptr< type_or_decl_base > &t)
Test if a type is a class_or_union.
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.
bool is_user_defined_type(const type_base *t)
Test if a type is user-defined.
bool operator==(const translation_unit_sptr &l, const translation_unit_sptr &r)
A deep comparison operator for pointers to translation units.
class_or_union_sptr anonymous_data_member_to_class_or_union(const var_decl_sptr &d)
Get the class_or_union type of a given anonymous data member.
weak_ptr< class_decl > class_decl_wptr
Convenience typedef for a weak pointer on a class_decl.
string components_to_type_name(const list< string > &comps)
Turn a set of qualified name components (that name a type) into a qualified name string.
void unmark_types_as_being_compared(T &l, T &r)
Mark a pair of types as being not compared anymore.
vector< type_base_sptr > type_base_sptrs_type
Helper typedef for a vector of shared pointer to a type_base.
void debug_comp_stack(const environment &env)
Emit a trace of the two comparison operands stack on the standard error stream.
bool collect_non_anonymous_data_members(const class_or_union *cou, string_decl_base_sptr_map &dms)
Collect all the non-anonymous data members of a class or union type.
union_decl_sptr is_union_type(const shared_ptr< type_or_decl_base > &t)
Test if a type is a union_decl.
bool is_class_type(const type_or_decl_base &t)
Test whether a type is a class.
type_base_sptr synthesize_type_from_translation_unit(const type_base_sptr &type, translation_unit &tu)
In a translation unit, lookup a given type or synthesize it if it's a qualified type.
void set_member_function_virtuality(function_decl &fn, bool is_virtual, ssize_t voffset)
Set the virtual-ness of a member fcuntion.
shared_ptr< array_type_def > array_type_def_sptr
Convenience typedef for a shared pointer on a array_type_def.
method_type * is_method_type(type_or_decl_base *t)
Test whether a type is a method_type.
function_type_sptr lookup_or_synthesize_fn_type(const function_type_sptr &fn_t, const corpus &corpus)
Look into an ABI corpus for a function type.
qualified_type_def_sptr lookup_qualified_type(const interned_string &qualified_name, const corpus &corp)
Look into a given corpus to find a qualified type which has a given qualified name.
bool is_declaration_only_class_or_union_type(const type_base *t, bool look_through_decl_only)
Test wheter a type is a declaration-only class.
type_base_sptr lookup_type(const type_base_sptr &t, const corpus &corp)
Look into a given corpus to find a type.
string get_pretty_representation(const type_or_decl_base *tod, bool internal)
Build and return a copy of the pretty representation of an ABI artifact that could be either a type o...
type_base_sptr lookup_class_typedef_or_enum_type(const string &qualified_name, const corpus &corp)
Look into a corpus to find a class, typedef or enum type which has a given qualified name.
const type_base_sptr peel_qualified_type(const type_base_sptr &type)
Return the leaf underlying type of a qualified type.
type_base_sptr peel_const_qualified_type(const qualified_type_def_sptr &q)
If a qualified type is const, then return its underlying type.
function_type_sptr lookup_function_type(const interned_string &qualified_name, const corpus &corp)
Look into a given corpus to find a function type which has a given qualified name.
const class_or_union_sptr data_member_has_anonymous_type(const var_decl &d)
Test if a data member has annonymous type or not.
type_decl * is_integral_type(const type_or_decl_base *t)
Test if a type is an integral type.
bool anonymous_data_member_exists_in_class(const var_decl &anon_dm, const class_or_union &clazz)
Test if a given anonymous data member exists in a class or union.
type_decl_sptr is_real_type(const type_or_decl_base_sptr &t)
Test if a type is a real type.
void set_member_function_is_dtor(function_decl &f, bool d)
Set the destructor-ness property of a member function.
const function_type * is_function_type(const type_or_decl_base *t)
Test whether a type is a function_type.
const type_base_sptr peel_array_type(const type_base_sptr &type)
Return the leaf element type of an array.
bool types_have_similar_structure(const type_base_sptr &first, const type_base_sptr &second, bool indirect_type)
Test if two types have similar structures, even though they are (or can be) different.
corpus_group_sptr is_corpus_group(const corpus_sptr &corpus)
Test if a corpus is a corpus_group.
shared_ptr< template_parameter > template_parameter_sptr
Convenience typedef for shared pointer to template parameter.
enum_type_decl_sptr look_through_decl_only_enum(enum_type_decl_sptr enom)
If an enum is a decl-only enum, get its definition. Otherwise, just return the initial enum.
class_or_union * is_class_or_union_type(const type_or_decl_base *t)
Test if a type is a class_or_union.
type_base * look_through_decl_only_type(type_base *t)
If a type is is decl-only, then get its definition. Otherwise, just return the initial type.
const var_decl_sptr get_next_data_member(const class_or_union *klass, const var_decl_sptr &data_member)
In the context of a given class or union, this function returns the data member that is located after...
shared_ptr< class_decl > class_decl_sptr
Convenience typedef for a shared pointer on a class_decl.
type_base_sptr peel_typedef_pointer_or_reference_type(const type_base_sptr type)
Return the leaf underlying or pointed-to type node of a typedef_decl, pointer_type_def,...
void set_member_function_is_const(function_decl &f, bool is_const)
set the const-ness property of a member function.
string get_name(const type_or_decl_base_sptr &tod, bool qualified)
Build and return a copy of the name of an ABI artifact that is either a type of a decl.
bool is_anonymous_type(const type_base_sptr &t)
Test if a given type is anonymous.
decl_base_sptr strip_useless_const_qualification(const qualified_type_def_sptr t)
Strip qualification from a qualified type, when it makes sense.
bool is_comparison_cycle_detected(T &l, T &r)
Detect if a recursive comparison cycle is detected while structurally comparing two types (a....
bool string_to_elf_symbol_type(const string &s, elf_symbol::type &t)
Convert a string representing a symbol type into an elf_symbol::type.
namespace_decl_sptr is_namespace(const decl_base_sptr &d)
Tests if a declaration is a namespace declaration.
array_type_def_sptr is_array_of_qualified_element(const type_base_sptr &type)
Test if an array type is an array to a qualified element type.
const type_decl * is_type_decl(const type_or_decl_base *t)
Test whether a type is a type_decl (a builtin type).
decl_base * is_decl_slow(const type_or_decl_base *t)
Test if an ABI artifact is a declaration.
decl_base_sptr look_through_decl_only(const decl_base &d)
If a decl is decl-only get its definition. Otherwise, just return nil.
function_type_sptr is_function_type(const type_or_decl_base_sptr &t)
Test whether a type is a function_type.
scope_decl_sptr is_scope_decl(const decl_base_sptr &d)
Test if a declaration is a scope_decl.
string get_name(const type_or_decl_base *tod, bool qualified)
Build and return a copy of the name of an ABI artifact that is either a type or a decl.
void set_member_access_specifier(decl_base &d, access_specifier a)
Sets the access specifier for a class member.
decl_base_sptr look_through_decl_only(const decl_base_sptr &d)
If a decl is decl-only get its definition. Otherwise, just return nil.
typedef_decl_sptr is_typedef(const type_or_decl_base_sptr t)
Test whether a type is a typedef.
abg_compat::optional< uint64_t > hash_t
The abstraction for an 8 bytes hash value.
type_base_sptr is_type(const type_or_decl_base_sptr &tod)
Test whether a declaration is a type.
uint64_t get_var_size_in_bits(const var_decl_sptr &v)
Get the size of a given variable.
string get_debug_representation(const type_or_decl_base *artifact)
Get the textual representation of a type for debugging purposes.
shared_ptr< function_type > function_type_sptr
Convenience typedef for a shared pointer on a function_type.
shared_ptr< typedef_decl > typedef_decl_sptr
Convenience typedef for a shared pointer on a typedef_decl.
function_type_sptr synthesize_function_type_from_translation_unit(const function_type &fn_type, translation_unit &tu)
In a translation unit, lookup the sub-types that make up a given function type and if the sub-types a...
std::ostream & operator<<(std::ostream &o, elf_symbol::type t)
Serialize an instance of symbol_type and stream it to a given output stream.
type_base_sptr peel_pointer_type(const type_base_sptr &type)
Return the leaf pointed-to type node of a pointer_type_def node.
bool var_equals_modulo_types(const var_decl &l, const var_decl &r, change_kind *k)
Compares two instances of var_decl without taking their type into account.
type_base_sptr lookup_type_through_translation_units(const string &qn, const corpus &abi_corpus)
Lookup a type definition in all the translation units of a given ABI corpus.
void sort_types(const canonical_type_sptr_set_type &types, vector< type_base_sptr > &result)
Sort types in a hopefully stable manner.
type_base * peel_pointer_or_reference_type(const type_base *type, bool peel_qual_type)
Return the leaf underlying or pointed-to type node of a, pointer_type_def, reference_type_def or qual...
decl_base_sptr is_decl_slow(const type_or_decl_base_sptr &t)
Test if an ABI artifact is a declaration.
reference_type_def * is_reference_type(type_or_decl_base *t, bool look_through_qualifiers)
Test whether a type is a reference_type_def.
corpus::origin operator|(corpus::origin l, corpus::origin r)
Bitwise | operator for the corpus::origin type.
bool elf_symbol_is_function(elf_symbol::type t)
Test if the type of an ELF symbol denotes a function symbol.
bool is_cplus_plus_language(translation_unit::language l)
Test if a language enumerator designates the C++ language.
bool integral_type_has_harmless_name_change(const decl_base_sptr &f, const decl_base_sptr &s)
Test if a diff node carries a change whereby two integral types have different names in a harmless wa...
enum_type_decl_sptr is_compatible_with_enum_type(const decl_base_sptr &t)
Test if a type is an enum. This function looks through typedefs.
function_decl::parameter_sptr is_function_parameter(const type_or_decl_base_sptr tod)
Test whether an ABI artifact is a function_decl.
class_or_union_sptr look_through_decl_only_class(class_or_union_sptr klass)
If a class (or union) is a decl-only class, get its definition. Otherwise, just return the initial cl...
bool lookup_decl_only_class_types(const interned_string &qualified_name, const corpus &corp, type_base_wptrs_type &result)
Look into a given corpus to find the class type*s* that have a given qualified name and that are decl...
bool member_function_has_vtable_offset(const function_decl &f)
Test if a virtual member function has a vtable offset set.
const type_base * peel_typedef_type(const type_base *type)
Return the leaf underlying type node of a typedef_decl node.
decl_base_sptr insert_decl_into_scope(decl_base_sptr decl, scope_decl::declarations::iterator before, scope_decl *scope)
Inserts a declaration into a given scope, before a given IR child node of the scope.
unordered_map< interned_string, bool, hash_interned_string > interned_string_bool_map_type
Convenience typedef for a map of interned_string -> bool.
const enum_type_decl * is_enum_type(const type_or_decl_base *d)
Test if a decl is an enum_type_decl.
unordered_map< interned_string, type_base_wptrs_type, hash_interned_string > istring_type_base_wptrs_map_type
A convenience typedef for a map which key is an interned_string and which value is a vector of type_b...
bool function_decl_is_less_than(const function_decl &f, const function_decl &s)
Test if the pretty representation of a given function_decl is lexicographically less then the pretty ...
bool elf_symbols_alias(const elf_symbol &s1, const elf_symbol &s2)
Test if two symbols alias.
var_decl_sptr find_data_member_from_anonymous_data_member(const var_decl_sptr &anon_dm, const string &name)
Find a data member inside an anonymous data member.
shared_ptr< var_decl > var_decl_sptr
Convenience typedef for a shared pointer on a var_decl.
shared_ptr< ptr_to_mbr_type > ptr_to_mbr_type_sptr
Convenience typedef for a shared pointer to a ptr_to_mbr_type.
const location & get_natural_or_artificial_location(const decl_base *decl)
Get the non-artificial (natural) location of a decl.
string build_qualified_name(const scope_decl *scope, const type_base_sptr &type)
Build and return the qualified name of a type in its scope.
size_t hash_type_or_decl(const type_or_decl_base *tod)
Hash an ABI artifact that is either a type or a decl.
array_type_def_sptr is_array_type(const type_or_decl_base_sptr &type, bool look_through_qualifiers)
Test if a type is an array_type_def.
corpus::origin operator&(corpus::origin l, corpus::origin r)
Bitwise & operator for the corpus::origin type.
bool is_template_decl(const decl_base_sptr &decl)
Tests whether a decl is a template.
shared_ptr< scope_decl > scope_decl_sptr
Convenience typedef for a shared pointer on a scope_decl.
class_decl_sptr lookup_class_type_per_location(const string &loc, const corpus &corp)
Look up a class_decl from a given corpus by its location.
bool string_to_elf_symbol_binding(const string &s, elf_symbol::binding &b)
Convert a string representing a an elf symbol binding into an elf_symbol::binding.
shared_ptr< type_or_decl_base > type_or_decl_base_sptr
A convenience typedef for a shared_ptr to type_or_decl_base.
ssize_t get_member_function_vtable_offset(const function_decl_sptr &f)
Get the vtable offset of a member function.
shared_ptr< translation_unit > translation_unit_sptr
Convenience typedef for a shared pointer on a translation_unit type.
bool is_data_member_of_anonymous_class_or_union(const var_decl &d)
Test if a var_decl is a data member belonging to an anonymous type.
namespace_decl * is_namespace(const decl_base *d)
Tests if a declaration is a namespace declaration.
bool integral_type_has_harmless_name_change(const type_base_sptr &f, const type_base_sptr &s)
Test if a diff node carries a change whereby two integral types have different names in a harmless wa...
type_base * peel_typedef_pointer_or_reference_type(const type_base *type, bool peel_qual_type)
Return the leaf underlying or pointed-to type node of a typedef_decl, pointer_type_def or reference_t...
const type_base * is_void_pointer_type_equivalent(const type_base *type)
Test if a type is equivalent to a pointer to void type.
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.
lookup_entity_kind
This enum describe the kind of entity to lookup, while using the lookup API.
bool try_canonical_compare(const T *l, const T *r)
Compare two types by comparing their canonical types if present.
type_base * type_has_non_canonicalized_subtype(type_base_sptr t)
Test if a type has sub-types that are non-canonicalized.
unordered_map< string, decl_base_sptr > string_decl_base_sptr_map
Convenience typedef for a map which key is a string and which value is a decl_base_sptr.
void push_composite_type_comparison_operands(const type_base &left, const type_base &right)
Push a pair of operands on the stack of operands of the current type comparison, during type canonica...
bool is_java_language(translation_unit::language l)
Test if a language enumerator designates the Java language.
function_decl::parameter * is_function_parameter(const type_or_decl_base *tod)
Test whether a declaration is a function_decl.
type_decl_sptr lookup_basic_type(const string &qualified_name, const corpus &corp)
Look into a given corpus to find a basic type which has a given qualified name.
class_or_union * is_at_class_scope(const decl_base &decl)
Tests whether a given decl is at class scope.
bool equals(const decl_base &l, const decl_base &r, change_kind *k)
Compares two instances of decl_base.
bool get_data_member_is_laid_out(const var_decl &m)
Test whether a data member is laid out.
const decl_base_sptr lookup_var_decl_in_scope(const std::list< string > &comps, const scope_decl_sptr &skope)
lookup a var_decl in a scope.
bool string_to_elf_symbol_visibility(const string &s, elf_symbol::visibility &v)
Convert a string representing a an elf symbol visibility into an elf_symbol::visibility.
union_decl_sptr lookup_union_type_per_location(const string &loc, const corpus &corp)
Lookup a union type in a given corpus, from its location.
weak_ptr< elf_symbol > elf_symbol_wptr
A convenience typedef for a weak pointer to elf_symbol.
uint64_t get_data_member_offset(const decl_base_sptr d)
Get the offset of a data member.
bool get_member_function_is_const(const function_decl &f)
Test whether a member function is const.
interned_string get_name_of_reference_to_type(const type_base &pointed_to_type, bool lvalue_reference, bool qualified, bool internal)
Get the name of the reference to a given type.
shared_ptr< pointer_type_def > pointer_type_def_sptr
Convenience typedef for a shared pointer on a pointer_type_def.
void maybe_update_types_lookup_map(const type_decl_sptr &basic_type)
Update the map that associates the fully qualified name of a basic type with the type itself.
bool is_enumerator_present_in_enum(const enum_type_decl::enumerator &enr, const enum_type_decl &enom)
Test if a given enumerator is found present in an enum.
interned_string get_method_type_name(const method_type &fn_type, bool internal)
Get the name of a given method type and return a copy of it.
bool is_const_qualified_type(const qualified_type_def_sptr &t)
Test if a given qualified type is const.
translation_unit::language string_to_translation_unit_language(const string &l)
Parse a string representing a language into a translation_unit::language enumerator into a string.
enum_type_decl_sptr is_enum_type(const type_or_decl_base_sptr &d)
Test if a decl is an enum_type_decl.
var_decl_sptr has_fake_flexible_array_data_member(const class_decl_sptr &klass)
Test if the last data member of a class is an array with one element.
type_base_sptr lookup_type_per_location(const interned_string &loc, const corpus &corp)
Lookup a type from a corpus, by its location.
bool get_next_data_member_offset(const class_or_union *klass, const var_decl_sptr &dm, uint64_t &offset)
Get the offset of the non-static data member that comes after a given one.
uint64_t get_absolute_data_member_offset(const var_decl &m)
Get the absolute offset of a data member.
shared_ptr< ir_traversable_base > ir_traversable_base_sptr
Convenience typedef for a shared pointer to ir_traversable_base.
bool is_member_function(const function_decl &f)
Test whether a function_decl is a member function.
const function_decl::parameter * get_function_parameter(const decl_base *fun, unsigned parm_index)
Get the function parameter designated by its index.
var_decl * is_var_decl(const type_or_decl_base *tod)
Tests if a declaration is a variable declaration.
string get_pretty_representation(const method_type_sptr method, bool internal)
Get the pretty representation of a method type.
bool is_c_language(translation_unit::language l)
Test if a language enumerator designates the C language.
decl_base * is_decl(const type_or_decl_base *d)
Test if an ABI artifact is a declaration.
void keep_type_alive(type_base_sptr t)
Make sure that the life time of a given (smart pointer to a) type is the same as the life time of the...
method_decl * is_method_decl(const type_or_decl_base *d)
Test if a function_decl is actually a method_decl.
bool is_member_type(const type_base_sptr &t)
Tests if a type is a class member.
string get_class_or_union_flat_representation(const class_or_union &cou, const string &indent, bool one_line, bool internal, bool qualified_names)
Get the flat representation of an instance of class_or_union type.
array_type_def::subrange_sptr is_subrange_type(const type_or_decl_base_sptr &type)
Test if a type is an array_type_def::subrange_type.
decl_base_sptr add_decl_to_scope(decl_base_sptr decl, scope_decl *scope)
Appends a declaration to a given scope, if the declaration doesn't already belong to one and if the d...
string build_internal_underlying_enum_type_name(const string &base_name, bool is_anonymous, uint64_t size)
Build the internal name of the underlying type of an enum.
bool is_npaf_type(const type_base_sptr &t)
Test if a type is a neither a pointer, an array nor a function type.
access_specifier get_member_access_specifier(const decl_base &d)
Gets the access specifier for a class member.
shared_ptr< enum_type_decl > enum_type_decl_sptr
Convenience typedef for shared pointer to a enum_type_decl.
void set_data_member_offset(var_decl_sptr m, uint64_t o)
Set the offset of a data member into its containing class.
const interned_string & get_node_name(var_decl_sptr node)
Gets the name of a var_decl node.
type_base_sptr strip_typedef(const type_base_sptr type)
Recursively returns the the underlying type of a typedef. The return type should not be a typedef of ...
uint64_t get_data_member_offset(const var_decl &m)
Get the offset of a data member.
unordered_set< uintptr_t > pointer_set
A convenience typedef for an unordered set of pointer values.
type_decl_sptr is_type_decl(const type_or_decl_base_sptr &t)
Test whether a type is a type_decl (a builtin type).
void sort_types_for_hash_computing_and_c14n(IteratorType begin, IteratorType end)
Sort types before hashing (and then canonicalizing) them.
class_or_union * is_at_class_scope(const decl_base_sptr decl)
Tests whether a given decl is at class scope.
bool get_member_function_is_virtual(const function_decl &f)
Test if a given member function is virtual.
const pointer_type_def * is_pointer_type(const type_or_decl_base *t, bool look_through_qualifiers)
Test whether a type is a pointer_type_def.
string get_class_or_enum_flat_representation(const type_base &coe, const string &indent, bool one_line, bool internal, bool qualified_name)
Get the flat representation of an instance of enum_type_decl type.
bool types_are_compatible(const decl_base_sptr d1, const decl_base_sptr d2)
Test if two types are equal modulo a typedef.
class_or_union * anonymous_data_member_to_class_or_union(const var_decl *d)
Get the class_or_union type of a given anonymous data member.
location get_location(const type_base_sptr &type)
Get the location of the declaration of a given type.
pointer_type_def_sptr is_pointer_to_function_type(const type_base_sptr &t)
Test if a type is a pointer to function type.
translation_unit * get_translation_unit(const type_or_decl_base &t)
Return the translation unit a declaration belongs to.
weak_ptr< decl_base > decl_base_wptr
Convenience typedef for a weak pointer to a decl_base.
interned_string get_function_type_name(const function_type_sptr &fn_type, bool internal)
Get the name of a given function type and return a copy of it.
bool is_function_template_pattern(const shared_ptr< decl_base > decl)
Test whether a decl is the pattern of a function template.
class_or_union * look_through_decl_only_class(class_or_union *the_class)
If a class (or union) is a decl-only class, get its definition. Otherwise, just return the initial cl...
bool is_union_type(const type_or_decl_base &t)
Test if a type is a union_decl.
const location & get_artificial_or_natural_location(const decl_base *decl)
Get the artificial location of a decl.
bool is_global_scope(const shared_ptr< scope_decl >scope)
Tests whether if a given scope is the global scope.
typedef_decl_sptr lookup_typedef_type_per_location(const string &loc, const corpus &corp)
Lookup a typedef_decl from a corpus, by its location.
type_base_sptr peel_typedef_type(const type_base_sptr &type)
Return the leaf underlying type node of a typedef_decl node.
interned_string get_name_of_qualified_type(const type_base_sptr &underlying_type, qualified_type_def::CV quals, bool qualified, bool internal)
Get the name of a qualified type, given the underlying type and its qualifiers.
shared_ptr< template_decl > template_decl_sptr
Convenience typedef for a shared pointer to template_decl.
array_type_def_sptr is_typedef_of_array(const type_base_sptr &t)
Test if a type is a typedef of an array.
bool is_global_scope(const scope_decl &scope)
Tests whether if a given scope is the global scope.
string get_string_representation_of_cv_quals(const qualified_type_def::CV cv_quals)
Get the string representation of a CV qualifier bitmap.
void set_data_member_is_laid_out(var_decl_sptr m, bool l)
Set a flag saying if a data member is laid out.
pointer_type_def_sptr is_pointer_to_ptr_to_mbr_type(const type_base_sptr &t)
Test if we are looking at a pointer to pointer to member type.
bool is_data_member(const var_decl &v)
Test if a var_decl is a data member.
var_decl_sptr find_first_data_member_matching_regexp(const class_or_union &t, const regex::regex_t_sptr &r)
Find the first data member of a class or union which name matches a regular expression.
const decl_base * get_type_declaration(const type_base *t)
Get the declaration for a given type.
bool is_at_global_scope(const decl_base *decl)
Tests whether a given declaration is at global scope.
void set_member_is_static(decl_base &d, bool s)
Sets the static-ness property of a class member.
array_type_def * is_array_type(const type_or_decl_base *type, bool look_through_qualifiers)
Test if a type is an array_type_def.
weak_ptr< template_decl > template_decl_wptr
Convenience typedef for a weak pointer to template_decl.
const var_decl * lookup_data_member(const type_base *type, const char *dm_name)
Look for a data member of a given class, struct or union type and return it.
interned_string get_function_id_or_pretty_representation(const function_decl *fn)
Get the ID of a function, or, if the ID can designate several different functions,...
shared_ptr< type_decl > type_decl_sptr
Convenience typedef for a shared pointer on a type_decl.
const global_scope * get_global_scope(const shared_ptr< decl_base > decl)
Return the global scope as seen by a given declaration.
typedef_decl_sptr clone_typedef(const typedef_decl_sptr &t)
Clone a typedef type.
bool compare_using_locations(const decl_base *f, const decl_base *s)
Compare decls using their locations.
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 classes_have_same_layout(const type_base_sptr &f, const type_base_sptr &s)
Test if two classes have the same layout.
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...
bool return_comparison_result(T &l, T &r, bool value)
Return the result of the comparison of two (sub) types.
array_type_def_sptr lookup_array_type(const interned_string &qualified_name, const corpus &corp)
Look into a given corpus to find an array type which has the same qualified name as a given array typ...
shared_ptr< namespace_decl > namespace_decl_sptr
Convenience typedef for a shared pointer on namespace_decl.
var_decl_sptr is_var_decl(const type_or_decl_base_sptr &decl)
Tests if a declaration is a variable declaration.
bool is_ada_language(translation_unit::language l)
Test if a language enumerator designates the Ada language.
string demangle_cplus_mangled_name(const string &mangled_name)
Demangle a C++ mangled name and return the resulting string.
bool is_unique_type(const type_base_sptr &t)
Test if a type is unique in the entire environment.
void maybe_update_types_lookup_map(const function_type_sptr &fn_type)
Update the map that associates the fully qualified name of a function type with the type itself.
void mark_types_as_being_compared(T &l, T &r)
Mark a pair of types as being compared.
interned_string get_type_name(const type_base_sptr &t, bool qualified, bool internal)
Get the name of a given type and return a copy of it.
corpus::origin operator&=(corpus::origin &l, corpus::origin r)
Bitwise &= operator for the corpus::origin type.
type_base_sptr clone_array_tree(const type_base_sptr t)
Clone a type tree made of an array or a typedef of array.
interned_string get_function_type_name(const function_type &fn_type, bool internal)
Get the name of a given function type and return a copy of it.
decl_base_sptr is_decl(const type_or_decl_base_sptr &d)
Test if an ABI artifact is a declaration.
bool operator!=(const translation_unit_sptr &l, const translation_unit_sptr &r)
A deep inequality operator for pointers to translation units.
interned_string get_name_of_pointer_to_type(const type_base &pointed_to_type, bool qualified, bool internal)
Get the name of the pointer to a given type.
bool decl_name_changed(const type_or_decl_base *a1, const type_or_decl_base *a2)
Test if two decls have different names.
bool is_at_template_scope(const shared_ptr< decl_base > decl)
Tests whether a given decl is at template scope.
function_decl * is_function_decl(const type_or_decl_base *d)
Test whether a declaration is a function_decl.
bool elf_symbol_is_variable(elf_symbol::type t)
Test if the type of an ELF symbol denotes a function symbol.
bool type_has_sub_type_changes(const type_base_sptr t_v1, const type_base_sptr t_v2)
Tests if the change of a given type effectively comes from just its sub-types. That is,...
bool maybe_update_types_lookup_map< class_decl >(const class_decl_sptr &class_type, istring_type_base_wptrs_map_type &map, bool use_type_name_as_key)
This is the specialization for type class_decl of the function template:
var_decl_sptr has_flexible_array_data_member(const class_decl_sptr &klass)
Test if the last data member of a class is an array with non-finite data member.
method_type_sptr is_method_type(const type_or_decl_base_sptr &t)
Test whether a type is a method_type.
qualified_type_def * is_qualified_type(const type_or_decl_base *t)
Test whether a type is a reference_type_def.
bool is_typedef_ptr_or_ref_to_decl_only_class_or_union_type(const type_base *t)
Test if a type is a typedef, pointer or reference to a decl-only class/union.
const scope_decl * get_top_most_scope_under(const decl_base_sptr decl, const scope_decl_sptr scope)
Return the a scope S containing a given declaration and that is right under a given scope P.
std::unordered_map< string, elf_symbols > string_elf_symbols_map_type
Convenience typedef for a map which key is a string and which value is a vector of elf_symbol.
string build_qualified_name(const scope_decl *scope, const string &name)
Build and return a qualified name from a name and its scope.
bool is_ptr_ref_or_qual_type(const type_base *t)
Helper to detect if a type is either a reference, a pointer, or a qualified type.
method_decl_sptr copy_member_function(const class_or_union_sptr &t, const method_decl_sptr &method)
Copy a method of a class_or_union into a new class_or_union.
decl_base_sptr get_type_declaration(const type_base_sptr t)
Get the declaration for a given type.
shared_ptr< function_tdecl > function_tdecl_sptr
Convenience typedef for a shared pointer on a function_tdecl.
type_base * peel_qualified_or_typedef_type(const type_base *type)
Return the leaf underlying type of a qualified or typedef type.
type_base_sptr type_or_void(const type_base_sptr t, const environment &env)
Return either the type given in parameter if it's non-null, or the void type.
pointer_type_def_sptr is_pointer_type(const type_or_decl_base_sptr &t, bool look_through_qualifiers)
Test whether a type is a pointer_type_def.
type_decl * is_real_type(const type_or_decl_base *t)
Test if a type is a real type.
const type_base_wptrs_type * lookup_union_types(const string &qualified_name, const corpus &corp)
Look into a given corpus to find the union types that have a given qualified name.
bool is_member_decl(const decl_base_sptr d)
Tests if a declaration is a class member.
bool maybe_compare_as_member_decls(const decl_base &l, const decl_base &r, change_kind *k)
Compare the properties that belong to the "is-a-member-relation" of a decl.
qualified_type_def_sptr is_qualified_type(const type_or_decl_base_sptr &t)
Test whether a type is a qualified_type_def.
bool 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.
reference_type_def_sptr is_reference_type(const type_or_decl_base_sptr &t, bool look_through_qualifiers)
Test whether a type is a reference_type_def.
bool get_member_function_is_ctor(const function_decl &f)
Test whether a member function is a constructor.
void set_member_function_is_ctor(function_decl &f, bool c)
Setter for the is_ctor property of the member function.
bool is_declaration_only_class_type(const type_base_sptr &t, bool look_through_decl_only)
Test wheter a type is a declaration-only class.
enum_type_decl_sptr lookup_enum_type(const interned_string &qualified_name, const corpus &corp)
Look into a given corpus to find an enum type which has a given qualified name.
bool match(const regex_t_sptr &r, const std::string &str)
See if a string matches a regex.
std::shared_ptr< regex_t > regex_t_sptr
A convenience typedef for a shared pointer of regex_t.
Toplevel namespace for libabigail.
bool operator==(const std::string &l, const interned_string &r)
Equality operator.
std::string operator+(const interned_string &s1, const std::string &s2)
Concatenation operator.
std::ostream & operator<<(std::ostream &o, const interned_string &s)
Streaming operator.
unordered_map< string, string * > pool_map_type
Convenience typedef for a map of string -> string*.
A functor to hash instances of interned_string.
size_t operator()(const type_base_sptr &l) const
Hash a type by returning the pointer value of its canonical type.
Hasher for the class_or_union type.
bool is_printing_flat_representation() const
Getter of the 'is_printing_flat_representation_' boolean.
void unset_printing_flat_representation()
Set the 'is_printing_flat_representation_' boolean to false.
void set_printing_flat_representation()
Set the 'is_printing_flat_representation_' boolean to true.
A functor to sort decls somewhat topologically. That is, types are sorted in a way that makes the one...
The private data of the environment type.
Equality functor for instances of function_decl.
The type of the private data of the function_type type.
virtual bool traverse(ir_node_visitor &v)
Traverse a given IR node and its children, calling an visitor on each node.
The hashing functor for member_base.
Private type to hold private members of translation_unit.
Hash functor for instances of type_base.
Definition of the private data of type_base.
The private data of type_or_decl_base.
A predicate for deep equality of instances of shared_ptr<type_base>
A functor to sort types somewhat topologically. That is, types are sorted in a way that makes the one...
A deleter for shared pointers that ... doesn't delete the object managed by the shared pointer.