Skip to content

Commit 37a2748

Browse files
committed
[ASTPrinter] Print SPI by default
`PrintOptions.InterfaceContentKind` was not initialized. Set it to `InteraceMode::Private` by default, so SPI declarations and their `@_spi` attribues are printed. This basically restores the behavior before aba3b6c , and is align with `AccessFilter` being `AccessLevel::Private` by default. rdar://131726756
1 parent bdfb609 commit 37a2748

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

include/swift/AST/PrintOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ struct PrintOptions {
194194
Package // prints package, SPI, and public/inlinable decls
195195
};
196196

197-
InterfaceMode InterfaceContentKind;
197+
InterfaceMode InterfaceContentKind = InterfaceMode::Private;
198198

199199
bool printPublicInterface() const {
200200
return InterfaceContentKind == InterfaceMode::Public;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@_spi(Hello)
2+
public struct World {}
3+
4+
// RUN: %sourcekitd-test -req=cursor -pos=2:15 %s -- %s | %FileCheck -check-prefix=CHECK %s
5+
// CHECK: source.lang.swift.decl.struct (2:15-2:20)
6+
// CHECK: <Declaration>@_spi(Hello) public struct World</Declaration>
7+
// CHECK: <decl.struct><syntaxtype.attribute.name>@_spi</syntaxtype.attribute.name>(Hello) <syntaxtype.keyword>public</syntaxtype.keyword> <syntaxtype.keyword>struct</syntaxtype.keyword> <decl.name>World</decl.name></decl.struct>

0 commit comments

Comments
 (0)