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

merge stable #11027

Merged
merged 34 commits into from Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b1e245d
Follow-up on #9221
kinke Mar 4, 2020
7ed5272
Fix Issue 20649 - Trait isZeroInit gives false in certain scenarios
BorisCarvajal Mar 9, 2020
345fac2
Merge pull request #10864 from kinke/needmoduleinfo
dlang-bot Mar 10, 2020
f0b4051
Merge pull request #10881 from BorisCarvajal/zeroinit
dlang-bot Mar 10, 2020
16b3334
Set the DMD binary as executable
Mar 10, 2020
e9d316a
Merge pull request #10889 from ErnyTech/stable
dlang-bot Mar 10, 2020
1a065b7
Fix Issue 20656 - cannot compile live function without -preview=dip1021
kubo39 Mar 9, 2020
8fed09c
Fix Issue 20610 - const in a .tupleof loop is ignored
BorisCarvajal Mar 15, 2020
7c22d24
Merge pull request #10923 from BorisCarvajal/fix20610
dlang-bot Mar 15, 2020
8f24852
Fix Issue 20130 - ICE when casting from string to other array type du…
BorisCarvajal Mar 18, 2020
ff7c9ef
Merge pull request #10941 from BorisCarvajal/fix20130
dlang-bot Mar 19, 2020
9200421
Merge pull request #10883 from kubo39/bugfix-20656
dlang-bot Mar 19, 2020
4ad1a19
Fix Issue 20687 - Allow member function address as const initializer
BorisCarvajal Mar 19, 2020
aba2dea
Merge pull request #10946 from BorisCarvajal/mptr_constinit
dlang-bot Mar 20, 2020
ef669f8
Fix Issue 20692 - Nested alias declarations and getMember trait can c…
BorisCarvajal Mar 21, 2020
1f3245d
Revert "Fix Issue 20687 - Allow member function address as const init…
ibuclaw Mar 20, 2020
a22ea07
Merge pull request #10952 from BorisCarvajal/fix20692
RazvanN7 Mar 31, 2020
050e71d
Fix issue 20700 - Fwd refs leads to extern(C++, class|struct) being i…
Geod24 Mar 31, 2020
4a39506
Merge pull request #10988 from Geod24/fix-20700
dlang-bot Apr 3, 2020
d96d44e
Fix Issue 18651 - ice: assert in glue.d:777 when building these three…
BorisCarvajal Apr 3, 2020
b15b0c4
Fix misc. issues wrt. temporaries for -checkaction=context lowering
kinke Apr 4, 2020
f4dc07c
Handle mixin expressions as assert conditions
kinke Apr 5, 2020
cbe2eee
Merge pull request #11005 from kinke/context
dlang-bot Apr 8, 2020
6354aee
bump VERSION to v2.091.1-beta.1
MartinNowak Apr 12, 2020
e8922ef
fix Issue 20730 - [REG 2.091] __traits(compiles) fails if any ungagge…
ibuclaw Apr 12, 2020
fa488fc
Merge pull request #11023 from ibuclaw/reg20730
dlang-bot Apr 12, 2020
f4988a7
Remove qualifiers from toPrec return type
ibuclaw Apr 12, 2020
18bcf60
2 small frontend fix-ups after v2.091.0
kinke Apr 12, 2020
9cc0e86
Merge pull request #11026 from ibuclaw/toprecswitch
dlang-bot Apr 12, 2020
83a929e
Merge pull request #11028 from kinke/stable
dlang-bot Apr 13, 2020
d02acc9
Fix Issue 20742 - dmd -X (JSON output) includes uncompiled symbols
MoonlightSentinel Apr 17, 2020
9236ba5
bump VERSION to v2.091.1
MartinNowak Apr 17, 2020
9b15009
Merge pull request #11044 from MoonlightSentinel/json-version
dlang-bot Apr 20, 2020
121b839
Merge remote-tracking branch 'upstream/stable' into merge_stable
Geod24 Apr 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
v2.091.0
v2.091.1
5 changes: 3 additions & 2 deletions src/build.d
Expand Up @@ -754,7 +754,7 @@ alias install = makeRule!((builder, rule) {
const bin = "bin" ~ env["MODEL"];
}

installRelativeFiles(env["INSTALL"].buildPath(env["OS"], bin), dmdExeFile.dirName, dmdExeFile.only);
installRelativeFiles(env["INSTALL"].buildPath(env["OS"], bin), dmdExeFile.dirName, dmdExeFile.only, octal!755);

version (Windows)
installRelativeFiles(env["INSTALL"], dmdRepo, sourceFiles);
Expand Down Expand Up @@ -1862,7 +1862,7 @@ Params:
in targetDir as they are from sourceBase
files = the files to install. must be in sourceBase
*/
void installRelativeFiles(T)(string targetDir, string sourceBase, T files)
void installRelativeFiles(T)(string targetDir, string sourceBase, T files, uint attributes = octal!644)
{
struct FileToCopy
{
Expand All @@ -1885,6 +1885,7 @@ void installRelativeFiles(T)(string targetDir, string sourceBase, T files)
foreach (fileToCopy; dirFilePair.value)
{
std.file.copy(fileToCopy.name, targetDir.buildPath(fileToCopy.relativeName));
std.file.setAttributes(targetDir.buildPath(fileToCopy.relativeName), attributes);
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/dmd/aggregate.d
Expand Up @@ -85,6 +85,10 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol

/// specifies whether this is a D, C++, Objective-C or anonymous struct/class/interface
ClassKind classKind;
/// Specify whether to mangle the aggregate as a `class` or a `struct`
/// This information is used by the MSVC mangler
/// Only valid for class and struct. TODO: Merge with ClassKind ?
CPPMANGLE cppmangle;

/* !=null if is nested
* pointing to the dsymbol that directly enclosing it.
Expand Down
1 change: 1 addition & 0 deletions src/dmd/aggregate.h
Expand Up @@ -84,6 +84,7 @@ class AggregateDeclaration : public ScopeDsymbol
Dsymbol *deferred; // any deferred semantic2() or semantic3() symbol

ClassKind::Type classKind; // specifies the linkage type
CPPMANGLE cppmangle;

/* !=NULL if is nested
* pointing to the dsymbol that directly enclosing it.
Expand Down
7 changes: 7 additions & 0 deletions src/dmd/attrib.d
Expand Up @@ -442,6 +442,13 @@ extern (C++) final class CPPMangleDeclaration : AttribDeclaration
sc.aligndecl, sc.inlining);
}

override void setScope(Scope* sc)
{
if (decl)
Dsymbol.setScope(sc); // for forward reference
return AttribDeclaration.setScope(sc);
}

override const(char)* toChars() const
{
return toString().ptr;
Expand Down
1 change: 1 addition & 0 deletions src/dmd/attrib.h
Expand Up @@ -87,6 +87,7 @@ class CPPMangleDeclaration : public AttribDeclaration

Dsymbol *syntaxCopy(Dsymbol *s);
Scope *newScope(Scope *sc);
void setScope(Scope *sc);
const char *toChars() const;
void accept(Visitor *v) { v->visit(this); }
};
Expand Down
8 changes: 6 additions & 2 deletions src/dmd/cppmanglewin.d
Expand Up @@ -16,8 +16,10 @@ import core.stdc.stdio;

import dmd.arraytypes;
import dmd.cppmangle : isPrimaryDtor, isCppOperator, CppOperator;
import dmd.dclass;
import dmd.declaration;
import dmd.denum : isSpecialEnumIdent;
import dmd.dstruct;
import dmd.dsymbol;
import dmd.dtemplate;
import dmd.errors;
Expand Down Expand Up @@ -385,10 +387,11 @@ public:
return;
//printf("visit(TypeStruct); is_not_top_type = %d\n", (int)(flags & IS_NOT_TOP_TYPE));
mangleModifier(type);
const agg = type.sym.isStructDeclaration();
if (type.sym.isUnionDeclaration())
buf.writeByte('T');
else
buf.writeByte(type.cppmangle == CPPMANGLE.asClass ? 'V' : 'U');
buf.writeByte(agg.cppmangle == CPPMANGLE.asClass ? 'V' : 'U');
mangleIdent(type.sym);
flags &= ~IS_NOT_TOP_TYPE;
flags &= ~IGNORE_CONST;
Expand Down Expand Up @@ -456,7 +459,8 @@ public:
buf.writeByte('E');
flags |= IS_NOT_TOP_TYPE;
mangleModifier(type);
buf.writeByte(type.cppmangle == CPPMANGLE.asStruct ? 'U' : 'V');
const cldecl = type.sym.isClassDeclaration();
buf.writeByte(cldecl.cppmangle == CPPMANGLE.asStruct ? 'U' : 'V');
mangleIdent(type.sym);
flags &= ~IS_NOT_TOP_TYPE;
flags &= ~IGNORE_CONST;
Expand Down
23 changes: 11 additions & 12 deletions src/dmd/dsymbolsem.d
Expand Up @@ -1591,20 +1591,16 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
// if inside a template instantiation, the instantianting
// module gets the import.
// https://issues.dlang.org/show_bug.cgi?id=17181
Module importer = sc._module;
if (sc.minst && sc.tinst)
{
//printf("%s imports %s\n", sc.minst.toChars(), imp.mod.toChars());
importer = sc.minst;
if (!sc.tinst.importedModules.contains(imp.mod))
sc.tinst.importedModules.push(imp.mod);
if (!sc.minst.aimports.contains(imp.mod))
sc.minst.aimports.push(imp.mod);
}
else
{
//printf("%s imports %s\n", sc._module.toChars(), imp.mod.toChars());
if (!sc._module.aimports.contains(imp.mod))
sc._module.aimports.push(imp.mod);
}
//printf("%s imports %s\n", importer.toChars(), imp.mod.toChars());
if (!importer.aimports.contains(imp.mod))
importer.aimports.push(imp.mod);

if (sc.explicitProtection)
imp.protection = sc.protection;
Expand Down Expand Up @@ -1656,8 +1652,8 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor

if (imp.mod.needmoduleinfo)
{
//printf("module4 %s because of %s\n", sc.module.toChars(), mod.toChars());
sc._module.needmoduleinfo = 1;
//printf("module4 %s because of %s\n", importer.toChars(), imp.mod.toChars());
importer.needmoduleinfo = 1;
}

sc = sc.push(imp.mod);
Expand Down Expand Up @@ -4702,6 +4698,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
if (sc.linkage == LINK.cpp)
sd.classKind = ClassKind.cpp;
sd.cppnamespace = sc.namespace;
sd.cppmangle = sc.cppmangle;
}
else if (sd.symtab && !scx)
return;
Expand Down Expand Up @@ -4920,6 +4917,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
if (sc.linkage == LINK.cpp)
cldec.classKind = ClassKind.cpp;
cldec.cppnamespace = sc.namespace;
cldec.cppmangle = sc.cppmangle;
if (sc.linkage == LINK.objc)
objc.setObjc(cldec);
}
Expand Down Expand Up @@ -6402,9 +6400,10 @@ void aliasSemantic(AliasDeclaration ds, Scope* sc)
//printf("AliasDeclaration::semantic() %s\n", ds.toChars());

// TypeTraits needs to know if it's located in an AliasDeclaration
const oldflags = sc.flags;
sc.flags |= SCOPE.alias_;
scope(exit)
sc.flags &= ~SCOPE.alias_;
sc.flags = oldflags;

// preserve the original type
if (!ds.originalType && ds.type)
Expand Down
2 changes: 1 addition & 1 deletion src/dmd/e2ir.d
Expand Up @@ -484,7 +484,7 @@ if (!irs.params.is64bit) assert(tysize(TYnptr) == 4);
{
static int X(int fty, int tty) { return fty * TMAX + tty; }

final switch (X(tybasic(ep.Ety), tyret))
final switch (X(tybasic(ep.Ety), tybasic(tyret)))
{
case X(TYfloat, TYfloat): // float -> float
case X(TYdouble, TYdouble): // double -> double
Expand Down
88 changes: 45 additions & 43 deletions src/dmd/expressionsem.d
Expand Up @@ -5864,20 +5864,8 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
printf("AssertExp::semantic('%s')\n", exp.toChars());
}

// save expression as a string before any semantic expansion
// if -checkaction=context is enabled an no message exists
const generateMsg = !exp.msg && global.params.checkAction == CHECKACTION.context;
auto assertExpMsg = generateMsg ? exp.toChars() : null;

if (Expression ex = unaSemantic(exp, sc))
{
result = ex;
return;
}
exp.e1 = resolveProperties(sc, exp.e1);
// BUG: see if we can do compile time elimination of the Assert
exp.e1 = exp.e1.optimize(WANTvalue);
exp.e1 = exp.e1.toBoolean(sc);
Expression temporariesPrefix;

if (generateMsg)
// no message - use assert expression as msg
Expand All @@ -5895,29 +5883,38 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
effects as in https://issues.dlang.org/show_bug.cgi?id=20114

Params:
op = an expression which may require a temporary and will be
replaced by `(auto tmp = op, tmp)` if necessary
op = an expression which may require a temporary (added to
`temporariesPrefix`: `auto tmp = op`) and will be replaced
by `tmp` if necessary

Returns: `op` or `tmp` for subsequent access to the possibly promoted operand
Returns: (possibly replaced) `op`
*/
Expression maybePromoteToTmp(ref Expression op)
{
op = op.expressionSemantic(sc);
op = resolveProperties(sc, op);
if (op.hasSideEffect)
{
const stc = STC.exptemp | (op.isLvalue() ? STC.ref_ : STC.rvalue);
const stc = op.isLvalue() ? STC.ref_ : 0;
auto tmp = copyToTemp(stc, "__assertOp", op);
tmp.dsymbolSemantic(sc);

auto decl = new DeclarationExp(op.loc, tmp);
auto var = new VarExp(op.loc, tmp);
auto comb = Expression.combine(decl, var);
op = comb.expressionSemantic(sc);
temporariesPrefix = Expression.combine(temporariesPrefix, decl);

return var;
op = new VarExp(op.loc, tmp);
op = op.expressionSemantic(sc);
}
return op;
}

// if the assert condition is a mixin expression, try to compile it
if (auto ce = exp.e1.isCompileExp())
{
if (auto e1 = compileIt(ce))
exp.e1 = e1;
}

const tok = exp.e1.op;
bool isEqualsCallExpression;
if (tok == TOK.call)
Expand Down Expand Up @@ -5953,31 +5950,20 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
auto callExp = cast(CallExp) exp.e1;
auto args = callExp.arguments;

// template args
static immutable compMsg = "==";
Expression comp = new StringExp(loc, compMsg);
comp = comp.expressionSemantic(sc);
(*tiargs)[0] = comp;

// structs with opEquals get rewritten to a DotVarExp:
// a.opEquals(b)
// https://issues.dlang.org/show_bug.cgi?id=20100
if (args.length == 1)
{
auto dv = callExp.e1.isDotVarExp();
assert(dv);
(*tiargs)[1] = dv.e1.type;
(*tiargs)[2] = (*args)[0].type;

// runtime args
(*es)[0] = maybePromoteToTmp(dv.e1);
(*es)[1] = maybePromoteToTmp((*args)[0]);
}
else
{
(*tiargs)[1] = (*args)[0].type;
(*tiargs)[2] = (*args)[1].type;

// runtime args
(*es)[0] = maybePromoteToTmp((*args)[0]);
(*es)[1] = maybePromoteToTmp((*args)[1]);
Expand All @@ -5987,18 +5973,18 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
{
auto binExp = cast(EqualExp) exp.e1;

// template args
Expression comp = new StringExp(loc, Token.toString(exp.e1.op));
comp = comp.expressionSemantic(sc);
(*tiargs)[0] = comp;
(*tiargs)[1] = binExp.e1.type;
(*tiargs)[2] = binExp.e2.type;

// runtime args
(*es)[0] = maybePromoteToTmp(binExp.e1);
(*es)[1] = maybePromoteToTmp(binExp.e2);
}

// template args
Expression comp = new StringExp(loc, isEqualsCallExpression ? "==" : Token.toString(exp.e1.op));
comp = comp.expressionSemantic(sc);
(*tiargs)[0] = comp;
(*tiargs)[1] = (*es)[0].type;
(*tiargs)[2] = (*es)[1].type;

Expression __assertFail = new IdentifierExp(exp.loc, Id.empty);
auto assertFail = new DotIdExp(loc, __assertFail, Id.object);

Expand All @@ -6009,10 +5995,22 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
else
{
OutBuffer buf;
buf.printf("%s failed", assertExpMsg);
buf.printf("%s failed", exp.toChars());
exp.msg = new StringExp(Loc.initial, buf.extractSlice());
}
}

if (Expression ex = unaSemantic(exp, sc))
{
result = ex;
return;
}

exp.e1 = resolveProperties(sc, exp.e1);
// BUG: see if we can do compile time elimination of the Assert
exp.e1 = exp.e1.optimize(WANTvalue);
exp.e1 = exp.e1.toBoolean(sc);

if (exp.msg)
{
exp.msg = expressionSemantic(exp.msg, sc);
Expand Down Expand Up @@ -6055,8 +6053,12 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
return;
}
}

exp.type = Type.tvoid;
result = exp;

result = !temporariesPrefix
? exp
: Expression.combine(temporariesPrefix, exp).expressionSemantic(sc);
}

override void visit(DotIdExp exp)
Expand Down Expand Up @@ -7144,8 +7146,8 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
auto tFrom = t1b.nextOf();
auto tTo = tob.nextOf();

// https://issues.dlang.org/show_bug.cgi?id=19954
if (exp.e1.op != TOK.string_ || tTo.ty == Tarray)
// https://issues.dlang.org/show_bug.cgi?id=20130
if (exp.e1.op != TOK.string_ || !ex.isStringExp)
{
const uint fromSize = cast(uint)tFrom.size();
const uint toSize = cast(uint)tTo.size();
Expand Down
1 change: 1 addition & 0 deletions src/dmd/json.d
Expand Up @@ -576,6 +576,7 @@ public:
if (d.condition.inc != Include.notComputed)
{
visit(cast(AttribDeclaration)d);
return; // Don't visit the if/else bodies again below
}
Dsymbols* ds = d.decl ? d.decl : d.elsedecl;
for (size_t i = 0; i < ds.dim; i++)
Expand Down
1 change: 1 addition & 0 deletions src/dmd/mars.d
Expand Up @@ -634,6 +634,7 @@ private int tryMain(size_t argc, const(char)** argv, ref Param params)
{
foreach (i; 1 .. modules[0].aimports.dim)
semantic3OnDependencies(modules[0].aimports[i]);
Module.runDeferredSemantic3();

const data = (*ob)[];
if (params.moduleDepsFile)
Expand Down