public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/ranger] d: Use toStringExp instead of explicit cast
@ 2020-06-17 22:54 Aldy Hernandez
  0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2020-06-17 22:54 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:15cf136abe0461f2bcf2ccf7a0e4e495f2362b75

commit 15cf136abe0461f2bcf2ccf7a0e4e495f2362b75
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Mon Jun 15 17:43:31 2020 +0200

    d: Use toStringExp instead of explicit cast
    
    gcc/d/ChangeLog:
    
            * d-attribs.cc (build_attributes): Use toStringExp instead of cast.
            * toir.cc (IRVisitor::visit): Likewise.

Diff:
---
 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 : "");


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-17 22:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-17 22:54 [gcc/devel/ranger] d: Use toStringExp instead of explicit cast Aldy Hernandez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).