diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2022-02-21 00:06:16 +0100 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2022-02-21 00:12:01 +0100 |
commit | 1d98337c6bebf41743dd3d1cc36222aa30e8f382 (patch) | |
tree | 9b1d528c247a528c812fec2a88fe3251d1cbab9e /gcc/d/expr.cc | |
parent | 6384eff56dba1fac071c1b525f7e49cf03f2737f (diff) | |
download | gcc-1d98337c6bebf41743dd3d1cc36222aa30e8f382.zip gcc-1d98337c6bebf41743dd3d1cc36222aa30e8f382.tar.gz gcc-1d98337c6bebf41743dd3d1cc36222aa30e8f382.tar.bz2 |
d: Remove handling of deleting GC allocated classes.
Now that the `delete' keyword has been removed from the front-end, only
compiler-generated uses of DeleteExp reach the code generator via the
auto-destruction of `scope class' variables.
The run-time library helpers that previously were used to delete GC
class objects can now be removed from the compiler.
gcc/d/ChangeLog:
* expr.cc (ExprVisitor::visit (DeleteExp *)): Remove handling of
deleting GC allocated classes.
* runtime.def (DELCLASS): Remove.
(DELINTERFACE): Remove.
Diffstat (limited to 'gcc/d/expr.cc')
-rw-r--r-- | gcc/d/expr.cc | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/gcc/d/expr.cc b/gcc/d/expr.cc index d5e4df7..2a7fb69 100644 --- a/gcc/d/expr.cc +++ b/gcc/d/expr.cc @@ -1438,28 +1438,16 @@ public: { /* For class object references, if there is a destructor for that class, the destructor is called for the object instance. */ - libcall_fn libcall; + gcc_assert (e->e1->op == EXP::variable); - if (e->e1->op == EXP::variable) - { - VarDeclaration *v = e->e1->isVarExp ()->var->isVarDeclaration (); - if (v && v->onstack) - { - libcall = tb1->isClassHandle ()->isInterfaceDeclaration () - ? LIBCALL_CALLINTERFACEFINALIZER : LIBCALL_CALLFINALIZER; + VarDeclaration *v = e->e1->isVarExp ()->var->isVarDeclaration (); + gcc_assert (v && v->onstack); - this->result_ = build_libcall (libcall, Type::tvoid, 1, t1); - return; - } - } + libcall_fn libcall = tb1->isClassHandle ()->isInterfaceDeclaration () + ? LIBCALL_CALLINTERFACEFINALIZER : LIBCALL_CALLFINALIZER; - /* Otherwise, the garbage collector is called to immediately free the - memory allocated for the class instance. */ - libcall = tb1->isClassHandle ()->isInterfaceDeclaration () - ? LIBCALL_DELINTERFACE : LIBCALL_DELCLASS; - - t1 = build_address (t1); this->result_ = build_libcall (libcall, Type::tvoid, 1, t1); + return; } else { |