Skip to content

Commit 1cc0f7f

Browse files
authored
Merge pull request #3620 from kinke/merge-2.095
Upgrade frontend & libs to v2.095.0+
2 parents d4a5722 + b7087e0 commit 1cc0f7f

Some content is hidden

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

114 files changed

+4455
-3079
lines changed

.azure-pipelines/posix.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ steps:
441441
mkdir bin
442442
$DMD -w -de -dip1000 rdmd.d -of=bin/rdmd
443443
$DMD -w -de -dip1000 ddemangle.d -of=bin/ddemangle
444-
$DMD -w -de -dip1000 DustMite/dustmite.d DustMite/splitter.d -of=bin/dustmite
444+
$DMD -w -de -dip1000 DustMite/dustmite.d DustMite/splitter.d DustMite/polyhash.d -of=bin/dustmite
445445
cp bin/{rdmd,ddemangle,dustmite} ../installed/bin
446446
displayName: Build & copy dlang tools
447447

.azure-pipelines/windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ steps:
205205
powershell -c "git checkout \"$(cat %BUILD_SOURCESDIRECTORY%/packaging/dlang-tools_version -Raw)\"" 2>&1
206206
%DMD% -w -de -dip1000 rdmd.d || exit /b
207207
%DMD% -w -de -dip1000 ddemangle.d || exit /b
208-
%DMD% -w -de -dip1000 DustMite\dustmite.d DustMite\splitter.d || exit /b
208+
%DMD% -w -de -dip1000 DustMite\dustmite.d DustMite\splitter.d DustMite\polyhash.d || exit /b
209209
cp *.exe ../installed/bin
210210
displayName: Build & copy dlang tools
211211

.cirrus.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ task:
247247
mkdir bin
248248
$DMD -w -de -dip1000 rdmd.d -of=bin/rdmd
249249
$DMD -w -de -dip1000 ddemangle.d -of=bin/ddemangle
250-
$DMD -w -de -dip1000 DustMite/dustmite.d DustMite/splitter.d -of=bin/dustmite
250+
$DMD -w -de -dip1000 DustMite/dustmite.d DustMite/splitter.d DustMite/polyhash.d -of=bin/dustmite
251251
cp bin/{rdmd,ddemangle,dustmite} ../installed/bin
252252
# Pack artifact
253253
pack_artifact_script: |

CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ include(GetLinuxDistribution)
110110
#
111111

112112
# Version information
113-
set(LDC_VERSION "1.24.0") # May be overridden by git hash tag
113+
set(LDC_VERSION "1.25.0") # May be overridden by git hash tag
114114
set(DMDFE_MAJOR_VERSION 2)
115115
set(DMDFE_MINOR_VERSION 0)
116-
set(DMDFE_PATCH_VERSION 94)
117-
set(DMDFE_FIX_LEVEL 1)
116+
set(DMDFE_PATCH_VERSION 95)
117+
set(DMDFE_FIX_LEVEL 0)
118118

119119
set(DMD_VERSION ${DMDFE_MAJOR_VERSION}.${DMDFE_MINOR_VERSION}${DMDFE_PATCH_VERSION})
120120
if(DEFINED DMDFE_FIX_LEVEL)

