Skip to content

Commit 5aff58e

Browse files
committed
d: Merge dmd, druntime 9471b25db9, phobos 547886846.
D front-end changes: - Import dmd v2.107.1-rc.1. D runtime changes: - Import druntime v2.107.1-rc.1. Phobos changes: - Import phobos v2.107.1-rc.1. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 9471b25db9. * dmd/VERSION: Bump version to v2.107.1-rc.1. * Make-lang.in (D_FRONTEND_OBJS): Add d/cxxfrontend.o. * d-attribs.cc (build_attributes): Update for new front-end interface. * d-builtins.cc (build_frontend_type): Likewise. (strip_type_modifiers): Likewise. (covariant_with_builtin_type_p): Likewise. * d-codegen.cc (declaration_type): Likewise. (parameter_type): Likewise. (build_array_struct_comparison): Likewise. (void_okay_p): Likewise. * d-convert.cc (convert_expr): Likewise. (check_valist_conversion): Likewise. * d-lang.cc (d_generate_ddoc_file): Likewise. (d_parse_file): Likewise. * d-target.cc (TargetCPP::toMangle): Likewise. (TargetCPP::typeInfoMangle): Likewise. (TargetCPP::thunkMangle): Likewise. (TargetCPP::parameterType): Likewise. * decl.cc (d_mangle_decl): Likewise. (DeclVisitor::visit): Likewise. (DeclVisitor::visit (CAsmDeclaration *)): New method. (get_symbol_decl): Update for new front-end interface. (layout_class_initializer): Likewise. * expr.cc (ExprVisitor::visit): Likewise. * intrinsics.cc (maybe_set_intrinsic): Likewise. (expand_intrinsic_rotate): Likewise. * modules.cc (layout_moduleinfo_fields): Likewise. (layout_moduleinfo): Likewise. * runtime.cc (get_libcall_type): Likewise. * typeinfo.cc (make_frontend_typeinfo): Likewise. (TypeInfoVisitor::visit): Likewise. (create_typeinfo): Likewise. * types.cc (same_type_p): Likewise. (build_ctype): Likewise. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 9471b25db9. * src/MERGE: Merge upstream phobos 547886846.
1 parent a71d874 commit 5aff58e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1817
-730
lines changed

gcc/d/Make-lang.in

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ D_FRONTEND_OBJS = \
104104
d/cppmangle.o \
105105
d/ctfeexpr.o \
106106
d/ctorflow.o \
107+
d/cxxfrontend.o \
107108
d/dcast.o \
108109
d/dclass.o \
109110
d/declaration.o \

gcc/d/d-attribs.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -320,14 +320,14 @@ build_attributes (Expressions *eattrs)
320320
if (!eattrs)
321321
return NULL_TREE;
322322

323-
expandTuples (eattrs);
323+
dmd::expandTuples (eattrs);
324324

325325
tree attribs = NULL_TREE;
326326

