Skip to content

Commit ba5cfc6

Browse files
author
Harlan Haskins
authored
Merge pull request #28204 from harlanhaskins/static-cling
[ModuleInterface] Don't print @_staticInitializeObjCMetadata
2 parents 51d7d6a + 9d08d4f commit ba5cfc6

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,13 @@ PrintOptions PrintOptions::printSwiftInterfaceFile(bool preferTypeRepr) {
196196
// the default to 'public' and mark the 'internal' things.
197197
result.PrintAccess = true;
198198

199-
result.ExcludeAttrList = {DAK_AccessControl, DAK_SetterAccess, DAK_Lazy};
199+
result.ExcludeAttrList = {
200+
DAK_AccessControl,
201+
DAK_SetterAccess,
202+
DAK_Lazy,
203+
DAK_StaticInitializeObjCMetadata,
204+
DAK_RestatedObjCConformance
205+
};
200206

201207
return result;
202208
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: %target-swift-frontend -typecheck -emit-module-interface-path - %s -enable-library-evolution -target %target-pre-stable-abi-triple -module-name Module | %FileCheck %s
2+
// REQUIRES: objc_interop
3+
4+
import Foundation
5+
6+
// To infer @_staticInitializeObjCMetadata, the following needs to be true
7+
// Our class needs to be:
8+
// - A subclass of a generic Objective-C class
9+
// - That inherits a conformance to a protocol
10+
// - Declared in a module with a deployment target before the stable ABI
11+
12+
public class Super<T>: NSObject, NSCoding {
13+
required public init(coder: NSCoder) {}
14+
public func encode(with: NSCoder) {}
15+
}
16+
17+
// CHECK-NOT: @_staticInitializeObjCMetadata
18+
// CHECK: public class Sub : Module.Super<Swift.Int>
19+
public class Sub: Super<Int> {
20+
required public init(coder: NSCoder) {}
21+
override public func encode(with: NSCoder) {}
22+
}

0 commit comments

Comments
 (0)