Skip to content

Commit b8eceeb

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-rebranch
2 parents 9126953 + 68f3341 commit b8eceeb

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3789,6 +3789,17 @@ ClangImporter::Implementation::loadNamedMembers(
37893789
Members.push_back(V);
37903790
}
37913791
}
3792+
3793+
// If the property's accessors have alternate decls, we might have
3794+
// to import those too.
3795+
if (auto *ASD = dyn_cast<AbstractStorageDecl>(TD)) {
3796+
for (auto *AD : ASD->getAllAccessors()) {
3797+
for (auto *D : getAlternateDecls(AD)) {
3798+
if (D->getBaseName() == N)
3799+
Members.push_back(D);
3800+
}
3801+
}
3802+
}
37923803
}
37933804
}
37943805

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-sil %s -verify
2+
// REQUIRES: objc_interop
3+
4+
import Foundation
5+
6+
func mirrorInstancePropertyAsStaticMethod() {
7+
// Instance properties are mirrored as static _methods_. Make sure this works.
8+
let _: AnyClass = NSObject.classForCoder()
9+
}

test/Inputs/clang-importer-sdk/usr/include/objc/NSObject.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
@property (readonly) NSInteger hash;
2828
@end
2929

30+
@interface NSObject (Coding)
31+
- (Class)classForCoder;
32+
@end
33+
3034
@interface A : NSObject
3135
- (int)method:(int)arg withDouble:(double)d;
3236
+ (int)classMethod;

0 commit comments

Comments
 (0)