Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/ClangImporter/ClangImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3787,6 +3787,17 @@ ClangImporter::Implementation::loadNamedMembers(
Members.push_back(V);
}
}

// If the property's accessors have alternate decls, we might have
// to import those too.
if (auto *ASD = dyn_cast<AbstractStorageDecl>(TD)) {
for (auto *AD : ASD->getAllAccessors()) {
for (auto *D : getAlternateDecls(AD)) {
if (D->getBaseName() == N)
Members.push_back(D);
}
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-sil %s -verify
// REQUIRES: objc_interop

import Foundation

func mirrorInstancePropertyAsStaticMethod() {
// Instance properties are mirrored as static _methods_. Make sure this works.
let _: AnyClass = NSObject.classForCoder()
}
4 changes: 4 additions & 0 deletions test/Inputs/clang-importer-sdk/usr/include/objc/NSObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
@property (readonly) NSInteger hash;
@end

@interface NSObject (Coding)
- (Class)classForCoder;
@end

@interface A : NSObject
- (int)method:(int)arg withDouble:(double)d;
+ (int)classMethod;
Expand Down