Skip to content

Commit

Permalink
Merge pull request #4563 from kinke/merge-2.107
Browse files Browse the repository at this point in the history
Upgrade frontend & libs to v2.107
  • Loading branch information
kinke committed Feb 5, 2024
2 parents cbdce51 + 3cb389a commit eeeebff
Show file tree
Hide file tree
Showing 401 changed files with 16,386 additions and 14,420 deletions.
3 changes: 2 additions & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ packaging_steps_template: &PACKAGING_STEPS_TEMPLATE
git clone --recursive https://github.com/atilaneves/reggae.git
cd reggae
git checkout "$(cat $CIRRUS_WORKING_DIR/packaging/reggae_version)"
DFLAGS="-O -linkonce-templates" ../dub/bin/dub build -v --combined --compiler="$PWD/../installed/bin/ldc2"
# needs rdmd in PATH
PATH="$PWD/../installed/bin:$PATH" DFLAGS="-O -linkonce-templates" ../dub/bin/dub build -v --build-mode=allAtOnce --combined --compiler="$PWD/../installed/bin/ldc2"
cp bin/reggae ../installed/bin
../installed/bin/reggae --version -b ninja
# Pack artifact
Expand Down
4 changes: 4 additions & 0 deletions .github/actions/7-package/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ runs:
archFlag=''
if [[ '${{ inputs.cross_target_triple }}' != '' ]]; then
archFlag='--arch=${{ inputs.cross_target_triple }}'
# run the preGenerateCommand manually; it must be a native build
sed -i${{ runner.os == 'macOS' && ' ""' || '' }} 's|^ "preGenerateCommands": \["rdmd \$PACKAGE_DIR/list_payload.d \$PACKAGE_DIR"\],$||' dub.json
"$(dirname "$DMD")/ldc2" -run list_payload.d .
fi
# use host compiler's dub, which is guaranteed to be native
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# LDC master