327327
for (size_t i = 0; i < eattrs->length; i++)
328328
{
329329
Expression *attr = (*eattrs)[i];
330-
Dsymbol *sym = toDsymbol (attr->type, NULL);
330+
Dsymbol *sym = dmd::toDsymbol (attr->type, NULL);
331331

332332
if (!sym)
333333
{
@@ -354,7 +354,7 @@ build_attributes (Expressions *eattrs)
354354

355355
/* Get the result of the attribute if it hasn't already been folded. */
356356
if (attr->op == EXP::call)
357-
attr = ctfeInterpret (attr);
357+
attr = dmd::ctfeInterpret (attr);
358358

359359
if (attr->op != EXP::structLiteral)
360360
{

gcc/d/d-builtins.cc

+20-19
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ build_frontend_type (tree type)
9898
/* Check for char * first. Needs to be done for chars/string. */
9999
if (TYPE_MAIN_VARIANT (TREE_TYPE (type)) == char_type_node)
100100
{
101-
dtype = addMod (Type::tchar, dtype->mod);
102-
return addMod (dtype->pointerTo (), mod);
101+
dtype = dmd::addMod (Type::tchar, dtype->mod);
102+
return dmd::addMod (dmd::pointerTo (dtype), mod);
103103
}
104104

105105
if (dtype->ty == TY::Tfunction)
106-
return addMod (TypePointer::create (dtype), mod);
106+
return dmd::addMod (TypePointer::create (dtype), mod);
107107

108-
return addMod (dtype->pointerTo (), mod);
108+
return dmd::addMod (dmd::pointerTo (dtype), mod);
109109
}
110110
break;
111111

@@ -116,7 +116,7 @@ build_frontend_type (tree type)
116116
/* Want to assign ctype directly so that the REFERENCE_TYPE code
117117
can be turned into as an `inout' argument. Can't use pointerTo(),
118118
because the returned Type is shared. */
119-
dtype = addMod (TypePointer::create (dtype), mod);
119+
dtype = dmd::addMod (TypePointer::create (dtype), mod);
120120
dtype->ctype = type;
121121
builtin_converted_decls.safe_push (builtin_data (dtype, type));
122122
return dtype;
@@ -125,7 +125,7 @@ build_frontend_type (tree type)
125125

126126
case BOOLEAN_TYPE:
127127
/* Should be no need for size checking. */
128-
return addMod (Type::tbool, mod);
128+
return dmd::addMod (Type::tbool, mod);
129129

130130
case INTEGER_TYPE:
131131
{
@@ -143,7 +143,7 @@ build_frontend_type (tree type)
143143
|| size != dtype->size ())
144144
continue;
145145

146-
return addMod (dtype, mod);
146+
return dmd::addMod (dtype, mod);
147147
}
148148
break;
149149
}
@@ -160,7 +160,7 @@ build_frontend_type (tree type)
160160
if (dtype->size () != size)
161161
continue;
162162

163-
return addMod (dtype, mod);
163+
return dmd::addMod (dtype, mod);
164164
}
165165
break;
166166
}
@@ -177,13 +177,13 @@ build_frontend_type (tree type)
177177
if (dtype->size () != size)
178178
continue;
179179

180-
return addMod (dtype, mod);
180+
return dmd::addMod (dtype, mod);
181181
}
182182
break;
183183
}
184184

185185
case VOID_TYPE:
186-
return addMod (Type::tvoid, mod);
186+
return dmd::addMod (Type::tvoid, mod);
187187

188188
case ARRAY_TYPE:
189189
dtype = build_frontend_type (TREE_TYPE (type));
@@ -197,7 +197,8 @@ build_frontend_type (tree type)
197197
length = size_binop (PLUS_EXPR, size_one_node,
198198
convert (sizetype, length));
199199

200-
dtype = addMod (dtype->sarrayOf (TREE_INT_CST_LOW (length)), mod);
200+
dtype =
201+
dmd::addMod (dtype->sarrayOf (TREE_INT_CST_LOW (length)), mod);
201202
builtin_converted_decls.safe_push (builtin_data (dtype, type));
202203
return dtype;
203204
}
@@ -213,11 +214,11 @@ build_frontend_type (tree type)
213214
if (!dtype)
214215
break;
215216

216-
dtype = addMod (dtype->sarrayOf (nunits), mod);
217+
dtype = dmd::addMod (dtype->sarrayOf (nunits), mod);
217218
if (target.isVectorTypeSupported (dtype->size (), dtype->nextOf ()))
218219
break;
219220

220-
dtype = addMod (TypeVector::create (dtype), mod);
221+
dtype = dmd::addMod (TypeVector::create (dtype), mod);
221222
builtin_converted_decls.safe_push (builtin_data (dtype, type));
222223
return dtype;
223224
}
@@ -241,9 +242,9 @@ build_frontend_type (tree type)
241242
sdecl->alignsize = TYPE_ALIGN_UNIT (type);
242243
sdecl->alignment.setDefault ();
243244
sdecl->sizeok = Sizeok::done;
244-
sdecl->type = addMod (TypeStruct::create (sdecl), mod);
245+
sdecl->type = dmd::addMod (TypeStruct::create (sdecl), mod);
245246
sdecl->type->ctype = type;
246-
merge2 (sdecl->type);
247+
dmd::merge2 (sdecl->type);
247248

