Skip to content

Commit

Permalink
Merge pull request #4660 from kinke/merge-2.109
Browse files Browse the repository at this point in the history
Upgrade frontend & libs to v2.109
  • Loading branch information
kinke committed Jun 3, 2024
2 parents 5310185 + b88f991 commit 49e5732
Show file tree
Hide file tree
Showing 203 changed files with 9,374 additions and 3,793 deletions.
2 changes: 1 addition & 1 deletion .github/actions/5-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ runs:
cp build-cross/bin/ldc2_install.conf install/etc/ldc2.conf
cp -R ldc/packaging/bash_completion.d install/etc/
mkdir install/import
cp -R ldc/runtime/druntime/src/{core,etc,ldc,object.d,__builtins.di,importc.h} install/import/
cp -R ldc/runtime/druntime/src/{core,etc,ldc,object.d,__importc_builtins.di,importc.h} install/import/
cp bootstrap-ldc/runtime/import/ldc/gccbuiltins_*.di install/import/ldc/
cp -R ldc/runtime/phobos/etc/c install/import/etc/
rm -rf install/import/etc/c/zlib
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.109.0](https://dlang.org/changelog/2.109.0.html). (#4660)
- LLVM for prebuilt packages bumped to v18.1.6 (except for macOS arm64). (#4678)

#### 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.38.0") # May be overridden by git hash tag
set(LDC_VERSION "1.39.0") # May be overridden by git hash tag
set(DMDFE_MAJOR_VERSION 2)
set(DMDFE_MINOR_VERSION 108)
set(DMDFE_PATCH_VERSION 1)
set(DMDFE_MINOR_VERSION 109)
set(DMDFE_PATCH_VERSION 0)

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

Expand Down
1 change: 1 addition & 0 deletions dmd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ Note that these groups have no strict meaning, the category assignments are a bi

| File | Purpose |
|-------------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| [attribsem.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/attribsem.d) | Attribute semantics |
| [dsymbolsem.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dsymbolsem.d) | Do semantic 1 pass (symbol identifiers/types) |
| [enumsem.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/enumsem.d) | Enum semantics |
| [funcsem.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/funcsem.d) | Function semantics |
Expand Down
2 changes: 1 addition & 1 deletion dmd/argtypes_aarch64.d
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import dmd.mtype;
* This breaks a type down into 'simpler' types that can be passed to a function
* in registers, and returned in registers.
* This is the implementation for the AAPCS64 ABI, based on
* https://github.com/ARM-software/abi-aa/blob/master/aapcs64/aapcs64.rst.
* $(LINK https://github.com/ARM-software/abi-aa/blob/master/aapcs64/aapcs64.rst).
* Params:
* t = type to break down
* Returns:
Expand Down
5 changes: 4 additions & 1 deletion dmd/arrayop.d
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ Expression arrayOp(BinExp e, Scope* sc)
if (auto te = id.isTemplateExp())
arrayOp = te.td;
else
ObjectNotFound(idArrayOp); // fatal error
{
ObjectNotFound(e.loc, idArrayOp); // fatal error
return ErrorExp.get();
}
}

auto fd = resolveFuncCall(e.loc, sc, arrayOp, tiargs, null, ArgumentList(args), FuncResolveFlag.standard);
Expand Down
27 changes: 27 additions & 0 deletions dmd/astenums.d
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ enum Sizeok : ubyte
done, /// size of aggregate is set correctly
}

/// D Language version
enum Edition : ubyte
{
none,
legacy, /// Before the introduction of editions
v2024, /// Experimental first new edition
latest = v2024 /// Newest edition that this compiler knows of
}

enum Baseok : ubyte
{
none, /// base classes not computed yet
Expand Down Expand Up @@ -441,6 +450,24 @@ enum FileType : ubyte
c, /// C source file
}

/// In which context checks for assertions, contracts, bounds checks etc. are enabled
enum CHECKENABLE : ubyte
{
_default, /// initial value
off, /// never do checking
on, /// always do checking
safeonly, /// do checking only in @safe functions
}

/// What should happend when an assertion fails
enum CHECKACTION : ubyte
{
D, /// call D assert on failure
C, /// call C assert on failure
halt, /// cause program halt on failure
context, /// call D assert with the error context on failure
}

extern (C++) struct structalign_t
{
private:
Expand Down
53 changes: 0 additions & 53 deletions dmd/attrib.d
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import dmd.dsymbol;
import dmd.dsymbolsem;
import dmd.errors;
import dmd.expression;
import dmd.expressionsem;
import dmd.func;
import dmd.globals;
import dmd.hdrgen : visibilityToBuffer;
Expand Down Expand Up @@ -1142,21 +1141,6 @@ extern (C++) final class UserAttributeDeclaration : AttribDeclaration
return udas;
}

Expressions* getAttributes()
{
if (auto sc = _scope)
{
_scope = null;
arrayExpressionSemantic(atts.peekSlice(), sc);
}
auto exps = new Expressions();
if (userAttribDecl && userAttribDecl !is this)
exps.push(new TupleExp(Loc.initial, userAttribDecl.getAttributes()));
if (atts && atts.length)
exps.push(new TupleExp(Loc.initial, atts));
return exps;
}

override const(char)* kind() const
{
return "UserAttribute";
Expand Down Expand Up @@ -1252,43 +1236,6 @@ bool isCoreUda(Dsymbol sym, Identifier ident)
return _module && _module.isCoreModule(Id.attribute);
}

/**
* Iterates the UDAs attached to the given symbol.
*
* Params:
* sym = the symbol to get the UDAs from
* sc = scope to use for semantic analysis of UDAs
* dg = called once for each UDA
*
* Returns:
* If `dg` returns `!= 0`, stops the iteration and returns that value.
* Otherwise, returns 0.
*/
int foreachUda(Dsymbol sym, Scope* sc, int delegate(Expression) dg)
{
if (!sym.userAttribDecl)
return 0;

auto udas = sym.userAttribDecl.getAttributes();
arrayExpressionSemantic(udas.peekSlice(), sc, true);

return udas.each!((uda) {
if (!uda.isTupleExp())
return 0;

auto exps = uda.isTupleExp().exps;

return exps.each!((e) {
assert(e);

if (auto result = dg(e))
return result;

return 0;
});
});
}

/**
* Iterates the UDAs attached to the given symbol, without performing semantic
* analysis.
Expand Down
6 changes: 5 additions & 1 deletion dmd/attrib.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ class Expression;
class Condition;
class StaticForeach;

namespace dmd
{
Expressions *getAttributes(UserAttributeDeclaration *a);
}

/**************************************************************/

class AttribDeclaration : public Dsymbol
Expand Down Expand Up @@ -226,7 +231,6 @@ class UserAttributeDeclaration final : public AttribDeclaration

UserAttributeDeclaration *syntaxCopy(Dsymbol *s) override;
Scope *newScope(Scope *sc) override;
Expressions *getAttributes();
const char *kind() const override;
void accept(Visitor *v) override { v->visit(this); }
};
87 changes: 87 additions & 0 deletions dmd/attribsem.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/**
* Does semantic analysis for attributes.
*
* The term 'attribute' refers to things that can apply to a larger scope than a single declaration.
* Among them are:
* - Alignment (`align(8)`)
* - User defined attributes (`@UDA`)
* - Function Attributes (`@safe`)
* - Storage classes (`static`, `__gshared`)
* - Mixin declarations (`mixin("int x;")`)
* - Conditional compilation (`static if`, `static foreach`)
* - Linkage (`extern(C)`)
* - Anonymous structs / unions
* - Protection (`private`, `public`)
* - Deprecated declarations (`@deprecated`)
*
* 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/attribsem.d, _attrib.d)
* Documentation: https://dlang.org/phobos/dmd_attribsem.html
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/attribsem.d
*/

