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 upstream stable (dlang/dmd@f2fbdcacaa) #3790

Merged
merged 1 commit into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ set(LDC_VERSION "1.27.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 0)
set(DMDFE_FIX_LEVEL 1)

set(DMD_VERSION ${DMDFE_MAJOR_VERSION}.${DMDFE_MINOR_VERSION}${DMDFE_PATCH_VERSION})
if(DEFINED DMDFE_FIX_LEVEL)
Expand Down
2 changes: 2 additions & 0 deletions dmd/dmodule.d
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,8 @@ else
foreach (id; md.packages[1 .. $]) // [b, c]
{
p = cast(Package) p.symtab.lookup(id);
if (p is null)
break;
addAccessiblePackage(p, Visibility(Visibility.Kind.private_));
}
}
Expand Down
3 changes: 2 additions & 1 deletion dmd/expressionsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -2344,7 +2344,8 @@ private bool functionParameters(const ref Loc loc, Scope* sc,

/* Declare temporary 'auto __pfx = arg' (needsDtor) or 'auto __pfy = arg' (!needsDtor)
*/
auto tmp = copyToTemp(parameter.storageClass & (STC.scope_),
auto tmp = copyToTemp(
(parameter ? parameter.storageClass : tf.parameterList.stc) & (STC.scope_),
needsDtor ? "__pfx" : "__pfy",
!isRef ? arg : arg.addressOf());
tmp.dsymbolSemantic(sc);
Expand Down
23 changes: 10 additions & 13 deletions dmd/parse.d
Original file line number Diff line number Diff line change
Expand Up @@ -3112,12 +3112,9 @@ final class Parser(AST) : Lexer
nextToken();
int alt = 0;
const typeLoc = token.loc;
Identifier ident;
memtype = parseBasicType();
memtype = parseDeclarator(memtype, alt, ident);
if (ident)
error("unexpected identifier `%s` in declarator", ident.toChars());
checkCstyleTypeSyntax(typeLoc, memtype, alt, ident);
memtype = parseDeclarator(memtype, alt, null);
checkCstyleTypeSyntax(typeLoc, memtype, alt, null);
}

e = new AST.EnumDeclaration(loc, id, memtype);
Expand Down Expand Up @@ -3611,11 +3608,8 @@ final class Parser(AST) : Lexer
t = parseBasicType();

int alt = 0;
Identifier ident;
t = parseDeclarator(t, alt, ident, ptpl);
checkCstyleTypeSyntax(typeLoc, t, alt, ident);
if (pident)
*pident = ident;
t = parseDeclarator(t, alt, pident, ptpl);
checkCstyleTypeSyntax(typeLoc, t, alt, pident ? *pident : null);

t = t.addSTC(stc);
return t;
Expand Down Expand Up @@ -4086,7 +4080,7 @@ final class Parser(AST) : Lexer
* type declared
* Reference: https://dlang.org/spec/declaration.html#Declarator
*/
private AST.Type parseDeclarator(AST.Type t, ref int palt, out Identifier pident,
private AST.Type parseDeclarator(AST.Type t, ref int palt, Identifier* pident,
AST.TemplateParameters** tpl = null, StorageClass storageClass = 0,
bool* pdisable = null, AST.Expressions** pudas = null)
{
Expand All @@ -4096,7 +4090,10 @@ final class Parser(AST) : Lexer
switch (token.value)
{
case TOK.identifier:
pident = token.ident;
if (pident)
*pident = token.ident;
else
error("unexpected identifier `%s` in declarator", token.ident.toChars());
ts = t;
nextToken();
break;
Expand Down Expand Up @@ -4793,7 +4790,7 @@ final class Parser(AST) : Lexer
const loc = token.loc;
Identifier ident;

auto t = parseDeclarator(ts, alt, ident, &tpl, storage_class, &disable, &udas);
auto t = parseDeclarator(ts, alt, &ident, &tpl, storage_class, &disable, &udas);
assert(t);
if (!tfirst)
tfirst = t;
Expand Down
24 changes: 9 additions & 15 deletions dmd/statementsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ private extern (C++) final class StatementSemanticVisitor : Visitor
const inLoopSave = sc.inLoop;
sc.inLoop = true;
if (ds._body)
ds._body = ds._body.semanticScope(sc, ds, ds);
ds._body = ds._body.semanticScope(sc, ds, ds, null);
sc.inLoop = inLoopSave;

if (ds.condition.op == TOK.dotIdentifier)
Expand Down Expand Up @@ -2375,7 +2375,7 @@ else
CtorFlow ctorflow_then = sc.ctorflow; // move flow results
sc.ctorflow = ctorflow_root; // reset flow analysis back to root
if (ifs.elsebody)
ifs.elsebody = ifs.elsebody.semanticScope(sc, null, null);
ifs.elsebody = ifs.elsebody.semanticScope(sc, null, null, null);

// Merge 'then' results into 'else' results
sc.merge(ifs.loc, ctorflow_then);
Expand Down Expand Up @@ -4021,13 +4021,9 @@ version (IN_LLVM)
enum FLAGcpp = 1;
enum FLAGd = 2;

tcs.tryBody = sc.tryBody;

scope sc2 = sc.push();
sc2.tryBody = tcs;
tcs._body = tcs._body.semanticScope(sc2, null, null);
tcs.tryBody = sc.tryBody; // chain on the in-flight tryBody
tcs._body = tcs._body.semanticScope(sc, null, null, tcs);
assert(tcs._body);
sc2.pop();

/* Even if body is empty, still do semantic analysis on catches
*/
Expand Down Expand Up @@ -4108,12 +4104,8 @@ version (IN_LLVM)
override void visit(TryFinallyStatement tfs)
{
//printf("TryFinallyStatement::semantic()\n");
tfs.tryBody = sc.tryBody;

auto sc2 = sc.push();
sc2.tryBody = tfs;
tfs._body = tfs._body.statementSemantic(sc2);
sc2.pop();
tfs.tryBody = sc.tryBody; // chain on in-flight tryBody
tfs._body = tfs._body.semanticScope(sc, null, null, tfs);

sc = sc.push();
sc.tf = tfs;
Expand Down Expand Up @@ -4544,7 +4536,7 @@ Statement semanticNoScope(Statement s, Scope* sc)
}

// Same as semanticNoScope(), but do create a new scope
Statement semanticScope(Statement s, Scope* sc, Statement sbreak, Statement scontinue)
private Statement semanticScope(Statement s, Scope* sc, Statement sbreak, Statement scontinue, Statement tryBody)
{
auto sym = new ScopeDsymbol();
sym.parent = sc.scopesym;
Expand All @@ -4553,6 +4545,8 @@ Statement semanticScope(Statement s, Scope* sc, Statement sbreak, Statement scon
scd.sbreak = sbreak;
if (scontinue)
scd.scontinue = scontinue;
if (tryBody)
scd.tryBody = tryBody;
s = s.semanticNoScope(scd);
scd.pop();
return s;
Expand Down
2 changes: 1 addition & 1 deletion runtime/druntime
Submodule druntime updated 1 files
+2 −6 posix.mak
2 changes: 1 addition & 1 deletion runtime/phobos
Submodule phobos updated 4 files
+2 −6 posix.mak
+5 −4 std/signals.d
+60 −10 std/traits.d
+20 −4 std/typecons.d