From patchwork Wed Jun 13 17:24:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 928991 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-479646-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=golang.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="jiSk3bme"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 415YXm0Dwhz9s01 for ; Thu, 14 Jun 2018 03:24:54 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=cQjTusaLCh4/c1JqKmX6EtsGtLU/aKuxAqfx/dnIAnxikE tB+ZSKezSKHCEv7xGPrdERtZ+xo1Px5tOAA8dD8zDLlx6tZROWi8jqbxHuBVJ0KJ YbUUVugZK8NjniZNASREhNbiAZPb1RWH5E1T2TsGCv3WSah2v/0uPVKciroto= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=A/quuqaD9vQ7JnbxctyLMUVOog0=; b=jiSk3bmezz0MS2zGR1tz 8XLWU/0RaP7q9M98kSwYINp0LB5dMrNJKX/wlK3G4/rR9u/YrqnJ0q2Sqf/B8umw OrY8RJvwWFtXmx4Ju049FiKnKAtS+cj80NVe9A+lCJH6PcLfkbjlUrF92DeicBoa HXQUqbJtRRuXsqoBTPkC8KU= Received: (qmail 14571 invoked by alias); 13 Jun 2018 17:24:46 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 14450 invoked by uid 89); 13 Jun 2018 17:24:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=HX-Received:a90c, Traverse, traverse, indicating X-HELO: mail-wm0-f53.google.com Received: from mail-wm0-f53.google.com (HELO mail-wm0-f53.google.com) (74.125.82.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Jun 2018 17:24:27 +0000 Received: by mail-wm0-f53.google.com with SMTP id o13-v6so6036517wmf.4 for ; Wed, 13 Jun 2018 10:24:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=BuyKpTDy1S2bph2arQkk2+HSD72z0g2tYGTyN2/qc7M=; b=lYYGT1+spRR6Pd/37f8pvfHy6flC5FaNDwWqOvPwAerxE7g5K5BvsTB1WsAzKmd4pC MKjDKq9t3rXe0SgV0tOiKIggRVXj9DUdJWFvEeQ7dWlGKeUjKwK5b5pCM6KqOPwJ7ydF a1y2d+K2oRfcRJ1/ZUqRkUDOy0iQsJAsW49T9WNYP/5cYuBFM8vIOX/0OE5iE02KIgy8 /N9vphM+5s3+CQMRAIgnH8p0Ho3QtZgW2XlzouCBEMnKswA7OOlrTgsGpFnfHN3IEfmM ottABFkK+CXxbCnM2aPhlzk7fKWniUzNMhq6mZBSaX+F+9xaXDfWGA8w024j4dX7a5pY fYWQ== X-Gm-Message-State: APt69E2J5tMczGkIlZe/nyOp+QmQevOSy3uuvVAMDziSVLuq7LmKCDO5 YzbYcef2LUw4U+ZqjJqPcqTtJMSINhtqQl+xDEAgFXGr X-Google-Smtp-Source: ADUXVKIOC9jK3Pw/b/r77SFj+ykTUiKoTbaEeti2aZoJIT6+tnGTbXqwYwVv+MS8OrNXMAE2lza32TDIRztAKuxSUt0= X-Received: by 2002:a50:a90c:: with SMTP id l12-v6mr5234303edc.106.1528910663210; Wed, 13 Jun 2018 10:24:23 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a50:9147:0:0:0:0:0 with HTTP; Wed, 13 Jun 2018 10:24:22 -0700 (PDT) From: Ian Lance Taylor Date: Wed, 13 Jun 2018 10:24:22 -0700 Message-ID: Subject: libgo patch committed: Dump preinit blocks in AST dumps To: gcc-patches , gofrontend-dev@googlegroups.com This patch to the Go frontend by Than McIntosh includes global variable preinit blocks in AST dumps. Each preinit block is prefixed with a comment indicating the variable it is initializing. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 261549) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -6743db0ed81e313acf66c00a4ed0e2dcaaca2c9f +1f07926263b6d14edb6abd6a00e6385190d30d0e The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: gcc/go/gofrontend/ast-dump.cc =================================================================== --- gcc/go/gofrontend/ast-dump.cc (revision 261521) +++ gcc/go/gofrontend/ast-dump.cc (working copy) @@ -29,7 +29,7 @@ class Ast_dump_traverse_blocks_and_funct { public: Ast_dump_traverse_blocks_and_functions(Ast_dump_context* ast_dump_context) - : Traverse(traverse_blocks | traverse_functions), + : Traverse(traverse_blocks | traverse_functions | traverse_variables), ast_dump_context_(ast_dump_context) { } @@ -40,6 +40,9 @@ class Ast_dump_traverse_blocks_and_funct int function(Named_object*); + int + variable(Named_object*); + private: Ast_dump_context* ast_dump_context_; }; @@ -150,6 +153,27 @@ Ast_dump_traverse_blocks_and_functions:: return TRAVERSE_CONTINUE; } +// Dump variable preinits + +int +Ast_dump_traverse_blocks_and_functions::variable(Named_object* no) +{ + if (!no->is_variable()) + return TRAVERSE_CONTINUE; + + Variable* var = no->var_value(); + if (var->has_pre_init()) + { + this->ast_dump_context_->ostream() << "// preinit block for var " + << no->message_name() << "\n"; + var->preinit()->traverse(this); + } + + return TRAVERSE_CONTINUE; +} + + + // Class Ast_dump_context. Ast_dump_context::Ast_dump_context(std::ostream* out /* = NULL */,