Skip to content

Commit c428454

Browse files
committed
d: Merge dmd, druntime a6f1083699, phobos 31dedd7da
D front-end changes: - Import dmd v2.107.0. - Character postfixes can now also be used for integers of size two or four. D run-time changes: - Import druntime v2.107.0. Phobos changes: - Import phobos v2.107.0. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd a6f1083699. * dmd/VERSION: Bump version to v2.107.0 * Make-lang.in (D_FRONTEND_OBJS): Add d/pragmasem.o. * d-builtins.cc (strip_type_modifiers): Update for new front-end interface. * d-codegen.cc (declaration_type): Likewise. (parameter_type): Likewise. * d-target.cc (TargetCPP::parameterType): Likewise. * expr.cc (ExprVisitor::visit (IndexExp *)): Likewise. (ExprVisitor::visit (VarExp *)): Likewise. (ExprVisitor::visit (AssocArrayLiteralExp *)): Likewise. * runtime.cc (get_libcall_type): Likewise. * typeinfo.cc (TypeInfoVisitor::visit (TypeInfoConstDeclaration *)): Likewise. (TypeInfoVisitor::visit (TypeInfoInvariantDeclaration *)): Likewise. (TypeInfoVisitor::visit (TypeInfoSharedDeclaration *)): Likewise. (TypeInfoVisitor::visit (TypeInfoWildDeclaration *)): Likewise. * types.cc (build_ctype): Likewise. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime a6f1083699. * src/MERGE: Merge upstream phobos 31dedd7da.
1 parent 435bed3 commit c428454

Some content is hidden

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

74 files changed

+4713
-4452
lines changed

gcc/d/Make-lang.in

+1
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ D_FRONTEND_OBJS = \
163163
d/parsetimevisitor.o \
164164
d/permissivevisitor.o \
165165
d/postordervisitor.o \
166+
d/pragmasem.o \
166167
d/printast.o \
167168
d/root-aav.o \
168169
d/root-array.o \

gcc/d/d-builtins.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ strip_type_modifiers (Type *type)
690690
return tnext->pointerTo ();
691691
}
692692

693-
return type->castMod (0);
693+
return castMod (type, 0);
694694
}
695695

