Skip to content

Commit e4ebc91

Browse files
committed
---
yaml --- r: 348102 b: refs/heads/master c: f37ab1b h: refs/heads/master
1 parent 0c98d57 commit e4ebc91

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: d8dbed7eab1fb757faa42b7893aba21db8c94353
2+
refs/heads/master: f37ab1bf652fa523d75a02727ce92e1c7f45dfc4
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/lib/SILOptimizer/Utils/SILInliner.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,15 +559,18 @@ SILValue SILInlineCloner::borrowFunctionArgument(SILValue callArg,
559559
|| callArg.getOwnershipKind() != ValueOwnershipKind::Owned) {
560560
return callArg;
561561
}
562-
auto *borrow = getBuilder().createBeginBorrow(AI.getLoc(), callArg);
562+
563+
SILBuilderWithScope beginBuilder(AI.getInstruction(), getBuilder());
564+
auto *borrow = beginBuilder.createBeginBorrow(AI.getLoc(), callArg);
563565
if (auto *tryAI = dyn_cast<TryApplyInst>(AI)) {
564-
SILBuilder returnBuilder(tryAI->getNormalBB()->begin());
566+
SILBuilderWithScope returnBuilder(tryAI->getNormalBB()->begin());
565567
returnBuilder.createEndBorrow(AI.getLoc(), borrow, callArg);
566568

567-
SILBuilder throwBuilder(tryAI->getErrorBB()->begin());
569+
SILBuilderWithScope throwBuilder(tryAI->getErrorBB()->begin());
568570
throwBuilder.createEndBorrow(AI.getLoc(), borrow, callArg);
569571
} else {
570-
SILBuilder returnBuilder(std::next(AI.getInstruction()->getIterator()));
572+
SILBuilderWithScope returnBuilder(
573+
std::next(AI.getInstruction()->getIterator()));
571574
returnBuilder.createEndBorrow(AI.getLoc(), borrow, callArg);
572575
}
573576
return borrow;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// REQUIRES: objc_interop
2+
3+
// RUN: %target-swift-frontend -emit-sil %s -Onone -Xllvm \
4+
// RUN: -sil-print-after=mandatory-inlining \
5+
// RUN: -enable-ownership-stripping-after-serialization \
6+
// RUN: -Xllvm -sil-print-debuginfo -o /dev/null 2>&1 | %FileCheck %s
7+
8+
// CHECK: begin_borrow {{.*}} : $OSLog, loc {{.*}}, scope 5
9+
// CHECK: tuple (), loc {{.*}}, scope 5
10+
// CHECK: end_borrow %9 : $OSLog, loc {{.*}}, scope 5
11+
12+
import os
13+
14+
func bar() {
15+
if #available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *) {
16+
foo(OSLog.default)
17+
}
18+
}
19+
20+
@_transparent
21+
func foo(_ logObject: OSLog) { }

0 commit comments

Comments
 (0)