aboutsummaryrefslogtreecommitdiff
path: root/gcc/d/d-codegen.cc
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2023-07-10 03:07:41 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2023-07-10 03:13:00 +0200
commit0cafc3b6272d1dd738e8d7e66e1d8741e08f74d3 (patch)
tree8c549ddd4b93c78f44959d47a4956837022a5cf1 /gcc/d/d-codegen.cc
parentd41a57c46df6f8f7dae0c0a8b349e734806a837b (diff)
downloadgcc-0cafc3b6272d1dd738e8d7e66e1d8741e08f74d3.zip
gcc-0cafc3b6272d1dd738e8d7e66e1d8741e08f74d3.tar.gz
gcc-0cafc3b6272d1dd738e8d7e66e1d8741e08f74d3.tar.bz2
d: Merge upstream dmd, druntime 17ccd12af3, phobos 8d3800bee.
D front-end changes: - Import dmd v2.104.0. - Assignment-style syntax is now allowed for `alias this'. - Overloading `extern(C)' functions is now an error. D runtime changes: - Import druntime v2.104.0. Phobos changes: - Import phobos v2.104.0. - Better static assert messages when instantiating `std.algorithm.iteration.permutations' with wrong inputs. - Added `std.system.instructionSetArchitecture' and `std.system.ISA'. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 17ccd12af3. * dmd/VERSION: Bump version to v2.104.0. * Make-lang.in (D_FRONTEND_OBJS): Rename d/apply.o to d/postordervisitor.o. * d-codegen.cc (make_location_t): Update for new front-end interface. (build_filename_from_loc): Likewise. (build_assert_call): Likewise. (build_array_bounds_call): Likewise. (build_bounds_index_condition): Likewise. (build_bounds_slice_condition): Likewise. (build_frame_type): Likewise. (get_frameinfo): Likewise. * d-diagnostic.cc (d_diagnostic_report_diagnostic): Likewise. * decl.cc (build_decl_tree): Likewise. (start_function): Likewise. * expr.cc (ExprVisitor::visit (NewExp *)): Replace code generation of `new pointer' with front-end lowering. * runtime.def (NEWITEMT): Remove. (NEWITEMIT): Remove. * toir.cc (IRVisitor::visit (LabelStatement *)): Update for new front-end interface. * typeinfo.cc (check_typeinfo_type): Likewise. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 17ccd12af3. * src/MERGE: Merge upstream phobos 8d3800bee. gcc/testsuite/ChangeLog: * gdc.dg/asm4.d: Update test.
Diffstat (limited to 'gcc/d/d-codegen.cc')
-rw-r--r--gcc/d/d-codegen.cc37
1 files changed, 20 insertions, 17 deletions
diff --git a/gcc/d/d-codegen.cc b/gcc/d/d-codegen.cc
index 689d1c5..2738958 100644
--- a/gcc/d/d-codegen.cc
+++ b/gcc/d/d-codegen.cc
@@ -50,11 +50,11 @@ make_location_t (const Loc &loc)
{
location_t gcc_location = input_location;
- if (loc.filename)
+ if (const char *filename = loc.filename ())
{
- linemap_add (line_table, LC_ENTER, 0, loc.filename, loc.linnum);
- linemap_line_start (line_table, loc.linnum, 0);
- gcc_location = linemap_position_for_column (line_table, loc.charnum);
+ linemap_add (line_table, LC_ENTER, 0, filename, loc.linnum ());
+ linemap_line_start (line_table, loc.linnum (), 0);
+ gcc_location = linemap_position_for_column (line_table, loc.charnum ());
linemap_add (line_table, LC_LEAVE, 0, NULL, 0);
}
@@ -1872,8 +1872,10 @@ void_okay_p (tree t)
static tree
build_filename_from_loc (const Loc &loc)
{
- const char *filename = loc.filename
- ? loc.filename : d_function_chain->module->srcfile.toChars ();
+ const char *filename = loc.filename ();
+
+ if (filename == NULL)
+ filename = d_function_chain->module->srcfile.toChars ();
unsigned length = strlen (filename);
tree str = build_string (length, filename);
@@ -1890,17 +1892,17 @@ tree
build_assert_call (const Loc &loc, libcall_fn libcall, tree msg)
{
tree file;
- tree line = size_int (loc.linnum);
+ tree line = size_int (loc.linnum ());
switch (libcall)
{
case LIBCALL_ASSERT_MSG:
case LIBCALL_UNITTEST_MSG:
/* File location is passed as a D string. */
- if (loc.filename)
+ if (const char *filename = loc.filename ())
{
- unsigned len = strlen (loc.filename);
- tree str = build_string (len, loc.filename);
+ unsigned len = strlen (filename);
+ tree str = build_string (len, filename);
TREE_TYPE (str) = make_array_type (Type::tchar, len);
file = d_array_value (build_ctype (Type::tchar->arrayOf ()),
@@ -1939,7 +1941,7 @@ build_array_bounds_call (const Loc &loc)
{
return build_libcall (LIBCALL_ARRAYBOUNDSP, Type::tvoid, 2,
build_filename_from_loc (loc),
- size_int (loc.linnum));
+ size_int (loc.linnum ()));
}
}
@@ -1968,7 +1970,8 @@ build_bounds_index_condition (IndexExp *ie, tree index, tree length)
{
boundserr = build_libcall (LIBCALL_ARRAYBOUNDS_INDEXP, Type::tvoid, 4,
build_filename_from_loc (ie->e2->loc),
- size_int (ie->e2->loc.linnum), index, length);
+ size_int (ie->e2->loc.linnum ()),
+ index, length);
}
return build_condition (TREE_TYPE (index), condition, boundserr, index);
@@ -2017,7 +2020,7 @@ build_bounds_slice_condition (SliceExp *se, tree lower, tree upper, tree length)
boundserr = build_libcall (LIBCALL_ARRAYBOUNDS_SLICEP,
Type::tvoid, 5,
build_filename_from_loc (se->loc),
- size_int (se->loc.linnum),
+ size_int (se->loc.linnum ()),
lower, upper, length);
}
@@ -2659,8 +2662,8 @@ build_frame_type (tree ffi, FuncDeclaration *fd)
of the calling function non-locally. So we add all parameters with nested
refs to the function frame, this should also mean overriding methods will
have the same frame layout when inheriting a contract. */
- if ((global.params.useIn == CHECKENABLEon && fd->frequire)
- || (global.params.useOut == CHECKENABLEon && fd->fensure))
+ if ((global.params.useIn == CHECKENABLEon && fd->frequire ())
+ || (global.params.useOut == CHECKENABLEon && fd->fensure ()))
{
if (fd->parameters)
{
@@ -2870,8 +2873,8 @@ get_frameinfo (FuncDeclaration *fd)
/* In checkNestedReference, references from contracts are not added to the
closureVars array, so assume all parameters referenced. */
- if ((global.params.useIn == CHECKENABLEon && fd->frequire)
- || (global.params.useOut == CHECKENABLEon && fd->fensure))
+ if ((global.params.useIn == CHECKENABLEon && fd->frequire ())
+ || (global.params.useOut == CHECKENABLEon && fd->fensure ()))
FRAMEINFO_CREATES_FRAME (ffi) = 1;
/* If however `fd` is nested (deeply) in a function that creates a