696696
/* Returns true if types T1 and T2 representing return types or types of

gcc/d/d-codegen.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ declaration_type (Declaration *decl)
157157
if (decl->isParameter () && valist_array_p (decl->type))
158158
{
159159
Type *valist = decl->type->nextOf ()->pointerTo ();
160-
valist = valist->castMod (decl->type->mod);
160+
valist = castMod (valist, decl->type->mod);
161161
return build_ctype (valist);
162162
}
163163

@@ -207,7 +207,7 @@ parameter_type (Parameter *arg)
207207
if (valist_array_p (arg->type))
208208
{
209209
Type *valist = arg->type->nextOf ()->pointerTo ();
210-
valist = valist->castMod (arg->type->mod);
210+
valist = castMod (valist, arg->type->mod);
211211
return build_ctype (valist);
212212
}
213213

gcc/d/d-target.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -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 = type->toBasetype ()->mutableOf ();
384+
Type *tb = mutableOf (type->toBasetype ());
385385
if (tb == tvalist)
386386
{
387387
tb = type->nextOf ()->pointerTo ();
388-
type = tb->castMod (type->mod);
388+
type = castMod (tb, type->mod);
389389
}
390390
}
391391

gcc/d/dmd/MERGE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
e7709452775d374c1e2dfb67566668ada3dec5fc
1+
a6f10836997d0b5526c8c363d781b4029c77f09f
22

33
The first line of this file holds the git revision number of the last
44
merge done from the dlang/dmd repository.

gcc/d/dmd/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ Note that these groups have no strict meaning, the category assignments are a bi
119119
| [expressionsem.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/expressionsem.d) | Do semantic analysis for expressions |
120120
| [statementsem.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/statementsem.d) | Do semantic analysis for statements |
121121
| [initsem.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/initsem.d) | Do semantic analysis for initializers |
122+
| [pragmasem.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/pragmasem.d) | Do semantic analysis for pragmas |
122123
| [templatesem.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/templatesem.d) | Do semantic analysis for templates |
123124
| [templateparamsem.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/templateparamsem.d) | Do semantic analysis for template parameters |
124125
| [typesem.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/typesem.d) | Do semantic analysis for types |

gcc/d/dmd/VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v2.107.0-beta.1
1+
v2.107.0

gcc/d/dmd/constfold.d

+3-3
Original file line numberDiff line numberDiff line change
@@ -1331,9 +1331,9 @@ int sliceCmpStringWithArray(const StringExp se1, ArrayLiteralExp ae2, size_t lo1
13311331
{
13321332
foreach (j; 0 .. len)
13331333
{
1334-
const val2 = cast(dchar)ae2[j + lo2].toInteger();
1335-
const val1 = se1.getCodeUnit(j + lo1);
1336-
const int c = val1 - val2;
1334+
const val2 = ae2[j + lo2].toInteger();
1335+
const val1 = se1.getIndex(j + lo1);
1336+
const int c = (val1 > val2) - (val1 < val2);
13371337
if (c)
13381338
return c;
13391339
}

gcc/d/dmd/cparse.d

+1-1
Original file line numberDiff line numberDiff line change
@@ -5291,7 +5291,7 @@ final class CParser(AST) : Parser!AST
52915291
auto ifn = new AST.ExpInitializer(loc, efn);
52925292
auto lenfn = new AST.IntegerExp(loc, fn.length + 1, AST.Type.tuns32); // +1 for terminating 0
52935293
auto tfn = new AST.TypeSArray(AST.Type.tchar, lenfn);
5294-
efn.type = tfn.immutableOf();
5294+
efn.type = tfn.makeImmutable();
52955295
efn.committed = true;
52965296
auto sfn = new AST.VarDeclaration(loc, tfn, Id.__func__, ifn, STC.gshared | STC.immutable_);
52975297
auto e = new AST.DeclarationExp(loc, sfn);

gcc/d/dmd/ctfeexpr.d

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import dmd.root.ctfloat;
3434
import dmd.root.port;
3535
import dmd.root.rmem;
3636
import dmd.tokens;
37+
import dmd.typesem;
3738
import dmd.visitor;
3839

3940
/****************************************************************/
@@ -640,7 +641,6 @@ bool isSafePointerCast(Type srcPointee, Type destPointee)
640641
// It's OK if function pointers differ only in safe/pure/nothrow
641642
if (srcPointee.ty == Tfunction && destPointee.ty == Tfunction)
642643
{
643-
import dmd.typesem : covariant;
644644
return srcPointee.covariant(destPointee) == Covariant.yes ||
645645
destPointee.covariant(srcPointee) == Covariant.yes;
646646
}

gcc/d/dmd/dcast.d

+12-8
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import dmd.escape;
3030
import dmd.expression;
3131
import dmd.expressionsem;
3232
import dmd.func;
33+
import dmd.funcsem;
3334
import dmd.globals;
3435
import dmd.hdrgen;
3536
import dmd.location;
@@ -720,11 +721,6 @@ extern(C++) MATCH implicitConvTo(Expression e, Type t)
720721
return m;
721722
case Tint8:
722723
case Tuns8:
723-
if (e.hexString)
724-
{
725-
m = MATCH.convert;
726-
return m;
727-
}
728724
break;
729725
case Tenum:
730726
if (tn.isTypeEnum().sym.isSpecial())
@@ -739,6 +735,14 @@ extern(C++) MATCH implicitConvTo(Expression e, Type t)
739735
break;
740736
}
741737
}
738+
if (e.hexString)
739+
{
740+
if (tn.isintegral && tn.size == e.sz)
741+
{
742+
m = MATCH.convert;
743+
return m;
744+
}
745+
}
742746
break;
743747

