diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2022-02-20 20:02:23 +0100 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2022-02-20 23:37:32 +0100 |
commit | 6384eff56dba1fac071c1b525f7e49cf03f2737f (patch) | |
tree | 7263a4a6ec603a81f6df660f4f6b19a4607513fc /gcc/d/expr.cc | |
parent | e49508ac6b36adb8a2056c5a1fb6e0178de2439d (diff) | |
download | gcc-6384eff56dba1fac071c1b525f7e49cf03f2737f.zip gcc-6384eff56dba1fac071c1b525f7e49cf03f2737f.tar.gz gcc-6384eff56dba1fac071c1b525f7e49cf03f2737f.tar.bz2 |
d: Merge upstream dmd cb49e99f8, druntime 55528bd1, phobos 1a3e80ec2.
D front-end changes:
- Import dmd v2.099.0-beta.1.
- It's now an error to use `alias this' for partial assignment.
- The `delete' keyword has been removed from the language.
- Using `this' and `super' as types has been removed from the
language, the parser no longer specially handles this wrong code
with an informative error.
D Runtime changes:
- Import druntime v2.099.0-beta.1.
Phobos changes:
- Import phobos v2.099.0-beta.1.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd cb49e99f8.
* dmd/VERSION: Update version to v2.099.0-beta.1.
* decl.cc (layout_class_initializer): Update call to NewExp::create.
* expr.cc (ExprVisitor::visit (DeleteExp *)): Remove handling of
deleting arrays and pointers.
(ExprVisitor::visit (DotVarExp *)): Convert complex types to the
front-end library type representing them.
(ExprVisitor::visit (StringExp *)): Use getCodeUnit instead of charAt
to get the value of each index in a string expression.
* runtime.def (DELMEMORY): Remove.
(DELARRAYT): Remove.
* types.cc (TypeVisitor::visit (TypeEnum *)): Handle anonymous enums.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime 55528bd1.
* src/MERGE: Merge upstream phobos 1a3e80ec2.
* testsuite/libphobos.hash/test_hash.d: Update.
* testsuite/libphobos.betterc/test19933.d: New test.
Diffstat (limited to 'gcc/d/expr.cc')
-rw-r--r-- | gcc/d/expr.cc | 46 |
1 files changed, 10 insertions, 36 deletions
diff --git a/gcc/d/expr.cc b/gcc/d/expr.cc index dd7ebc8..d5e4df7 100644 --- a/gcc/d/expr.cc +++ b/gcc/d/expr.cc @@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see #include "dmd/aggregate.h" #include "dmd/ctfe.h" #include "dmd/declaration.h" +#include "dmd/enum.h" #include "dmd/expression.h" #include "dmd/identifier.h" #include "dmd/init.h" @@ -1460,40 +1461,6 @@ public: t1 = build_address (t1); this->result_ = build_libcall (libcall, Type::tvoid, 1, t1); } - else if (tb1->ty == TY::Tarray) - { - /* For dynamic arrays, the garbage collector is called to immediately - release the memory. */ - Type *telem = tb1->nextOf ()->baseElemOf (); - tree ti = null_pointer_node; - - if (TypeStruct *ts = telem->isTypeStruct ()) - { - /* Might need to run destructor on array contents. */ - if (ts->sym->dtor) - ti = build_typeinfo (e->loc, tb1->nextOf ()); - } - - /* Generate: _delarray_t (&t1, ti); */ - this->result_ = build_libcall (LIBCALL_DELARRAYT, Type::tvoid, 2, - build_address (t1), ti); - } - else if (tb1->ty == TY::Tpointer) - { - /* For pointers to a struct instance, if the struct has overloaded - operator delete, then that operator is called. */ - t1 = build_address (t1); - Type *tnext = tb1->isTypePointer ()->next->toBasetype (); - - /* This case should have been rewritten to `_d_delstruct` in the - semantic phase. */ - if (TypeStruct *ts = tnext->isTypeStruct ()) - gcc_assert (!ts->sym->dtor); - - /* Otherwise, the garbage collector is called to immediately free the - memory allocated for the pointer. */ - this->result_ = build_libcall (LIBCALL_DELMEMORY, Type::tvoid, 1, t1); - } else { error ("don%'t know how to delete %qs", e->e1->toChars ()); @@ -1936,10 +1903,17 @@ public: else { tree object = build_expr (e->e1); + Type *tb = e->e1->type->toBasetype (); - if (e->e1->type->toBasetype ()->ty != TY::Tstruct) + if (tb->ty != TY::Tstruct) object = build_deref (object); + /* __complex is represented as a struct in the front-end, but + underlying is really a complex type. */ + if (e->e1->type->ty == TY::Tenum + && e->e1->type->isTypeEnum ()->sym->isSpecial ()) + object = build_vconvert (build_ctype (tb), object); + this->result_ = component_ref (object, get_symbol_decl (vd)); } } @@ -2604,7 +2578,7 @@ public: for (size_t i = 0; i < e->len; i++) { - tree value = build_integer_cst (e->charAt (i), etype); + tree value = build_integer_cst (e->getCodeUnit (i), etype); CONSTRUCTOR_APPEND_ELT (elms, size_int (i), value); } |