Skip to content

Commit bcdbeb4

Browse files
committed
[PrintAsClang] Don’t print any objcImpl overrides
Previously we only excluded implicitly-created overrides, but it turns out explicit overrides are just as problematic and just as unnecessary. Fixes rdar://123633538.
1 parent 5edd379 commit bcdbeb4

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

lib/PrintAsClang/DeclAndTypePrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2872,7 +2872,7 @@ static bool excludeForObjCImplementation(const ValueDecl *VD) {
28722872
return true;
28732873
// Exclude overrides in an @_objcImplementation extension; the decl they're
28742874
// overriding is declared elsewhere.
2875-
if (VD->isImplicit() && VD->getOverriddenDecl()) {
2875+
if (VD->getOverriddenDecl()) {
28762876
auto ED = dyn_cast<ExtensionDecl>(VD->getDeclContext());
28772877
if (ED && ED->isObjCImplementation())
28782878
return true;

test/PrintAsObjC/Inputs/custom-modules/objc_implementation/objc_implementation.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@
66

77
@end
88

9+
@interface ObjCClass2 : NSObject
10+
11+
@end
12+
913
void CImplFunc(void);

test/PrintAsObjC/objc_implementation.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,18 @@ extension ObjCClass {
3030
// Implicit `override init()` to override superclass
3131

3232
// NEGATIVE-NOT: )swiftMethod{{ }}
33-
@objc func swiftMethod() -> Any? { nil }
33+
@objc public func swiftMethod() -> Any? { nil }
3434

3535
// NEGATIVE-NOT: )privateMethod{{ }}
3636
@objc private func privateMethod() -> Any? { nil }
3737
}
3838

39+
// Has no contents that need to be printed
40+
// NEGATIVE-NOT: ObjCClass2
41+
@_objcImplementation extension ObjCClass2 {
42+
// NEGATIVE-NOT: )init{{ }}
43+
public override init() { }
44+
}
45+
3946
@_cdecl("CImplFunc") @_objcImplementation func CImplFunc() {}
4047
// NEGATIVE-NOT: CImplFunc(

0 commit comments

Comments
 (0)