744748
default:
@@ -2185,7 +2189,7 @@ Expression castTo(Expression e, Scope* sc, Type t, Type att = null)
21852189

21862190
if (auto f = isFuncAddress(e))
21872191
{
2188-
if (f.checkForwardRef(e.loc))
2192+
if (checkForwardRef(f, e.loc))
21892193
{
21902194
return ErrorExp.get();
21912195
}
@@ -2441,7 +2445,7 @@ Expression castTo(Expression e, Scope* sc, Type t, Type att = null)
24412445

24422446
if (auto f = isFuncAddress(e))
24432447
{
2444-
if (f.checkForwardRef(e.loc))
2448+
if (checkForwardRef(f, e.loc))
24452449
{
24462450
return ErrorExp.get();
24472451
}
@@ -2496,7 +2500,7 @@ Expression castTo(Expression e, Scope* sc, Type t, Type att = null)
24962500

24972501
if (auto f = isFuncAddress(e))
24982502
{
2499-
if (f.checkForwardRef(e.loc))
2503+
if (checkForwardRef(f, e.loc))
25002504
{
25012505
return ErrorExp.get();
25022506
}

gcc/d/dmd/dclass.d

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import dmd.mtype;
3333
import dmd.objc;
3434
import dmd.root.rmem;
3535
import dmd.target;
36+
import dmd.typesem;
3637
import dmd.visitor;
3738

3839
/***********************************************************

gcc/d/dmd/declaration.h

-1
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,6 @@ class FuncDeclaration : public Declaration
703703
Expressions *fdensureParams(Expressions *fdep);
704704
bool equals(const RootObject * const o) const override final;
705705

706-
int findVtblIndex(Dsymbols *vtbl, int dim);
707706
bool overloadInsert(Dsymbol *s) override;
708707
bool inUnittest();
709708
static MATCH leastAsSpecialized(FuncDeclaration *f, FuncDeclaration *g, Identifiers *names);

gcc/d/dmd/denum.d

+2-5
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,16 @@ import core.stdc.stdio;
1818

1919
import dmd.astenums;
2020
import dmd.attrib;
21-
import dmd.errors;
2221
import dmd.gluelayer;
2322
import dmd.declaration;
2423
import dmd.dscope;
2524
import dmd.dsymbol;
26-
import dmd.dsymbolsem;
2725
import dmd.expression;
2826
import dmd.id;
2927
import dmd.identifier;
3028
import dmd.init;
3129
import dmd.location;
3230
import dmd.mtype;
33-
import dmd.typesem;
3431
import dmd.visitor;
3532

3633
/***********************************************************
@@ -66,6 +63,8 @@ extern (C++) final class EnumDeclaration : ScopeDsymbol
6663
import dmd.common.bitfields : generateBitFields;
6764
mixin(generateBitFields!(BitFields, ubyte));
6865

66+
Symbol* sinit;
67+
6968
extern (D) this(const ref Loc loc, Identifier ident, Type memtype)
7069
{
7170
super(loc, ident);
@@ -127,8 +126,6 @@ extern (C++) final class EnumDeclaration : ScopeDsymbol
127126
return this;
128127
}
129128

130-
Symbol* sinit;
131-
132129
override void accept(Visitor v)
133130
{
134131
v.visit(this);

gcc/d/dmd/dinterpret.d

+2-41
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ import dmd.rootobject;
5050
import dmd.root.utf;
5151
import dmd.statement;
5252
import dmd.tokens;
53+
import dmd.typesem : mutableOf;
54+
import dmd.utils : arrayCastBigEndian;
5355
import dmd.visitor;
5456

5557
/*************************************
@@ -7744,44 +7746,3 @@ private void removeHookTraceImpl(ref CallExp ce, ref FuncDeclaration fd)
77447746
if (global.params.v.verbose)
77457747
message("strip %s =>\n %s", oldCE.toChars(), ce.toChars());
77467748
}
7747-
7748-
/**
7749-
* Cast a `ubyte[]` to an array of larger integers as if we are on a big endian architecture
7750-
* Params:
7751-
* data = array with big endian data
7752-
* size = 1 for ubyte[], 2 for ushort[], 4 for uint[], 8 for ulong[]
7753-
* Returns: copy of `data`, with bytes shuffled if compiled for `version(LittleEndian)`
7754-
*/
7755-
ubyte[] arrayCastBigEndian(const ubyte[] data, size_t size)
7756-
{
7757-
ubyte[] impl(T)()
7758-
{
7759-
auto result = new T[](data.length / T.sizeof);
7760-
foreach (i; 0 .. result.length)
7761-
{
7762-
result[i] = 0;
7763-
foreach (j; 0 .. T.sizeof)
7764-
{
7765-
result[i] |= T(data[i * T.sizeof + j]) << ((T.sizeof - 1 - j) * 8);
7766-
}
7767-
}
7768-
return cast(ubyte[]) result;
7769-
}
7770-
switch (size)
7771-
{
7772-
case 1: return data.dup;
7773-
case 2: return impl!ushort;
7774-
case 4: return impl!uint;
7775-
case 8: return impl!ulong;
7776-
default: assert(0);
7777-
}
7778-
}
7779-
7780-
unittest
7781-
{
7782-
ubyte[] data = [0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22];
7783-
assert(cast(ulong[]) arrayCastBigEndian(data, 8) == [0xAABBCCDDEEFF1122]);
7784-
assert(cast(uint[]) arrayCastBigEndian(data, 4) == [0xAABBCCDD, 0xEEFF1122]);
7785-
assert(cast(ushort[]) arrayCastBigEndian(data, 2) == [0xAABB, 0xCCDD, 0xEEFF, 0x1122]);
7786-
assert(cast(ubyte[]) arrayCastBigEndian(data, 1) == data);
7787-
}

gcc/d/dmd/dmangle.d

+11-9
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,14 @@ public:
951951
OutBuffer tmp;
952952
const(char)[] q;
953953

954+
void mangleAsArray()
955+
{
956+
buf.writeByte('A');
957+
buf.print(e.len);
958+
foreach (i; 0 .. e.len)
959+
mangleInteger(e.getIndex(i));
960+
}
961+
954962
/* Write string in UTF-8 format
955963
*/
956964
switch (e.sz)
@@ -967,7 +975,7 @@ public:
967975
{
968976
dchar c;
969977
if (const s = utf_decodeWchar(slice, u, c))
970-
error(e.loc, "%.*s", cast(int)s.length, s.ptr);
978+
return mangleAsArray();
971979
else
972980
tmp.writeUTF8(c);
973981
}
@@ -981,7 +989,7 @@ public:
981989
foreach (c; slice)
982990
{
983991
if (!utf_isValidDchar(c))
984-
error(e.loc, "invalid UCS-32 char \\U%08x", c);
992+
return mangleAsArray();
985993
else
986994
tmp.writeUTF8(c);
987995
}
@@ -990,13 +998,7 @@ public:
990998
}
991999
case 8:
9921000
// String of size 8 has to be hexstring cast to long[], mangle as array literal
993-
buf.writeByte('A');
994-
buf.print(e.len);
995-
foreach (i; 0 .. e.len)
996-
{
997-
mangleInteger(e.getIndex(i));
998-
}
999-
return;
1001+
return mangleAsArray();
10001002
default:
10011003
assert(0);
10021004
}

gcc/d/dmd/dsymbol.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ enum
147147

148148
/* Flags for symbol search
149149
*/
150-
typedef uint SearchOptFlags;
150+
typedef unsigned SearchOptFlags;
151151
enum class SearchOpt : SearchOptFlags
152152
{
153153
all = 0x00, // default

0 commit comments

Comments
 (0)