Skip to content

[pull] swiftwasm from master #1129

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

Merged
merged 11 commits into from
May 31, 2020
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
| **Ubuntu 16.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04)|
| **Ubuntu 18.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-18_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04)|
| **Ubuntu 20.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04)|
| **CentOS 8** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-package-centos-8/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-centos-8)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-centos-8)|
| **CentOS 8** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-package-centos-8/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-centos-8)|[![Build Status](https://ci.swift.org/job/oss-swift-package-centos-8/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-centos-8)|
| **Amazon Linux 2** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-package-amazon-linux-2/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-amazon-linux-2)|[![Build Status](https://ci.swift.org/job/oss-swift-package-amazon-linux-2/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-amazon-linux-2)|

**Swift Community-Hosted CI Platforms**
Expand Down
8 changes: 4 additions & 4 deletions include/swift/AST/Stmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -539,11 +539,11 @@ class LabeledStmt : public Stmt {
/// DoStmt - do statement, without any trailing clauses.
class DoStmt : public LabeledStmt {
SourceLoc DoLoc;
Stmt *Body;
BraceStmt *Body;

public:
DoStmt(LabeledStmtInfo labelInfo, SourceLoc doLoc,
Stmt *body, Optional<bool> implicit = None)
BraceStmt *body, Optional<bool> implicit = None)
: LabeledStmt(StmtKind::Do, getDefaultImplicitFlag(implicit, doLoc),
labelInfo),
DoLoc(doLoc), Body(body) {}
Expand All @@ -553,8 +553,8 @@ class DoStmt : public LabeledStmt {
SourceLoc getStartLoc() const { return getLabelLocOrKeywordLoc(DoLoc); }
SourceLoc getEndLoc() const { return Body->getEndLoc(); }

Stmt *getBody() const { return Body; }
void setBody(Stmt *s) { Body = s; }
BraceStmt *getBody() const { return Body; }
void setBody(BraceStmt *s) { Body = s; }

static bool classof(const Stmt *S) { return S->getKind() == StmtKind::Do; }
};
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/ASTWalker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,7 @@ Stmt *Traversal::visitGuardStmt(GuardStmt *US) {
}

Stmt *Traversal::visitDoStmt(DoStmt *DS) {
if (Stmt *S2 = doIt(DS->getBody()))
if (BraceStmt *S2 = cast_or_null<BraceStmt>(doIt(DS->getBody())))
DS->setBody(S2);
else
return nullptr;
Expand Down
14 changes: 7 additions & 7 deletions lib/Sema/BuilderTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@ class BuilderClosureVisitor
}

VarDecl *visitBraceStmt(BraceStmt *braceStmt) {
return visitBraceStmt(braceStmt, ctx.Id_buildBlock);
}

VarDecl *visitBraceStmt(BraceStmt *braceStmt, Identifier builderFunction) {
SmallVector<Expr *, 4> expressions;
auto addChild = [&](VarDecl *childVar) {
if (!childVar)
Expand Down Expand Up @@ -359,7 +363,7 @@ class BuilderClosureVisitor

// Call Builder.buildBlock(... args ...)
auto call = buildCallIfWanted(braceStmt->getStartLoc(),
ctx.Id_buildBlock, expressions,
builderFunction, expressions,
/*argLabels=*/{ });
if (!call)
return nullptr;
Expand All @@ -380,17 +384,13 @@ class BuilderClosureVisitor
return nullptr;
}

auto childVar = visit(doStmt->getBody());
auto childVar = visitBraceStmt(doStmt->getBody(), ctx.Id_buildDo);
if (!childVar)
return nullptr;

auto childRef = buildVarRef(childVar, doStmt->getEndLoc());
auto call = buildCallIfWanted(doStmt->getStartLoc(), ctx.Id_buildDo,
childRef, /*argLabels=*/{ });
if (!call)
return nullptr;

return captureExpr(call, /*oneWay=*/true, doStmt);
return captureExpr(childRef, /*oneWay=*/true, doStmt);
}

CONTROL_FLOW_STMT(Yield)
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/TypeCheckStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ class StmtChecker : public StmtVisitor<StmtChecker, Stmt*> {

Stmt *visitDoStmt(DoStmt *DS) {
AddLabeledStmt loopNest(*this, DS);
Stmt *S = DS->getBody();
BraceStmt *S = DS->getBody();
typeCheckStmt(S);
DS->setBody(S);
return DS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ enum Tree : Differentiable & AdditiveArithmetic {
case branch(Float, Float)

typealias TangentVector = Self
typealias AllDifferentiableVariables = Self
static var zero: Self { .leaf(0) }

// expected-error @+1 {{function is not differentiable}}
Expand Down
Loading