From patchwork Wed Aug 14 12:56:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 95820 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6D9513858417 for ; Wed, 14 Aug 2024 12:57:24 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by sourceware.org (Postfix) with ESMTPS id 60FC63858C35 for ; Wed, 14 Aug 2024 12:56:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 60FC63858C35 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 60FC63858C35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640215; cv=none; b=fnLmP48Ys3U09eDEktjz9i4Bcj4TYoWNNZR8aiUgpB/YJJhOySbxxDoRVpH7cDWPxOlF6B+uLqoaUJ6GBiAUSU5OG0ElEyLvP0actunep9Zw/1lLf4CmLZVxfhsKIBu9buH0CewY6OYvTAL4uwBcPVPEUAWXbyH3q/y9e10RH2o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640215; c=relaxed/simple; bh=8CJgUcJMe6WcDbte21JY7IUr1SbGS/vKZ3/2+U3duu8=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=xntLktOWsPPFvTUuK0Ykw27JwaFeB+awG6ywQ/eMUwfd0g9dDB9zpS0AklnNLSUQ9AYGCK4nvgiZ9/N7CQIEAN2zq9Ey8QJ3akl5JznHuu6whMdj6nGWK8T5Lq9DV3PWJrphb605CdHNErGSz6zlDwEAkrtl1ytG6uV+LF48AAE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id C8C0C1BF203; Wed, 14 Aug 2024 12:56:49 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 23D70507A61B; Wed, 14 Aug 2024 14:56:49 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 01/11] Use smart pointers for variables exported from the ABI corpus Date: Wed, 14 Aug 2024 14:56:39 +0200 Message-ID: <20240814125649.47119-1-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli It turned out that for some applications using the library, being able to share the variables returned by libabigail::ir::corpus::lookup_variable is useful. This patch changes the API to use shared pointer for variables exported from the ABI corpus. For the sake of consistency, we should do the same for function decls, but given the churn, I thought I'd do it for variables first and see the impact. If it's OK then I'll do it for function decls too. * include/abg-comparison.h (string_var_ptr_map): Use a var_decl_sptr rather than a var_decl*. * include/abg-corpus.h (corpus::{variable, variables_set}): Likewise. (corpus::lookup_variable): Return a var_decl_sptr not a var_decl*. (corpus::exported_decls_builder::maybe_add_var_to_exported_vars): Take a var_decl_sptr, not a var_decl*. * include/abg-fe-iface.h (fe_iface::add_var_to_exported_or_undefined_decls): Likewise. * include/abg-ir.h (istring_var_decl_ptr_map_type): Use a var_decl_sptr rather than a var_decl*. * src/abg-btf-reader.cc (reader::build_ir_node_from_btf_type): Adjust call to add_var_to_exported_or_undefined_decls. * src/abg-comparison-priv.h (var_comp::operator()()): Add a new overload for var_decl_sptr. (corpus_diff::priv::{deleted_variable_is_suppressed, deleted_variable_is_suppressed}): Take a var_decl_sptr not a var_decl*. (sort_string_var_ptr_map): Take ... * src/abg-comparison.cc (sort_string_var_ptr_map): ... a vector rather than a vector. (corpus_diff::priv::ensure_lookup_tables_populated): Adjust. (variable_is_suppressed): Likewise. (corpus_diff::priv::{deleted_variable_is_suppressed, added_variable_is_suppressed}): Likewise. * src/abg-corpus-priv.h (str_var_ptr_map_type) (istr_var_ptr_map_type): Use a var_decl_sptr rather than a var_decl*. (corpus::exported_decls_builder::priv::{add_var_to_map, keep_wrt_id_of_vars_to_keep, keep_wrt_regex_of_vars_to_suppress, keep_wrt_regex_of_vars_to_keep}): Likewise. (corpus::exported_decls_builder::priv::vars): Likewise. * src/abg-corpus.cc (corpus::exported_decls_builder::maybe_add_var_to_exported_vars): Likewise. (var_comp::operator()()): Add an overload for var_decl_sptr. (corpus::lookup_variable): Return var_decl_sptr rather than var_decl*. * src/abg-ctf-reader.cc (reader::process_ctf_archive): Adjust. * src/abg-dwarf-reader.cc (build_ir_node_from_die): Adjust. * src/abg-fe-iface.cc (fe_iface::add_var_to_exported_or_undefined_decls): Take a var_decl_sptr rather than a var_decl*. * src/abg-reader.cc (build_class_decl, handle_var_decl): Adjust. * src/abg-writer.cc (write_translation_unit): Likewise. * tools/abicompat.cc (var_change::decl, var_change::var_change): Likewise. (compare_expected_against_provided_variables): Likewise. Signed-off-by: Dodji Seketeli --- include/abg-comparison.h | 2 +- include/abg-corpus.h | 8 ++++---- include/abg-fe-iface.h | 2 +- include/abg-ir.h | 2 +- src/abg-btf-reader.cc | 2 +- src/abg-comparison-priv.h | 10 +++++++--- src/abg-comparison.cc | 18 ++++++++---------- src/abg-corpus-priv.h | 20 ++++++++++---------- src/abg-corpus.cc | 10 +++++++--- src/abg-ctf-reader.cc | 2 +- src/abg-dwarf-reader.cc | 4 ++-- src/abg-fe-iface.cc | 2 +- src/abg-reader.cc | 4 ++-- src/abg-writer.cc | 3 +-- tools/abicompat.cc | 6 +++--- 15 files changed, 50 insertions(+), 45 deletions(-) diff --git a/include/abg-comparison.h b/include/abg-comparison.h index 3178c97a..b0527e79 100644 --- a/include/abg-comparison.h +++ b/include/abg-comparison.h @@ -225,7 +225,7 @@ typedef unordered_map 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_ptr_map; +typedef unordered_map 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 cbadbdb2..2cebad2e 100644 --- a/include/abg-corpus.h +++ b/include/abg-corpus.h @@ -34,10 +34,10 @@ public: typedef std::unordered_set functions_set; ///Convenience typedef for std::vector - typedef vector variables; + typedef vector variables; /// Convenience typedef for std::unordered_set. - typedef std::unordered_set variables_set; + typedef std::unordered_set variables_set; class exported_decls_builder; @@ -230,7 +230,7 @@ public: const std::unordered_set* lookup_functions(const char* id) const; - const var_decl* + const var_decl_sptr lookup_variable(const interned_string& id) const; void @@ -370,7 +370,7 @@ public: maybe_add_fn_to_exported_fns(function_decl*); bool - maybe_add_var_to_exported_vars(const var_decl*); + maybe_add_var_to_exported_vars(const var_decl_sptr&); }; //corpus::exported_decls_builder /// Abstraction of a group of corpora. diff --git a/include/abg-fe-iface.h b/include/abg-fe-iface.h index 119ab7ce..65bc0493 100644 --- a/include/abg-fe-iface.h +++ b/include/abg-fe-iface.h @@ -145,7 +145,7 @@ protected: add_fn_to_exported_or_undefined_decls(const function_decl* fn); void - add_var_to_exported_or_undefined_decls(const var_decl* var); + add_var_to_exported_or_undefined_decls(const var_decl_sptr& var); virtual ir::corpus_sptr read_corpus(status& status) = 0; diff --git a/include/abg-ir.h b/include/abg-ir.h index 348cce3c..1e89d06c 100644 --- a/include/abg-ir.h +++ b/include/abg-ir.h @@ -579,7 +579,7 @@ typedef unordered_map istring_function_decl_ptr_map_type; typedef unordered_map istring_var_decl_ptr_map_type; /// This is a type that aggregates maps of all the kinds of types that diff --git a/src/abg-btf-reader.cc b/src/abg-btf-reader.cc index ec13d267..ad610410 100644 --- a/src/abg-btf-reader.cc +++ b/src/abg-btf-reader.cc @@ -661,7 +661,7 @@ public: if (function_decl_sptr fn = is_function_decl(result)) add_fn_to_exported_or_undefined_decls(fn.get()); else if (var_decl_sptr var = is_var_decl(result)) - add_var_to_exported_or_undefined_decls(var.get()); + add_var_to_exported_or_undefined_decls(var); return result; } diff --git a/src/abg-comparison-priv.h b/src/abg-comparison-priv.h index db7946ae..1cd92790 100644 --- a/src/abg-comparison-priv.h +++ b/src/abg-comparison-priv.h @@ -1013,6 +1013,10 @@ struct var_comp bool operator() (const var_decl* l, const var_decl* r) const {return operator()(*l, *r);} + + bool + operator() (const var_decl_sptr& l, const var_decl_sptr& r) const + {return operator()(l.get(), r.get());} };// end struct var_comp /// A functor to compare instances of @ref elf_symbol base on their @@ -1147,10 +1151,10 @@ struct corpus_diff::priv added_function_is_suppressed(const function_decl* fn) const; bool - deleted_variable_is_suppressed(const var_decl* var) const; + deleted_variable_is_suppressed(const var_decl_sptr& var) const; bool - added_variable_is_suppressed(const var_decl* var) const; + added_variable_is_suppressed(const var_decl_sptr& var) const; bool added_unreachable_type_is_suppressed(const type_base *t)const ; @@ -1434,7 +1438,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& sorted); + vector& 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 65996a84..87a2e4a9 100644 --- a/src/abg-comparison.cc +++ b/src/abg-comparison.cc @@ -324,7 +324,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& sorted) + vector& sorted) { for (string_var_ptr_map::const_iterator i = map.begin(); i != map.end(); @@ -9685,7 +9685,7 @@ corpus_diff::priv::ensure_lookup_tables_populated() unsigned i = it->index(); ABG_ASSERT(i < first_->get_variables().size()); - const var_decl* deleted_var = first_->get_variables()[i]; + const var_decl_sptr 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()); @@ -9702,7 +9702,7 @@ corpus_diff::priv::ensure_lookup_tables_populated() ++iit) { unsigned i = *iit; - const var_decl* added_var = second_->get_variables()[i]; + const var_decl_sptr added_var = second_->get_variables()[i]; string n = added_var->get_id(); ABG_ASSERT(!n.empty()); { @@ -9720,10 +9720,8 @@ corpus_diff::priv::ensure_lookup_tables_populated() { if (*j->second != *added_var) { - var_decl_sptr f(const_cast(j->second), - noop_deleter()); - var_decl_sptr s(const_cast(added_var), - noop_deleter()); + var_decl_sptr f = j->second; + var_decl_sptr s = added_var; changed_vars_map_[n] = compute_diff(f, s, ctxt); } deleted_vars_.erase(j); @@ -10173,7 +10171,7 @@ function_is_suppressed(const function_decl* fn, /// change reports about variable @p fn, if that variable changes in /// the way expressed by @p k. static bool -variable_is_suppressed(const var_decl* var, +variable_is_suppressed(const var_decl_sptr& var, const suppression_sptr suppr, variable_suppression::change_kind k, const diff_context_sptr ctxt) @@ -10425,7 +10423,7 @@ corpus_diff::priv::added_function_is_suppressed(const function_decl* fn) const /// @return true iff the change reports for a give given deleted /// variable has been deleted. bool -corpus_diff::priv::deleted_variable_is_suppressed(const var_decl* var) const +corpus_diff::priv::deleted_variable_is_suppressed(const var_decl_sptr& var) const { if (!var) return false; @@ -10444,7 +10442,7 @@ corpus_diff::priv::deleted_variable_is_suppressed(const var_decl* var) const /// @return true iff the change reports for a given deleted /// variable has been deleted. bool -corpus_diff::priv::added_variable_is_suppressed(const var_decl* var) const +corpus_diff::priv::added_variable_is_suppressed(const var_decl_sptr& var) const { if (!var) return false; diff --git a/src/abg-corpus-priv.h b/src/abg-corpus-priv.h index 485c77dc..100eaee7 100644 --- a/src/abg-corpus-priv.h +++ b/src/abg-corpus-priv.h @@ -55,12 +55,12 @@ typedef unordered_map str_var_ptr_map_type; +typedef unordered_map str_var_ptr_map_type; /// Convenience typedef for a hash map which key is an interned_string /// and which data is an abigail::ir::var_decl*. typedef unordered_map istr_var_ptr_map_type; /// The type of the private data of @ref @@ -449,7 +449,7 @@ public: /// /// @param id the variable to add to the map. void - add_var_to_map(var_decl* var) + add_var_to_map(const var_decl_sptr& var) { if (var) { @@ -475,13 +475,13 @@ public: /// /// @param fn the variable to add to the set of exported variables. void - add_var_to_exported(const var_decl* var) + add_var_to_exported(const var_decl_sptr& var) { const interned_string& id = get_id(*var); if (!var_id_is_in_id_var_map(id)) { - vars_.push_back(const_cast(var)); - add_var_to_map(const_cast(var)); + vars_.push_back(var); + add_var_to_map(var); } } @@ -617,7 +617,7 @@ public: /// /// @return true iff the variable is to be kept. bool - keep_wrt_id_of_vars_to_keep(const var_decl* var) + keep_wrt_id_of_vars_to_keep(const var_decl_sptr& var) { if (!var) return false; @@ -662,7 +662,7 @@ public: /// /// @return true iff the variable is to be kept. bool - keep_wrt_regex_of_vars_to_suppress(const var_decl *var) + keep_wrt_regex_of_vars_to_suppress(const var_decl_sptr var) { if (!var) return false; @@ -691,7 +691,7 @@ public: /// /// @return true iff the variable is to be kept. bool - keep_wrt_regex_of_vars_to_keep(const var_decl *var) + keep_wrt_regex_of_vars_to_keep(const var_decl_sptr& var) { if (!var) return false; @@ -743,7 +743,7 @@ struct corpus::priv translation_units members; string_tu_map_type path_tu_map; vector fns; - vector vars; + vector vars; functions_set undefined_fns; functions sorted_undefined_fns; variables_set undefined_vars; diff --git a/src/abg-corpus.cc b/src/abg-corpus.cc index e9ba92ae..61c9b63d 100644 --- a/src/abg-corpus.cc +++ b/src/abg-corpus.cc @@ -190,7 +190,7 @@ corpus::exported_decls_builder::maybe_add_fn_to_exported_fns(function_decl* fn) /// @return true iff the variable was added to the set of exported /// variables. bool -corpus::exported_decls_builder::maybe_add_var_to_exported_vars(const var_decl* var) +corpus::exported_decls_builder::maybe_add_var_to_exported_vars(const var_decl_sptr& var) { if (!var->get_is_in_public_symbol_table()) return false; @@ -308,8 +308,12 @@ struct var_comp return first_name < second_name; } -}; + bool + operator()(const var_decl_sptr& first, + const var_decl_sptr& second) const + {return operator()(first.get(), second.get());} +}; /// A comparison functor to compare elf_symbols for the purpose of /// sorting. @@ -1411,7 +1415,7 @@ corpus::lookup_functions(const char* id) const /// /// @return the variable with ID @p id that was found or nil if none /// was found. -const var_decl* +const var_decl_sptr corpus::lookup_variable(const interned_string& id) const { exported_decls_builder_sptr b = get_exported_decls_builder(); diff --git a/src/abg-ctf-reader.cc b/src/abg-ctf-reader.cc index 6879c6e0..9f551eab 100644 --- a/src/abg-ctf-reader.cc +++ b/src/abg-ctf-reader.cc @@ -502,7 +502,7 @@ public: add_decl_to_scope(var_declaration, ir_translation_unit->get_global_scope()); var_declaration->set_is_in_public_symbol_table(true); - add_var_to_exported_or_undefined_decls(var_declaration.get()); + add_var_to_exported_or_undefined_decls(var_declaration); } else { diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index 1da1fd06..70a44674 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -16300,7 +16300,7 @@ build_ir_node_from_die(reader& rdr, rdr.var_decls_to_re_add_to_tree().push_back(m); } ABG_ASSERT(m->get_scope()); - rdr.add_var_to_exported_or_undefined_decls(m.get()); + rdr.add_var_to_exported_or_undefined_decls(m); result = m; } } @@ -16318,7 +16318,7 @@ build_ir_node_from_die(reader& rdr, ABG_ASSERT(v); ABG_ASSERT(v->get_scope()); rdr.var_decls_to_re_add_to_tree().push_back(v); - rdr.add_var_to_exported_or_undefined_decls(v.get()); + rdr.add_var_to_exported_or_undefined_decls(v); } } break; diff --git a/src/abg-fe-iface.cc b/src/abg-fe-iface.cc index e44d1126..e13ba68e 100644 --- a/src/abg-fe-iface.cc +++ b/src/abg-fe-iface.cc @@ -334,7 +334,7 @@ fe_iface::add_fn_to_exported_or_undefined_decls(const function_decl* fn) /// /// @param var the internal representation of the ABI of a variable. void -fe_iface::add_var_to_exported_or_undefined_decls(const var_decl* var) +fe_iface::add_var_to_exported_or_undefined_decls(const var_decl_sptr& var) { bool added = false; if (var) diff --git a/src/abg-reader.cc b/src/abg-reader.cc index 2d06302e..2928f3b3 100644 --- a/src/abg-reader.cc +++ b/src/abg-reader.cc @@ -5375,7 +5375,7 @@ build_class_decl(reader& rdr, is_static, offset_in_bits); if (is_static) - rdr.add_var_to_exported_or_undefined_decls(v.get()); + rdr.add_var_to_exported_or_undefined_decls(v); // Now let's record the fact that the data // member uses its type and that the class being // built uses the data member. @@ -6469,7 +6469,7 @@ handle_var_decl(reader& rdr, { decl_base_sptr decl = build_var_decl_if_not_suppressed(rdr, node, add_to_current_scope); - rdr.add_var_to_exported_or_undefined_decls(is_var_decl(decl).get()); + rdr.add_var_to_exported_or_undefined_decls(is_var_decl(decl)); return decl; } diff --git a/src/abg-writer.cc b/src/abg-writer.cc index 935ab08f..c198a532 100644 --- a/src/abg-writer.cc +++ b/src/abg-writer.cc @@ -2548,8 +2548,7 @@ write_translation_unit(write_context& ctxt, if (const abigail::ir::corpus* abi = tu.get_corpus()) for (auto undefined_var : abi->get_sorted_undefined_variables()) { - var_decl_sptr v(const_cast(undefined_var), - noop_deleter()); + var_decl_sptr v = undefined_var; if (v->get_translation_unit() != &tu || ctxt.decl_is_emitted(v)) continue; diff --git a/tools/abicompat.cc b/tools/abicompat.cc index 718ddd9c..05ac2bdb 100644 --- a/tools/abicompat.cc +++ b/tools/abicompat.cc @@ -166,11 +166,11 @@ struct fn_change /// the differences found in the type of that variable. struct var_change { - const var_decl* decl = nullptr; + var_decl_sptr decl = nullptr; diff_sptr diff; bool reverse_direction = false; - var_change(const var_decl* var, + var_change(const var_decl_sptr& var, diff_sptr difference, bool reverse_dir) : decl(var), @@ -542,7 +542,7 @@ compare_expected_against_provided_variables(diff_context_sptr& ctxt, { interned_string var_id = expected_var->get_id(); // ... against the variables exported by the library! - const var_decl* exported_var = + const var_decl_sptr exported_var = reverse_direction ? app_corpus->lookup_variable(var_id) : lib_corpus->lookup_variable(var_id); From patchwork Wed Aug 14 12:56:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 95816 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E1D8D3858D3C for ; Wed, 14 Aug 2024 12:57:06 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by sourceware.org (Postfix) with ESMTPS id 99E8F385840F for ; Wed, 14 Aug 2024 12:56:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 99E8F385840F Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 99E8F385840F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4b98:dc4:8::226 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640214; cv=none; b=huBlfBam5M1zAPuW31o6U4TSlKEYotqaclc0kt1XVbYYYhtWC0YrW8DuAecdyCrlsg2ae0tUhw6VK1n/Tf44Fi9ej6Dz6uyC0+1Ruy5jmJs5GGhBn6miN+m9q4y3397T/jMvMAxzfrmAww4dMGet3/rj8rZcaqEqlBQcbixsvqE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640214; c=relaxed/simple; bh=NtHLFholNPoDBBJF/7/fE/za5Lc1j9jyQJ3E8Siqr3Y=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=NqIvQi5/EFRzwVsGyJm9n6WQeso3/DqJ/Ipm2+luxxw3BwE80Gm3ArKTIpCG/dVM7dMxclmIIPdoVBWjCENZgYmpZ7MyPlWQmYBe8aigGEzAl1AMsDHYI2RN4M5r8dhSIzRK8VUYOGNf6mVd89Rx8+sQpVhvpfp95KRTIXpOCAE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id 0D215C0004; Wed, 14 Aug 2024 12:56:49 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 2648A507A621; Wed, 14 Aug 2024 14:56:49 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 02/11] ir: Fix getting the translation unit for an ABI artifact Date: Wed, 14 Aug 2024 14:56:40 +0200 Message-ID: <20240814125649.47119-2-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240814125649.47119-1-dodji@redhat.com> References: <20240814125649.47119-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli Sometimes when the current translation unit is not yet set for a given artifact, we can infer it by getting the translation unit of the scope of the artifact. This patch performs that inference when the translation unit is not yet set for the current artifact. * include/abg-fwd.h (get_translation_unit): Take a type_or_decl_base parameter, not a decl_base. * src/abg-ir.cc (get_translation_unit): Likewise. If no translation has yet been associated with the ABI artifact, get it from its scope. (type_or_decl_base::get_corpus): Use the new get_translation_unit. (maybe_set_translation_unit): Assert that the translation unit is non-nil. Signed-off-by: Dodji Seketeli --- include/abg-fwd.h | 6 +++--- src/abg-ir.cc | 34 ++++++++++++++++++++++++++++------ 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/include/abg-fwd.h b/include/abg-fwd.h index afe4163d..8b46eb08 100644 --- a/include/abg-fwd.h +++ b/include/abg-fwd.h @@ -359,13 +359,13 @@ const global_scope* get_global_scope(const decl_base_sptr); translation_unit* -get_translation_unit(const decl_base&); +get_translation_unit(const type_or_decl_base&); translation_unit* -get_translation_unit(const decl_base*); +get_translation_unit(const type_or_decl_base*); translation_unit* -get_translation_unit(const decl_base_sptr); +get_translation_unit(const type_or_decl_base_sptr&); bool is_global_scope(const scope_decl&); diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 62d870cd..f6d7c527 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -4220,7 +4220,7 @@ type_or_decl_base::has_artificial_location() const corpus* type_or_decl_base::get_corpus() { - translation_unit* tu = get_translation_unit(); + translation_unit* tu = abigail::ir::get_translation_unit(this); if (!tu) return 0; return tu->get_corpus(); @@ -7984,6 +7984,8 @@ static void maybe_set_translation_unit(const decl_base_sptr& decl, translation_unit* tu) { + ABG_ASSERT(tu); + if (translation_unit* existing_tu = decl->get_translation_unit()) // The decl already belongs to a translation unit. // Either: @@ -10167,8 +10169,28 @@ types_are_compatible(const decl_base_sptr d1, /// @return the resulting translation unit, or null if the decl is not /// yet added to a translation unit. translation_unit* -get_translation_unit(const decl_base& decl) -{return const_cast(decl.get_translation_unit());} +get_translation_unit(const type_or_decl_base& t) +{ + translation_unit* result = + const_cast(t.get_translation_unit()); + + if (result) + return result; + + if (decl_base* decl = is_decl(&t)) + { + scope_decl* scope = decl->get_scope(); + while (scope) + { + result = scope->get_translation_unit(); + if (result) + break; + scope = scope->get_scope(); + } + } + + return result; +} /// Return the translation unit a declaration belongs to. /// @@ -10177,8 +10199,8 @@ get_translation_unit(const decl_base& decl) /// @return the resulting translation unit, or null if the decl is not /// yet added to a translation unit. translation_unit* -get_translation_unit(const decl_base* decl) -{return decl ? get_translation_unit(*decl) : 0;} +get_translation_unit(const type_or_decl_base* decl) +{return decl ? get_translation_unit(*decl) : nullptr;} /// Return the translation unit a declaration belongs to. /// @@ -10187,7 +10209,7 @@ get_translation_unit(const decl_base* decl) /// @return the resulting translation unit, or null if the decl is not /// yet added to a translation unit. translation_unit* -get_translation_unit(const shared_ptr decl) +get_translation_unit(const type_or_decl_base_sptr& decl) {return get_translation_unit(decl.get());} /// Tests whether if a given scope is the global scope. From patchwork Wed Aug 14 12:56:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 95815 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8C55D385841C for ; Wed, 14 Aug 2024 12:57:05 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by sourceware.org (Postfix) with ESMTPS id 87D083858403 for ; Wed, 14 Aug 2024 12:56:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 87D083858403 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 87D083858403 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.70.183.195 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640214; cv=none; b=UUCPlB2F2ULkT0XLXXVahH1NkWXJmelrYCAjrVEuRxxwxQ4372Fi5rGajqIOlW+jBc7SO/oplvfmpORF+gIbwUhA778HuSWSREZNIHRkvjQt1AGxwFk9R/oYhHlGJKRt+Pt41h2/nSgykLbvuaebQHVse3bgewY1N3pw59H29MI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640214; c=relaxed/simple; bh=UwAwm9E4wVhjMCPCoeWHQwUQ8bKDSB27GpF8Isln02k=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=fIr3Fo8ibZXCLpkm5ZVNM+ZU1lrEJ3XfStor+z21cnkjMqTQbZiZ+Aj5hCoYOvNouPZRlcUOmO0pj5X31AGQd6oqZJZq0Cha1zbfc58kUPIAi5rzNOxqRnc2e12tpkTlgf74U9bsu7vBhWMbh9CTC2yDPedmKgwjDGjOeQCpg/g= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id 0F42060002; Wed, 14 Aug 2024 12:56:49 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 27FE2507A623; Wed, 14 Aug 2024 14:56:49 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 03/11] ir: add_decl_to_scope shouldn't abort on nullptr scopes Date: Wed, 14 Aug 2024 14:56:41 +0200 Message-ID: <20240814125649.47119-3-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240814125649.47119-1-dodji@redhat.com> References: <20240814125649.47119-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli * src/abg-ir.cc (add_decl_to_scope): Do not abort on an empty scope. Signed-off-by: Dodji Seketeli --- src/abg-ir.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index f6d7c527..7d8de813 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -8415,7 +8415,8 @@ scope_decl::~scope_decl() decl_base_sptr add_decl_to_scope(decl_base_sptr decl, scope_decl* scope) { - ABG_ASSERT(scope); + if (!scope) + return decl; if (scope && decl && !decl->get_scope()) decl = scope->add_member_decl(decl); From patchwork Wed Aug 14 12:56:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 95814 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D1A0A385842C for ; Wed, 14 Aug 2024 12:57:01 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by sourceware.org (Postfix) with ESMTPS id 60DAB3858C60 for ; Wed, 14 Aug 2024 12:56:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 60DAB3858C60 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 60DAB3858C60 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.70.183.196 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640213; cv=none; b=NOl2wR2TpBksk0i7rKca+yvupKaDt+x++Ni5GkGro9opub9a2NthuvW/8nMLT5T+wy1uaxF+Nhir8SZJVT/ycJ7Z3TCoXnZbt6y8Ci+0EOE3t9JAMOb68be/cqf4kSZLg2t4joK5nM7UurQCY//fb/II04HkwBUALfnTC0ZlOY8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640213; c=relaxed/simple; bh=NgiURG8m3zyQcrPu0J80+mHyBRTD7ukvvt79/K02pjs=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=iAorTv20EbWV0UmhbX3QJ957Ch6LzGE9oLXESD2udfODMZZCy2Gy+RSkir+5tNK0ZWdnEGkTorgeycij2U27HHciBKe9+kyScn3BTB/gXFQenuT93TopqiH7hBIabBLOxp7h6LCw9ia06Y2Wlaalv3RCzTuvjcbkDQ7j7liQy2I= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id 0C21BE0006; Wed, 14 Aug 2024 12:56:49 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 2A811507A626; Wed, 14 Aug 2024 14:56:49 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 04/11] ir: Make odr_is_relevant support support artifacts with no TU set yet Date: Wed, 14 Aug 2024 14:56:42 +0200 Message-ID: <20240814125649.47119-4-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240814125649.47119-1-dodji@redhat.com> References: <20240814125649.47119-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli * src/abg-ir.cc (odr_is_relevant): Consider that an artifact with no associated TU is not relevant for ODR considerations. Signed-off-by: Dodji Seketeli --- src/abg-ir.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 7d8de813..9dcdc1c7 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -10070,6 +10070,9 @@ debug_comp_stack(const environment& env) bool odr_is_relevant(const type_or_decl_base& artifact) { + if (!artifact.get_translation_unit()) + return false; + translation_unit::language l = artifact.get_translation_unit()->get_language(); From patchwork Wed Aug 14 12:56:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 95817 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 83F533858403 for ; Wed, 14 Aug 2024 12:57:10 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::229]) by sourceware.org (Postfix) with ESMTPS id 741B43858401 for ; Wed, 14 Aug 2024 12:56:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 741B43858401 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 741B43858401 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4b98:dc4:8::229 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640214; cv=none; b=TNLn5ppn5GqBJQBGt5ApzDX3HMaM128Il9mQFxb0u/2jCRZJnvIq4hiemfgVTHCFFTDVNuAzodM5Q1w1zH89rrKaLbyVNsvraxyh6r0ehrHBakRlWIaMzUEiXoS4IeRFw3vQxAImCk3rC019ePDuaMloqlXXbEKeE8v+dO64se8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640214; c=relaxed/simple; bh=IkTgQF70c4tunG/f1jvzTzx6bGiv4/e+rbSojrOF5XA=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=xME5Qn9W6qNhVtJINDr5Zv0Qo9pbwt6D96YVh85djuvle5TEE2z6gaQqiDDfARklSmLOzLTV76p4jSUY1bSfFbwQzd+IhaQgpssJnsJjmqKuglS9JfdTy8uxuh3uJQ6H8eVyv5/zhL8HeJTgqaHmPvYIJKuvPhL4zEgeTy8Aof4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id DB857FF804; Wed, 14 Aug 2024 12:56:49 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 2CBD7507A629; Wed, 14 Aug 2024 14:56:49 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 05/11] ir: Support canonical type adjustments for decl-only class types Date: Wed, 14 Aug 2024 14:56:43 +0200 Message-ID: <20240814125649.47119-5-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240814125649.47119-1-dodji@redhat.com> References: <20240814125649.47119-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli When a decl-only class 'D' type (which has an associated class type) is canonicalized and its canonical type is being adjusted to make sure it contains all the member functions of 'D', the member functions are not being taken into account. Fixed thus. * src/abg-ir.cc (maybe_adjust_canonical_type): Look through decl-only classes to get their definition. Signed-off-by: Dodji Seketeli --- src/abg-ir.cc | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 9dcdc1c7..d0f267be 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -15639,6 +15639,7 @@ maybe_adjust_canonical_type(const type_base_sptr& canonical, if (class_decl_sptr cl = is_class_type(type)) { + cl = is_class_type(look_through_decl_only_class(cl)); if (canonical_class && canonical_class.get() != cl.get()) { @@ -15664,15 +15665,15 @@ maybe_adjust_canonical_type(const type_base_sptr& canonical, if (canonical_class->get_corpus() && cl->get_corpus() && (cl->get_corpus() == canonical_class->get_corpus())) - // There is a member function defined and publicly - // exported in the other class and the canonical - // class doesn't have that member function. This - // should not have happened! For instance, the - // DWARF reader does merge the member functions of - // classes having the same name so that all of them - // end-up having the same member functions. What's - // going on here? - ABG_ASSERT_NOT_REACHED; + // There is a member function defined and publicly + // exported in the other class and the canonical + // class doesn't have that member function. This + // should not have happened! For instance, the + // DWARF reader does merge the member functions of + // classes having the same name so that all of them + // end-up having the same member functions. What's + // going on here? + ABG_ASSERT_NOT_REACHED; } } } @@ -15806,11 +15807,11 @@ canonicalize(type_base_sptr t) // 'canonical' to the set of canonical types belonging // to ST. if (type_base_sptr c = is_type(scope)->get_canonical_type()) - // We want to add 'canonical' to set of canonical - // types belonging to the canonical type of ST. That - // way, just looking at the canonical type of ST is - // enough to get the types that belong to the scope of - // the class of equivalence of ST. + // We want to add 'canonical' to the set of + // canonical types belonging to the canonical type + // of ST. That way, just looking at the canonical + // type of ST is enough to get the types that belong + // to the scope of the class of equivalence of ST. scope = is_scope_decl(is_decl(c)).get(); scope->get_canonical_types().insert(canonical); } From patchwork Wed Aug 14 12:56:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 95821 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CB0EA3858C60 for ; Wed, 14 Aug 2024 12:57:26 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by sourceware.org (Postfix) with ESMTPS id 9E3CE3858C50 for ; Wed, 14 Aug 2024 12:56:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9E3CE3858C50 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9E3CE3858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.70.183.199 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640216; cv=none; b=T4RDjKll6UZubR5ZZ4epSN3B3qe6CQdS11bOewamciQXAbFpaUGafWIoxBks+dGb10HOW7Brs5cdJSP4CfqKsYM3/eWXoAE/tIYsjzlK5vMqf2ZQqLucdat+3Z8ATVooSFt3eCzWZPGw+EtqK+m+woU21rcsNAg6GV9zGMB/YuU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640216; c=relaxed/simple; bh=0V82D3RA4FgmnVJ3qnG2vUEyWpKzaOb1fWJ6p7nHhAc=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=eweLe6421mj7J2Yn7XqlTo1Qppf4sabWs/f+8tOVOvwJKA8a4+rneOn/2Guz6Zc9FPq/hzpuFk1TbauXSCgttfn2ToXCeesAmbkbJjLJnrwhhz/SD4o5nMP8OOr7XSQNfDXn5tPy0TkYHMgm/17nPYGMoUVxFuAbN4iAU2e+zP0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id BC5B1FF808; Wed, 14 Aug 2024 12:56:50 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 2F063507A62B; Wed, 14 Aug 2024 14:56:49 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 06/11] ir: Support comparing a class_decl against a class_or_union Date: Wed, 14 Aug 2024 14:56:44 +0200 Message-ID: <20240814125649.47119-6-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240814125649.47119-1-dodji@redhat.com> References: <20240814125649.47119-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli When a class_decl is compared against a class_or_union type using class_decl::operator==, that operator systematically fails. This patch fixes that by comparing the common parts between the two objects. * src/abg-ir.cc (class_decl::operator==): Support comparing against a class_or_union. Signed-off-by: Dodji Seketeli --- src/abg-ir.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index d0f267be..0b9e8d48 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -25647,7 +25647,11 @@ class_decl::operator==(const decl_base& other) const { const class_decl* op = is_class_type(&other); if (!op) - return false; + { + if (class_or_union* cou = is_class_or_union_type(&other)) + return class_or_union::operator==(*cou); + return false; + } // If this is a decl-only type (and thus with no canonical type), // use the canonical type of the definition, if any. From patchwork Wed Aug 14 12:56:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 95818 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ABC9C3858428 for ; Wed, 14 Aug 2024 12:57:17 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::229]) by sourceware.org (Postfix) with ESMTPS id C02E53858414 for ; Wed, 14 Aug 2024 12:56:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C02E53858414 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C02E53858414 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4b98:dc4:8::229 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640215; cv=none; b=Ce59wE6qBzMYEVIwSRyA4YQX1CizlOCS1JJSj0f7kl8vrJzzoTCGxYOh8e/hzRKTEugSnnSVIdsRa5yTIk/Ns4SnmPqOd/Mph6ndSv8a+uT8/wRzMjyQ2ylZSV8lg3g2535traKSgBSc2HoTO990C2BY04jl/UPU0RlYH+c6AHI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640215; c=relaxed/simple; bh=n9A8EIRQ8cmpQstwHwwy9bV33vgpgjQ2MhoHEWcSiUs=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=SWjHy66zy1IkIpVCxGICOA84PRt6QPbjvYAm2qP33oiABMyDTswH/HuIYYN63mtXmCjipdhpz9cFVS1NiDRohhE2Qe3ehPfx63rgdWWtTsKLVgfBFgojZmd/+Ulap8BK5wLzY1a7RAZ9KB+TeU+xRVmnCMwPNvIwHKnGpwJx5J0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id C7EFEFF809; Wed, 14 Aug 2024 12:56:50 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 31743507A62E; Wed, 14 Aug 2024 14:56:49 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 07/11] ir: Speed up enum comparison Date: Wed, 14 Aug 2024 14:56:45 +0200 Message-ID: <20240814125649.47119-7-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240814125649.47119-1-dodji@redhat.com> References: <20240814125649.47119-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli When two enums are naively equal, comparing then member-wise should be fast. This patch does just that. This speeds up things a lot, in the context of self-comparison and type canonicalization (from DWARF) when there are huge enums in the binary. * src/abg-ir.cc (equals): In the overload for enums, compare enumerators naively for the case both enums are naively equal. Signed-off-by: Dodji Seketeli --- src/abg-ir.cc | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 0b9e8d48..f15d655d 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -19997,7 +19997,34 @@ equals(const enum_type_decl& l, const enum_type_decl& r, change_kind* k) ABG_RETURN_FALSE; } - // Now compare the enumerators. Note that the order of declaration + // Now compare the enumerators. + + // First in a naive (but potentially fast) way in case both enums + // are equal in a naive manner. + + if (def1->get_enumerators().size() == def2->get_enumerators().size()) + { + bool equals = true; + for (auto e1 = def1->get_enumerators().begin(), + e2 = def2->get_enumerators().begin(); + (e1 != def1->get_enumerators().end() + && e2 != def2->get_enumerators().end()); + ++e1, ++e2) + { + if (*e1 != *e2) + { + equals = false; + break; + } + } + if (equals) + ABG_RETURN(result); + } + + // If the two enums where not naively equals, let's try a more + // clever (and slow) way. + + // Note that the order of declaration // of enumerators should not matter in the comparison. // // Also if an enumerator value is redundant, that shouldn't impact From patchwork Wed Aug 14 12:56:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 95819 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4B87B3858C60 for ; Wed, 14 Aug 2024 12:57:21 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by sourceware.org (Postfix) with ESMTPS id CF7703858417 for ; Wed, 14 Aug 2024 12:56:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CF7703858417 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CF7703858417 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4b98:dc4:8::226 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640215; cv=none; b=Kc/wygRcFQKkOFcfEtefZ0wUxZKOQzlHXVQ06icx1r7q3LgVWivmRmxVuzLmjU4Lvvk+42Ru8cS0rvvihvfh3ZKG2OAMnoZx2nIgl/rb2/dYuIt3pWj/qSUTCl0m6AOaGCCQFkFuejhyofuMZJzFMlQlNArbFq9hwyPBqe+bftQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640215; c=relaxed/simple; bh=ayvaVSyTggR9NX/a81JmaUP59yyDG0P2hGfE6Aqpgbw=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=qxLDVQBaIITR3hZizy57vixyoEP6VkmBv9Q3yNOdIJm62yA9UxmBJH3zLoRD3qRJUYeZrCuG4U6ZMM9Qwq4Gcxe+YsNmH/zzBgwcfgNPo2zo+iuKFtlvLhPwyxNhi7WDlT9ot8RKDHN78qPLg5p9Kf0EkOoMdz2oJjONt+hNA2Q= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id D855BC0009; Wed, 14 Aug 2024 12:56:50 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 339D6507A630; Wed, 14 Aug 2024 14:56:49 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 08/11] ir: Fix comment for translation_unit::get_global_scope Date: Wed, 14 Aug 2024 14:56:46 +0200 Message-ID: <20240814125649.47119-8-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240814125649.47119-1-dodji@redhat.com> References: <20240814125649.47119-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli * src/abg-ir.cc (translation_unit::get_global_scope): Fix comment. Signed-off-by: Dodji Seketeli --- src/abg-ir.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index f15d655d..542f9060 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -1279,11 +1279,11 @@ translation_unit::get_global_scope() const return const_cast(this)->get_global_scope(); } -/// Getter of the the global scope of the translation unit. +/// Getter of the global scope of the translation unit. /// /// @return the global scope of the current translation unit. If -/// there is not global scope allocated yet, this function creates one -/// and returns it. +/// there is not allocated yet, this function creates one and returns +/// it. scope_decl_sptr& translation_unit::get_global_scope() { From patchwork Wed Aug 14 12:56:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 95823 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5FE403858427 for ; Wed, 14 Aug 2024 12:57:40 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::225]) by sourceware.org (Postfix) with ESMTPS id 3EB14385840A for ; Wed, 14 Aug 2024 12:56:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3EB14385840A Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3EB14385840A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4b98:dc4:8::225 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640216; cv=none; b=Cd/Qf3khAclAKFYc9b8qD4VSdsQ0zHmoaYDIaO9lEVVMJDL59bdmL/sbs8BqJHqKL3RVnfw44XByq6cgSdrgZha/N0PoNAsYqJewjvdz5T1m+bXQNHLe0m+vc6zAx4rMcVtE7ez1S/W0C3yaDwP77K3WkmZZxgGaUqIcnbkDFd0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640216; c=relaxed/simple; bh=7Ir25qB8vK53gChN4zGJJeBX94ROHR3IegACX+CkjLo=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=PjF1/Z2tLJNfryjkkUSPBEKu3CGqJjWG3NB96WepFGBQRxskch98eaC2oypZwVtcVeZAg3BQprm0W7J+fsd9bRHfAev1Ofx0UDWBK9oz5ekXNpMoz4gc0iqdUzE93H5JHkLzyppG/419v2WiVxRNusj1Jks3ELSTIUEPwf+1fnU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id E3AB11C0008; Wed, 14 Aug 2024 12:56:50 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 35B81507A632; Wed, 14 Aug 2024 14:56:49 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 09/11] reader: Avoid crashing on empty scopes in reader::push_decl_to_scope Date: Wed, 14 Aug 2024 14:56:47 +0200 Message-ID: <20240814125649.47119-9-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240814125649.47119-1-dodji@redhat.com> References: <20240814125649.47119-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli When abixml::reader::push_decl_to_scope gets a nullptr scope, it can sometimes abort. Fixed thus. * src/abg-reader.cc (reader::push_decl_to_scope): It's only if there is a non-nil scope that the assert can be reached. Signed-off-by: Dodji Seketeli --- src/abg-reader.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/abg-reader.cc b/src/abg-reader.cc index 2928f3b3..64d16171 100644 --- a/src/abg-reader.cc +++ b/src/abg-reader.cc @@ -802,10 +802,12 @@ public: { ABG_ASSERT(decl); if (scope) - add_decl_to_scope(decl, scope); - if (!decl->get_translation_unit()) - decl->set_translation_unit(get_translation_unit()); - ABG_ASSERT(decl->get_translation_unit()); + { + add_decl_to_scope(decl, scope); + if (!decl->get_translation_unit()) + decl->set_translation_unit(get_translation_unit()); + ABG_ASSERT(decl->get_translation_unit()); + } push_decl(decl); } From patchwork Wed Aug 14 12:56:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 95824 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F1BDB3858428 for ; Wed, 14 Aug 2024 12:57:42 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by sourceware.org (Postfix) with ESMTPS id 4D6F53858424 for ; Wed, 14 Aug 2024 12:56:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4D6F53858424 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4D6F53858424 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.70.183.193 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640217; cv=none; b=CzRkAoM/1o1YFxeD4oeHjYCl8r/VOPmI8cbo/Pesz/w3Y8YNCZQQ5nm6yzd4nxzAjT8UJq7qb460C7lbHr8T075ERPTHI/8RgxO1OAioAh/Z0WHMXNVwYRgDcvB3Xl0yOGjmO1DxgyJZIufaizha66XMBTO0aU4HX74QASIKjwU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640217; c=relaxed/simple; bh=lG0q7Zu7czRNRwYd7BVmc1NYw1qZFV7JinNmInt3cYU=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=ipvvyZIuSQDOuGicNK9slOlKPZx2cH9GmKUa6upYre4KCQCPiZUsMFGMOHKAocfJMJzwm7Iheh5I84bg8w66lID7qQD+ec8SG1L83wvRoDHfCpSRnlSm10Oy/DmlkfVnsjTVcX31HuDiR/s7w2HBgHDC8oj9E81sNNL1wG9akOc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id 2D291240002; Wed, 14 Aug 2024 12:56:51 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 3824A507A634; Wed, 14 Aug 2024 14:56:49 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 10/11] reader: Fix building of reference type Date: Wed, 14 Aug 2024 14:56:48 +0200 Message-ID: <20240814125649.47119-10-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240814125649.47119-1-dodji@redhat.com> References: <20240814125649.47119-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli This patch ensures that the built reference type IR node is always associated with the type-id used in the ABIXML. * src/abg-reader.cc (build_reference_type_def): Remove unnecessary condition. Signed-off-by: Dodji Seketeli --- src/abg-reader.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/abg-reader.cc b/src/abg-reader.cc index 64d16171..8c66d6b4 100644 --- a/src/abg-reader.cc +++ b/src/abg-reader.cc @@ -4346,8 +4346,8 @@ build_reference_type_def(reader& rdr, is_lvalue, size_in_bits, alignment_in_bits, loc)); maybe_set_artificial_location(rdr, node, t); - if (rdr.push_and_key_type_decl(t, node, add_to_current_scope)) - rdr.map_xml_node_to_decl(node, t); + ABG_ASSERT(rdr.push_and_key_type_decl(t, node, add_to_current_scope)); + rdr.map_xml_node_to_decl(node, t); type_base_sptr pointed_to_type = rdr.build_or_get_type_decl(type_id,/*add_to_current_scope=*/ true); From patchwork Wed Aug 14 12:56:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 95822 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0B7CE3858C52 for ; Wed, 14 Aug 2024 12:57:37 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by sourceware.org (Postfix) with ESMTPS id CAE883858420 for ; Wed, 14 Aug 2024 12:56:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CAE883858420 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CAE883858420 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4b98:dc4:8::224 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640216; cv=none; b=qNI/fyUsDlYV7K1O4VRGN7Z8FBIaJvXTrYaZwMqR7XRD4+SOJeUDezj5PM4yZFwTJ/yKCqgfMY6Ou0obfQcN2TMb2CStEVpTrBwLtKJKhywrObMZYhFCJwduSJT1NRAxPglsWiPqyyE3JBDn7rtOo/5p0WEcohMltwJOrF52X6E= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723640216; c=relaxed/simple; bh=m3TCUhNvFYB8JejP99GCMizCYOdUOu/ydmQWsjHvTuk=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=bcbUUR+Iq0twHyGw/jyA/yza8pNsea/HnU9vSqoFKe1eO7y/P+4oUAdVmFrXCmlPin8DWBYC5QRXRxZ8FlONDoeczbvUi2J4TQj1/HIu9t7UKlHPaXYhbhBa0PF07AsO4Tf5EhCY8HLvyknF6+FmVgmhlEsUPWPBsu484Vye93g= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id E3089E0004; Wed, 14 Aug 2024 12:56:50 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 3A5B7507A635; Wed, 14 Aug 2024 14:56:49 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 11/11] abidw: Make generic options like --verbose work with the ABIXML front-end Date: Wed, 14 Aug 2024 14:56:49 +0200 Message-ID: <20240814125649.47119-11-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240814125649.47119-1-dodji@redhat.com> References: <20240814125649.47119-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli * tools/abidw.cc (set_generic_options): Take a fe_iface in parameter, not an elf_based_reader. (perform_self_comparison): Call set_generic_options. Signed-off-by: Dodji Seketeli --- tools/abidw.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/abidw.cc b/tools/abidw.cc index 6bb1ef55..b7642747 100644 --- a/tools/abidw.cc +++ b/tools/abidw.cc @@ -612,7 +612,7 @@ set_suppressions(abigail::elf_based_reader& rdr, options& opts) /// /// @param opts the command line options. static void -set_generic_options(abigail::elf_based_reader& rdr, options& opts) +set_generic_options(abigail::fe_iface& rdr, options& opts) { rdr.options().drop_undefined_syms = opts.drop_undefined_syms; rdr.options().show_stats = opts.show_stats; @@ -675,6 +675,7 @@ perform_self_comparison(const write_context_sptr& write_ctxt, } #endif fe_iface_sptr rdr = abixml::create_reader(tmp_file->get_path(), env); + set_generic_options(*rdr, opts); #ifdef WITH_DEBUG_SELF_COMPARISON if (opts.debug_abidiff