248249
/* Add both named and anonymous fields as members of the struct.
249250
Anonymous fields still need a name in D, so call them "__pad%u". */
@@ -334,7 +335,7 @@ build_frontend_type (tree type)
334335
if (args->length != 0 || varargs_p == VARARGnone)
335336
{
336337
dtype = TypeFunction::create (args, dtype, varargs_p, LINK::c);
337-
return addMod (dtype, mod);
338+
return dmd::addMod (dtype, mod);
338339
}
339340
}
340341
break;
@@ -690,10 +691,10 @@ strip_type_modifiers (Type *type)
690691
if (type->ty == TY::Tpointer)
691692
{
692693
Type *tnext = strip_type_modifiers (type->nextOf ());
693-
return tnext->pointerTo ();
694+
return dmd::pointerTo (tnext);
694695
}
695696

696-
return castMod (type, 0);
697+
return dmd::castMod (type, 0);
697698
}
698699

699700
/* Returns true if types T1 and T2 representing return types or types of
@@ -727,7 +728,7 @@ static bool
727728
covariant_with_builtin_type_p (Type *t1, Type *t2)
728729
{
729730
/* Check whether the declared function matches the built-in. */
730-
if (same_type_p (t1, t2) || covariant (t1, t2) == Covariant::yes)
731+
if (same_type_p (t1, t2) || dmd::covariant (t1, t2) == Covariant::yes)
731732
return true;
732733

733734
/* May not be covariant because of D attributes applied on t1.

gcc/d/d-codegen.cc

+8-8
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ declaration_type (Declaration *decl)
150150
TypeFunction *tf = TypeFunction::create (NULL, decl->type,
151151
VARARGnone, LINK::d);
152152
TypeDelegate *t = TypeDelegate::create (tf);
153-
return build_ctype (merge2 (t));
153+
return build_ctype (dmd::merge2 (t));
154154
}
155155

156156
/* Static array va_list have array->pointer conversions applied. */
157157
if (decl->isParameter () && valist_array_p (decl->type))
158158
{
159-
Type *valist = decl->type->nextOf ()->pointerTo ();
160-
valist = castMod (valist, decl->type->mod);
159+
Type *valist = dmd::pointerTo (decl->type->nextOf ());
160+
valist = dmd::castMod (valist, decl->type->mod);
161161
return build_ctype (valist);
162162
}
163163

@@ -200,14 +200,14 @@ parameter_type (Parameter *arg)
200200
TypeFunction *tf = TypeFunction::create (NULL, arg->type,
201201
VARARGnone, LINK::d);
202202
TypeDelegate *t = TypeDelegate::create (tf);
203-
return build_ctype (merge2 (t));
203+
return build_ctype (dmd::merge2 (t));
204204
}
205205

206206
/* Static array va_list have array->pointer conversions applied. */
207207
if (valist_array_p (arg->type))
208208
{
209-
Type *valist = arg->type->nextOf ()->pointerTo ();
210-
valist = castMod (valist, arg->type->mod);
209+
Type *valist = dmd::pointerTo (arg->type->nextOf ());
210+
valist = dmd::castMod (valist, arg->type->mod);
211211
return build_ctype (valist);
212212
}
213213

