Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f70a51a
Merge 2.074.0 front-end
kinke Apr 21, 2017
83c9d66
druntime: Remove obsolete OSX code in rt.sections_ldc
kinke Apr 22, 2017
0a11aa8
druntime: Fix rt.sections_elf_shared regression
kinke Apr 22, 2017
708486d
druntime: Fix __cmp(void[], void[])
kinke Apr 22, 2017
1e11275
dmd-testsuite: Fix compile error for runnable/ldc_enum
kinke Apr 22, 2017
15e565e
Support cast runtime variables as case expressions
kinke Apr 22, 2017
fe3d36a
druntime: Fix rt.arrayint (RAX instead of EAX for 64-bit inline asm)
kinke Apr 23, 2017
a5fe1ab
Phobos: Fix missing alignment for kernighan_ritchie allocator unittests
kinke Apr 23, 2017
6ac98e3
Merge branch 'master' into merge-2.074
kinke Apr 23, 2017
bcec3d2
dmd-testsuite: Disable Windows-specific runnable/testptrref
kinke Apr 23, 2017
a966f22
druntime: Make LDC-specific fiber migration check @nogc
kinke Apr 23, 2017
0637caa
Phobos: Relax a few unittests for double-precision reals
kinke Apr 23, 2017
291c2a6
Merge branch 'master' into merge-2.074
kinke May 7, 2017
60285b7
Phobos: Apply upstream SSE control register fixes
kinke May 12, 2017
0ae2a95
Phobos: Tiny std.math inline assembly constraints fixes
kinke May 12, 2017
51f1b13
druntime: Mark dladdr() as @nogc for OSX
kinke May 12, 2017
6a44d57
Support DMD's new undocumented -vcg-ast switch
kinke May 14, 2017
a3025b0
druntime: Adapt core.memory to LLVM optimizer cleverness
kinke May 15, 2017
ff33356
Phobos: Disable some new std.math tests affected by issue #888
kinke May 15, 2017
85e004f
Merge branch 'master' into merge-2.074
kinke May 16, 2017
090031c
Upgrade front-end + libs to v2.074.1
kinke Jun 10, 2017
45eacd0
Merge branch 'master' into merge-2.074
kinke Jun 10, 2017
03d8034
Fix Target.RealProperties potentially aliasing Target.DoubleProperties
kinke Jun 10, 2017
6036769
Merge branch 'master' into merge-2.074
kinke Jun 25, 2017
a0a20cd
Merge branch 'master' into merge-2.074
kinke Jul 7, 2017
8a3188d
Merge branch 'master' into merge-2.074
kinke Jul 15, 2017
cd45257
Merge branch 'master' into merge-2.074
kinke Jul 20, 2017
66241ab
Merge branch 'master' into merge-2.074
kinke Jul 27, 2017
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
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ endfunction()
set(LDC_VERSION "1.4.0") # May be overridden by git hash tag
set(DMDFE_MAJOR_VERSION 2)
set(DMDFE_MINOR_VERSION 0)
set(DMDFE_PATCH_VERSION 73)
set(DMDFE_FIX_LEVEL 2) # Comment out if not used
set(DMDFE_PATCH_VERSION 74)
set(DMDFE_FIX_LEVEL 1) # Comment out if not used

