From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id BBD513858D32 for ; Thu, 10 Aug 2023 21:04:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BBD513858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691701448; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CnCyKHjL5uWd9YqT77WT2qD+kLeTDHXUf13+1TMtzMc=; b=hX1ydeRVqrPMioqRS8jGIRMLQCID4aKpHrHcVVftZkQRuNK1SxHoBmKgfB4U91VhiZzOtN 4h8A4Fd5sLXi6l1yXKWY1D31UkVyYEReCEZEa0UomfyLEytvEaDRDTBWRkGtiPM2u/gaot 4iFSmnpQCppJHiL5gEBf8ixdlDNFtmQ= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-99-iCmlNarUNfOXr2XNf9U18A-1; Thu, 10 Aug 2023 17:04:06 -0400 X-MC-Unique: iCmlNarUNfOXr2XNf9U18A-1 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-403aa5cca80so14153911cf.0 for ; Thu, 10 Aug 2023 14:04:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691701445; x=1692306245; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CnCyKHjL5uWd9YqT77WT2qD+kLeTDHXUf13+1TMtzMc=; b=fHFvLBM032mxnG66tMHmfc2gfAPuBEEKrPdkmzafcCOm/iOEJwiqt+iAvJoDLUXFeE G4rRwAcQtbriNYgTeMUTgUC2F8z0sh566ozdofnG4NMplUCuMuP1q8svetelUFvW+e9R D0CZMCwDJjR7FU7ErHR+gOLtJqFdHBhsqno057IKj2wIZ7Tntm20K2JDj3nlPSD/UUYo FytBZG68SXxINPGWhcYF9WxF//WAWGHovzV9jfVWuP8+v9qgkNoSMiE4/gkaWfq26t8h OacdenvBpbDofQiyBmJ52Hsgf2jWzoylPBjTfQeXZAjRJ+BsmeMW77+gWrvjwRs03/mS lXAQ== X-Gm-Message-State: AOJu0YxkLAJHBlF83BJx20eML8fwE6omzXK7wAVLTYe9wJHeHq8lJdMt OuKhItbAUVrI1Ln6f/6Ih+5ph8qMVDiTyz0xAey3QMTRNXJ5ezt2PjoqBpUTLX7hLBp+QVessas SI/QtbbsJ+hce5406DA== X-Received: by 2002:ac8:5856:0:b0:410:332e:d9fe with SMTP id h22-20020ac85856000000b00410332ed9femr2223977qth.14.1691701445257; Thu, 10 Aug 2023 14:04:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHQBaH0VMHj/As1uBPfBuK8e7pXcbsNTjWDxXPs132XD8ifu1WVnQGab1QwnSVv++dCL/iASQ== X-Received: by 2002:ac8:5856:0:b0:410:332e:d9fe with SMTP id h22-20020ac85856000000b00410332ed9femr2223958qth.14.1691701445007; Thu, 10 Aug 2023 14:04:05 -0700 (PDT) Received: from [192.168.1.108] (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id l25-20020ac84cd9000000b0040331a24f16sm746268qtv.3.2023.08.10.14.04.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Aug 2023 14:04:04 -0700 (PDT) Message-ID: Date: Thu, 10 Aug 2023 17:04:03 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] c++: improve debug_tree for templated types/decls To: Patrick Palka Cc: gcc-patches@gcc.gnu.org References: <20230801003456.994217-1-ppalka@redhat.com> <5ab5f1fa-6ccd-599f-8d81-da8e67888a7f@redhat.com> From: Jason Merrill In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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: On 8/10/23 16:59, Patrick Palka wrote: > On Tue, 8 Aug 2023, Jason Merrill wrote: > >> On 7/31/23 20:34, Patrick Palka wrote: >>> Tested on x86_64-pc-linux-gnu, does this look OK for trunk? >>> >>> -- >8 -- >>> >>> gcc/cp/ChangeLog: >>> >>> * ptree.cc (cxx_print_decl): Check for DECL_LANG_SPECIFIC and >>> TS_DECL_COMMON only when necessary. Print DECL_TEMPLATE_INFO >>> for all decls that have it, not just VAR_DECL or FUNCTION_DECL. >>> Also print DECL_USE_TEMPLATE. >>> (cxx_print_type): Print TYPE_TEMPLATE_INFO. >>> : Don't print TYPE_TI_ARGS >>> anymore. >>> : Print TEMPLATE_TYPE_PARM_INDEX >>> instead of printing the index, level and original level >>> individually. >>> --- >>> gcc/cp/ptree.cc | 32 +++++++++++++++++--------------- >>> 1 file changed, 17 insertions(+), 15 deletions(-) >>> >>> diff --git a/gcc/cp/ptree.cc b/gcc/cp/ptree.cc >>> index 33af7b81f58..13306fc8762 100644 >>> --- a/gcc/cp/ptree.cc >>> +++ b/gcc/cp/ptree.cc >>> @@ -38,10 +38,6 @@ cxx_print_decl (FILE *file, tree node, int indent) >>> return; >>> } >>> - if (!CODE_CONTAINS_STRUCT (TREE_CODE (node), TS_DECL_COMMON) >>> - || !DECL_LANG_SPECIFIC (node)) >>> - return; >>> - >>> if (TREE_CODE (node) == FUNCTION_DECL) >>> { >>> int flags = TFF_DECL_SPECIFIERS|TFF_RETURN_TYPE >>> @@ -106,7 +102,10 @@ cxx_print_decl (FILE *file, tree node, int indent) >>> need_indent = false; >>> } >>> - if (DECL_EXTERNAL (node) && DECL_NOT_REALLY_EXTERN (node)) >>> + if (CODE_CONTAINS_STRUCT (TREE_CODE (node), TS_DECL_COMMON) >>> + && DECL_LANG_SPECIFIC (node) >>> + && DECL_EXTERNAL (node) >>> + && DECL_NOT_REALLY_EXTERN (node)) >>> { >>> if (need_indent) >>> indent_to (file, indent + 3); >>> @@ -115,6 +114,7 @@ cxx_print_decl (FILE *file, tree node, int indent) >>> } >>> if (TREE_CODE (node) == FUNCTION_DECL >>> + && DECL_LANG_SPECIFIC (node) >>> && DECL_PENDING_INLINE_INFO (node)) >>> { >>> if (need_indent) >>> @@ -124,27 +124,29 @@ cxx_print_decl (FILE *file, tree node, int indent) >>> need_indent = false; >>> } >>> - if (VAR_OR_FUNCTION_DECL_P (node) >>> + if (DECL_LANG_SPECIFIC (node) >> >> Hmm, won't this crash on a non-COMMON decl? > > Oops yes, I overlooked that DECL_LANG_SPECIFIC requires DECL_COMMON. So > we should just move the early exit test down a bit. > >> >>> && DECL_TEMPLATE_INFO (node)) > > We also need to constrain the kinds of decls that we test > DECL_TEMPLATE_INFO on according to template_info_decl_check. > > -- >8 -- > > Subject: [PATCH] c++: improve debug_tree for templated types/decls > > gcc/cp/ChangeLog: > > * ptree.cc (cxx_print_decl): Check for DECL_LANG_SPECIFIC and > TS_DECL_COMMON only when necessary. Print DECL_TEMPLATE_INFO > for all decls that have it, not just VAR_DECL or FUNCTION_DECL. > Also print DECL_USE_TEMPLATE. > (cxx_print_type): Print TYPE_TEMPLATE_INFO. > : Don't print TYPE_TI_ARGS > anymore. > : Print TEMPLATE_TYPE_PARM_INDEX > instead of printing the index, level and original level > individually. OK. Jason