From patchwork Mon Oct 10 17:33:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 680512 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3st6gY6V45z9s9N for ; Tue, 11 Oct 2016 04:34:17 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=IG3CUr24; dkim-atps=neutral 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=ZYodvy9nXLjd7DD0MtZXOIuAf5ADUFNZBdD6nB2b95DuW2 mm4XridnTGawDGZM4bbhg0FnnB2CdcLAKIi8YXfOpSaarozjEsjH7QsLrOYL9As1 G6AkVeGL5UNEIxDeT2YFsd3bCAkbIvnHtBG9/sq13QZ9e0wLf/znGCrYn/mvA= 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=jpCtyb4DTrZFxs+O1+oVNE1RV6o=; b=IG3CUr24ufdbzlbmeZ0G SZYTq4z5RT39N27NEeMNTRhCPre9cQ0y9Q3SSImKMMoh2Sbe4Wm1WaFjus4hHH9r wMSwCLu3uAuIoMsg9VH6St4aL4U0TSlyHxjEF8RexUaKgKu5ZVYaZMS0CPZLokNf 0VFyfsWwe6IdNc2q+1+ksjA= Received: (qmail 38749 invoked by alias); 10 Oct 2016 17:34:10 -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 38737 invoked by uid 89); 10 Oct 2016 17:34:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=no version=3.3.2 spammy=HTo:D*googlegroups.com, H*Ad:D*googlegroups.com, Than, Location X-HELO: mail-it0-f41.google.com Received: from mail-it0-f41.google.com (HELO mail-it0-f41.google.com) (209.85.214.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 10 Oct 2016 17:33:59 +0000 Received: by mail-it0-f41.google.com with SMTP id o19so39177ito.1 for ; Mon, 10 Oct 2016 10:33:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=NSt1bJcxv43xUwIg7UO6cEFvAbXZLzbdAKMJil+3VFk=; b=SLHxWNwUST3uZHaMBo3Ymc8xOI930SR55Krwf+hN5Lny8f4YgNGl/8c5dGoiLTjshL bvhBIIrSukKdyJISj84gluq+vKWoht7RLPtyelZ/gET4NOAW6mU7QvUWqDYctarr2o7r jgHaiK7ygYcAH7fv+j62F5clfHBWCtTs6wSB7HXMiJU7116WhprxgBZAIXu+VW1zDqlk clXgZoUlh1+z3K6Rk3/1Tt9cerAzHR51/mTNmgNzTIOHE+CqMhWcKdCz9lcDJQFmGhgt 3ALvD7CCw3tKTUWsJm5o/p9EifnKSz+JTz+qSZ5JsbHjcRMqtn1KMGAE2oG555F3XKvQ vqIQ== X-Gm-Message-State: AA6/9Rm7oO9ZnS3WiOA46WHSCr9Ojrt0AlV1gAh/q+t9CY8Aa4qALkvuxGr2jLsoPQevqZsJPbTqIDKy4TALIQ== X-Received: by 10.36.213.131 with SMTP id a125mr23101itg.14.1476120837379; Mon, 10 Oct 2016 10:33:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.154.155 with HTTP; Mon, 10 Oct 2016 10:33:56 -0700 (PDT) From: Ian Lance Taylor Date: Mon, 10 Oct 2016 10:33:56 -0700 Message-ID: Subject: Go patch committed: remove GCC-specific linemap usage To: gcc-patches , "gofrontend-dev@googlegroups.com" This patch by Than McIntosh removes a GCC-specific use of the linemap code to retrieve the line number. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian 2016-10-10 Than McIntosh * go-linemap.cc (Gcc_linemap::location_line): New method. Index: gcc/go/go-linemap.cc =================================================================== --- gcc/go/go-linemap.cc (revision 240755) +++ gcc/go/go-linemap.cc (working copy) @@ -32,6 +32,9 @@ class Gcc_linemap : public Linemap std::string to_string(Location); + int + location_line(Location); + protected: Location get_predeclared_location(); @@ -88,6 +91,13 @@ Gcc_linemap::to_string(Location location return ss.str(); } +// Return the line number for a given location (for debugging dumps) +int +Gcc_linemap::location_line(Location loc) +{ + return LOCATION_LINE(loc.gcc_location()); +} + // Stop getting locations. void Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 240941) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -9401e714d690e3907a64ac5c8cd5aed9e28f511b +f3658aea2493c7f1c4a72502f9e7da562c7764c4 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: gcc/go/gofrontend/escape.cc =================================================================== --- gcc/go/gofrontend/escape.cc (revision 240941) +++ gcc/go/gofrontend/escape.cc (working copy) @@ -145,7 +145,7 @@ Node::details() const std::stringstream details; if (!this->is_sink()) - details << " l(" << LOCATION_LINE(this->location().gcc_location()) << ")"; + details << " l(" << Linemap::location_to_line(this->location()) << ")"; bool is_varargs = false; bool is_address_taken = false; Index: gcc/go/gofrontend/go-linemap.h =================================================================== --- gcc/go/gofrontend/go-linemap.h (revision 240755) +++ gcc/go/gofrontend/go-linemap.h (working copy) @@ -63,6 +63,10 @@ class Linemap virtual std::string to_string(Location) = 0; + // Return the line number for a given location (for debugging dumps) + virtual int + location_line(Location) = 0; + protected: // Return a special Location used for predeclared identifiers. This // Location should be different from that for any actual source @@ -135,6 +139,14 @@ class Linemap go_assert(Linemap::instance_ != NULL); return Linemap::instance_->to_string(loc); } + + // Return line number for location + static int + location_to_line(Location loc) + { + go_assert(Linemap::instance_ != NULL); + return Linemap::instance_->location_line(loc); + } }; // The backend interface must define this function. It should return