dmd/access.d

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ private bool hasProtectedAccess(Scope *sc, Dsymbol s)
163163
* Check access to d for expression e.d
164164
* Returns true if the declaration is not accessible.
165165
*/
166-
bool checkAccess(Loc loc, Scope* sc, Expression e, Declaration d)
166+
bool checkAccess(Loc loc, Scope* sc, Expression e, Dsymbol d)
167167
{
168168
if (sc.flags & SCOPE.noaccesscheck)
169169
return false;

dmd/aggregate.d

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ import dmd.tokens;
3838
import dmd.typesem : defaultInit;
3939
import dmd.visitor;
4040

41-
enum Sizeok : int
41+
enum Sizeok : ubyte
4242
{
4343
none, /// size of aggregate is not yet able to compute
4444
fwd, /// size of aggregate is ready to compute
4545
inProcess, /// in the midst of computing the size
4646
done, /// size of aggregate is set correctly
4747
}
4848

49-
enum Baseok : int
49+
enum Baseok : ubyte
5050
{
5151
none, /// base classes not computed yet
5252
start, /// in process of resolving base classes
@@ -60,7 +60,7 @@ enum Baseok : int
6060
* is an anonymous class. If the class is anonymous it is also
6161
* considered to be a D class.
6262
*/
63-
enum ClassKind : int
63+
enum ClassKind : ubyte
6464
{
6565
/// the aggregate is a d(efault) class
6666
d,

dmd/aggregate.h

+23-25
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ class InterfaceDeclaration;
2626
class TypeInfoClassDeclaration;
2727
class VarDeclaration;
2828

29-
enum Sizeok
29+
enum class Sizeok : uint8_t
3030
{
31-
SIZEOKnone, // size of aggregate is not yet able to compute
32-
SIZEOKfwd, // size of aggregate is ready to compute
33-
SIZEOKinProcess, // in the midst of computing the size
34-
SIZEOKdone // size of aggregate is set correctly
31+
none, // size of aggregate is not yet able to compute
32+
fwd, // size of aggregate is ready to compute
33+
inProcess, // in the midst of computing the size
34+
done // size of aggregate is set correctly
3535
};
3636

37-
enum Baseok
37+
enum class Baseok : uint8_t
3838
{
39-
BASEOKnone, // base classes not computed yet
40-
BASEOKin, // in process of resolving base classes
41-
BASEOKdone, // all base classes are resolved
42-
BASEOKsemanticdone // all base classes semantic done
39+
none, // base classes not computed yet
40+
in, // in process of resolving base classes
41+
done, // all base classes are resolved
42+
semanticdone // all base classes semantic done
4343
};
4444

4545
enum StructPOD
@@ -49,26 +49,23 @@ enum StructPOD
4949
ISPODfwd // POD not yet computed
5050
};
5151

52-
enum Abstract
52+
enum class Abstract : uint8_t
5353
{
54-
ABSfwdref = 0, // whether an abstract class is not yet computed
55-
ABSyes, // is abstract class
56-
ABSno // is not abstract class
54+
fwdref = 0, // whether an abstract class is not yet computed
55+
yes, // is abstract class
56+
no // is not abstract class
5757
};
5858

5959
FuncDeclaration *search_toString(StructDeclaration *sd);
6060

61-
struct ClassKind
61+
enum class ClassKind : uint8_t
6262
{
63-
enum Type
64-
{
65-
/// the aggregate is a d(efault) struct/class/interface
66-
d,
67-
/// the aggregate is a C++ struct/class/interface
68-
cpp,
69-
/// the aggregate is an Objective-C class/interface
70-
objc
71-
};
63+
/// the aggregate is a d(efault) struct/class/interface
64+
d,
65+
/// the aggregate is a C++ struct/class/interface
66+
cpp,
67+
/// the aggregate is an Objective-C class/interface
68+
objc
7269
};
7370

7471
class AggregateDeclaration : public ScopeDsymbol
@@ -81,7 +78,7 @@ class AggregateDeclaration : public ScopeDsymbol
8178
VarDeclarations fields; // VarDeclaration fields
8279
Dsymbol *deferred; // any deferred semantic2() or semantic3() symbol
8380

84-
ClassKind::Type classKind; // specifies the linkage type
81+
ClassKind classKind; // specifies the linkage type
8582
CPPMANGLE cppmangle;
8683

8784
/* !=NULL if is nested
@@ -286,6 +283,7 @@ class ClassDeclaration : public AggregateDeclaration
286283
#endif
287284

288285
static ClassDeclaration *create(Loc loc, Identifier *id, BaseClasses *baseclasses, Dsymbols *members, bool inObject);
286+
const char *toPrettyChars(bool QualifyTypes = false);
289287
Dsymbol *syntaxCopy(Dsymbol *s);
290288
Scope *newScope(Scope *sc);
291289
bool isBaseOf2(ClassDeclaration *cd);

dmd/aliasthis.d

+17-13
Original file line numberDiff line numberDiff line change
@@ -154,25 +154,29 @@ Expression resolveAliasThis(Scope* sc, Expression e, bool gag = false)
154154
*/
155155
bool checkDeprecatedAliasThis(AliasThis at, const ref Loc loc, Scope* sc)
156156
{
157-
import dmd.errors : deprecation;
157+
import dmd.errors : deprecation, Classification;
158158
import dmd.dsymbolsem : getMessage;
159159

160160
if (global.params.useDeprecated != DiagnosticReporting.off
161161
&& at.isDeprecated() && !sc.isDeprecated())
162162
{
163-
const(char)* message = null;
164-
for (Dsymbol p = at; p; p = p.parent)
165-
{
166-
message = p.depdecl ? p.depdecl.getMessage() : null;
167-
if (message)
168-
break;
169-
}
163+
const(char)* message = null;
164+
for (Dsymbol p = at; p; p = p.parent)
165+
{
166+
message = p.depdecl ? p.depdecl.getMessage() : null;
170167
if (message)
171-
deprecation(loc, "`alias %s this` is deprecated - %s",
172-
at.sym.toChars(), message);
173-
else
174-
deprecation(loc, "`alias %s this` is deprecated",
175-
at.sym.toChars());
168+
break;
169+
}
170+
if (message)
171+
deprecation(loc, "`alias %s this` is deprecated - %s",
172+
at.sym.toChars(), message);
173+
else
174+
deprecation(loc, "`alias %s this` is deprecated",
175+
at.sym.toChars());
176+
177+
if (auto ti = sc.parent ? sc.parent.isInstantiated() : null)
178+
ti.printInstantiationTrace(Classification.deprecation);
179+
176180
return true;
177181
}
178182
return false;

dmd/argtypes_x86.d

+1-1
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ extern (C++) TypeTuple toArgTypes_x86(Type t)
349349
default:
350350
return memory();
351351
}
352-
if (global.params.isFreeBSD && nfields == 1 &&
352+
if (global.params.targetOS == TargetOS.FreeBSD && nfields == 1 &&
353353
(sz == 4 || sz == 8))
354354
{
355355
/* FreeBSD changed their 32 bit ABI at some point before 10.3 for the following:

dmd/attrib.d

+40-36
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import dmd.dscope;
3333
import dmd.dsymbol;
3434
import dmd.dsymbolsem : dsymbolSemantic;
3535
import dmd.expression;
36-
import dmd.expressionsem : arrayExpressionSemantic;
36+
import dmd.expressionsem;
3737
import dmd.func;
3838
import dmd.globals;
3939
import dmd.hdrgen : protectionToBuffer;
@@ -84,7 +84,7 @@ extern (C++) abstract class AttribDeclaration : Dsymbol
8484
*/
8585
extern (D) static Scope* createNewScope(Scope* sc, StorageClass stc, LINK linkage,
8686
CPPMANGLE cppmangle, Prot protection, int explicitProtection,
87-
AlignDeclaration aligndecl, PINLINE inlining)
87+
AlignDeclaration aligndecl, PragmaDeclaration inlining)
8888
{
8989
Scope* sc2 = sc;
9090
if (stc != sc.stc ||
@@ -878,32 +878,9 @@ extern (C++) final class PragmaDeclaration : AttribDeclaration
878878
{
879879
if (ident == Id.Pinline)
880880
{
881-
PINLINE inlining = PINLINE.default_;
882-
if (!args || args.dim == 0)
883-
inlining = PINLINE.default_;
884-
else if (args.dim != 1)
885-
{
886-
error("one boolean expression expected for `pragma(inline)`, not %llu", cast(ulong) args.dim);
887-
args.setDim(1);
888-
(*args)[0] = ErrorExp.get();
889-
}
890-
else
891-
{
892-
Expression e = (*args)[0];
893-
if (e.op != TOK.int64 || !e.type.equals(Type.tbool))
894-
{
895-
if (e.op != TOK.error)
896-
{
897-
error("pragma(`inline`, `true` or `false`) expected, not `%s`", e.toChars());
898-
(*args)[0] = ErrorExp.get();
899-
}
900-
}
901-
else if (e.isBool(true))
902-
inlining = PINLINE.always;
903-
else if (e.isBool(false))
904-
inlining = PINLINE.never;
905-
}
906-
return createNewScope(sc, sc.stc, sc.linkage, sc.cppmangle, sc.protection, sc.explicitProtection, sc.aligndecl, inlining);
881+
// We keep track of this pragma inside scopes,
882+
// then it's evaluated on demand in function semantic
883+
return createNewScope(sc, sc.stc, sc.linkage, sc.cppmangle, sc.protection, sc.explicitProtection, sc.aligndecl, this);
907884
}
908885
if (ident == Id.printf || ident == Id.scanf)
909886
{
@@ -939,6 +916,34 @@ extern (C++) final class PragmaDeclaration : AttribDeclaration
939916
return sc;
940917
}
941918

919+
PINLINE evalPragmaInline(Scope* sc)
920+
{
921+
if (!args || args.dim == 0)
922+
return PINLINE.default_;
923+
924+
Expression e = (*args)[0];
925+
if (!e.type)
926+
{
927+
928+
sc = sc.startCTFE();
929+
e = e.expressionSemantic(sc);
930+
e = resolveProperties(sc, e);
931+
sc = sc.endCTFE();
932+
e = e.ctfeInterpret();
933+
e = e.toBoolean(sc);
934+
if (e.isErrorExp())
935+
error("pragma(`inline`, `true` or `false`) expected, not `%s`", (*args)[0].toChars());
936+
(*args)[0] = e;
937+
}
938+
939+
if (e.isBool(true))
940+
return PINLINE.always;
941+
else if (e.isBool(false))
942+
return PINLINE.never;
943+
else
944+
return PINLINE.default_;
945+
}
946+
942947
override const(char)* kind() const
943948
{
944949
return "pragma";
@@ -961,9 +966,9 @@ extern (C++) class ConditionalDeclaration : AttribDeclaration
961966
Condition condition; /// condition deciding whether decl or elsedecl applies
962967
Dsymbols* elsedecl; /// array of Dsymbol's for else block
963968

964-
extern (D) this(Condition condition, Dsymbols* decl, Dsymbols* elsedecl)
969+
extern (D) this(const ref Loc loc, Condition condition, Dsymbols* decl, Dsymbols* elsedecl)
965970
{
966-
super(decl);
971+
super(loc, null, decl);
967972
//printf("ConditionalDeclaration::ConditionalDeclaration()\n");
968973
this.condition = condition;
969974
this.elsedecl = elsedecl;
@@ -972,7 +977,7 @@ extern (C++) class ConditionalDeclaration : AttribDeclaration
972977
override Dsymbol syntaxCopy(Dsymbol s)
973978
{
974979
assert(!s);
975-
return new ConditionalDeclaration(condition.syntaxCopy(), Dsymbol.arraySyntaxCopy(decl), Dsymbol.arraySyntaxCopy(elsedecl));
980+
return new ConditionalDeclaration(loc, condition.syntaxCopy(), Dsymbol.arraySyntaxCopy(decl), Dsymbol.arraySyntaxCopy(elsedecl));
976981
}
977982

978983
override final bool oneMember(Dsymbol* ps, Identifier ident)
@@ -1039,16 +1044,16 @@ extern (C++) final class StaticIfDeclaration : ConditionalDeclaration
10391044
private bool addisdone = false; /// true if members have been added to scope
10401045
private bool onStack = false; /// true if a call to `include` is currently active
10411046

1042-
extern (D) this(Condition condition, Dsymbols* decl, Dsymbols* elsedecl)
1047+
extern (D) this(const ref Loc loc, Condition condition, Dsymbols* decl, Dsymbols* elsedecl)
10431048
{
1044-
super(condition, decl, elsedecl);
1049+
super(loc, condition, decl, elsedecl);
10451050
//printf("StaticIfDeclaration::StaticIfDeclaration()\n");
10461051
}
10471052

10481053
override Dsymbol syntaxCopy(Dsymbol s)
10491054
{
10501055
assert(!s);
1051-
return new StaticIfDeclaration(condition.syntaxCopy(), Dsymbol.arraySyntaxCopy(decl), Dsymbol.arraySyntaxCopy(elsedecl));
1056+
return new StaticIfDeclaration(loc, condition.syntaxCopy(), Dsymbol.arraySyntaxCopy(decl), Dsymbol.arraySyntaxCopy(elsedecl));
10521057
}
10531058

10541059
/****************************************
@@ -1150,7 +1155,7 @@ extern (C++) final class StaticForeachDeclaration : AttribDeclaration
11501155

11511156
extern (D) this(StaticForeach sfe, Dsymbols* decl)
11521157
{
1153-
super(decl);
1158+
super(sfe.loc, null, decl);
11541159
this.sfe = sfe;
11551160
}
11561161

@@ -1378,7 +1383,6 @@ extern (C++) final class UserAttributeDeclaration : AttribDeclaration
13781383
extern (D) this(Expressions* atts, Dsymbols* decl)
13791384
{
13801385
super(decl);
1381-
//printf("UserAttributeDeclaration()\n");
13821386
this.atts = atts;
13831387
}
13841388

dmd/attrib.h

+1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ class PragmaDeclaration : public AttribDeclaration
154154

155155
Dsymbol *syntaxCopy(Dsymbol *s);
156156
Scope *newScope(Scope *sc);
157+
PINLINE evalPragmaInline(Scope* sc);
157158
const char *kind() const;
158159
void accept(Visitor *v) { v->visit(this); }
159160
};

dmd/canthrow.d

-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ import dmd.apply;
1818
import dmd.arraytypes;
1919
import dmd.attrib;
2020
import dmd.declaration;
21-
import dmd.dstruct;
2221
import dmd.dsymbol;
23-
import dmd.dtemplate;
2422
import dmd.expression;
2523
import dmd.func;
2624
import dmd.globals;

0 commit comments

Comments
 (0)