From patchwork Tue Jun 16 21:59:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 1310727 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=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=hAyZL82H; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 49mhw01DSRz9sR4 for ; Wed, 17 Jun 2020 08:00:32 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6EC24388B014; Tue, 16 Jun 2020 22:00:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6EC24388B014 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1592344825; bh=9O4uKpE9KGfM8yLd0ema5AlJlJ9vekHaww647GnmCOU=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=hAyZL82HK55HTAnff5THm7BzlUgjZUszAlr81Ujr5qkBkp4r3+anotHk1n+bp+7HL kRAC5WsSCa0Q0hDzi9fQvOIxyD14FAWS+Tb4U0NoqkH0wyzS3GoLLxi8GuyQN+zD/k adP/W3w2y2unDbKEl1Dhqn+oKfAMEzsC0H8d1Wu0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [IPv6:2001:67c:2050::465:202]) by sourceware.org (Postfix) with ESMTPS id DE96E388A83A for ; Tue, 16 Jun 2020 22:00:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DE96E388A83A Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 49mhvm6h8hzQlHN; Wed, 17 Jun 2020 00:00:20 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id JWVTLpYA_0mz; Wed, 17 Jun 2020 00:00:17 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [committed] d: Use toStringExp instead of explicit cast Date: Tue, 16 Jun 2020 23:59:32 +0200 Message-Id: <20200616215933.3858164-9-ibuclaw@gdcproject.org> In-Reply-To: <20200616215933.3858164-1-ibuclaw@gdcproject.org> References: <20200616215933.3858164-1-ibuclaw@gdcproject.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: E2A13178C X-Rspamd-Score: 1.79 / 15.00 / 15.00 X-Spam-Status: No, score=-17.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_FILL_THIS_FORM_SHORT 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: , X-Patchwork-Original-From: Iain Buclaw via Gcc-patches From: Iain Buclaw Reply-To: Iain Buclaw Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi, This patch replaces uses of casting to StringExp with toStringExp. Bootstrapped and regression tested on x86_64-linux-gnu, and committed to master. Regards Iain gcc/d/ChangeLog: * d-attribs.cc (build_attributes): Use toStringExp instead of cast. * toir.cc (IRVisitor::visit): Likewise. --- gcc/d/d-attribs.cc | 2 +- gcc/d/toir.cc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/d/d-attribs.cc b/gcc/d/d-attribs.cc index 7e55b42fd03..79938075a7c 100644 --- a/gcc/d/d-attribs.cc +++ b/gcc/d/d-attribs.cc @@ -277,7 +277,7 @@ build_attributes (Expressions *eattrs) return error_mark_node; } - StringExp *se = (StringExp*) e0; + StringExp *se = e0->toStringExp (); gcc_assert (se->sz == 1); /* Empty string attribute, just ignore it. */ diff --git a/gcc/d/toir.cc b/gcc/d/toir.cc index d8a14efd667..130cbbafe00 100644 --- a/gcc/d/toir.cc +++ b/gcc/d/toir.cc @@ -1292,7 +1292,7 @@ public: void visit (GccAsmStatement *s) { - StringExp *insn = (StringExp *)s->insn; + StringExp *insn = s->insn->toStringExp (); tree outputs = NULL_TREE; tree inputs = NULL_TREE; tree clobbers = NULL_TREE; @@ -1307,7 +1307,7 @@ public: const char *sname = name ? name->toChars () : NULL; tree id = name ? build_string (strlen (sname), sname) : NULL_TREE; - StringExp *constr = (StringExp *)(*s->constraints)[i]; + StringExp *constr = (*s->constraints)[i]->toStringExp (); const char *cstring = (const char *)(constr->len ? constr->string : ""); tree str = build_string (constr->len, cstring); @@ -1333,7 +1333,7 @@ public: { for (size_t i = 0; i < s->clobbers->length; i++) { - StringExp *clobber = (StringExp *)(*s->clobbers)[i]; + StringExp *clobber = (*s->clobbers)[i]->toStringExp (); const char *cstring = (const char *)(clobber->len ? clobber->string : "");