From 15cf136abe0461f2bcf2ccf7a0e4e495f2362b75 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Mon, 15 Jun 2020 17:43:31 +0200 Subject: [PATCH] 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. --- 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 : ""); -- 2.30.2