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); }