diff mbox series

[committed] d: Use toStringExp instead of explicit cast

Message ID 20200616215933.3858164-9-ibuclaw@gdcproject.org
State New
Headers show
Series [committed] d: Use toStringExp instead of explicit cast | expand

Commit Message

Iain Buclaw June 16, 2020, 9:59 p.m. UTC
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 mbox series

Patch

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