@@ -1089,7 +1089,7 @@ build_array_struct_comparison (tree_code code, StructDeclaration *sd,
10891089
add_stmt (build_assign (INIT_EXPR, result, init));
10901090

10911091
/* Cast pointer-to-array to pointer-to-struct. */
1092-
tree ptrtype = build_ctype (sd->type->pointerTo ());
1092+
tree ptrtype = build_ctype (dmd::pointerTo (sd->type));
10931093
tree lentype = TREE_TYPE (length);
10941094

10951095
push_binding_level (level_block);
@@ -1859,7 +1859,7 @@ void_okay_p (tree t)
18591859

18601860
if (VOID_TYPE_P (TREE_TYPE (type)))
18611861
{
1862-
tree totype = build_ctype (Type::tuns8->pointerTo ());
1862+
tree totype = build_ctype (dmd::pointerTo (Type::tuns8));
18631863
return fold_convert (totype, t);
18641864
}
18651865

gcc/d/d-convert.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ convert_expr (tree exp, Type *etype, Type *totype)
470470
dinteger_t esize = ebtype->nextOf ()->size ();
471471
dinteger_t tsize = tbtype->nextOf ()->size ();
472472

473-
tree ptrtype = build_ctype (tbtype->nextOf ()->pointerTo ());
473+
tree ptrtype = build_ctype (dmd::pointerTo (tbtype->nextOf ()));
474474

475475
if (esize != tsize)
476476
{
@@ -727,12 +727,12 @@ check_valist_conversion (Expression *expr, Type *totype, bool in_assignment)
727727
if (VarExp *ve = expr->isVarExp ())
728728
{
729729
decl = ve->var;
730-
type = ve->var->type->nextOf ()->pointerTo ();
730+
type = dmd::pointerTo (ve->var->type->nextOf ());
731731
}
732732
else if (SymOffExp *se = expr->isSymOffExp ())
733733
{
734734
decl = se->var;
735-
type = se->var->type->nextOf ()->pointerTo ()->pointerTo ();
735+
type = dmd::pointerTo (dmd::pointerTo (se->var->type->nextOf ()));
736736
}
737737

738738
/* Should not be called unless is_valist_parameter_type also matched. */

gcc/d/d-lang.cc

+13-13
Original file line numberDiff line numberDiff line change
@@ -1029,8 +1029,8 @@ d_generate_ddoc_file (Module *m, OutBuffer &ddocbuf)
10291029
d_read_ddoc_files (global.params.ddoc.files, ddocbuf);
10301030

10311031
OutBuffer ddocbuf_out;
1032-
gendocfile (m, ddocbuf.peekChars (), ddocbuf.length (), global.datetime,
1033-
global.errorSink, ddocbuf_out);
1032+
dmd::gendocfile (m, ddocbuf.peekChars (), ddocbuf.length (), global.datetime,
1033+
global.errorSink, ddocbuf_out);
10341034

10351035
d_write_file (m->docfile.toChars (), ddocbuf_out.peekChars ());
10361036
}
@@ -1205,7 +1205,7 @@ d_parse_file (void)
12051205
message ("import %s", m->toChars ());
12061206

12071207
OutBuffer buf;
1208-
genhdrfile (m, global.params.dihdr.fullOutput, buf);
1208+
dmd::genhdrfile (m, global.params.dihdr.fullOutput, buf);
12091209
d_write_file (m->hdrfile.toChars (), buf.peekChars ());
12101210
}
12111211

@@ -1223,7 +1223,7 @@ d_parse_file (void)
12231223
if (global.params.v.verbose)
12241224
message ("importall %s", m->toChars ());
12251225

1226-
importAll (m, NULL);
1226+
dmd::importAll (m, NULL);
12271227
}
12281228

12291229
if (global.errors)
@@ -1247,7 +1247,7 @@ d_parse_file (void)
12471247
if (global.params.v.verbose)
12481248
message ("semantic %s", m->toChars ());
12491249

1250-
dsymbolSemantic (m, NULL);
1250+
dmd::dsymbolSemantic (m, NULL);
12511251
}
12521252

12531253
/* Do deferred semantic analysis. */
@@ -1278,7 +1278,7 @@ d_parse_file (void)
12781278
if (global.params.v.verbose)
12791279
message ("semantic2 %s", m->toChars ());
12801280

1281-
semantic2 (m, NULL);
1281+
dmd::semantic2 (m, NULL);
12821282
}
12831283

12841284
Module::runDeferredSemantic2 ();
@@ -1294,7 +1294,7 @@ d_parse_file (void)
12941294
if (global.params.v.verbose)
12951295
message ("semantic3 %s", m->toChars ());
12961296

