Skip to content

Commit 7c67096

Browse files
authored
Merge pull request #1129 from swiftwasm/master
[pull] swiftwasm from master
2 parents 3ed48c7 + dd645d8 commit 7c67096

File tree

13 files changed

+1300
-20
lines changed

13 files changed

+1300
-20
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
| **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)|
1010
| **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)|
1111
| **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)|
12-
| **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)|
12+
| **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)|
1313
| **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)|
1414

1515
**Swift Community-Hosted CI Platforms**

include/swift/AST/Stmt.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,11 +539,11 @@ class LabeledStmt : public Stmt {
539539
/// DoStmt - do statement, without any trailing clauses.
540540
class DoStmt : public LabeledStmt {
541541
SourceLoc DoLoc;
542-
Stmt *Body;
542+
BraceStmt *Body;
543543

544544
public:
545545
DoStmt(LabeledStmtInfo labelInfo, SourceLoc doLoc,
546-
Stmt *body, Optional<bool> implicit = None)
546+
BraceStmt *body, Optional<bool> implicit = None)
547547
: LabeledStmt(StmtKind::Do, getDefaultImplicitFlag(implicit, doLoc),
548548
labelInfo),
549549
DoLoc(doLoc), Body(body) {}
@@ -553,8 +553,8 @@ class DoStmt : public LabeledStmt {
553553
SourceLoc getStartLoc() const { return getLabelLocOrKeywordLoc(DoLoc); }
554554
SourceLoc getEndLoc() const { return Body->getEndLoc(); }
555555

556-
Stmt *getBody() const { return Body; }
557-
void setBody(Stmt *s) { Body = s; }
556+
BraceStmt *getBody() const { return Body; }
557+
void setBody(BraceStmt *s) { Body = s; }
558558

559559
static bool classof(const Stmt *S) { return S->getKind() == StmtKind::Do; }
560560
};

lib/AST/ASTWalker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1493,7 +1493,7 @@ Stmt *Traversal::visitGuardStmt(GuardStmt *US) {
14931493
}
14941494

14951495
Stmt *Traversal::visitDoStmt(DoStmt *DS) {
1496-
if (Stmt *S2 = doIt(DS->getBody()))
1496+
if (BraceStmt *S2 = cast_or_null<BraceStmt>(doIt(DS->getBody())))
14971497
DS->setBody(S2);
14981498
else
14991499
return nullptr;

lib/Sema/BuilderTransform.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,10 @@ class BuilderClosureVisitor
293293
}
294294

295295
VarDecl *visitBraceStmt(BraceStmt *braceStmt) {
296+
return visitBraceStmt(braceStmt, ctx.Id_buildBlock);
297+
}
298+
299+
VarDecl *visitBraceStmt(BraceStmt *braceStmt, Identifier builderFunction) {
296300
SmallVector<Expr *, 4> expressions;
297301
auto addChild = [&](VarDecl *childVar) {
298302
if (!childVar)
@@ -359,7 +363,7 @@ class BuilderClosureVisitor
359363

360364
// Call Builder.buildBlock(... args ...)
361365
auto call = buildCallIfWanted(braceStmt->getStartLoc(),
362-
ctx.Id_buildBlock, expressions,
366+
builderFunction, expressions,
363367
/*argLabels=*/{ });
364368
if (!call)
365369
return nullptr;
@@ -380,17 +384,13 @@ class BuilderClosureVisitor
380384
return nullptr;
381385
}
382386

383-
auto childVar = visit(doStmt->getBody());
387+
auto childVar = visitBraceStmt(doStmt->getBody(), ctx.Id_buildDo);
384388
if (!childVar)
385389
return nullptr;
386390

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

393-
return captureExpr(call, /*oneWay=*/true, doStmt);
393+
return captureExpr(childRef, /*oneWay=*/true, doStmt);
394394
}
395395

396396
CONTROL_FLOW_STMT(Yield)

lib/Sema/TypeCheckStmt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ class StmtChecker : public StmtVisitor<StmtChecker, Stmt*> {
658658

659659
Stmt *visitDoStmt(DoStmt *DS) {
660660
AddLabeledStmt loopNest(*this, DS);
661-
Stmt *S = DS->getBody();
661+
BraceStmt *S = DS->getBody();
662662
typeCheckStmt(S);
663663
DS->setBody(S);
664664
return DS;

test/AutoDiff/SILOptimizer/differentiation_control_flow_diagnostics.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ enum Tree : Differentiable & AdditiveArithmetic {
121121
case branch(Float, Float)
122122

123123
typealias TangentVector = Self
124-
typealias AllDifferentiableVariables = Self
125124
static var zero: Self { .leaf(0) }
126125

127126
// expected-error @+1 {{function is not differentiable}}

0 commit comments

Comments
 (0)