module dmd.attribsem;

import dmd.arraytypes;
import dmd.attrib;
import dmd.dscope;
import dmd.dsymbol;
import dmd.expression;
import dmd.expressionsem;
import dmd.location;
import dmd.root.array; // for each


Expressions* getAttributes(UserAttributeDeclaration a)
{
if (auto sc = a._scope)
{
a._scope = null;
arrayExpressionSemantic(a.atts.peekSlice(), sc);
}
auto exps = new Expressions();
if (a.userAttribDecl && a.userAttribDecl !is a)
exps.push(new TupleExp(Loc.initial, a.userAttribDecl.getAttributes()));
if (a.atts && a.atts.length)
exps.push(new TupleExp(Loc.initial, a.atts));
return exps;
}

/**
* Iterates the UDAs attached to the given symbol.
*
* Params:
* sym = the symbol to get the UDAs from
* sc = scope to use for semantic analysis of UDAs
* dg = called once for each UDA
*
* Returns:
* If `dg` returns `!= 0`, stops the iteration and returns that value.
* Otherwise, returns 0.
*/
int foreachUda(Dsymbol sym, Scope* sc, int delegate(Expression) dg)
{
if (!sym.userAttribDecl)
return 0;

auto udas = sym.userAttribDecl.getAttributes();
arrayExpressionSemantic(udas.peekSlice(), sc, true);

return udas.each!((uda) {
if (!uda.isTupleExp())
return 0;

auto exps = uda.isTupleExp().exps;

return exps.each!((e) {
assert(e);

if (auto result = dg(e))
return result;

return 0;
});
});
}
Loading

0 comments on commit 49e5732

Please sign in to comment.