File tree Expand file tree Collapse file tree 4 files changed +66
-1
lines changed Expand file tree Collapse file tree 4 files changed +66
-1
lines changed Original file line number Diff line number Diff line change @@ -3280,6 +3280,20 @@ ClangImporter::Implementation::loadNamedMembers(
3280
3280
auto *CD = D->getClangDecl ();
3281
3281
assert (CD && " loadNamedMembers on a Decl without a clangDecl" );
3282
3282
3283
+
3284
+ // FIXME: The legacy of mirroring protocol members rears its ugly head,
3285
+ // and as a result we have to bail on any @interface or @category that
3286
+ // has a declared protocol conformance.
3287
+ if (auto *ID = dyn_cast<clang::ObjCInterfaceDecl>(CD)) {
3288
+ if (ID->protocol_begin () != ID->protocol_end ())
3289
+ return None;
3290
+ }
3291
+ if (auto *CCD = dyn_cast<clang::ObjCCategoryDecl>(CD)) {
3292
+ if (CCD->protocol_begin () != CCD->protocol_end ())
3293
+ return None;
3294
+ }
3295
+
3296
+
3283
3297
// There are 3 cases:
3284
3298
//
3285
3299
// - The decl is from a bridging header, CMO is Some(nullptr)
Original file line number Diff line number Diff line change 50
50
51
51
@end
52
52
53
+
54
+ @protocol MirroredBase
55
+ + (void )mirroredBaseClassMethod ;
56
+ - (void )mirroredBaseInstanceMethod ;
57
+ @end
58
+
59
+ @protocol MirroredDoer <MirroredBase>
60
+ + (void )mirroredDerivedClassMethod ;
61
+ - (void )mirroredDerivedInstanceMethod ;
62
+ @end
63
+
64
+ @interface MirroringDoer : NSObject <MirroredDoer>
65
+ - (void )unobtrusivelyGoForWalk ;
66
+ - (void )unobtrusivelyTakeNap ;
67
+ - (void )unobtrusivelyEatMeal ;
68
+ - (void )unobtrusivelyTidyHome ;
69
+ - (void )unobtrusivelyCallFamily ;
70
+ - (void )unobtrusivelySingSong ;
71
+ - (void )unobtrusivelyReadBook ;
72
+ - (void )unobtrusivelyAttendLecture ;
73
+ - (void )unobtrusivelyWriteLetter ;
74
+ @end
75
+
76
+ @interface DerivedFromMirroringDoer : MirroringDoer
77
+ @end
Original file line number Diff line number Diff line change 8
8
// Check that named-lazy-member-loading reduces the number of Decls deserialized
9
9
// RUN: %target-swift-frontend -typecheck -I %S/Inputs/NamedLazyMembers -disable-named-lazy-member-loading -stats-output-dir %t/stats-pre %s
10
10
// RUN: %target-swift-frontend -typecheck -I %S/Inputs/NamedLazyMembers -stats-output-dir %t/stats-post %s
11
- // RUN: %utils/process-stats-dir.py --evaluate-delta 'NumTotalClangImportedEntities < -10 ' %t/stats-pre %t/stats-post
11
+ // RUN: %utils/process-stats-dir.py --evaluate-delta 'NumTotalClangImportedEntities < -9 ' %t/stats-pre %t/stats-post
12
12
13
13
import NamedLazyMembers
14
14
Original file line number Diff line number Diff line change
1
+ // REQUIRES: objc_interop
2
+ // REQUIRES: OS=macosx
3
+ // RUN: rm -rf %t && mkdir -p %t/stats-pre && mkdir -p %t/stats-post
4
+ //
5
+ // Prime module cache
6
+ // RUN: %target-swift-frontend -typecheck -I %S/Inputs/NamedLazyMembers -typecheck %s
7
+ //
8
+ // Check that named-lazy-member-loading reduces the number of Decls deserialized
9
+ // RUN: %target-swift-frontend -typecheck -I %S/Inputs/NamedLazyMembers -disable-named-lazy-member-loading -stats-output-dir %t/stats-pre %s
10
+ // RUN: %target-swift-frontend -typecheck -I %S/Inputs/NamedLazyMembers -stats-output-dir %t/stats-post %s
11
+
12
+ import NamedLazyMembers
13
+
14
+ public func foo( d: MirroringDoer ) {
15
+ let _ = MirroringDoer . mirroredBaseClassMethod ( )
16
+ let _ = MirroringDoer . mirroredDerivedClassMethod ( )
17
+ let _ = d. mirroredBaseInstanceMethod ( )
18
+ let _ = d. mirroredDerivedInstanceMethod ( )
19
+ }
20
+
21
+ public func foo( d: DerivedFromMirroringDoer ) {
22
+ let _ = MirroringDoer . mirroredBaseClassMethod ( )
23
+ let _ = MirroringDoer . mirroredDerivedClassMethod ( )
24
+ let _ = d. mirroredBaseInstanceMethod ( )
25
+ let _ = d. mirroredDerivedInstanceMethod ( )
26
+ }
You can’t perform that action at this time.
0 commit comments