From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by sourceware.org (Postfix) with ESMTPS id 451023858D1E for ; Mon, 19 Dec 2022 16:21:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 451023858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=seketeli.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org Received: (Authenticated sender: dodji@seketeli.org) by mail.gandi.net (Postfix) with ESMTPSA id 0F58E60002 for ; Mon, 19 Dec 2022 16:21:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seketeli.org; s=gm1; t=1671466917; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=R8gd+66DKDe4dqu3r09ur+YJXK5yuORi2hyjlo8hw2g=; b=jF7A7xjhuvDPVPGnuIF9ZOr4pRcW2telaa7n7SYAv3Xfj+eHmmAZZMSbwV+9NJfYeBhsFX yDg7hB8vFmJWmZoXBqCTu9hFMfHuxdua1VJrLcvibeARzTXAbvaRU5Ec10jlFbEXK7v3P8 kSZDgAOMswXvq31ZRgTOpZEjBBXn7HwxysrAlyDQEOdHbofGdyHGkFB1tAIuA5InzuGtvb pJ9f5nY/vTE4MeEjpeYYIN5qr82T3cUO2swAw10mDKzQ//q5thsXqTBgnmTg+3cITfQnkF zVFFrO5MkfhsS9zUMaAbEARLwoogxuf7AO989/Oqe5eD+sxgwZ4C0se2Yi70Jw== Received: by localhost (Postfix, from userid 1000) id 0EA12B5649; Mon, 19 Dec 2022 17:21:56 +0100 (CET) From: Dodji Seketeli To: libabigail@sourceware.org Subject: [PATCH, applied] ir: Improve get_debug_representation Organization: Me, myself and I X-Operating-System: CentOS Stream release 9 X-URL: http://www.seketeli.net/~dodji Date: Mon, 19 Dec 2022 17:21:56 +0100 Message-ID: <875ye7fjob.fsf@seketeli.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hello, While looking at something else, I noticed that the debug() function, very useful which debugging (using GDB at least) could be improved for classes/unions by prefixing the type name with struct/class/union as appropriate. Fixed thus. * src/abg-ir.cc (get_debug_representation): Prefix classes/structs/unions with the 'classes/struct/union' prefix. Signed-off-by: Dodji Seketeli --- src/abg-ir.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 0f8c1d2b..85b5cbb3 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -9303,6 +9303,15 @@ get_debug_representation(const type_or_decl_base* artifact) class_decl *clazz = is_class_type(c); string name = c->get_qualified_name(); std::ostringstream o; + if (clazz) + { + if (clazz->is_struct()) + o << "struct "; + else + o << "class "; + } + else if (is_union_type(c)) + o << "union "; o << name; if (clazz) @@ -9362,7 +9371,7 @@ get_debug_representation(const type_or_decl_base* artifact) { string name = e->get_qualified_name(); std::ostringstream o; - o << name + o << "union " << name << " : " << e->get_underlying_type()->get_pretty_representation(/*internal=*/false, true) -- 2.31.1 -- Dodji