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.098.0 #3821

Merged
merged 31 commits into from
Sep 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
9dabd0b
Upgrade frontend & libs to early v2.098.0 (dlang/dmd@4533410d5b)
kinke Sep 6, 2021
369cfd1
Adapt to TY enum class
kinke Sep 6, 2021
e9f40d8
Adapt to removed custom (de)allocators
kinke Sep 6, 2021
7aed600
Adapt to changed TypeDelegate constructor signature
kinke Sep 6, 2021
adc5c02
Adapt to semanticTypeInfoMembers() refactoring
kinke Sep 6, 2021
e126c86
Adapt to global.params.useDIP1000 refactoring
kinke Sep 6, 2021
98838cd
Misc. minor adaptations to frontend changes
kinke Sep 6, 2021
6a724cb
SemanticTimeTraceVisitor: Add BitFieldDeclaration override
kinke Sep 6, 2021
8fef7e1
Fix some frontend C++ header regressions
kinke Sep 7, 2021
43dd834
Initialize new TargetC::bitFieldStyle
kinke Sep 7, 2021
7c34ee5
Adapt lit-tests to new frontend errors
kinke Sep 7, 2021
c3df7bb
ldmd2: Translate -target to -mtriple
kinke Sep 7, 2021
33a9502
Initialize new Target::osMajor
kinke Sep 7, 2021
988824d
Adapt to new TypeInfo names for aggregates
kinke Sep 7, 2021
538b4da
WinEH: Adapt to changed TypeInfo_Class names
kinke Sep 7, 2021
598b615
Fix switch case with const runtime variable assuming a *constant* ini…
kinke Sep 8, 2021
4fd476d
dmd-testsuite: Adapt/disable 2 new tests for LDC
kinke Sep 8, 2021
db4867d
Handle new extern(C) structs with size 0
kinke Sep 8, 2021
64d79ef
Write JSON file with -Xi without -X/-Xf
kinke Sep 8, 2021
fab8243
Use new druntime hooks _d_arraybounds_{slice,index} for more informat…
kinke Sep 9, 2021
ab8ba9b
druntime: Fix core.sys.linux.fs compilability for Bionic and Musl C r…
kinke Sep 9, 2021
63a069f
Travis CI: Exclude hanging druntime-test-gc integration tests
kinke Sep 9, 2021
af75e66
Restore compilability with ltsmaster
kinke Sep 10, 2021
50fb6c8
Add support for StringExp typed as pointer to static array
kinke Sep 10, 2021
067fbaf
ImportC: Gracefully terminate when encountering C initializer lists
kinke Sep 10, 2021
cb4104f
ImportC: Gracefully terminate when encountering C bit fields
kinke Sep 10, 2021
58e4c54
dmd-testsuite: Disable/adapt some ImportC tests
kinke Sep 10, 2021
b44f280
Azure CI: Disable ASan lit-tests on Win64
kinke Sep 10, 2021
b40581a
druntime: Facilitate troubleshooting of 'exceptions' integration tests
kinke Sep 11, 2021
6806135
Merge upstream stable (dlang/dmd@4fabb86680)
kinke Sep 11, 2021
86f430c
Slightly revise frontend diff
kinke Sep 11, 2021
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
2 changes: 2 additions & 0 deletions .azure-pipelines/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ steps:
:: strings_cdb has regressed for 32-bit starting with the VS 2019 v16.6.0 Azure Image (worked fine until v16.5.4)
:: it also works fine on my box with the same v16.7.2...
if "%MODEL%" == "32" ( del %BUILD_SOURCESDIRECTORY%\tests\debuginfo\strings_cdb.d)
:: for 64-bit, all ASan tests have regressed ("ASan init calls itself!") with image 20210907.4 - working fine on my box
if "%MODEL%" == "64" ( del %BUILD_SOURCESDIRECTORY%\tests\sanitizers\*asan*.d)
call "%LDC_VSDIR%\Common7\Tools\VsDevCmd.bat" -arch=%ARCH%
cd build
ctest -V -R "lit-tests"
Expand Down
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ script:
# Run DMD testsuite
- DMD_TESTSUITE_MAKE_ARGS="-j8" ctest -V -R "dmd-testsuite"
# Run defaultlib unittests & druntime integration tests
# FIXME: don't exclude hanging core.thread.fiber & don't ignore errors
- ctest -j8 --output-on-failure -E "dmd-testsuite|lit-tests|ldc2-unittest|^core.thread.fiber($|-)" || true
# FIXME:
# * don't exclude hanging core.thread.fiber & druntime-test-gc (probably concurrent-GC tests)
# * don't ignore errors
- ctest -j8 --output-on-failure -E "dmd-testsuite|lit-tests|ldc2-unittest|^core.thread.fiber($|-)|^druntime-test-gc" || true
# Terminate the job if there were failures
- if [[ "$TRAVIS_TEST_RESULT" != "0" ]]; then travis_terminate 1; fi
# Install LDC & make portable
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ include(GetLinuxDistribution)
#

