Skip to content

Commit

Permalink
Merge pull request #4440 from kinke/merge-2.104
Browse files Browse the repository at this point in the history
Upgrade frontend & libs to v2.104.2
  • Loading branch information
kinke authored Jul 28, 2023
2 parents f806ce1 + 1a1c2a2 commit 1a93fc7
Show file tree
Hide file tree
Showing 291 changed files with 7,779 additions and 4,054 deletions.
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.104.2](https://dlang.org/changelog/2.104.0.html). (#4440)

#### Platform support

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

# Version information
set(LDC_VERSION "1.33.0") # May be overridden by git hash tag
set(LDC_VERSION "1.34.0") # May be overridden by git hash tag
set(DMDFE_MAJOR_VERSION 2)
set(DMDFE_MINOR_VERSION 103)
set(DMDFE_PATCH_VERSION 1)
set(DMDFE_MINOR_VERSION 104)
set(DMDFE_PATCH_VERSION 2)

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

Expand Down
10 changes: 5 additions & 5 deletions dmd/aggregate.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ class AggregateDeclaration : public ScopeDsymbol
Expression *getRTInfo; // pointer to GC info generated by object.RTInfo(this)

Visibility visibility;
bool noDefaultCtor; // no default construction
bool disableNew; // disallow allocations using `new`
d_bool noDefaultCtor; // no default construction
d_bool disableNew; // disallow allocations using `new`
Sizeok sizeok; // set when structsize contains valid data

virtual Scope *newScope(Scope *sc);
Expand Down Expand Up @@ -273,10 +273,10 @@ class ClassDeclaration : public AggregateDeclaration
// their own vtbl[]

TypeInfoClassDeclaration *vclassinfo; // the ClassInfo object for this ClassDeclaration
bool com; // true if this is a COM class (meaning it derives from IUnknown)
bool stack; // true if this is a scope class
d_bool com; // true if this is a COM class (meaning it derives from IUnknown)
d_bool stack; // true if this is a scope class
int cppDtorVtblIndex; // slot reserved for the virtual destructor [extern(C++)]
bool inuse; // to prevent recursive attempts
d_bool inuse; // to prevent recursive attempts

ThreeState isabstract; // if abstract class
Baseok baseok; // set the progress of base classes resolving
Expand Down
24 changes: 19 additions & 5 deletions dmd/aliasthis.d
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ extern (C++) final class AliasThis : Dsymbol
* Params:
* sc = context
* e = expression forming the `this`
* gag = if true do not print errors, return null instead
* 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:
Expand All @@ -93,7 +93,7 @@ Expression resolveAliasThis(Scope* sc, Expression e, bool gag = false, bool find
{
Loc loc = e.loc;
Type tthis = (e.op == EXP.type ? e.type : null);
const flags = DotExpFlag.noAliasThis | (gag ? DotExpFlag.gag : 0);
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)
Expand Down Expand Up @@ -200,15 +200,29 @@ bool checkDeprecatedAliasThis(AliasThis at, const ref Loc loc, Scope* sc)

/**************************************
* 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
* t = 'alias this' type
* att = type reference used to detect recursion. Should be initialized to `null`.
* t = type of 'alias this' rewrite to attempt
*
* Returns:
* Whether the 'alias this' is recursive or not
* `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;
Expand Down
2 changes: 1 addition & 1 deletion dmd/apply.d
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public:
{
if (e.stageflags & stageApply)
return;
int old = e.stageflags;
const old = e.stageflags;
e.stageflags |= stageApply;
doCond(e.elements.peekSlice()) || applyTo(e);
e.stageflags = old;
Expand Down
25 changes: 22 additions & 3 deletions dmd/astenums.d
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ enum TY : ubyte
Tmixin,
Tnoreturn,
Ttag,
TMAX
}
enum TMAX = TY.max + 1;

alias Tarray = TY.Tarray;
alias Tsarray = TY.Tsarray;
Expand Down Expand Up @@ -265,7 +265,6 @@ alias Ttraits = TY.Ttraits;
alias Tmixin = TY.Tmixin;
alias Tnoreturn = TY.Tnoreturn;
alias Ttag = TY.Ttag;
alias TMAX = TY.TMAX;

enum TFlags
{
Expand Down Expand Up @@ -328,6 +327,7 @@ enum VarArg : ubyte
variadic = 1, /// (T t, ...) can be C-style (core.stdc.stdarg) or D-style (core.vararg)
typesafe = 2, /// (T t ...) typesafe https://dlang.org/spec/function.html#typesafe_variadic_functions
/// or https://dlang.org/spec/function.html#typesafe_variadic_functions
KRvariadic = 3, /// K+R C style variadics (no function prototype)
}

/*************************
Expand All @@ -339,7 +339,7 @@ enum STMT : ubyte
Error,
Peel,
Exp, DtorExp,
Compile,
Mixin,
Compound, CompoundDeclaration, CompoundAsm,
UnrolledLoop,
Scope,
Expand Down Expand Up @@ -439,3 +439,22 @@ enum FileType : ubyte
ddoc, /// Ddoc documentation file (.dd)
c, /// C source file
}

extern (C++) struct structalign_t
{
private:
ushort value = 0; // unknown
enum STRUCTALIGN_DEFAULT = 1234; // default = match whatever the corresponding C compiler does
bool pack; // use #pragma pack semantics

public:
pure @safe @nogc nothrow:
bool isDefault() const { return value == STRUCTALIGN_DEFAULT; }
void setDefault() { value = STRUCTALIGN_DEFAULT; }
bool isUnknown() const { return value == 0; } // value is not set
void setUnknown() { value = 0; }
void set(uint value) { this.value = cast(ushort)value; }
uint get() const { return value; }
bool isPack() const { return pack; }
void setPack(bool pack) { this.pack = pack; }
}
27 changes: 20 additions & 7 deletions dmd/attrib.d
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ extern (C++) abstract class AttribDeclaration : Dsymbol
this.decl = decl;
}

extern (D) this(const ref Loc loc, Dsymbols* decl)
{
super(loc, null);
this.decl = decl;
}

extern (D) this(const ref Loc loc, Identifier ident, Dsymbols* decl)
{
super(loc, ident);
Expand Down Expand Up @@ -228,6 +234,12 @@ extern (C++) class StorageClassDeclaration : AttribDeclaration
this.stc = stc;
}

extern (D) this(const ref Loc loc, StorageClass stc, Dsymbols* decl)
{
super(loc, decl);
this.stc = stc;
}

override StorageClassDeclaration syntaxCopy(Dsymbol s)
{
assert(!s);
Expand Down Expand Up @@ -1300,7 +1312,8 @@ extern(C++) final class ForwardingAttribDeclaration : AttribDeclaration
* mixin("int x");
* https://dlang.org/spec/module.html#mixin-declaration
*/
extern (C++) final class CompileDeclaration : AttribDeclaration
// Note: was CompileDeclaration
extern (C++) final class MixinDeclaration : AttribDeclaration
{
Expressions* exps;
ScopeDsymbol scopesym;
Expand All @@ -1309,19 +1322,19 @@ extern (C++) final class CompileDeclaration : AttribDeclaration
extern (D) this(const ref Loc loc, Expressions* exps)
{
super(loc, null, null);
//printf("CompileDeclaration(loc = %d)\n", loc.linnum);
//printf("MixinDeclaration(loc = %d)\n", loc.linnum);
this.exps = exps;
}

override CompileDeclaration syntaxCopy(Dsymbol s)
override MixinDeclaration syntaxCopy(Dsymbol s)
{
//printf("CompileDeclaration::syntaxCopy('%s')\n", toChars());
return new CompileDeclaration(loc, Expression.arraySyntaxCopy(exps));
//printf("MixinDeclaration::syntaxCopy('%s')\n", toChars());
return new MixinDeclaration(loc, Expression.arraySyntaxCopy(exps));
}

override void addMember(Scope* sc, ScopeDsymbol sds)
{
//printf("CompileDeclaration::addMember(sc = %p, sds = %p, memnum = %d)\n", sc, sds, memnum);
//printf("MixinDeclaration::addMember(sc = %p, sds = %p, memnum = %d)\n", sc, sds, memnum);
this.scopesym = sds;
}

Expand All @@ -1335,7 +1348,7 @@ extern (C++) final class CompileDeclaration : AttribDeclaration
return "mixin";
}

override inout(CompileDeclaration) isCompileDeclaration() inout
override inout(MixinDeclaration) isMixinDeclaration() inout
{
return this;
}
Expand Down
16 changes: 8 additions & 8 deletions dmd/attrib.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class AlignDeclaration final : public AttribDeclaration
class AnonDeclaration final : public AttribDeclaration
{
public:
bool isunion;
d_bool isunion;
int sem; // 1 if successful semantic()
unsigned anonoffset; // offset of anonymous struct
unsigned anonstructsize; // size of anonymous struct
Expand Down Expand Up @@ -175,8 +175,8 @@ class StaticIfDeclaration final : public ConditionalDeclaration
{
public:
ScopeDsymbol *scopesym;
bool addisdone;
bool onStack;
d_bool addisdone;
d_bool onStack;

StaticIfDeclaration *syntaxCopy(Dsymbol *s) override;
Dsymbols *include(Scope *sc) override;
Expand All @@ -193,8 +193,8 @@ class StaticForeachDeclaration final : public AttribDeclaration
public:
StaticForeach *sfe;
ScopeDsymbol *scopesym;
bool onStack;
bool cached;
d_bool onStack;
d_bool cached;
Dsymbols *cache;

StaticForeachDeclaration *syntaxCopy(Dsymbol *s) override;
Expand All @@ -221,15 +221,15 @@ class ForwardingAttribDeclaration final : public AttribDeclaration

// Mixin declarations

class CompileDeclaration final : public AttribDeclaration
class MixinDeclaration final : public AttribDeclaration
{
public:
Expressions *exps;

ScopeDsymbol *scopesym;
bool compiled;
d_bool compiled;

CompileDeclaration *syntaxCopy(Dsymbol *s) override;
MixinDeclaration *syntaxCopy(Dsymbol *s) override;
void addMember(Scope *sc, ScopeDsymbol *sds) override;
void setScope(Scope *sc) override;
const char *kind() const override;
Expand Down
Loading

0 comments on commit 1a93fc7

Please sign in to comment.