#### Big news
- Frontend, druntime and Phobos are at version [2.107.0](https://dlang.org/changelog/2.107.0.html). (#4563)

#### Platform support

Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ include(GetLinuxDistribution)
#

# Version information
set(LDC_VERSION "1.36.0") # May be overridden by git hash tag
set(LDC_VERSION "1.37.0") # May be overridden by git hash tag
set(DMDFE_MAJOR_VERSION 2)
set(DMDFE_MINOR_VERSION 106)
set(DMDFE_PATCH_VERSION 1)
set(DMDFE_MINOR_VERSION 107)
set(DMDFE_PATCH_VERSION 0)

set(DMD_VERSION ${DMDFE_MAJOR_VERSION}.${DMDFE_MINOR_VERSION}.${DMDFE_PATCH_VERSION})

Expand Down
2 changes: 1 addition & 1 deletion dmd/access.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Specification: $(LINK2 https://dlang.org/spec/attribute.html#visibility_attributes, Visibility Attributes)
*
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/access.d, _access.d)
Expand Down
16 changes: 3 additions & 13 deletions dmd/aggregate.d
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Specification: $(LINK2 https://dlang.org/spec/struct.html, Structs, Unions),
* $(LINK2 https://dlang.org/spec/class.html, Class).
*
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/aggregate.d, _aggregate.d)
Expand Down Expand Up @@ -65,7 +65,7 @@ enum ClassKind : ubyte
* Returns:
* 0-terminated string for `c`
*/
const(char)* toChars(ClassKind c) @safe
const(char)* ClassKindToChars(ClassKind c) @safe
{
final switch (c)
{
Expand Down Expand Up @@ -178,16 +178,6 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
return sc2;
}

override final void setScope(Scope* sc)
{
// Might need a scope to resolve forward references. The check for
// semanticRun prevents unnecessary setting of _scope during deferred
// setScope phases for aggregates which already finished semantic().
// See https://issues.dlang.org/show_bug.cgi?id=16607
if (semanticRun < PASS.semanticdone)
ScopeDsymbol.setScope(sc);
}

/***************************************
* Returns:
* The total number of fields minus the number of hidden fields.
Expand Down Expand Up @@ -663,7 +653,7 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
*/
extern (D) final Dsymbol searchCtor()
{
auto s = search(Loc.initial, Id.ctor);
auto s = this.search(Loc.initial, Id.ctor);
if (s)
{
if (!(s.isCtorDeclaration() ||
Expand Down
5 changes: 1 addition & 4 deletions dmd/aggregate.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/* Compiler implementation of the D programming language
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
* written by Walter Bright
* https://www.digitalmars.com
* Distributed under the Boost Software License, Version 1.0.
Expand Down Expand Up @@ -113,7 +113,6 @@ class AggregateDeclaration : public ScopeDsymbol
Sizeok sizeok; // set when structsize contains valid data

virtual Scope *newScope(Scope *sc);
void setScope(Scope *sc) override final;
virtual void finalizeSize() = 0;
uinteger_t size(const Loc &loc) override final;
bool fill(const Loc &loc, Expressions &elements, bool ctorinit);
Expand Down Expand Up @@ -169,7 +168,6 @@ class StructDeclaration : public AggregateDeclaration
public:
static StructDeclaration *create(const Loc &loc, Identifier *id, bool inObject);
StructDeclaration *syntaxCopy(Dsymbol *s) override;
Dsymbol *search(const Loc &loc, Identifier *ident, int flags = SearchLocalsOnly) override final;
const char *kind() const override;
void finalizeSize() override final;
bool isPOD();
Expand Down Expand Up @@ -291,7 +289,6 @@ class ClassDeclaration : public AggregateDeclaration
virtual bool isBaseOf(ClassDeclaration *cd, int *poffset);

bool isBaseInfoComplete();
Dsymbol *search(const Loc &loc, Identifier *ident, int flags = SearchLocalsOnly) override final;
void finalizeSize() override;
bool hasMonitor();
bool isFuncHidden(FuncDeclaration *fd);
Expand Down
168 changes: 2 additions & 166 deletions dmd/aliasthis.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Specification: $(LINK2 https://dlang.org/spec/class.html#alias-this, Alias This)
*
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/aliasthis.d, _aliasthis.d)
Expand All @@ -14,16 +14,10 @@
module dmd.aliasthis;

import core.stdc.stdio;
import dmd.aggregate;
import dmd.dscope;

import dmd.dsymbol;
import dmd.expression;
import dmd.expressionsem;
import dmd.globals;
import dmd.identifier;
import dmd.location;
import dmd.mtype;
import dmd.tokens;
import dmd.visitor;

/***********************************************************
Expand Down Expand Up @@ -71,161 +65,3 @@ extern (C++) final class AliasThis : Dsymbol
return this.isDeprecated_;
}
}

/*************************************
* Find the `alias this` symbol of e's type.
* Params:
* sc = context
* e = expression forming the `this`
* gag = do not print errors, return `null` instead
* findOnly = don't do further processing like resolving properties,
* i.e. just return plain dotExp() result.
* Returns:
* Expression that is `e.aliasthis`
*/
Expression resolveAliasThis(Scope* sc, Expression e, bool gag = false, bool findOnly = false)
{
import dmd.typesem : dotExp;
for (AggregateDeclaration ad = isAggregate(e.type); ad;)
{
if (ad.aliasthis)
{
Loc loc = e.loc;
Type tthis = (e.op == EXP.type ? e.type : null);
const flags = cast(DotExpFlag) (DotExpFlag.noAliasThis | (gag * DotExpFlag.gag));
uint olderrors = gag ? global.startGagging() : 0;
e = dotExp(ad.type, sc, e, ad.aliasthis.ident, flags);
if (!e || findOnly)
return gag && global.endGagging(olderrors) ? null : e;

if (tthis && ad.aliasthis.sym.needThis())
{
if (auto ve = e.isVarExp())
{
if (auto fd = ve.var.isFuncDeclaration())
{
// https://issues.dlang.org/show_bug.cgi?id=13009
// Support better match for the overloaded alias this.
bool hasOverloads;
if (auto f = fd.overloadModMatch(loc, tthis, hasOverloads))
{
if (!hasOverloads)
fd = f; // use exact match
e = new VarExp(loc, fd, hasOverloads);
e.type = f.type;
e = new CallExp(loc, e);
goto L1;
}
}
}
/* non-@property function is not called inside typeof(),
* so resolve it ahead.
*/
{
int save = sc.intypeof;
sc.intypeof = 1; // bypass "need this" error check
e = resolveProperties(sc, e);
sc.intypeof = save;
}
L1:
e = new TypeExp(loc, new TypeTypeof(loc, e));
e = e.expressionSemantic(sc);
}
e = resolveProperties(sc, e);
if (!gag)
ad.aliasthis.checkDeprecatedAliasThis(loc, sc);
else if (global.endGagging(olderrors))
e = null;
}

import dmd.dclass : ClassDeclaration;
auto cd = ad.isClassDeclaration();
if ((!e || !ad.aliasthis) && cd && cd.baseClass && cd.baseClass != ClassDeclaration.object)
{
ad = cd.baseClass;
continue;
}
break;
}
return e;
}

/**
* Check if an `alias this` is deprecated
*
* Usually one would use `expression.checkDeprecated(scope, aliasthis)` to
* check if `expression` uses a deprecated `aliasthis`, but this calls
* `toPrettyChars` which lead to the following message:
* "Deprecation: alias this `fullyqualified.aggregate.__anonymous` is deprecated"
*
* Params:
* at = The `AliasThis` object to check
* loc = `Loc` of the expression triggering the access to `at`
* sc = `Scope` of the expression
* (deprecations do not trigger in deprecated scopes)
*
* Returns:
* Whether the alias this was reported as deprecated.
*/
bool checkDeprecatedAliasThis(AliasThis at, const ref Loc loc, Scope* sc)
{
import dmd.errors : deprecation, Classification;
import dmd.dsymbolsem : getMessage;

if (global.params.useDeprecated != DiagnosticReporting.off
&& at.isDeprecated() && !sc.isDeprecated())
{
const(char)* message = null;
for (Dsymbol p = at; p; p = p.parent)
{
message = p.depdecl ? p.depdecl.getMessage() : null;
if (message)
break;
}
if (message)
deprecation(loc, "`alias %s this` is deprecated - %s",
at.sym.toChars(), message);
else
deprecation(loc, "`alias %s this` is deprecated",
at.sym.toChars());

if (auto ti = sc.parent ? sc.parent.isInstantiated() : null)
ti.printInstantiationTrace(Classification.deprecation);

return true;
}
return false;
}

/**************************************
* Check and set 'att' if 't' is a recursive 'alias this' type
*
* The goal is to prevent endless loops when there is a cycle in the alias this chain.
* Since there is no multiple `alias this`, the chain either ends in a leaf,
* or it loops back on itself as some point.
*
* Example: S0 -> (S1 -> S2 -> S3 -> S1)
*
* `S0` is not a recursive alias this, so this returns `false`, and a rewrite to `S1` can be tried.
* `S1` is a recursive alias this type, but since `att` is initialized to `null`,
* this still returns `false`, but `att1` is set to `S1`.
* A rewrite to `S2` and `S3` can be tried, but when we want to try a rewrite to `S1` again,
* we notice `att == t`, so we're back at the start of the loop, and this returns `true`.
*
* Params:
* att = type reference used to detect recursion. Should be initialized to `null`.
* t = type of 'alias this' rewrite to attempt
*
* Returns:
* `false` if the rewrite is safe, `true` if it would loop back around
*/
bool isRecursiveAliasThis(ref Type att, Type t)
{
//printf("+isRecursiveAliasThis(att = %s, t = %s)\n", att ? att.toChars() : "null", t.toChars());
auto tb = t.toBasetype();
if (att && tb.equivalent(att))
return true;
else if (!att && tb.checkAliasThisRec())
att = tb;
return false;
}
2 changes: 1 addition & 1 deletion dmd/aliasthis.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/* Compiler implementation of the D programming language
* Copyright (C) 2009-2023 by The D Language Foundation, All Rights Reserved
* Copyright (C) 2009-2024 by The D Language Foundation, All Rights Reserved
* written by Walter Bright
* https://www.digitalmars.com
* Distributed under the Boost Software License, Version 1.0.
Expand Down
2 changes: 1 addition & 1 deletion dmd/argtypes_aarch64.d
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Break down a D type into basic (register) types for the AArch64 ABI.
*
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
* Authors: Martin Kinkelin
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/argtypes_aarch64.d, _argtypes_aarch64.d)
Expand Down
2 changes: 1 addition & 1 deletion dmd/argtypes_sysv_x64.d
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Break down a D type into basic (register) types for the x86_64 System V ABI.
*
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
* Authors: Martin Kinkelin
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/argtypes_sysv_x64.d, _argtypes_sysv_x64.d)
Expand Down
2 changes: 1 addition & 1 deletion dmd/argtypes_x86.d
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Break down a D type into basic (register) types for the 32-bit x86 ABI.
*
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/argtypes_x86.d, _argtypes_x86.d)
Expand Down
4 changes: 2 additions & 2 deletions dmd/arrayop.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Specification: $(LINK2 https://dlang.org/spec/arrays.html#array-operations, Array Operations)
*
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/arrayop.d, _arrayop.d)
Expand Down Expand Up @@ -172,7 +172,7 @@ Expression arrayOp(BinAssignExp e, Scope* sc)
}
if (e.e1.op == EXP.arrayLiteral)
{
return e.e1.modifiableLvalue(sc, e.e1);
return e.e1.modifiableLvalue(sc);
}

return arrayOp(e.isBinExp(), sc);
Expand Down
2 changes: 1 addition & 1 deletion dmd/arraytypes.d
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Provide aliases for arrays of certain declarations or statements.
*
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/arraytypes.d, _arraytypes.d)
Expand Down
2 changes: 1 addition & 1 deletion dmd/arraytypes.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/* Compiler implementation of the D programming language
* Copyright (C) 2006-2023 by The D Language Foundation, All Rights Reserved
* Copyright (C) 2006-2024 by The D Language Foundation, All Rights Reserved
* written by Walter Bright
* https://www.digitalmars.com
* Distributed under the Boost Software License, Version 1.0.
Expand Down
2 changes: 1 addition & 1 deletion dmd/ast_node.d
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Defines the base class for all nodes which are part of the AST.
*
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/ast_node.d, _ast_node.d)
Expand Down
Loading

0 comments on commit eeeebff

Please sign in to comment.