set(DMD_VERSION ${DMDFE_MAJOR_VERSION}.${DMDFE_MINOR_VERSION}${DMDFE_PATCH_VERSION})
if(DEFINED DMDFE_FIX_LEVEL)
Expand Down Expand Up @@ -269,15 +269,15 @@ endmacro()
#
# Build idgen.
#
build_idgen(${DDMDFE_PATH}/idgen.d ${PROJECT_BINARY_DIR}/${DDMDFE_PATH}/idgen${CMAKE_EXECUTABLE_SUFFIX} ${DDMD_DFLAGS} "" "")
build_idgen(${DDMDFE_PATH}/idgen.d ${PROJECT_BINARY_DIR}/idgen${CMAKE_EXECUTABLE_SUFFIX} ${DDMD_DFLAGS} "" "")
# Run idgen.
add_custom_command(
OUTPUT
${PROJECT_BINARY_DIR}/${DDMDFE_PATH}/id.d
${PROJECT_BINARY_DIR}/${DDMDFE_PATH}/id.h
COMMAND ${PROJECT_BINARY_DIR}/${DDMDFE_PATH}/idgen #provide full path to avoid clash with idgen on path
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${DDMDFE_PATH}
DEPENDS ${PROJECT_BINARY_DIR}/${DDMDFE_PATH}/idgen${CMAKE_EXECUTABLE_SUFFIX}
COMMAND ${PROJECT_BINARY_DIR}/idgen #provide full path to avoid clash with idgen on path
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${PROJECT_BINARY_DIR}/idgen${CMAKE_EXECUTABLE_SUFFIX}
)
set(LDC_CXX_GENERATED
${PROJECT_BINARY_DIR}/${DDMDFE_PATH}/id.h
Expand Down
2 changes: 1 addition & 1 deletion ddmd/access.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Compiler implementation of the
* $(LINK2 http://www.dlang.org, D programming language).
*
* Copyright: Copyright (c) 1999-2016 by Digital Mars, All Rights Reserved
* Copyright: Copyright (c) 1999-2017 by Digital Mars, 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)
* Source: $(DMDSRC _access.d)
Expand Down
31 changes: 16 additions & 15 deletions ddmd/aggregate.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Compiler implementation of the
* $(LINK2 http://www.dlang.org, D programming language).
*
* Copyright: Copyright (c) 1999-2016 by Digital Mars, All Rights Reserved
* Copyright: Copyright (c) 1999-2017 by Digital Mars, 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)
* Source: $(DMDSRC _aggregate.d)
Expand Down Expand Up @@ -232,6 +232,8 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
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);

