Skip to content

Commit

Permalink
Merge remote-tracking branch 'ldc/master' (1.35 beta) into weka-master
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanEngelen committed Oct 11, 2023
2 parents 0625d7e + 60e45d6 commit 1ea7d47
Show file tree
Hide file tree
Showing 349 changed files with 12,842 additions and 1,963 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ jobs:
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 50
Expand Down Expand Up @@ -201,7 +201,7 @@ jobs:
- build-native
- build-cross
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Merge x86_64 & arm64 packages to universal one
uses: ./.github/actions/merge-macos

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/supported_llvm_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
env:
MACOSX_DEPLOYMENT_TARGET: 11.6 # silence `ld: warning: object file (…) was built for newer macOS version (…) than being linked (…)`
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 50
Expand All @@ -75,7 +75,7 @@ jobs:
sudo apt-get install gdb=9.1-0ubuntu1 llvm
- name: Try to restore cached LLVM
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: llvm
key: llvm-${{ matrix.llvm_version }}-${{ runner.os }}
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# LDC master

#### Big news
- Frontend, druntime and Phobos are at version [2.105.2](https://dlang.org/changelog/2.105.0.html). (#4476, #4498)
- The Windows installer now supports non-admin installs *without* an explicit `/CURRENTUSER` switch. (#4495)

#### Platform support

#### Bug fixes
- ImportC:
- Fix `static` linkage. (#4484, 4487)
- Make gcc builtins available. (#4483)
- Apple: Support weird `asm("_" "<name>")` mangling stuff. (#4485, #4486)

# LDC 1.34.0 (2023-08-26)

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

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

set(DMD_VERSION ${DMDFE_MAJOR_VERSION}.${DMDFE_MINOR_VERSION}.${DMDFE_PATCH_VERSION})
Expand Down
5 changes: 2 additions & 3 deletions dmd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ this license for that file.
| Folder | Purpose |
|--------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [dmd/](https://github.com/dlang/dmd/tree/master/compiler/src/dmd) | The dmd driver and front-end |
| [dmd/backend/](https://github.com/dlang/dmd/tree/master/compiler/src/dmd/backend) | Code generation for x86 or x86-64. Shared by the [Digital Mars C compiler](https://github.com/DigitalMars/Compiler/), but not [LDC](https://github.com/ldc-developers/ldc) or [GDC](https://gdcproject.org/). |
| [dmd/backend/](https://github.com/dlang/dmd/tree/master/compiler/src/dmd/backend) | Code generation for x86 or x86-64. Based on [DMC](https://github.com/DigitalMars/Compiler/)'s backend, but not kept in sync anymore. Not used by [LDC](https://github.com/ldc-developers/ldc) or [GDC](https://gdcproject.org/). |
| [dmd/common/](https://github.com/dlang/dmd/tree/master/compiler/src/dmd/common) | Code shared by the front-end and back-end |
| [dmd/root/](https://github.com/dlang/dmd/tree/master/compiler/src/dmd/root) | Meant as a portable utility library, but ["it wasn't very good and the only project left using it is dmd"](https://github.com/dlang/dmd/pull/9844#issuecomment-498479516). |

Expand Down Expand Up @@ -99,7 +99,7 @@ Note that these groups have no strict meaning, the category assignments are a bi
| [strictvisitor.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/strictvisitor.d) | Visitor that forces derived classes to implement `visit` for every possible node |
| [visitor.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/visitor.d) | A visitor implementing `visit` for all nodes present in the compiler |
| [transitivevisitor.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/transitivevisitor.d) | Provide a mixin template with visit methods for the parse time AST |
| [apply.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/apply.d) | Depth-first expression visitor |
| [postordervisitor.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/postordervisitor.d) | Depth-first expression visitor |
| [sapply.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/sapply.d) | Depth-first statement visitor |
| [statement_rewrite_walker.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/statement_rewrite_walker.d) | Statement visitor that allows replacing the currently visited node |

Expand Down Expand Up @@ -174,7 +174,6 @@ Note that these groups have no strict meaning, the category assignments are a bi
| [cond.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/cond.d) | Evaluate `static if`, `version` `debug ` |
| [staticcond.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/staticcond.d) | Lazily evaluate static conditions for `static if`, `static assert` and template constraints |
| [delegatize.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/delegatize.d) | Converts expression to delegates for `lazy` parameters |
| [eh.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/eh.d) | Generate tables for exception handling |
| [nspace.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/nspace.d) | Namespace for `extern (C++, Module)` |
| [intrange.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/intrange.d) | [Value range propagation](https://digitalmars.com/articles/b62.html) |
| [dimport.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dimport.d) | Renamed imports (`import aliasSymbol = pkg1.pkg2.symbol`) |
Expand Down
4 changes: 0 additions & 4 deletions dmd/access.d
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,13 @@ module dmd.access;
import dmd.aggregate;
import dmd.astenums;
import dmd.dclass;
import dmd.declaration;
import dmd.dmodule;
import dmd.dscope;
import dmd.dstruct;
import dmd.dsymbol;
import dmd.errors;
import dmd.expression;
import dmd.func;
import dmd.globals;
import dmd.location;
import dmd.mtype;
import dmd.tokens;

private enum LOG = false;
Expand Down
49 changes: 39 additions & 10 deletions dmd/aggregate.d
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import core.stdc.stdio;
import core.checkedint;

import dmd.aliasthis;
import dmd.apply;
import dmd.arraytypes;
import dmd.astenums;
import dmd.attrib;
Expand Down Expand Up @@ -764,21 +763,18 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
if (s)
{
// Finish all constructors semantics to determine this.noDefaultCtor.
struct SearchCtor
static int searchCtor(Dsymbol s, void*)
{
extern (C++) static int fp(Dsymbol s, void* ctxt)
{
auto f = s.isCtorDeclaration();
if (f && f.semanticRun == PASS.initial)
f.dsymbolSemantic(null);
return 0;
}
auto f = s.isCtorDeclaration();
if (f && f.semanticRun == PASS.initial)
f.dsymbolSemantic(null);
return 0;
}

for (size_t i = 0; i < members.length; i++)
{
auto sm = (*members)[i];
sm.apply(&SearchCtor.fp, null);
sm.apply(&searchCtor, null);
}
}
return s;
Expand Down Expand Up @@ -817,3 +813,36 @@ version (IN_LLVM) {} else
v.visit(this);
}
}

/*********************************
* Iterate this dsymbol or members of this scoped dsymbol, then
* call `fp` with the found symbol and `params`.
* Params:
* symbol = the dsymbol or parent of members to call fp on
* fp = function pointer to process the iterated symbol.
* If it returns nonzero, the iteration will be aborted.
* ctx = context parameter passed to fp.
* Returns:
* nonzero if the iteration is aborted by the return value of fp,
* or 0 if it's completed.
*/
int apply(Dsymbol symbol, int function(Dsymbol, void*) fp, void* ctx)
{
if (auto nd = symbol.isNspace())
{
return nd.members.foreachDsymbol( (s) { return s && s.apply(fp, ctx); } );
}
if (auto ad = symbol.isAttribDeclaration())
{
return ad.include(ad._scope).foreachDsymbol( (s) { return s && s.apply(fp, ctx); } );
}
if (auto tm = symbol.isTemplateMixin())
{
if (tm._scope) // if fwd reference
dsymbolSemantic(tm, null); // try to resolve it

return tm.members.foreachDsymbol( (s) { return s && s.apply(fp, ctx); } );
}

return fp(symbol, ctx);
}
1 change: 0 additions & 1 deletion dmd/asttypename.d
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import dmd.mtype;
import dmd.typinf;
import dmd.identifier;
import dmd.init;
import dmd.doc;
import dmd.root.complex;
import dmd.root.rootobject;
import dmd.statement;
Expand Down
3 changes: 2 additions & 1 deletion dmd/attrib.d
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,8 @@ extern (C++) final class VisibilityDeclaration : AttribDeclaration
{
Module m = sc._module;

// While isAncestorPackageOf does an equality check, the fix for issue 17441 adds a check to see if
// https://issues.dlang.org/show_bug.cgi?id=17441
// While isAncestorPackageOf does an equality check, the fix for the issue adds a check to see if
// each package's .isModule() properites are equal.
//
// Properties generated from `package(foo)` i.e. visibility.pkg have .isModule() == null.
Expand Down
13 changes: 3 additions & 10 deletions dmd/canthrow.d
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
module dmd.canthrow;

import dmd.aggregate;
import dmd.apply;
import dmd.arraytypes;
import dmd.attrib;
import dmd.astenums;
Expand All @@ -26,6 +25,7 @@ import dmd.func;
import dmd.globals;
import dmd.init;
import dmd.mtype;
import dmd.postordervisitor;
import dmd.root.rootobject;
import dmd.tokens;
import dmd.visitor;
Expand Down Expand Up @@ -80,7 +80,7 @@ extern (C++) /* CT */ BE canThrow(Expression e, FuncDeclaration func, bool mustN
if (!f.isDtorDeclaration())
errorSupplementalInferredAttr(f, 10, false, STC.nothrow_);

e.checkOverridenDtor(null, f, dd => dd.type.toTypeFunction().isnothrow, "not nothrow");
e.checkOverriddenDtor(null, f, dd => dd.type.toTypeFunction().isnothrow, "not nothrow");
}
else if (func)
{
Expand Down Expand Up @@ -133,16 +133,9 @@ extern (C++) /* CT */ BE canThrow(Expression e, FuncDeclaration func, bool mustN
*/
if (ce.f && ce.f == func)
return;
Type t = ce.e1.type.toBasetype();
auto tf = t.isTypeFunction();
const tf = ce.calledFunctionType();
if (tf && tf.isnothrow)
return;
else
{
auto td = t.isTypeDelegate();
if (td && td.nextOf().isTypeFunction().isnothrow)
return;
}

if (ce.f)
checkFuncThrows(ce, ce.f);
Expand Down
2 changes: 2 additions & 0 deletions dmd/chkformat.d
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ bool checkPrintfFormat(ref const Loc loc, scope const char[] format, scope Expre
errorMsg(null, e, (c_longsize == 4 ? "uint" : "ulong"), t);
else
errorMsg(null, e, (c_longsize == 4 ? "int" : "long"), t);
if (t.isintegral() && t.size() != c_longsize)
errorSupplemental(e.loc, "C `long` is %d bytes on your system", c_longsize);
}
break;

Expand Down
23 changes: 14 additions & 9 deletions dmd/cli.d
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ version (IN_LLVM) {} else
$(LI $(B in): in contracts)
$(LI $(B invariant): class/struct invariants)
$(LI $(B out): out contracts)
$(LI $(B switch): finalswitch failure checking)
$(LI $(B switch): $(D final switch) failure checking)
)
$(UL
$(LI $(B on) or not specified: specified check is enabled.)
Expand All @@ -232,8 +232,8 @@ version (IN_LLVM) {} else
),
Option("checkaction=[D|C|halt|context]",
"behavior on assert/boundscheck/finalswitch failure",
`Sets behavior when an assert fails, and array boundscheck fails,
or a final switch errors.
`Sets behavior when an assert or an array bounds check fails,
or a $(D final switch) errors.
$(UL
$(LI $(B D): Default behavior, which throws an unrecoverable $(D AssertError).)
$(LI $(B C): Calls the C runtime library assert failure function.)
Expand Down Expand Up @@ -400,7 +400,7 @@ dmd -cov -unittest myprog.d
),
Option("Hd=<directory>",
"write 'header' file to directory",
`Write D interface file to $(I dir) directory. $(SWLINK -op)
`Write D interface file to $(I directory). $(SWLINK -op)
can be used if the original package hierarchy should
be retained.`,
),
Expand Down Expand Up @@ -435,7 +435,7 @@ dmd -cov -unittest myprog.d
q"{$(P Enables "include imports" mode, where the compiler will include imported
modules in the compilation, as if they were given on the command line. By default, when
this option is enabled, all imported modules are included except those in
druntime/phobos. This behavior can be overriden by providing patterns via `-i=<pattern>`.
druntime/phobos. This behavior can be overridden by providing patterns via `-i=<pattern>`.
A pattern of the form `-i=<package>` is an "inclusive pattern", whereas a pattern
of the form `-i=-<package>` is an "exclusive pattern". Inclusive patterns will include
all module's whose names match the pattern, whereas exclusive patterns will exclude them.
Expand All @@ -445,14 +445,14 @@ dmd -cov -unittest myprog.d
$(P The default behavior of excluding druntime/phobos is accomplished by internally adding a
set of standard exclusions, namely, `-i=-std -i=-core -i=-etc -i=-object`. Note that these
can be overriden with `-i=std -i=core -i=etc -i=object`.)
can be overridden with `-i=std -i=core -i=etc -i=object`.)
$(P When a module matches multiple patterns, matches are prioritized by their component length, where
a match with more components takes priority (i.e. pattern `foo.bar.baz` has priority over `foo.bar`).)
$(P By default modules that don't match any pattern will be included. However, if at
least one inclusive pattern is given, then modules not matching any pattern will
be excluded. This behavior can be overriden by usig `-i=.` to include by default or `-i=-.` to
be excluded. This behavior can be overridden by usig `-i=.` to include by default or `-i=-.` to
exclude by default.)
$(P Note that multiple `-i=...` options are allowed, each one adds a pattern.)}"
Expand Down Expand Up @@ -826,6 +826,11 @@ dmd -cov -unittest myprog.d
`Enable $(LINK2 $(ROOT_DIR)articles/warnings.html, informational warnings (i.e. compilation
still proceeds normally))`,
),
Option("wo",
"warnings about use of obsolete features (compilation will continue)",
`Enable warnings about use of obsolete features that may be problematic (compilation
still proceeds normally)`,
),
Option("X",
"generate JSON file"
),
Expand Down Expand Up @@ -1033,8 +1038,8 @@ version (IN_LLVM) {} else
/// Options supported by -HC
enum hcUsage = "Available header generation modes:
=[h|help|?] List information on all available choices
=silent Silently ignore non-exern(C[++]) declarations
=verbose Add a comment for ignored non-exern(C[++]) declarations
=silent Silently ignore non-extern(C[++]) declarations
=verbose Add a comment for ignored non-extern(C[++]) declarations
";

/// Options supported by -gdwarf
Expand Down
20 changes: 10 additions & 10 deletions dmd/clone.d
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,18 @@ FuncDeclaration hasIdentityOpAssign(AggregateDeclaration ad, Scope* sc)
scope er = new NullExp(ad.loc, ad.type); // dummy rvalue
scope el = new IdentifierExp(ad.loc, Id.p); // dummy lvalue
el.type = ad.type;
auto a = Expressions(1);
auto a = new Expressions(1);
const errors = global.startGagging(); // Do not report errors, even if the template opAssign fbody makes it.
sc = sc.push();
sc.tinst = null;
sc.minst = null;

a[0] = er;
auto f = resolveFuncCall(ad.loc, sc, assign, null, ad.type, ArgumentList(&a), FuncResolveFlag.quiet);
(*a)[0] = er;
auto f = resolveFuncCall(ad.loc, sc, assign, null, ad.type, ArgumentList(a), FuncResolveFlag.quiet);
if (!f)
{
a[0] = el;
f = resolveFuncCall(ad.loc, sc, assign, null, ad.type, ArgumentList(&a), FuncResolveFlag.quiet);
(*a)[0] = el;
f = resolveFuncCall(ad.loc, sc, assign, null, ad.type, ArgumentList(a), FuncResolveFlag.quiet);
}

sc = sc.pop();
Expand Down Expand Up @@ -465,7 +465,7 @@ private FuncDeclaration hasIdentityOpEquals(AggregateDeclaration ad, Scope* sc)
*/
scope er = new NullExp(ad.loc, null); // dummy rvalue
scope el = new IdentifierExp(ad.loc, Id.p); // dummy lvalue
auto a = Expressions(1);
auto a = new Expressions(1);

bool hasIt(Type tthis)
{
Expand All @@ -476,9 +476,9 @@ private FuncDeclaration hasIdentityOpEquals(AggregateDeclaration ad, Scope* sc)

FuncDeclaration rfc(Expression e)
{
a[0] = e;
a[0].type = tthis;
return resolveFuncCall(ad.loc, sc, eq, null, tthis, ArgumentList(&a), FuncResolveFlag.quiet);
(*a)[0] = e;
(*a)[0].type = tthis;
return resolveFuncCall(ad.loc, sc, eq, null, tthis, ArgumentList(a), FuncResolveFlag.quiet);
}

f = rfc(er);
Expand Down Expand Up @@ -1126,7 +1126,7 @@ private DtorDeclaration buildExternDDtor(AggregateDeclaration ad, Scope* sc)
return null;

// Generate shim only when ABI incompatible on target platform
if (ad.classKind != ClassKind.cpp || !target.cpp.wrapDtorInExternD)
if (dtor._linkage != LINK.cpp || !target.cpp.wrapDtorInExternD)
return dtor;

// generate member function that adjusts calling convention
Expand Down
Loading

0 comments on commit 1ea7d47

Please sign in to comment.