From: Dodji Seketeli <dodji@redhat.com>
To: libabigail@sourceware.org
Cc: dodji@redhat.com
Subject: [PATCH] ir,corpus,comparison: Const-iffy the access to corpus interfaces
Date: Fri, 01 Mar 2024 18:21:44 +0100 [thread overview]
Message-ID: <87r0gt7tqv.fsf@redhat.com> (raw)
Hello,
In preparation to subsequent patches that perform manipulations of the
corpus interfaces, it appears that we need to add const access to
those corpus interfaces.
* include/abg-comparison.h (typedef string_function_ptr_map): Make
this typedef use a const function_decl*, not just a
function_decl*.
(typedef string_var_ptr_map): Make this typedef use a const
var_decl*, not just a var_decl*.
* include/abg-corpus.h (typedef corpus::functions): Make this
typedef be a vector<const function_decl*>, not just a
vector<function_decl*>.
(corpus::exported_decls_builder::fn_id_maps_to_several_fns):
Adjust declaration to const function_decl*.
* include/abg-fwd.h (typedef istring_var_decl_ptr_map_type)
(typedef istring_function_decl_ptr_map_type): Move these typedefs to
abg-ir.h.
(get_function_id_or_pretty_representation): Use const function_decl*.
* include/abg-ir.h (typedef istring_var_decl_ptr_map_type)
(typedef istring_function_decl_ptr_map_type): Move these here from
abg-fwd.h. Also make these use const var_decl* and const.
function_decl.
* src/abg-comparison-priv.h (sort_string_function_ptr_map)
(sort_string_var_ptr_map): Use vector<const function_decl*> and
vector<const var_decl*> rather than their non-const variants.
* src/abg-comparison.cc (sort_string_function_ptr_map)
(sort_string_var_ptr_map): Likewise.
(corpus_diff::priv::{ensure_lookup_tables_populated,
apply_supprs_to_added_removed_fns_vars_unreachable_types}):
Adjust.
* src/abg-corpus-priv.h (corpus::priv::{fns,vars}): Make these
data members use vector<const function_decl*> and vector<const
var_decl*> types.
* src/abg-corpus.cc
(corpus::exported_decls_builder::fn_id_maps_to_several_fns)
(corpus::maybe_drop_some_exported_decls): Adjust.
(corpus_group::priv::{fns,vars}): Make these data members use
vector<const function_decl*> and vector<const var_decl*> types.
* src/abg-default-reporter.cc (default_reporter::report): In the
overload for const corpus_diff&, adjust.
* src/abg-ir.cc (get_function_id_or_pretty_representation):
Adjust.
* src/abg-leaf-reporter.cc (leaf_reporter::report): In the
overload for const corpus_diff&, adjust.
* tools/abicompat.cc (perform_compat_check_in_normal_mode):
Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applying to the master branch
---
include/abg-comparison.h | 4 +--
include/abg-corpus.h | 6 ++--
include/abg-fwd.h | 10 +-----
include/abg-ir.h | 8 +++++
src/abg-comparison-priv.h | 4 +--
src/abg-comparison.cc | 28 +++++++++-------
src/abg-corpus-priv.h | 4 +--
src/abg-corpus.cc | 18 ++++------
src/abg-default-reporter.cc | 59 ++++++++++++++-------------------
src/abg-ir.cc | 4 +--
src/abg-leaf-reporter.cc | 66 +++++++++++++++----------------------
tools/abicompat.cc | 8 ++---
12 files changed, 97 insertions(+), 122 deletions(-)
diff --git a/include/abg-comparison.h b/include/abg-comparison.h
index f6e25e20..a395210d 100644
--- a/include/abg-comparison.h
+++ b/include/abg-comparison.h
@@ -204,7 +204,7 @@ typedef unordered_map<string, changed_enumerator> string_changed_enumerator_map;
/// Convenience typedef for a map which key is a string and which
/// value is a pointer to @ref decl_base.
-typedef unordered_map<string, function_decl*> string_function_ptr_map;
+typedef unordered_map<string, const function_decl*> string_function_ptr_map;
/// Convenience typedef for a map which key is a string and which
/// value is a @ref function_decl_diff_sptr.
@@ -229,7 +229,7 @@ typedef unordered_map<string, method_decl_sptr> string_member_function_sptr_map;
/// Convenience typedef for a map which key is a string and which
/// value is a point to @ref var_decl.
-typedef unordered_map<string, var_decl*> string_var_ptr_map;
+typedef unordered_map<string, const var_decl*> string_var_ptr_map;
/// Convenience typedef for a pair of pointer to @ref var_decl
/// representing a @ref var_decl change. The first member of the pair
diff --git a/include/abg-corpus.h b/include/abg-corpus.h
index aafa3a1f..489a2507 100644
--- a/include/abg-corpus.h
+++ b/include/abg-corpus.h
@@ -28,10 +28,10 @@ public:
typedef vector<string> strings_type;
/// Convenience typedef for std::vector<abigail::ir::function_decl*>
- typedef vector<function_decl*> functions;
+ typedef vector<const function_decl*> functions;
///Convenience typedef for std::vector<abigail::ir::var_decl*>
- typedef vector<var_decl*> variables;
+ typedef vector<const var_decl*> variables;
class exported_decls_builder;
@@ -331,7 +331,7 @@ public:
exported_functions();
std::unordered_set<function_decl*>*
- fn_id_maps_to_several_fns(function_decl*);
+ fn_id_maps_to_several_fns(const function_decl*);
const variables&
exported_variables() const;
diff --git a/include/abg-fwd.h b/include/abg-fwd.h
index 51043af2..b9cfcf13 100644
--- a/include/abg-fwd.h
+++ b/include/abg-fwd.h
@@ -255,10 +255,6 @@ typedef shared_ptr<var_decl> var_decl_sptr;
/// Convenience typedef for a weak pointer on a @ref var_decl
typedef weak_ptr<var_decl> var_decl_wptr;
-typedef unordered_map<interned_string,
- var_decl*,
- hash_interned_string> istring_var_decl_ptr_map_type;
-
class scope_decl;
/// Convenience typedef for a shared pointer on a @ref scope_decl.
@@ -269,10 +265,6 @@ class function_decl;
/// Convenience typedef for a shared pointer on a @ref function_decl
typedef shared_ptr<function_decl> function_decl_sptr;
-typedef unordered_map<interned_string,
- function_decl*,
- hash_interned_string> istring_function_decl_ptr_map_type;
-
class method_decl;
typedef shared_ptr<method_decl> method_decl_sptr;
@@ -1096,7 +1088,7 @@ interned_string
get_function_type_name(const function_type&, bool internal = false);
interned_string
-get_function_id_or_pretty_representation(function_decl *fn);
+get_function_id_or_pretty_representation(const function_decl *fn);
interned_string
get_method_type_name(const method_type_sptr&, bool internal = false);
diff --git a/include/abg-ir.h b/include/abg-ir.h
index 90f5d4d3..2c69cfe0 100644
--- a/include/abg-ir.h
+++ b/include/abg-ir.h
@@ -574,6 +574,14 @@ typedef unordered_map<interned_string,
hash_interned_string>
istring_type_or_decl_base_sptr_map_type;
+typedef unordered_map<interned_string,
+ const function_decl*,
+ hash_interned_string> istring_function_decl_ptr_map_type;
+
+typedef unordered_map<interned_string,
+ const var_decl*,
+ hash_interned_string> istring_var_decl_ptr_map_type;
+
/// This is a type that aggregates maps of all the kinds of types that
/// are supported by libabigail.
///
diff --git a/src/abg-comparison-priv.h b/src/abg-comparison-priv.h
index 3f86db5e..434e6267 100644
--- a/src/abg-comparison-priv.h
+++ b/src/abg-comparison-priv.h
@@ -1422,7 +1422,7 @@ sort_changed_data_members(changed_var_sptrs_type& input);
void
sort_string_function_ptr_map(const string_function_ptr_map& map,
- vector<function_decl*>& sorted);
+ vector<const function_decl*>& sorted);
void
sort_string_member_function_sptr_map(const string_member_function_sptr_map& map,
@@ -1447,7 +1447,7 @@ sort_string_elf_symbol_map(const string_elf_symbol_map& map,
void
sort_string_var_ptr_map(const string_var_ptr_map& map,
- vector<var_decl*>& sorted);
+ vector<const var_decl*>& sorted);
void
sort_string_data_member_diff_sptr_map(const string_var_diff_sptr_map& map,
diff --git a/src/abg-comparison.cc b/src/abg-comparison.cc
index fdd2a688..1af10529 100644
--- a/src/abg-comparison.cc
+++ b/src/abg-comparison.cc
@@ -176,7 +176,7 @@ sort_changed_data_members(changed_var_sptrs_type& to_sort)
/// @param sorted the resulting sorted vector.
void
sort_string_function_ptr_map(const string_function_ptr_map& map,
- vector<function_decl*>& sorted)
+ vector<const function_decl*>& sorted)
{
sorted.reserve(map.size());
for (string_function_ptr_map::const_iterator i = map.begin();
@@ -283,7 +283,7 @@ sort_string_elf_symbol_map(const string_elf_symbol_map& map,
/// @param sorted out parameter; the sorted vector of @ref var_decl.
void
sort_string_var_ptr_map(const string_var_ptr_map& map,
- vector<var_decl*>& sorted)
+ vector<const var_decl*>& sorted)
{
for (string_var_ptr_map::const_iterator i = map.begin();
i != map.end();
@@ -9382,7 +9382,7 @@ corpus_diff::priv::ensure_lookup_tables_populated()
unsigned i = it->index();
ABG_ASSERT(i < first_->get_functions().size());
- function_decl* deleted_fn = first_->get_functions()[i];
+ const function_decl* deleted_fn = first_->get_functions()[i];
string n = get_function_id_or_pretty_representation(deleted_fn);
ABG_ASSERT(!n.empty());
// The below is commented out because there can be several
@@ -9402,7 +9402,7 @@ corpus_diff::priv::ensure_lookup_tables_populated()
++iit)
{
unsigned i = *iit;
- function_decl* added_fn = second_->get_functions()[i];
+ const function_decl* added_fn = second_->get_functions()[i];
string n = get_function_id_or_pretty_representation(added_fn);
ABG_ASSERT(!n.empty());
// The below is commented out because there can be several
@@ -9413,8 +9413,10 @@ corpus_diff::priv::ensure_lookup_tables_populated()
deleted_fns_.find(n);
if (j != deleted_fns_.end())
{
- function_decl_sptr f(j->second, noop_deleter());
- function_decl_sptr s(added_fn, noop_deleter());
+ function_decl_sptr f(const_cast<function_decl*>(j->second),
+ noop_deleter());
+ function_decl_sptr s(const_cast<function_decl*>(added_fn),
+ noop_deleter());
function_decl_diff_sptr d = compute_diff(f, s, ctxt);
if (*j->second != *added_fn)
changed_fns_map_[j->first] = d;
@@ -9482,7 +9484,7 @@ corpus_diff::priv::ensure_lookup_tables_populated()
unsigned i = it->index();
ABG_ASSERT(i < first_->get_variables().size());
- var_decl* deleted_var = first_->get_variables()[i];
+ const var_decl* deleted_var = first_->get_variables()[i];
string n = deleted_var->get_id();
ABG_ASSERT(!n.empty());
ABG_ASSERT(deleted_vars_.find(n) == deleted_vars_.end());
@@ -9499,7 +9501,7 @@ corpus_diff::priv::ensure_lookup_tables_populated()
++iit)
{
unsigned i = *iit;
- var_decl* added_var = second_->get_variables()[i];
+ const var_decl* added_var = second_->get_variables()[i];
string n = added_var->get_id();
ABG_ASSERT(!n.empty());
{
@@ -9517,8 +9519,10 @@ corpus_diff::priv::ensure_lookup_tables_populated()
{
if (*j->second != *added_var)
{
- var_decl_sptr f(j->second, noop_deleter());
- var_decl_sptr s(added_var, noop_deleter());
+ var_decl_sptr f(const_cast<var_decl*>(j->second),
+ noop_deleter());
+ var_decl_sptr s(const_cast<var_decl*>(added_var),
+ noop_deleter());
changed_vars_map_[n] = compute_diff(f, s, ctxt);
}
deleted_vars_.erase(j);
@@ -10045,7 +10049,7 @@ corpus_diff::priv::apply_supprs_to_added_removed_fns_vars_unreachable_types()
if (is_member_function(e->second)
&& get_member_function_is_virtual(e->second))
{
- function_decl *f = e->second;
+ const function_decl *f = e->second;
class_decl_sptr c =
is_class_type(is_method_type(f->get_type())->get_class_type());
ABG_ASSERT(c);
@@ -10059,7 +10063,7 @@ corpus_diff::priv::apply_supprs_to_added_removed_fns_vars_unreachable_types()
if (is_member_function(e->second)
&& get_member_function_is_virtual(e->second))
{
- function_decl *f = e->second;
+ const function_decl *f = e->second;
class_decl_sptr c =
is_class_type(is_method_type(f->get_type())->get_class_type());
ABG_ASSERT(c);
diff --git a/src/abg-corpus-priv.h b/src/abg-corpus-priv.h
index 6908142e..58faedb2 100644
--- a/src/abg-corpus-priv.h
+++ b/src/abg-corpus-priv.h
@@ -742,8 +742,8 @@ struct corpus::priv
string architecture_name;
translation_units members;
string_tu_map_type path_tu_map;
- vector<function_decl*> fns;
- vector<var_decl*> vars;
+ vector<const function_decl*> fns;
+ vector<const var_decl*> vars;
symtab_reader::symtab_sptr symtab_;
// The type maps contained in this data member are populated if the
// corpus follows the One Definition Rule and thus if there is only
diff --git a/src/abg-corpus.cc b/src/abg-corpus.cc
index 2a904079..770757c3 100644
--- a/src/abg-corpus.cc
+++ b/src/abg-corpus.cc
@@ -122,7 +122,7 @@ corpus::exported_decls_builder::exported_functions()
/// @return the set of functions designated by the ELF symbol of @p
/// fn, or nullptr if the function ID maps to just @p fn.
std::unordered_set<function_decl*>*
-corpus::exported_decls_builder::fn_id_maps_to_several_fns(function_decl* fn)
+corpus::exported_decls_builder::fn_id_maps_to_several_fns(const function_decl* fn)
{
std::unordered_set<function_decl*> *fns_for_id =
priv_->fn_id_is_in_id_fns_map(fn);
@@ -1570,11 +1570,9 @@ corpus::maybe_drop_some_exported_decls()
{
string sym_name, sym_version;
- vector<function_decl*> fns_to_keep;
+ functions fns_to_keep;
exported_decls_builder* b = get_exported_decls_builder().get();
- for (vector<function_decl*>::iterator f = priv_->fns.begin();
- f != priv_->fns.end();
- ++f)
+ for (auto f = priv_->fns.begin(); f != priv_->fns.end(); ++f)
{
if (b->priv_->keep_wrt_id_of_fns_to_keep(*f)
&& b->priv_->keep_wrt_regex_of_fns_to_suppress(*f)
@@ -1583,10 +1581,8 @@ corpus::maybe_drop_some_exported_decls()
}
priv_->fns = fns_to_keep;
- vector<var_decl*> vars_to_keep;
- for (vector<var_decl*>::iterator v = priv_->vars.begin();
- v != priv_->vars.end();
- ++v)
+ variables vars_to_keep;
+ for (auto v = priv_->vars.begin(); v != priv_->vars.end(); ++v)
{
if (b->priv_->keep_wrt_id_of_vars_to_keep(*v)
&& b->priv_->keep_wrt_regex_of_vars_to_suppress(*v)
@@ -1690,9 +1686,9 @@ struct corpus_group::priv
std::set<string> corpora_paths;
corpora_type corpora;
istring_function_decl_ptr_map_type fns_map;
- vector<function_decl*> fns;
+ corpus::functions fns;
istring_var_decl_ptr_map_type vars_map;
- vector<var_decl*> vars;
+ corpus::variables vars;
string_elf_symbols_map_type var_symbol_map;
string_elf_symbols_map_type fun_symbol_map;
elf_symbols sorted_var_symbols;
diff --git a/src/abg-default-reporter.cc b/src/abg-default-reporter.cc
index 0b317fac..426b27b4 100644
--- a/src/abg-default-reporter.cc
+++ b/src/abg-default-reporter.cc
@@ -1886,32 +1886,29 @@ default_reporter::report(const corpus_diff& d, ostream& out,
out << indent << s.net_num_func_removed() << " Removed functions:\n\n";
bool emitted = false;
- vector<function_decl*>sorted_deleted_fns;
+ corpus::functions sorted_deleted_fns;
sort_string_function_ptr_map(d.priv_->deleted_fns_, sorted_deleted_fns);
- for (vector<function_decl*>::const_iterator i =
- sorted_deleted_fns.begin();
- i != sorted_deleted_fns.end();
- ++i)
+ for (auto f : sorted_deleted_fns)
{
- if (d.priv_->deleted_function_is_suppressed(*i))
+ if (d.priv_->deleted_function_is_suppressed(f))
continue;
out << indent
<< " ";
out << "[D] ";
- out << "'" << (*i)->get_pretty_representation() << "'";
+ out << "'" << (f)->get_pretty_representation() << "'";
if (ctxt->show_linkage_names())
{
out << " {";
- show_linkage_name_and_aliases(out, "", *(*i)->get_symbol(),
+ show_linkage_name_and_aliases(out, "", *(f)->get_symbol(),
d.first_corpus()->get_fun_symbol_map());
out << "}";
}
out << "\n";
- if (is_member_function(*i) && get_member_function_is_virtual(*i))
+ if (is_member_function(f) && get_member_function_is_virtual(f))
{
class_decl_sptr c =
- is_class_type(is_method_type((*i)->get_type())->get_class_type());
+ is_class_type(is_method_type(f->get_type())->get_class_type());
out << indent
<< " "
<< "note that this removes an entry from the vtable of "
@@ -1932,13 +1929,11 @@ default_reporter::report(const corpus_diff& d, ostream& out,
out << indent << s.net_num_func_added()
<< " Added functions:\n\n";
bool emitted = false;
- vector<function_decl*> sorted_added_fns;
+ corpus::functions sorted_added_fns;
sort_string_function_ptr_map(d.priv_->added_fns_, sorted_added_fns);
- for (vector<function_decl*>::const_iterator i = sorted_added_fns.begin();
- i != sorted_added_fns.end();
- ++i)
+ for (auto f : sorted_added_fns)
{
- if (d.priv_->added_function_is_suppressed(*i))
+ if (d.priv_->added_function_is_suppressed(f))
continue;
out
@@ -1946,21 +1941,21 @@ default_reporter::report(const corpus_diff& d, ostream& out,
<< " ";
out << "[A] ";
out << "'"
- << (*i)->get_pretty_representation()
+ << f->get_pretty_representation()
<< "'";
if (ctxt->show_linkage_names())
{
out << " {";
show_linkage_name_and_aliases
- (out, "", *(*i)->get_symbol(),
+ (out, "", *f->get_symbol(),
d.second_corpus()->get_fun_symbol_map());
out << "}";
}
out << "\n";
- if (is_member_function(*i) && get_member_function_is_virtual(*i))
+ if (is_member_function(f) && get_member_function_is_virtual(f))
{
class_decl_sptr c =
- is_class_type(is_method_type((*i)->get_type())->get_class_type());
+ is_class_type(is_method_type(f->get_type())->get_class_type());
out << indent
<< " "
<< "note that this adds a new entry to the vtable of "
@@ -2063,17 +2058,14 @@ default_reporter::report(const corpus_diff& d, ostream& out,
<< " Removed variables:\n\n";
string n;
bool emitted = false;
- vector<var_decl*> sorted_deleted_vars;
+ corpus::variables sorted_deleted_vars;
sort_string_var_ptr_map(d.priv_->deleted_vars_, sorted_deleted_vars);
- for (vector<var_decl*>::const_iterator i =
- sorted_deleted_vars.begin();
- i != sorted_deleted_vars.end();
- ++i)
+ for (auto v : sorted_deleted_vars)
{
- if (d.priv_->deleted_variable_is_suppressed(*i))
+ if (d.priv_->deleted_variable_is_suppressed(v))
continue;
- n = (*i)->get_pretty_representation();
+ n = v->get_pretty_representation();
out << indent
<< " ";
@@ -2084,7 +2076,7 @@ default_reporter::report(const corpus_diff& d, ostream& out,
if (ctxt->show_linkage_names())
{
out << " {";
- show_linkage_name_and_aliases(out, "", *(*i)->get_symbol(),
+ show_linkage_name_and_aliases(out, "", *v->get_symbol(),
d.first_corpus()->get_var_symbol_map());
out << "}";
}
@@ -2104,17 +2096,14 @@ default_reporter::report(const corpus_diff& d, ostream& out,
<< " Added variables:\n\n";
string n;
bool emitted = false;
- vector<var_decl*> sorted_added_vars;
+ corpus::variables sorted_added_vars;
sort_string_var_ptr_map(d.priv_->added_vars_, sorted_added_vars);
- for (vector<var_decl*>::const_iterator i =
- sorted_added_vars.begin();
- i != sorted_added_vars.end();
- ++i)
+ for (auto v : sorted_added_vars)
{
- if (d.priv_->added_variable_is_suppressed(*i))
+ if (d.priv_->added_variable_is_suppressed(v))
continue;
- n = (*i)->get_pretty_representation();
+ n = v->get_pretty_representation();
out << indent
<< " ";
@@ -2123,7 +2112,7 @@ default_reporter::report(const corpus_diff& d, ostream& out,
if (ctxt->show_linkage_names())
{
out << " {";
- show_linkage_name_and_aliases(out, "", *(*i)->get_symbol(),
+ show_linkage_name_and_aliases(out, "", *v->get_symbol(),
d.second_corpus()->get_var_symbol_map());
out << "}";
}
diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index e6a7a51d..fcacc382 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -9221,13 +9221,13 @@ get_function_type_name(const function_type& fn_type,
///
/// @return the function ID of pretty representation of @p fn.
interned_string
-get_function_id_or_pretty_representation(function_decl *fn)
+get_function_id_or_pretty_representation(const function_decl *fn)
{
ABG_ASSERT(fn);
interned_string result = fn->get_environment().intern(fn->get_id());
- if (corpus *c = fn->get_corpus())
+ if (const corpus *c = fn->get_corpus())
{
corpus::exported_decls_builder_sptr b =
c->get_exported_decls_builder();
diff --git a/src/abg-leaf-reporter.cc b/src/abg-leaf-reporter.cc
index 7b7111db..fdd53f4a 100644
--- a/src/abg-leaf-reporter.cc
+++ b/src/abg-leaf-reporter.cc
@@ -1074,32 +1074,29 @@ leaf_reporter::report(const corpus_diff& d,
out << indent << s.net_num_func_removed() << " Removed functions:\n\n";
bool emitted = false;
- vector<function_decl*>sorted_deleted_fns;
+ corpus::functions sorted_deleted_fns;
sort_string_function_ptr_map(d.priv_->deleted_fns_, sorted_deleted_fns);
- for (vector<function_decl*>::const_iterator i =
- sorted_deleted_fns.begin();
- i != sorted_deleted_fns.end();
- ++i)
+ for (auto f : sorted_deleted_fns)
{
- if (d.priv_->deleted_function_is_suppressed(*i))
+ if (d.priv_->deleted_function_is_suppressed(f))
continue;
out << indent
<< " ";
out << "[D] ";
- out << "'" << (*i)->get_pretty_representation() << "'";
+ out << "'" << f->get_pretty_representation() << "'";
if (ctxt->show_linkage_names())
{
out << " {";
- show_linkage_name_and_aliases(out, "", *(*i)->get_symbol(),
+ show_linkage_name_and_aliases(out, "", *f->get_symbol(),
d.first_corpus()->get_fun_symbol_map());
out << "}";
}
out << "\n";
- if (is_member_function(*i) && get_member_function_is_virtual(*i))
+ if (is_member_function(f) && get_member_function_is_virtual(f))
{
class_decl_sptr c =
- is_class_type(is_method_type((*i)->get_type())->get_class_type());
+ is_class_type(is_method_type(f->get_type())->get_class_type());
out << indent
<< " "
<< "note that this removes an entry from the vtable of "
@@ -1120,13 +1117,11 @@ leaf_reporter::report(const corpus_diff& d,
out << indent << s.net_num_func_added()
<< " Added functions:\n\n";
bool emitted = false;
- vector<function_decl*> sorted_added_fns;
+ corpus::functions sorted_added_fns;
sort_string_function_ptr_map(d.priv_->added_fns_, sorted_added_fns);
- for (vector<function_decl*>::const_iterator i = sorted_added_fns.begin();
- i != sorted_added_fns.end();
- ++i)
+ for (auto f : sorted_added_fns)
{
- if (d.priv_->added_function_is_suppressed(*i))
+ if (d.priv_->added_function_is_suppressed(f))
continue;
out
@@ -1134,21 +1129,21 @@ leaf_reporter::report(const corpus_diff& d,
<< " ";
out << "[A] ";
out << "'"
- << (*i)->get_pretty_representation()
+ << f->get_pretty_representation()
<< "'";
if (ctxt->show_linkage_names())
{
out << " {";
show_linkage_name_and_aliases
- (out, "", *(*i)->get_symbol(),
+ (out, "", *f->get_symbol(),
d.second_corpus()->get_fun_symbol_map());
out << "}";
}
out << "\n";
- if (is_member_function(*i) && get_member_function_is_virtual(*i))
+ if (is_member_function(f) && get_member_function_is_virtual(f))
{
class_decl_sptr c =
- is_class_type(is_method_type((*i)->get_type())->get_class_type());
+ is_class_type(is_method_type(f->get_type())->get_class_type());
out << indent
<< " "
<< "note that this adds a new entry to the vtable of "
@@ -1239,17 +1234,14 @@ leaf_reporter::report(const corpus_diff& d,
<< " Removed variables:\n\n";
string n;
bool emitted = false;
- vector<var_decl*> sorted_deleted_vars;
+ corpus::variables sorted_deleted_vars;
sort_string_var_ptr_map(d.priv_->deleted_vars_, sorted_deleted_vars);
- for (vector<var_decl*>::const_iterator i =
- sorted_deleted_vars.begin();
- i != sorted_deleted_vars.end();
- ++i)
+ for (auto v : sorted_deleted_vars)
{
- if (d.priv_->deleted_variable_is_suppressed(*i))
+ if (d.priv_->deleted_variable_is_suppressed(v))
continue;
- n = (*i)->get_pretty_representation();
+ n = v->get_pretty_representation();
out << indent
<< " ";
@@ -1260,7 +1252,7 @@ leaf_reporter::report(const corpus_diff& d,
if (ctxt->show_linkage_names())
{
out << " {";
- show_linkage_name_and_aliases(out, "", *(*i)->get_symbol(),
+ show_linkage_name_and_aliases(out, "", *v->get_symbol(),
d.first_corpus()->get_var_symbol_map());
out << "}";
}
@@ -1280,17 +1272,14 @@ leaf_reporter::report(const corpus_diff& d,
<< " Added variables:\n\n";
string n;
bool emitted = false;
- vector<var_decl*> sorted_added_vars;
+ corpus::variables sorted_added_vars;
sort_string_var_ptr_map(d.priv_->added_vars_, sorted_added_vars);
- for (vector<var_decl*>::const_iterator i =
- sorted_added_vars.begin();
- i != sorted_added_vars.end();
- ++i)
+ for (auto v : sorted_added_vars)
{
- if (d.priv_->added_variable_is_suppressed(*i))
+ if (d.priv_->added_variable_is_suppressed(v))
continue;
- n = (*i)->get_pretty_representation();
+ n = v->get_pretty_representation();
out << indent
<< " ";
@@ -1299,7 +1288,7 @@ leaf_reporter::report(const corpus_diff& d,
if (ctxt->show_linkage_names())
{
out << " {";
- show_linkage_name_and_aliases(out, "", *(*i)->get_symbol(),
+ show_linkage_name_and_aliases(out, "", *v->get_symbol(),
d.second_corpus()->get_var_symbol_map());
out << "}";
}
@@ -1319,12 +1308,9 @@ leaf_reporter::report(const corpus_diff& d,
out << indent << num_changed
<< " Changed variables:\n\n";
string n1, n2;
- for (var_diff_sptrs_type::const_iterator i =
- d.priv_->sorted_changed_vars_.begin();
- i != d.priv_->sorted_changed_vars_.end();
- ++i)
+ for (auto d : d.priv_->sorted_changed_vars_)
{
- diff_sptr diff = *i;
+ diff_sptr diff = d;
if (!diff)
continue;
diff --git a/tools/abicompat.cc b/tools/abicompat.cc
index 043e9028..9e264b0e 100644
--- a/tools/abicompat.cc
+++ b/tools/abicompat.cc
@@ -435,14 +435,14 @@ perform_compat_check_in_normal_mode(options& opts,
/// the differences found in the type of that function.
struct fn_change
{
- function_decl* decl;
+ const function_decl* decl;
function_type_diff_sptr diff;
fn_change()
: decl()
{}
- fn_change(function_decl* decl,
+ fn_change(const function_decl* decl,
function_type_diff_sptr difference)
: decl(decl),
diff(difference)
@@ -454,14 +454,14 @@ struct fn_change
/// the differences found in the type of that variable.
struct var_change
{
- var_decl* decl;
+ const var_decl* decl;
diff_sptr diff;
var_change()
: decl()
{}
- var_change(var_decl* var,
+ var_change(const var_decl* var,
diff_sptr difference)
: decl(var),
diff(difference)
--
2.39.3
--
Dodji
reply other threads:[~2024-03-01 17:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r0gt7tqv.fsf@redhat.com \
--to=dodji@redhat.com \
--cc=libabigail@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).