Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Commit 03a4ce5

Browse files
committed
Merge branch 'master' of github.com:apple/swift into tensorflow-stage
* 'master' of github.com:apple/swift: [cxx-interop] [NFC] Rename MemberInline.IntBox -> LoadableIntWrapper. (swiftlang#33930)
2 parents 2a14c7a + be2f85c commit 03a4ce5

File tree

6 files changed

+21
-19
lines changed

6 files changed

+21
-19
lines changed
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#ifndef TEST_INTEROP_CXX_OPERATORS_INPUTS_MEMBER_INLINE_H
22
#define TEST_INTEROP_CXX_OPERATORS_INPUTS_MEMBER_INLINE_H
33

4-
struct IntBox {
4+
struct LoadableIntWrapper {
55
int value;
6-
IntBox operator-(IntBox rhs) { return IntBox{.value = value - rhs.value}; }
6+
LoadableIntWrapper operator-(LoadableIntWrapper rhs) {
7+
return LoadableIntWrapper{.value = value - rhs.value};
8+
}
79
};
810

911
#endif

test/Interop/Cxx/operators/member-inline-irgen.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import MemberInline
77

8-
public func sub(_ lhs: inout IntBox, _ rhs: IntBox) -> IntBox { lhs - rhs }
8+
public func sub(_ lhs: inout LoadableIntWrapper, _ rhs: LoadableIntWrapper) -> LoadableIntWrapper { lhs - rhs }
99

10-
// CHECK: call [[RES:i32|i64]] [[NAME:@(_ZN6IntBoxmiES_|"\?\?GIntBox@@QEAA\?AU0@U0@@Z")]](%struct.IntBox* {{%[0-9]+}}, {{i32|\[1 x i32\]|i64|%struct.IntBox\* byval align 4}} {{%[0-9]+}})
11-
// CHECK: define linkonce_odr [[RES]] [[NAME]](%struct.IntBox* %this, {{i32 %rhs.coerce|\[1 x i32\] %rhs.coerce|i64 %rhs.coerce|%struct.IntBox\* byval\(%struct.IntBox\) align 4 %rhs}})
10+
// CHECK: call [[RES:i32|i64]] [[NAME:@(_ZN18LoadableIntWrappermiES_|"\?\?GLoadableIntWrapper@@QEAA\?AU0@U0@@Z")]](%struct.LoadableIntWrapper* {{%[0-9]+}}, {{i32|\[1 x i32\]|i64|%struct.LoadableIntWrapper\* byval align 4}} {{%[0-9]+}})
11+
// CHECK: define linkonce_odr [[RES]] [[NAME]](%struct.LoadableIntWrapper* %this, {{i32 %rhs.coerce|\[1 x i32\] %rhs.coerce|i64 %rhs.coerce|%struct.LoadableIntWrapper\* byval\(%struct.LoadableIntWrapper\) align 4 %rhs}})
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %target-swift-ide-test -print-module -module-to-print=MemberInline -I %S/Inputs -source-filename=x -enable-cxx-interop | %FileCheck %s
22

3-
// CHECK: struct IntBox {
4-
// CHECK: static func - (lhs: inout IntBox, rhs: IntBox) -> IntBox
3+
// CHECK: struct LoadableIntWrapper {
4+
// CHECK: static func - (lhs: inout LoadableIntWrapper, rhs: LoadableIntWrapper) -> LoadableIntWrapper
55
// CHECK: }

test/Interop/Cxx/operators/member-inline-silgen.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
import MemberInline
44

5-
public func sub(_ lhs: inout IntBox, _ rhs: IntBox) -> IntBox { lhs - rhs }
5+
public func sub(_ lhs: inout LoadableIntWrapper, _ rhs: LoadableIntWrapper) -> LoadableIntWrapper { lhs - rhs }
66

7-
// CHECK: bb0([[SELF:%.*]] : $*IntBox, [[RHS:%.*]] : $IntBox):
7+
// CHECK: bb0([[SELF:%.*]] : $*LoadableIntWrapper, [[RHS:%.*]] : $LoadableIntWrapper):
88

9-
// CHECK: [[SELFACCESS:%.*]] = begin_access [modify] [static] [[SELF]] : $*IntBox
10-
// CHECK: [[OP:%.*]] = function_ref [[NAME:@(_ZN6IntBoxmiES_|\?\?GIntBox@@QEAA\?AU0@U0@@Z)]] : $@convention(c) (@inout IntBox, IntBox) -> IntBox
11-
// CHECK: apply [[OP]]([[SELFACCESS]], [[RHS]]) : $@convention(c) (@inout IntBox, IntBox) -> IntBox
12-
// CHECK: end_access [[SELFACCESS]] : $*IntBox
9+
// CHECK: [[SELFACCESS:%.*]] = begin_access [modify] [static] [[SELF]] : $*LoadableIntWrapper
10+
// CHECK: [[OP:%.*]] = function_ref [[NAME:@(_ZN18LoadableIntWrappermiES_|\?\?GLoadableIntWrapper@@QEAA\?AU0@U0@@Z)]] : $@convention(c) (@inout LoadableIntWrapper, LoadableIntWrapper) -> LoadableIntWrapper
11+
// CHECK: apply [[OP]]([[SELFACCESS]], [[RHS]]) : $@convention(c) (@inout LoadableIntWrapper, LoadableIntWrapper) -> LoadableIntWrapper
12+
// CHECK: end_access [[SELFACCESS]] : $*LoadableIntWrapper
1313

14-
// CHECK: sil [clang IntBox."-"] [[NAME]] : $@convention(c) (@inout IntBox, IntBox) -> IntBox
14+
// CHECK: sil [clang LoadableIntWrapper."-"] [[NAME]] : $@convention(c) (@inout LoadableIntWrapper, LoadableIntWrapper) -> LoadableIntWrapper

test/Interop/Cxx/operators/member-inline-typechecker.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import MemberInline
44

5-
var lhs = IntBox(value: 42)
6-
let rhs = IntBox(value: 23)
5+
var lhs = LoadableIntWrapper(value: 42)
6+
let rhs = LoadableIntWrapper(value: 23)
77

88
let resultPlus = lhs - rhs

test/Interop/Cxx/operators/member-inline.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import StdlibUnittest
1010

1111
var OperatorsTestSuite = TestSuite("Operators")
1212

13-
OperatorsTestSuite.test("plus") {
14-
var lhs = IntBox(value: 42)
15-
let rhs = IntBox(value: 23)
13+
OperatorsTestSuite.test("LoadableIntWrapper.plus") {
14+
var lhs = LoadableIntWrapper(value: 42)
15+
let rhs = LoadableIntWrapper(value: 23)
1616

1717
let result = lhs - rhs
1818

0 commit comments

Comments
 (0)