From patchwork Mon Aug 24 13:31:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 1350381 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Fceq3Cak; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BZtMF4j9mz9sRK for ; Mon, 24 Aug 2020 23:31:52 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4B9A4384A034; Mon, 24 Aug 2020 13:31:50 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by sourceware.org (Postfix) with ESMTPS id 1AC523865492 for ; Mon, 24 Aug 2020 13:31:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1AC523865492 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nathanmsidwell@gmail.com Received: by mail-qt1-x82c.google.com with SMTP id p36so2726280qtd.12 for ; Mon, 24 Aug 2020 06:31:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=g63A3Pvi+LYryu9TOdnmZJnxPaehyyCC9/YTlk4lSh8=; b=Fceq3Cakr53U8rvjX5bh+nSxk//lVdvE3nUmGn36LOBr759UiYs6vz8/tpQDST6nak XCscUG+kTSvWV85cYC7rKmpXikDQRvEN1AlmP2YMZk43K8GJlQLIKMscTn1BGGWgtt/m Zb/YrFiJ8zY22Eh2wrBTAs7WanhzjmrS8cQyypcVlCUxlC6zB2J11k+JbZ/Yo2Go0eFo 8049kxRjssqjfE3IiSE492J72fjb0u28DA1wuILh4bRrdLMf+pa97yW2hbXCb+7i6Y4i graz1QAfTJ4D71Ee79e/70UuPj91lJ+/rLlU2bT+TTR7BjtlP1fN7JnwoXCHHwSKx3Uu Cl3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:from:subject:message-id:date :user-agent:mime-version:content-language; bh=g63A3Pvi+LYryu9TOdnmZJnxPaehyyCC9/YTlk4lSh8=; b=DcQexvLdsIxtdslgiHK599/cskn+mRs1sfT5IwdseMLyGhxASlPymI/qwlzmWwHcxN GpxoiJsA4ie/okyrqAKJqY0p5oPmHsBacCym9Okr2/K0FEAEfDc80yDqLSqSPdtK0EBB CI8xojgvUcuStBO7rq7vt67wD9BhcXzbzTZD7DiJekgo4lEEKkHVLJ1g3VctNlPxTXmq 47AWmAckoJWJ0+mwVNiX7HHWzczH2bmtL6wa9xs+ztipPHm4iQUyKsYWCye5Ee4OBVbL MFz72x9pBnta3XF1KyLcBErMTabX1KDblbgSe1jgyKIp2uv8fNpgGv65QRrP0W+rlowy lUug== X-Gm-Message-State: AOAM5337LFUsIkT74YigDpY/SEhdfqTTsktCU8sSMOdwjPWKY5QKU1nv rDYNue9DdZTRbEzmGXfyb2Q= X-Google-Smtp-Source: ABdhPJyDaGAdqVAbgZRFkQgX3HJRwxOLUP7VS2h1/X5PgciSfLulpBiXN/wno3eG3S4GZt+HhgK9tQ== X-Received: by 2002:aed:3b4e:: with SMTP id q14mr4737379qte.285.1598275907326; Mon, 24 Aug 2020 06:31:47 -0700 (PDT) Received: from ?IPv6:2620:10d:c0a8:1102:c810:ccda:c498:a211? ([2620:10d:c091:480::1:9f38]) by smtp.googlemail.com with ESMTPSA id k31sm10542404qtd.60.2020.08.24.06.31.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Aug 2020 06:31:46 -0700 (PDT) To: GCC Patches From: Nathan Sidwell Subject: c++: overload dumper Message-ID: Date: Mon, 24 Aug 2020 09:31:45 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" I frequently need to look at overload sets, and debug_node spews more information than is useful, most of the time. Here's a dumper for overloads, that just tells you their full name and where they came from. gcc/cp * ptree.c (debug_overload): New. pushed diff --git c/gcc/cp/ptree.c w/gcc/cp/ptree.c index dfc244fdceb..11833e3b4da 100644 --- c/gcc/cp/ptree.c +++ w/gcc/cp/ptree.c @@ -321,3 +321,19 @@ debug_tree (cp_expr node) { debug_tree (node.get_value()); } + +DEBUG_FUNCTION void +debug_overload (tree node) +{ + FILE *file = stdout; + + for (lkp_iterator iter (node); iter; ++iter) + { + tree decl = *iter; + auto xloc = expand_location (DECL_SOURCE_LOCATION (decl)); + auto fullname = decl_as_string (decl, 0); + + fprintf (file, "%p: %s:%d:%d \"%s\"\n", (void *)decl, + xloc.file, xloc.line, xloc.column, fullname); + } +}