1297-
semantic3 (m, NULL);
1297+
dmd::semantic3 (m, NULL);
12981298
}
12991299

13001300
Module::runDeferredSemantic3 ();
@@ -1318,7 +1318,7 @@ d_parse_file (void)
13181318
/* Declare the name of the root module as the first global name in order
13191319
to make the middle-end fully deterministic. */
13201320
OutBuffer buf;
1321-
mangleToBuffer (Module::rootModule, buf);
1321+
dmd::mangleToBuffer (Module::rootModule, buf);
13221322
first_global_object_name = buf.extractChars ();
13231323
}
13241324

@@ -1341,15 +1341,15 @@ d_parse_file (void)
13411341

13421342
if (global.params.v.templates)
13431343
{
1344-
printTemplateStats (global.params.v.templatesListInstances,
1345-
global.errorSink);
1344+
dmd::printTemplateStats (global.params.v.templatesListInstances,
1345+
global.errorSink);
13461346
}
13471347

13481348
/* Generate JSON files. */
13491349
if (global.params.json.doOutput)
13501350
{
13511351
OutBuffer buf;
1352-
json_generate (modules, buf);
1352+
dmd::json_generate (modules, buf);
13531353
d_write_file (global.params.json.name.ptr, buf.peekChars ());
13541354
}
13551355

@@ -1372,14 +1372,14 @@ d_parse_file (void)
13721372
OutBuffer buf;
13731373
buf.doindent = 1;
13741374

1375-
moduleToBuffer (buf, true, m);
1375+
dmd::moduleToBuffer (buf, true, m);
13761376
message ("%s", buf.peekChars ());
13771377
}
13781378
}
13791379

13801380
/* Generate C++ header files. */
13811381
if (global.params.cxxhdr.doOutput)
1382-
genCppHdrFiles (modules);
1382+
dmd::genCppHdrFiles (modules);
13831383

13841384
if (global.errors)
13851385
goto had_errors;

gcc/d/d-target.cc

+6-6
Original file line numberDiff line numberDiff line change
@@ -335,15 +335,15 @@ Target::isVectorOpSupported (Type *type, EXP op, Type *)
335335
const char *
336336
TargetCPP::toMangle (Dsymbol *s)
337337
{
338-
return toCppMangleItanium (s);
338+
return dmd::toCppMangleItanium (s);
339339
}
340340

341341
/* Return the symbol mangling of CD for C++ linkage. */
342342

343343
const char *
344344
TargetCPP::typeInfoMangle (ClassDeclaration *cd)
345345
{
346-
return cppTypeInfoMangleItanium (cd);
346+
return dmd::cppTypeInfoMangleItanium (cd);
347347
}
348348

349349
/* Get mangle name of a this-adjusting thunk to the function declaration FD
@@ -352,7 +352,7 @@ TargetCPP::typeInfoMangle (ClassDeclaration *cd)
352352
const char *
353353
TargetCPP::thunkMangle (FuncDeclaration *fd, int offset)
354354
{
355-
return cppThunkMangleItanium (fd, offset);
355+
return dmd::cppThunkMangleItanium (fd, offset);
356356
}
357357

358358
/* For a vendor-specific type, return a string containing the C++ mangling.
@@ -381,11 +381,11 @@ TargetCPP::parameterType (Type *type)
381381
Type *tvalist = target.va_listType (Loc (), NULL);
382382
if (type->ty == TY::Tsarray && tvalist->ty == TY::Tsarray)
383383
{
384-
Type *tb = mutableOf (type->toBasetype ());
384+
Type *tb = dmd::mutableOf (type->toBasetype ());
385385
if (tb == tvalist)
386386
{
387-
tb = type->nextOf ()->pointerTo ();
388-
type = castMod (tb, type->mod);
387+
tb = dmd::pointerTo (type->nextOf ());
388+
type = dmd::castMod (tb, type->mod);
389389
}
390390
}
391391

0 commit comments

Comments
 (0)