diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2025-03-14 23:08:16 +0100 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2025-03-16 21:06:07 +0100 |
commit | 7d6e5591e6ab1f5a24dcf007b17f81cc19987c47 (patch) | |
tree | fdc4ad1abac3bd4a831b5e72ec6e3003f88f872c /gcc/d/expr.cc | |
parent | 26c4ea2ebcdcd0aa26350d04dc4cd38348148bd9 (diff) | |
download | gcc-7d6e5591e6ab1f5a24dcf007b17f81cc19987c47.zip gcc-7d6e5591e6ab1f5a24dcf007b17f81cc19987c47.tar.gz gcc-7d6e5591e6ab1f5a24dcf007b17f81cc19987c47.tar.bz2 |
d: Merge upstream dmd, druntime 603225372b
D front-end changes:
- Import dmd v2.111.0-beta.1.
- Added placement `new' expressions.
D runtime changes:
- Import druntime v2.111.0-beta.1.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd 603225372b.
* dmd/VERSION: Bump version to v2.111.0-beta.1.
* d-builtins.cc (build_frontend_type): Update for new front-end
interface.
* decl.cc (Class DeclVisitor): Likewise.
(maybe_build_decl_tree): Likewise.
(get_vtable_decl): Likewise.
(layout_class_initializer): Likewise.
* expr.cc (class ExprVisitor): Likewise.
(ExprVisitor::visit (NewExp *)): Implement placement new for class,
struct, and pointer types.
* modules.cc (get_internal_fn): Update for new front-end interface.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime 603225372b.
Diffstat (limited to 'gcc/d/expr.cc')
-rw-r--r-- | gcc/d/expr.cc | 51 |
1 files changed, 40 insertions, 11 deletions
diff --git a/gcc/d/expr.cc b/gcc/d/expr.cc index da794ea..0415763 100644 --- a/gcc/d/expr.cc +++ b/gcc/d/expr.cc @@ -1783,7 +1783,7 @@ public: void visit (DelegateExp *e) final override { - if (e->func->semanticRun == PASS::semantic3done) + if (e->func->semanticRun () == PASS::semantic3done) { /* Add the function as nested function if it belongs to this module. ie: it is a member of this module, or it is a template instance. */ @@ -2246,6 +2246,15 @@ public: new_call = build_nop (type, build_address (var)); setup_exp = modify_expr (var, aggregate_initializer_decl (cd)); } + else if (e->placement != NULL) + { + /* Generate: placement_expr = typeid(class).init */ + tree placement_expr = build_expr (e->placement); + new_call = build_nop (type, build_address (placement_expr)); + tree class_init = build_vconvert (TREE_TYPE (placement_expr), + aggregate_initializer_decl (cd)); + setup_exp = modify_expr (placement_expr, class_init); + } else { /* Generate: _d_newclass() @@ -2318,12 +2327,22 @@ public: return; } - /* This case should have been rewritten to `_d_newitemT' during the - semantic phase. */ - gcc_assert (e->lowering); + if (e->placement != NULL) + { + /* Generate: &placement_expr */ + tree placement_expr = build_expr (e->placement); + new_call = build_nop (build_ctype (tb), + build_address (placement_expr)); + } + else + { + /* This case should have been rewritten to `_d_newitemT' during the + semantic phase. */ + gcc_assert (e->lowering); - /* Generate: _d_newitemT() */ - new_call = build_expr (e->lowering); + /* Generate: _d_newitemT() */ + new_call = build_expr (e->lowering); + } if (e->member || !e->arguments) { @@ -2396,12 +2415,22 @@ public: return; } - /* This case should have been rewritten to `_d_newitemT' during the - semantic phase. */ - gcc_assert (e->lowering); + if (e->placement != NULL) + { + /* Generate: &placement_expr */ + tree placement_expr = build_expr (e->placement); + result = build_nop (build_ctype (tb), + build_address (placement_expr)); + } + else + { + /* This case should have been rewritten to `_d_newitemT' during the + semantic phase. */ + gcc_assert (e->lowering); - /* Generate: _d_newitemT() */ - result = build_expr (e->lowering); + /* Generate: _d_newitemT() */ + result = build_expr (e->lowering); + } if (e->arguments && e->arguments->length == 1) { |