Skip to content

Commit 952f156

Browse files
Merge pull request #4413 from swiftwasm/main
[pull] swiftwasm from main
2 parents b51df73 + 338af18 commit 952f156

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

lib/LLVMPasses/LLVMMergeFunctions.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,16 @@ static bool isCalleeOperand(const CallInst *CI, unsigned opIdx) {
120120
static bool canParameterizeCallOperand(const CallInst *CI, unsigned opIdx) {
121121
if (CI->isInlineAsm())
122122
return false;
123-
if (Function *Callee = CI->getCalledFunction()) {
123+
124+
Function *Callee = CI->getCalledOperand() ?
125+
dyn_cast_or_null<Function>(CI->getCalledOperand()->stripPointerCasts()) :
126+
nullptr;
127+
if (Callee) {
124128
if (Callee->isIntrinsic())
125129
return false;
130+
// objc_msgSend stubs must be called, and can't have their address taken.
131+
if (Callee->getName().startswith("objc_msgSend$"))
132+
return false;
126133
}
127134
if (isCalleeOperand(CI, opIdx) &&
128135
CI->getOperandBundle(LLVMContext::OB_ptrauth).hasValue()) {

test/Interop/Cxx/apinotes/Inputs/SomeModule.apinotes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ Name: SomeModule
33
Classes:
44
- Name: NSSomeClass
55
SwiftName: SomeClass
6+
Methods:
7+
- Selector: 'didMoveToParentViewController:'
8+
SwiftName: didMove(toParent:)
9+
MethodKind: Instance

test/Interop/Cxx/apinotes/Inputs/SomeModule.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@
22
-(instancetype)init;
33
@end
44

5+
// Extension, inspired by UIKit UIViewController.h
6+
@interface NSSomeClass (UIContainerViewControllerCallbacks)
7+
8+
- (void)didMoveToParentViewController:(NSSomeClass *)parent;
9+
10+
@end

test/Interop/Cxx/apinotes/apinotes-objcxx-smoke.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,16 @@ import SomeModule
77
// CHECK-IDE-TEST: typealias NSSomeClass = SomeClass
88
// CHECK-IDE-TEST-NEXT: class SomeClass
99
class MyClass : SomeClass { }
10+
11+
// CHECK-IDE-TEST: extension SomeClass {
12+
// CHECK-IDE-TEST-NEXT: class func didMove(toParent parent
13+
// CHECK-IDE-TEST-NEXT: func didMove(toParent parent:
14+
// CHECK-IDE-TEST-NEXT: @available
15+
// CHECK-IDE-TEST-NEXT: class func didMoveToParentViewController(_ parent
16+
// CHECK-IDE-TEST-NEXT: @available
17+
// CHECK-IDE-TEST-NEXT: func didMoveToParentViewController(_ parent
18+
19+
// CHECK: didMove
20+
let a = SomeClass()
21+
let b = MyClass()
22+
let c = b!.didMove(toParent: a!)

0 commit comments

Comments
 (0)