Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade frontend & libs to early v2.099.0 #3917

Merged
merged 27 commits into from
Feb 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5a2f3ed
Upgrade frontend & libs to v2.099.0-beta.1+ (dlang/dmd@1c31d85613)
kinke Feb 16, 2022
a2ea924
Fix little C++ header regressions
kinke Feb 16, 2022
4bd8dcd
Adapt to new TOK and EXP enum classes
kinke Feb 16, 2022
9d2d891
Adapt to new PASS enum class
kinke Feb 16, 2022
7f7bad1
Adapt to moved/added zlib test files for Phobos
kinke Feb 16, 2022
a4d2192
2.099: Compile Phobos with -preview=fieldwise
kinke Feb 16, 2022
3dd43cb
Merge fix: Failing assertion with -linkonce-templates
kinke Feb 16, 2022
34f2628
Handle newly unparsed unittests from non-root modules
kinke Feb 16, 2022
b8ff365
Merge fix: -main regression
kinke Feb 16, 2022
79cf879
lit-tests: Fix implicit switch fall-throughs (an error now)
kinke Feb 16, 2022
a9877cb
Remove orphaned dmd/root/root.h
kinke Feb 17, 2022
ba97305
Restore compilability with ltsmaster
kinke Feb 17, 2022
a6e9903
dmd-testsuite: Tweak expected output of fail_compilation/test22361.d
kinke Feb 18, 2022
fa9897f
Sync with dmd/mars.d
kinke Feb 18, 2022
bbbcd97
Merge upstream stable (dlang/dmd@a3865eb2b4)
kinke Feb 19, 2022
78681e1
Sync with dmd/target.d
kinke Feb 19, 2022
5c9f1e5
Handle new throw expressions
kinke Feb 19, 2022
84da9ad
Handle ImportC special case wrt. non-variadic declaration vs. variadi…
kinke Feb 19, 2022
22a544f
Adapt getParentFunc() to extern(C++) delegates
kinke Feb 19, 2022
6510878
dmd-testsuite: Minimally adapt 2 new tests for MSVC targets
kinke Feb 21, 2022
dc25da9
ABI: Handle extern(C++) delegates for 32-bit MSVC with __thiscall con…
kinke Feb 22, 2022
25e0f90
Adapt 2 PGO lit-tests to explicit fall-throughs
kinke Feb 22, 2022
f3416a1
Bump mimalloc version and bundled dub & dlang-tools
kinke Feb 22, 2022
bcf3b6e
druntime: Work around core.int128.Cent alignment issue for 32-bit MSVC
kinke Feb 23, 2022
dae17c2
Merge upstream stable (dlang/dmd@a04cb14657)
kinke Feb 24, 2022
599f563
Implement new Target::supportsLinkerDirective() properly
kinke Feb 24, 2022
e82c0d9
[undo superfluous recent change]
kinke Feb 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ include(GetLinuxDistribution)
#

# Version information
set(LDC_VERSION "1.28.1") # May be overridden by git hash tag
set(LDC_VERSION "1.29.0") # May be overridden by git hash tag
set(DMDFE_MAJOR_VERSION 2)
set(DMDFE_MINOR_VERSION 0)
set(DMDFE_PATCH_VERSION 98)
set(DMDFE_FIX_LEVEL 1)
set(DMDFE_PATCH_VERSION 99)
set(DMDFE_FIX_LEVEL 0)

set(DMD_VERSION ${DMDFE_MAJOR_VERSION}.${DMDFE_MINOR_VERSION}${DMDFE_PATCH_VERSION})
if(DEFINED DMDFE_FIX_LEVEL)
Expand Down
21 changes: 10 additions & 11 deletions dmd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

This is the source code to the DMD compiler
for the D Programming Language defined in the documents at
http://dlang.org/
https://dlang.org/

These sources are free, they are redistributable and modifiable
under the terms of the Boost Software License, Version 1.0.
The terms of this license are in the file boostlicense.txt,
or see http://www.boost.org/LICENSE_1_0.txt.
or see https://www.boost.org/LICENSE_1_0.txt.