# Version information
set(LDC_VERSION "1.27.1") # May be overridden by git hash tag
set(LDC_VERSION "1.28.0") # May be overridden by git hash tag
set(DMDFE_MAJOR_VERSION 2)
set(DMDFE_MINOR_VERSION 0)
set(DMDFE_PATCH_VERSION 97)
set(DMDFE_FIX_LEVEL 2)
set(DMDFE_PATCH_VERSION 98)
set(DMDFE_FIX_LEVEL 0)

set(DMD_VERSION ${DMDFE_MAJOR_VERSION}.${DMDFE_MINOR_VERSION}${DMDFE_PATCH_VERSION})
if(DEFINED DMDFE_FIX_LEVEL)
Expand Down
7 changes: 5 additions & 2 deletions dmd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ Note that these groups have no strict meaning, the category assignments are a bi

| File | Purpose |
|-----------------------------------------------------------------------|----------------------------------------------------------------------|
| [lexer.d](https://github.com/dlang/dmd/blob/master/src/dmd/lexer.d) | Convert source code into tokens for the parser |
| [lexer.d](https://github.com/dlang/dmd/blob/master/src/dmd/lexer.d) | Convert source code into tokens for the D and ImportC parsers |
| [entity.d](https://github.com/dlang/dmd/blob/master/src/dmd/entity.d) | Define "\\&Entity;" escape sequence for strings / character literals |
| [tokens.d](https://github.com/dlang/dmd/blob/master/src/dmd/tokens.d) | Define lexical tokens. |
| [parse.d](https://github.com/dlang/dmd/blob/master/src/dmd/parse.d) | Convert tokens into an Abstract Syntax Tree (AST) |
| [parse.d](https://github.com/dlang/dmd/blob/master/src/dmd/parse.d) | D parser, converting tokens into an Abstract Syntax Tree (AST) |
| [cparse.d](https://github.com/dlang/dmd/blob/master/src/dmd/cparse.d) | ImportC parser, converting tokens into an Abstract Syntax Tree (AST) |

### Semantic analysis

Expand Down Expand Up @@ -76,6 +77,7 @@ Note that these groups have no strict meaning, the category assignments are a bi
| [ast_node.d](https://github.com/dlang/dmd/blob/master/src/dmd/ast_node.d) | Define an abstract AST node class |
| [astbase.d](https://github.com/dlang/dmd/blob/master/src/dmd/astbase.d) | Namespace of AST nodes that can be produced by the parser |
| [astcodegen.d](https://github.com/dlang/dmd/blob/master/src/dmd/astcodegen.d) | Namespace of AST nodes of a AST ready for code generation |
| [astenums.d](https://github.com/dlang/dmd/blob/master/src/dmd/astenums.d) | Enums common to DMD and AST |
| [expression.d](https://github.com/dlang/dmd/blob/master/src/dmd/expression.d) | Define expression AST nodes |
| [statement.d](https://github.com/dlang/dmd/blob/master/src/dmd/statement.d) | Define statement AST nodes |
| [staticassert.d](https://github.com/dlang/dmd/blob/master/src/dmd/staticassert.d) | Define a `static assert` AST node |
Expand Down Expand Up @@ -124,6 +126,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
| [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
11 changes: 6 additions & 5 deletions dmd/access.d
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
module dmd.access;

import dmd.aggregate;
import dmd.astenums;
import dmd.dclass;
import dmd.declaration;
import dmd.dmodule;
Expand Down Expand Up @@ -58,7 +59,7 @@ bool checkAccess(AggregateDeclaration ad, Loc loc, Scope* sc, Dsymbol smember)
return false;
}

ad.error(loc, "member `%s` is not accessible%s", smember.toChars(), (sc.flags & SCOPE.onlysafeaccess) ? " from `@safe` code".ptr : "".ptr);
ad.error(loc, "%s `%s` is not accessible%s", smember.kind(), smember.toChars(), (sc.flags & SCOPE.onlysafeaccess) ? " from `@safe` code".ptr : "".ptr);
//printf("smember = %s %s, vis = %d, semanticRun = %d\n",
// smember.kind(), smember.toPrettyChars(), smember.visible() smember.semanticRun);
return true;
Expand Down Expand Up @@ -196,21 +197,21 @@ bool checkAccess(Loc loc, Scope* sc, Expression e, Dsymbol d)
if (!e)
return false;

if (e.type.ty == Tclass)
if (auto tc = e.type.isTypeClass())
{
// Do access check
ClassDeclaration cd = (cast(TypeClass)e.type).sym;
ClassDeclaration cd = tc.sym;
if (e.op == TOK.super_)
{
if (ClassDeclaration cd2 = sc.func.toParent().isClassDeclaration())
cd = cd2;
}
return checkAccess(cd, loc, sc, d);
}
else if (e.type.ty == Tstruct)
else if (auto ts = e.type.isTypeStruct())
{
// Do access check
StructDeclaration cd = (cast(TypeStruct)e.type).sym;
StructDeclaration cd = ts.sym;
return checkAccess(cd, loc, sc, d);
}
return false;
Expand Down
124 changes: 12 additions & 112 deletions dmd/aggregate.d
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import core.checkedint;
import dmd.aliasthis;
import dmd.apply;
import dmd.arraytypes;
import dmd.gluelayer; // : Symbol;
import dmd.astenums;
import dmd.declaration;
import dmd.dscope;
import dmd.dstruct;
Expand All @@ -38,22 +38,6 @@ import dmd.tokens;
import dmd.typesem : defaultInit;
import dmd.visitor;

enum Sizeok : ubyte
{
none, /// size of aggregate is not yet able to compute
fwd, /// size of aggregate is ready to compute
inProcess, /// in the midst of computing the size
done, /// size of aggregate is set correctly
}

enum Baseok : ubyte
{
none, /// base classes not computed yet
start, /// in process of resolving base classes
done, /// all base classes are resolved
semanticdone, /// all base classes semantic done
}

/**
* The ClassKind enum is used in AggregateDeclaration AST nodes to
* specify the linkage type of the struct/class/interface or if it
Expand All @@ -68,6 +52,8 @@ enum ClassKind : ubyte
cpp,
/// the aggregate is an Objective-C class/interface
objc,
/// the aggregate is a C struct
c,
}

/**
Expand Down Expand Up @@ -119,7 +105,6 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
// Special member functions
FuncDeclarations invs; /// Array of invariants
FuncDeclaration inv; /// Merged invariant calling all members of invs
NewDeclaration aggNew; /// allocator

/// CtorDeclaration or TemplateDeclaration
Dsymbol ctor;
Expand All @@ -141,6 +126,7 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
///
Visibility visibility;
bool noDefaultCtor; /// no default construction
bool disableNew; /// disallow allocations using `new`
Sizeok sizeok = Sizeok.none; /// set when structsize contains valid data

final extern (D) this(const ref Loc loc, Identifier id)
Expand All @@ -156,7 +142,7 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
Scope* newScope(Scope* sc)
{
auto sc2 = sc.push(this);
sc2.stc &= STCFlowThruAggregate;
sc2.stc &= STC.flowThruAggregate;
sc2.parent = this;
sc2.inunion = isUnionDeclaration();
sc2.visibility = Visibility(Visibility.Kind.public_);
Expand All @@ -177,91 +163,6 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
ScopeDsymbol.setScope(sc);
}

/***************************************
* Find all instance fields, then push them into `fields`.
*
* Runs semantic() for all instance field variables, but also
* the field types can remain yet not resolved forward references,
* except direct recursive definitions.
* After the process sizeok is set to Sizeok.fwd.
*
* Returns:
* false if any errors occur.
*/
final bool determineFields()
{
if (_scope)
dsymbolSemantic(this, null);
if (sizeok != Sizeok.none)
return true;

//printf("determineFields() %s, fields.dim = %d\n", toChars(), fields.dim);
// determineFields can be called recursively from one of the fields's v.semantic
fields.setDim(0);

static int func(Dsymbol s, AggregateDeclaration ad)
{
auto v = s.isVarDeclaration();
if (!v)
return 0;
if (v.storage_class & STC.manifest)
return 0;

if (v.semanticRun < PASS.semanticdone)
v.dsymbolSemantic(null);
// Return in case a recursive determineFields triggered by v.semantic already finished
if (ad.sizeok != Sizeok.none)
return 1;

if (v.aliassym)
return 0; // If this variable was really a tuple, skip it.

if (v.storage_class & (STC.static_ | STC.extern_ | STC.tls | STC.gshared | STC.manifest | STC.ctfe | STC.templateparameter))
return 0;
if (!v.isField() || v.semanticRun < PASS.semanticdone)
return 1; // unresolvable forward reference

ad.fields.push(v);

if (v.storage_class & STC.ref_)
return 0;
auto tv = v.type.baseElemOf();
if (tv.ty != Tstruct)
return 0;
if (ad == (cast(TypeStruct)tv).sym)
{
const(char)* psz = (v.type.toBasetype().ty == Tsarray) ? "static array of " : "";
ad.error("cannot have field `%s` with %ssame struct type", v.toChars(), psz);
ad.type = Type.terror;
ad.errors = true;
return 1;
}
return 0;
}

if (members)
{
for (size_t i = 0; i < members.dim; i++)
{
auto s = (*members)[i];
if (s.apply(&func, this))
{
if (sizeok != Sizeok.none)
{
// recursive determineFields already finished
return true;
}
return false;
}
}
}

if (sizeok != Sizeok.done)
sizeok = Sizeok.fwd;

return true;
}

/***************************************
* Returns:
* The total number of fields minus the number of hidden fields.
Expand Down Expand Up @@ -304,7 +205,7 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
}

// Determine instance fields when sizeok == Sizeok.none
if (!determineFields())
if (!this.determineFields())
goto Lfail;
if (sizeok != Sizeok.done)
finalizeSize();
Expand Down Expand Up @@ -411,10 +312,9 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
}
else if (v2._init && i < j)
{
// @@@DEPRECATED_v2.086@@@.
.deprecation(v2.loc, "union field `%s` with default initialization `%s` must be before field `%s`",
.error(v2.loc, "union field `%s` with default initialization `%s` must be before field `%s`",
v2.toChars(), v2._init.toChars(), vd.toChars());
//errors = true;
errors = true;
}
}
}
Expand Down Expand Up @@ -554,8 +454,9 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
* will return the base of the enum, and its default initializer
* would be different from the enum's.
*/
while (telem.toBasetype().ty == Tsarray)
telem = (cast(TypeSArray)telem.toBasetype()).next;
TypeSArray tsa;
while ((tsa = telem.toBasetype().isTypeSArray()) !is null)
telem = tsa.next;
if (telem.ty == Tvoid)
telem = Type.tuns8.addMod(telem.mod);
}
Expand Down Expand Up @@ -856,8 +757,7 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
version (IN_LLVM) {} else
{
// Back end
Symbol* stag; /// tag symbol for debug data
Symbol* sinit; /// initializer symbol
void* sinit; /// initializer symbol
}

override final inout(AggregateDeclaration) isAggregateDeclaration() inout
Expand Down
Loading