extern (C++) static int func(Dsymbol s, void* param)
{
Expand All @@ -241,8 +243,14 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
if (v.storage_class & STCmanifest)
return 0;

auto ad = cast(AggregateDeclaration)param;

if (v._scope)
v.semantic(null);
// Return in case a recursive determineFields triggered by v.semantic already finished
if (ad.sizeok != SIZEOKnone)
return 1;

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

Expand All @@ -251,18 +259,6 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
if (!v.isField() || v.semanticRun < PASSsemanticdone)
return 1; // unresolvable forward reference

auto ad = cast(AggregateDeclaration)param;
version(IN_LLVM)
{
for (size_t i = 0; i < ad.fields.dim; i++)
{
if (ad.fields[i] == v)
{
// already a field
return 0;
}
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to be checked, i.e., whether a proper fix preventing the same field from being added multiple times to the fields list has made it into upstream 2.074.

ad.fields.push(v);

if (v.storage_class & STCref)
Expand All @@ -281,13 +277,18 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
return 0;
}

fields.setDim(0);

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

if (sizeok != SIZEOKdone)
Expand Down
2 changes: 1 addition & 1 deletion ddmd/aliasthis.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Compiler implementation of the
* $(LINK2 http://www.dlang.org, D programming language).
*
* Copyright: Copyright (c) 1999-2016 by Digital Mars, All Rights Reserved
* Copyright: Copyright (c) 1999-2017 by Digital Mars, 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)
* Source: $(DMDSRC _aliasthis.d)
Expand Down
2 changes: 1 addition & 1 deletion ddmd/apply.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Compiler implementation of the
* $(LINK2 http://www.dlang.org, D programming language).
*
* Copyright: Copyright (c) 1999-2016 by Digital Mars, All Rights Reserved
* Copyright: Copyright (c) 1999-2017 by Digital Mars, 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)
* Source: $(DMDSRC _apply.d)
Expand Down
2 changes: 1 addition & 1 deletion ddmd/argtypes.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Compiler implementation of the
* $(LINK2 http://www.dlang.org, D programming language).
*
* Copyright: Copyright (c) 1999-2016 by Digital Mars, All Rights Reserved
* Copyright: Copyright (c) 1999-2017 by Digital Mars, 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)
* Source: $(DMDSRC _argtypes.d)
Expand Down
6 changes: 3 additions & 3 deletions ddmd/arrayop.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Compiler implementation of the
* $(LINK2 http://www.dlang.org, D programming language).
*
* Copyright: Copyright (c) 1999-2016 by Digital Mars, All Rights Reserved
* Copyright: Copyright (c) 1999-2017 by Digital Mars, 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)
* Source: $(DMDSRC _arrayop.d)
Expand Down Expand Up @@ -333,7 +333,7 @@ extern (C++) void buildArrayIdent(Expression e, OutBuffer* buf, Expressions* arg
switch (e.op)
{
case TOKaddass: s = "Addass"; break;
case TOKminass: s = "Subass"; break;
case TOKminass: s = "Minass"; break;
case TOKmulass: s = "Mulass"; break;
case TOKdivass: s = "Divass"; break;
case TOKmodass: s = "Modass"; break;
Expand Down Expand Up @@ -367,7 +367,7 @@ extern (C++) void buildArrayIdent(Expression e, OutBuffer* buf, Expressions* arg
switch (e.op)
{
case TOKadd: s = "Add"; break;
case TOKmin: s = "Sub"; break;
case TOKmin: s = "Min"; break;
case TOKmul: s = "Mul"; break;
case TOKdiv: s = "Div"; break;
case TOKmod: s = "Mod"; break;
Expand Down
2 changes: 1 addition & 1 deletion ddmd/arraytypes.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Compiler implementation of the
* $(LINK2 http://www.dlang.org, D programming language).
*
* Copyright: Copyright (c) 1999-2016 by Digital Mars, All Rights Reserved
* Copyright: Copyright (c) 1999-2017 by Digital Mars, 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)
* Source: $(DMDSRC _arraytypes.d)
Expand Down
115 changes: 115 additions & 0 deletions ddmd/asttypename.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/**
* Part of the Compiler implementation of the D programming language
* Copyright: Copyright (c) 1999-2017 by The D Language Foundation, All Rights Reserved
* Authors: Stefan Koch
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(DMDSRC _asttypename.d)
*/

module ddmd.asttypename;

import ddmd.attrib;
import ddmd.aliasthis;
import ddmd.aggregate;
import ddmd.complex;
import ddmd.cond;
import ddmd.ctfeexpr;
import ddmd.dclass;
import ddmd.declaration;
import ddmd.denum;
import ddmd.dimport;
import ddmd.declaration;
import ddmd.dstruct;
import ddmd.dsymbol;
import ddmd.dtemplate;
import ddmd.dversion;
import ddmd.expression;
import ddmd.func;
import ddmd.denum;
import ddmd.dimport;
import ddmd.dmodule;
import ddmd.mtype;
import ddmd.typinf;
import ddmd.identifier;
import ddmd.init;
import ddmd.doc;
import ddmd.root.rootobject;
import ddmd.statement;
import ddmd.staticassert;
import ddmd.nspace;
import ddmd.visitor;

/// Returns: the typename of the dynamic ast-node-type
/// (this is a development tool, do not use in actual code)
string astTypeName(RootObject node)
{
final switch (node.dyncast())
{
case DYNCAST.object:
return "RootObject";
case DYNCAST.identifier:
return "Identifier";

case DYNCAST.expression:
return astTypeName(cast(Expression) node);
case DYNCAST.dsymbol:
return astTypeName(cast(Dsymbol) node);
case DYNCAST.type:
return astTypeName(cast(Type) node);
case DYNCAST.tuple:
return astTypeName(cast(Tuple) node);
case DYNCAST.parameter:
return astTypeName(cast(Parameter) node);
case DYNCAST.statement:
return astTypeName(cast(Statement) node);
case DYNCAST.condition:
return astTypeName(cast(Condition) node);
}
}

mixin
({
string astTypeNameFunctions;
string visitOverloads;

foreach (ov; __traits(getOverloads, Visitor, "visit"))
{
static if (is(typeof(ov) P == function))
{
static if (is(P[0] S == super) && is(S[0] == RootObject))
{
astTypeNameFunctions ~= `
string astTypeName(` ~ P[0].stringof ~ ` node)
{
scope tsv = new AstTypeNameVisitor;
node.accept(tsv);
return tsv.typeName;
}
`;
}

visitOverloads ~= `
override void visit (` ~ P[0].stringof ~ ` _)
{
typeName = "` ~ P[0].stringof ~ `";
}
`;
}
}

return astTypeNameFunctions ~ `
extern(C++) final class AstTypeNameVisitor : Visitor
{
alias visit = super.visit;
public :
string typeName;
` ~ visitOverloads ~ "}";
}());

///
unittest
{
import ddmd.globals : Loc;
Expression e = new TypeidExp(Loc.init, null);
assert(e.astTypeName == "TypeidExp");
}
2 changes: 1 addition & 1 deletion ddmd/attrib.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Compiler implementation of the
* $(LINK2 http://www.dlang.org, D programming language).
*
* Copyright: Copyright (c) 1999-2016 by Digital Mars, All Rights Reserved
* Copyright: Copyright (c) 1999-2017 by Digital Mars, 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)
* Source: $(DMDSRC _attrib.d)
Expand Down
2 changes: 1 addition & 1 deletion ddmd/builtin.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Compiler implementation of the
* $(LINK2 http://www.dlang.org, D programming language).
*
* Copyright: Copyright (c) 1999-2016 by Digital Mars, All Rights Reserved
* Copyright: Copyright (c) 1999-2017 by Digital Mars, 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)
* Source: $(DMDSRC _builtin.d)
Expand Down
4 changes: 2 additions & 2 deletions ddmd/canthrow.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Compiler implementation of the
* $(LINK2 http://www.dlang.org, D programming language).
*
* Copyright: Copyright (c) 1999-2016 by Digital Mars, All Rights Reserved
* Copyright: Copyright (c) 1999-2017 by Digital Mars, 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)
* Source: $(DMDSRC _canthrow.d)
Expand Down Expand Up @@ -294,7 +294,7 @@ extern (C++) bool Dsymbol_canThrow(Dsymbol s, FuncDeclaration func, bool mustNot
for (size_t i = 0; i < td.objects.dim; i++)
{
RootObject o = (*td.objects)[i];
if (o.dyncast() == DYNCAST_EXPRESSION)
if (o.dyncast() == DYNCAST.expression)
{
Expression eo = cast(Expression)o;
if (eo.op == TOKdsymbol)
Expand Down
15 changes: 6 additions & 9 deletions ddmd/clone.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Compiler implementation of the
* $(LINK2 http://www.dlang.org, D programming language).
*
* Copyright: Copyright (c) 1999-2016 by Digital Mars, All Rights Reserved
* Copyright: Copyright (c) 1999-2017 by Digital Mars, 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)
* Source: $(DMDSRC _clone.d)
Expand Down Expand Up @@ -782,7 +782,7 @@ extern (C++) FuncDeclaration buildPostBlit(StructDeclaration sd, Scope* sc)
stc |= sd.postblits[i].storage_class & STCdisable;
}

Statements* a = null;
auto a = new Statements();
for (size_t i = 0; i < sd.fields.dim && !(stc & STCdisable); i++)
{
auto v = sd.fields[i];
Expand All @@ -803,11 +803,9 @@ extern (C++) FuncDeclaration buildPostBlit(StructDeclaration sd, Scope* sc)
stc = mergeFuncAttrs(stc, sdv.dtor);
if (stc & STCdisable)
{
a = null;
a.setDim(0);
break;
}
if (!a)
a = new Statements();

Expression ex;
tv = v.type.toBasetype();
Expand Down Expand Up @@ -918,15 +916,14 @@ extern (C++) FuncDeclaration buildPostBlit(StructDeclaration sd, Scope* sc)
a.push(new OnScopeStatement(loc, TOKon_scope_failure, new ExpStatement(loc, ex)));
}

/* Build our own "postblit" which executes a
*/
if (a || (stc & STCdisable))
// Build our own "postblit" which executes a, but only if needed.
if (a.dim || (stc & STCdisable))
{
//printf("Building __fieldPostBlit()\n");
auto dd = new PostBlitDeclaration(declLoc, Loc(), stc, Id.__fieldPostblit);
dd.generated = true;
dd.storage_class |= STCinference;
dd.fbody = a ? new CompoundStatement(loc, a) : null;
dd.fbody = (stc & STCdisable) ? null : new CompoundStatement(loc, a);
sd.postblits.shift(dd);
sd.members.push(dd);
dd.semantic(sc);
Expand Down
2 changes: 1 addition & 1 deletion ddmd/complex.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Compiler implementation of the
* $(LINK2 http://www.dlang.org, D programming language).
*
* Copyright: Copyright (c) 1999-2016 by Digital Mars, All Rights Reserved
* Copyright: Copyright (c) 1999-2017 by Digital Mars, 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)
* Source: $(DMDSRC _complex.d)
Expand Down
Loading