If a particular file has a different license in it, that overrides
this license for that file.
Expand All @@ -20,6 +20,7 @@ this license for that file.
|--------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [dmd/](https://github.com/dlang/dmd/tree/master/src/dmd) | The dmd driver and front-end |
| [dmd/backend/](https://github.com/dlang/dmd/tree/master/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/common/](https://github.com/dlang/dmd/tree/master/src/dmd/common) | Code shared by the front-end and back-end |
| [dmd/root/](https://github.com/dlang/dmd/tree/master/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). |

DMD has a mostly flat directory structure, so this section aims to divide all source files into logical groups for easier navigation.
Expand All @@ -32,6 +33,7 @@ Note that these groups have no strict meaning, the category assignments are a bi
|-----------------------------------------------------------------------------|-----------------------------------------------------------------------|
| [mars.d](https://github.com/dlang/dmd/blob/master/src/dmd/mars.d) | The entry point. Contains `main`. |
| [cli.d](https://github.com/dlang/dmd/blob/master/src/dmd/cli.d) | Define the command line interface |
| [dmdparams.d](https://github.com/dlang/dmd/blob/master/src/dmd/dmdparams.d) | DMD-specific parameters |
| [globals.d](https://github.com/dlang/dmd/blob/master/src/dmd/globals.d) | Define a structure storing command line options |
| [dinifile.d](https://github.com/dlang/dmd/blob/master/src/dmd/dinifile.d) | Parse settings from .ini file (`sc.ini` / `dmd.conf`) |
| [vsoptions.d](https://github.com/dlang/dmd/blob/master/src/dmd/vsoptions.d) | Detect the Microsoft Visual Studio toolchain for linking |
Expand Down Expand Up @@ -126,7 +128,7 @@ Note that these groups have no strict meaning, the category assignments are a bi
| [optimize.d](https://github.com/dlang/dmd/blob/master/src/dmd/optimize.d) | Do constant folding more generally |
| [dcast.d](https://github.com/dlang/dmd/blob/master/src/dmd/dcast.d) | Implicit or explicit cast(), finding common types e.g. in `x ? a : b`, integral promotions |
| [impcnvtab.d](https://github.com/dlang/dmd/blob/master/src/dmd/impcnvtab.d) | Define an implicit conversion table for basic types |
| [importc.d](https://github.com/dlang/dmd/blob/master/src/dmd/importc.d) | Helpers specific to ImportC
| [importc.d](https://github.com/dlang/dmd/blob/master/src/dmd/importc.d) | Helpers specific to ImportC |
| [sideeffect.d](https://github.com/dlang/dmd/blob/master/src/dmd/sideeffect.d) | Extract side-effects of expressions for certain lowerings. |

**Compile Time Function Execution (CTFE)**
Expand Down Expand Up @@ -244,14 +246,11 @@ Note that these groups have no strict meaning, the category assignments are a bi

Note: many other utilities are in [dmd/root](https://github.com/dlang/dmd/tree/master/src/dmd/root).

| File | Purpose |
|-----------------------------------------------------------------------------|---------------------------------------------------|
| [env.d](https://github.com/dlang/dmd/blob/master/src/dmd/env.d) | Modify environment variables |
| [console.d](https://github.com/dlang/dmd/blob/master/src/dmd/console.d) | Print error messages in color |
| [utf.d](https://github.com/dlang/dmd/blob/master/src/dmd/utf.d) | Encoding/decoding Unicode text |
| [filecache.d](https://github.com/dlang/dmd/blob/master/src/dmd/filecache.d) | Keep file contents in memory |
| [utils.d](https://github.com/dlang/dmd/blob/master/src/dmd/utils.d) | Utility functions related to files and file paths |
| [complex.d](https://github.com/dlang/dmd/blob/master/src/dmd/complex.d) | A complex number type |
| File | Purpose |
|-----------------------------------------------------------------------------------|---------------------------------------------------|
| [console.d](https://github.com/dlang/dmd/blob/master/src/dmd/console.d) | Print error messages in color |
| [file_manager.d](https://github.com/dlang/dmd/blob/master/src/dmd/file_manager.d) | Keep file contents in memory |
| [utils.d](https://github.com/dlang/dmd/blob/master/src/dmd/utils.d) | Utility functions related to files and file paths |

| File | Purpose |
|---------------------------------------------------------------------------------|---------------------------------------------------------------|
Expand Down
18 changes: 5 additions & 13 deletions dmd/access.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* Specification: $(LINK2 https://dlang.org/spec/attribute.html#visibility_attributes, Visibility Attributes)
*
* Copyright: Copyright (C) 1999-2021 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 http://www.digitalmars.com, Walter Bright)
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Copyright: Copyright (C) 1999-2022 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)
* Documentation: https://dlang.org/phobos/dmd_access.html
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/access.d
Expand Down Expand Up @@ -51,15 +51,7 @@ bool checkAccess(AggregateDeclaration ad, Loc loc, Scope* sc, Dsymbol smember)

if (!symbolIsVisible(sc, smember))
{
// when in @safe code or with -preview=dip1000
if (sc.flags & SCOPE.onlysafeaccess)
{
// if there is a func. ask for it's opinion of safety, and if it considers the access @safe accept it.
if (sc.func && !sc.func.setUnsafe())
return false;
}

ad.error(loc, "%s `%s` is not accessible%s", smember.kind(), smember.toChars(), (sc.flags & SCOPE.onlysafeaccess) ? " from `@safe` code".ptr : "".ptr);
ad.error(loc, "%s `%s` is not accessible", smember.kind(), smember.toChars());
//printf("smember = %s %s, vis = %d, semanticRun = %d\n",
// smember.kind(), smember.toPrettyChars(), smember.visible() smember.semanticRun);
return true;
Expand Down Expand Up @@ -201,7 +193,7 @@ bool checkAccess(Loc loc, Scope* sc, Expression e, Dsymbol d)
{
// Do access check
ClassDeclaration cd = tc.sym;
if (e.op == TOK.super_)
if (e.op == EXP.super_)
{
if (ClassDeclaration cd2 = sc.func.toParent().isClassDeclaration())
cd = cd2;
Expand Down
53 changes: 34 additions & 19 deletions dmd/aggregate.d
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* Specification: $(LINK2 https://dlang.org/spec/struct.html, Structs, Unions),
* $(LINK2 https://dlang.org/spec/class.html, Class).
*
* Copyright: Copyright (C) 1999-2021 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 http://www.digitalmars.com, Walter Bright)
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Copyright: Copyright (C) 1999-2022 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)
* Documentation: https://dlang.org/phobos/dmd_aggregate.html
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/aggregate.d
Expand Down Expand Up @@ -116,11 +116,12 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol

AliasThis aliasthis; /// forward unresolved lookups to aliasthis

DtorDeclarations dtors; /// Array of destructors
DtorDeclaration dtor; /// aggregate destructor calling dtors and member constructors
DtorDeclaration primaryDtor;/// non-deleting C++ destructor, same as dtor for D
DtorDeclarations userDtors; /// user-defined destructors (`~this()`) - mixins can yield multiple ones
DtorDeclaration aggrDtor; /// aggregate destructor calling userDtors and fieldDtor (and base class aggregate dtor for C++ classes)
DtorDeclaration dtor; /// the aggregate destructor exposed as `__xdtor` alias
/// (same as aggrDtor, except for C++ classes with virtual dtor on Windows)
DtorDeclaration tidtor; /// aggregate destructor used in TypeInfo (must have extern(D) ABI)
FuncDeclaration fieldDtor; /// aggregate destructor for just the fields
DtorDeclaration fieldDtor; /// function destructing (non-inherited) fields

Expression getRTInfo; /// pointer to GC info generated by object.RTInfo(this)

Expand Down Expand Up @@ -178,7 +179,7 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
* Returns:
* false if failed to determine the size.
*/
final bool determineSize(Loc loc)
final bool determineSize(const ref Loc loc)
{
//printf("AggregateDeclaration::determineSize() %s, sizeok = %d\n", toChars(), sizeok);

Expand Down Expand Up @@ -332,7 +333,7 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
* false if any errors occur.
* Otherwise, returns true and the missing arguments will be pushed in elements[].
*/
final bool fill(Loc loc, Expressions* elements, bool ctorinit)
final bool fill(const ref Loc loc, Expressions* elements, bool ctorinit)
{
//printf("AggregateDeclaration::fill() %s\n", toChars());
assert(sizeok == Sizeok.done);
Expand Down Expand Up @@ -471,7 +472,7 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
}
foreach (e; *elements)
{
if (e && e.op == TOK.error)
if (e && e.op == EXP.error)
return false;
}

Expand Down Expand Up @@ -516,17 +517,19 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
}

/****************************************
* Place a member (mem) into an aggregate (agg), which can be a struct, union or class
* Place a field (mem) into an aggregate (agg), which can be a struct, union or class
* Params:
* nextoffset = location just past the end of the previous field in the aggregate.
* Updated to be just past the end of this field to be placed, i.e. the future nextoffset
* memsize = size of field
* memalignsize = natural alignment of field
* alignment = alignment in effect for this field
* paggsize = size of aggregate (updated)
* paggalignsize = alignment of aggregate (updated)
* isunion = the aggregate is a union
* Returns:
* offset to place field at
* aligned offset to place field at
*
* nextoffset: next location in aggregate
* memsize: size of member
* memalignsize: natural alignment of member
* alignment: alignment in effect for this member
* paggsize: size of aggregate (updated)
* paggalignsize: alignment of aggregate (updated)
* isunion: the aggregate is a union
*/
extern (D) static uint placeField(uint* nextoffset, uint memsize, uint memalignsize,
structalign_t alignment, uint* paggsize, uint* paggalignsize, bool isunion)
Expand Down Expand Up @@ -562,6 +565,18 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol

override final Type getType()
{
/* Apply storage classes to forward references. (Issue 22254)
* Note: Avoid interfaces for now. Implementing qualifiers on interface
* definitions exposed some issues in their TypeInfo generation in DMD.
* Related PR: https://github.com/dlang/dmd/pull/13312
*/
if (semanticRun == PASS.init && !isInterfaceDeclaration())
{
auto stc = storage_class;
if (_scope)
stc |= _scope.stc;
type = type.addSTC(stc);
}
return type;
}

Expand Down
23 changes: 12 additions & 11 deletions dmd/aggregate.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

/* Compiler implementation of the D programming language
* Copyright (C) 1999-2021 by The D Language Foundation, All Rights Reserved
* Copyright (C) 1999-2022 by The D Language Foundation, All Rights Reserved
* written by Walter Bright
* http://www.digitalmars.com
* https://www.digitalmars.com
* Distributed under the Boost Software License, Version 1.0.
* http://www.boost.org/LICENSE_1_0.txt
* https://www.boost.org/LICENSE_1_0.txt
* https://github.com/dlang/dmd/blob/master/src/dmd/aggregate.h
*/

Expand Down Expand Up @@ -105,11 +105,12 @@ class AggregateDeclaration : public ScopeDsymbol

AliasThis *aliasthis; // forward unresolved lookups to aliasthis

DtorDeclarations dtors; // Array of destructors
DtorDeclaration *dtor; // aggregate destructor
DtorDeclaration *primaryDtor; // non-deleting C++ destructor, same as dtor for D
DtorDeclarations userDtors; // user-defined destructors (`~this()`) - mixins can yield multiple ones
DtorDeclaration *aggrDtor; // aggregate destructor calling userDtors and fieldDtor (and base class aggregate dtor for C++ classes)
DtorDeclaration *dtor; // the aggregate destructor exposed as `__xdtor` alias
// (same as aggrDtor, except for C++ classes with virtual dtor on Windows)
DtorDeclaration *tidtor; // aggregate destructor used in TypeInfo (must have extern(D) ABI)
FuncDeclaration *fieldDtor; // aggregate destructor for just the fields
DtorDeclaration *fieldDtor; // function destructing (non-inherited) fields

Expression *getRTInfo; // pointer to GC info generated by object.RTInfo(this)

Expand All @@ -121,10 +122,10 @@ class AggregateDeclaration : public ScopeDsymbol
virtual Scope *newScope(Scope *sc);
void setScope(Scope *sc);
size_t nonHiddenFields();
bool determineSize(Loc loc);
bool determineSize(const Loc &loc);
virtual void finalizeSize() = 0;
d_uns64 size(const Loc &loc);
bool fill(Loc loc, Expressions *elements, bool ctorinit);
bool fill(const Loc &loc, Expressions *elements, bool ctorinit);
Type *getType();
bool isDeprecated() const; // is aggregate deprecated?
void setDeprecated();
Expand Down Expand Up @@ -188,7 +189,7 @@ class StructDeclaration : public AggregateDeclaration
// ABI-specific type(s) if the struct can be passed in registers
TypeTuple *argTypes;

static StructDeclaration *create(Loc loc, Identifier *id, bool inObject);
static StructDeclaration *create(const Loc &loc, Identifier *id, bool inObject);
StructDeclaration *syntaxCopy(Dsymbol *s);
Dsymbol *search(const Loc &loc, Identifier *ident, int flags = SearchLocalsOnly);
const char *kind() const;
Expand Down Expand Up @@ -283,7 +284,7 @@ class ClassDeclaration : public AggregateDeclaration
Symbol *cpp_type_info_ptr_sym; // cached instance of class Id.cpp_type_info_ptr
#endif

static ClassDeclaration *create(Loc loc, Identifier *id, BaseClasses *baseclasses, Dsymbols *members, bool inObject);
static ClassDeclaration *create(const Loc &loc, Identifier *id, BaseClasses *baseclasses, Dsymbols *members, bool inObject);
const char *toPrettyChars(bool QualifyTypes = false);
ClassDeclaration *syntaxCopy(Dsymbol *s);
Scope *newScope(Scope *sc);
Expand Down
10 changes: 5 additions & 5 deletions dmd/aliasthis.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* Specification: $(LINK2 https://dlang.org/spec/class.html#alias-this, Alias This)
*
* Copyright: Copyright (C) 1999-2021 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 http://www.digitalmars.com, Walter Bright)
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Copyright: Copyright (C) 1999-2022 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)
* Documentation: https://dlang.org/phobos/dmd_aliasthis.html
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/aliasthis.d
Expand Down Expand Up @@ -91,7 +91,7 @@ Expression resolveAliasThis(Scope* sc, Expression e, bool gag = false, bool find
if (ad.aliasthis)
{
Loc loc = e.loc;
Type tthis = (e.op == TOK.type ? e.type : null);
Type tthis = (e.op == EXP.type ? e.type : null);
const flags = DotExpFlag.noAliasThis | (gag ? DotExpFlag.gag : 0);
uint olderrors = gag ? global.startGagging() : 0;
e = dotExp(e.type, sc, e, ad.aliasthis.ident, flags);
Expand All @@ -100,7 +100,7 @@ Expression resolveAliasThis(Scope* sc, Expression e, bool gag = false, bool find

if (tthis && ad.aliasthis.sym.needThis())
{
if (e.op == TOK.variable)
if (e.op == EXP.variable)
{
if (auto fd = (cast(VarExp)e).var.isFuncDeclaration())
{
Expand Down
6 changes: 3 additions & 3 deletions dmd/aliasthis.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

/* Compiler implementation of the D programming language
* Copyright (C) 2009-2021 by The D Language Foundation, All Rights Reserved
* Copyright (C) 2009-2022 by The D Language Foundation, All Rights Reserved
* written by Walter Bright
* http://www.digitalmars.com
* https://www.digitalmars.com
* Distributed under the Boost Software License, Version 1.0.
* http://www.boost.org/LICENSE_1_0.txt
* https://www.boost.org/LICENSE_1_0.txt
* https://github.com/dlang/dmd/blob/master/src/dmd/aliasthis.h
*/

Expand Down
Loading