[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
aba3b6c24e , and is align with
`AccessFilter` being `AccessLevel::Private` by default.

rdar://131726756
This commit is contained in:
Rintaro Ishizaki
2025-01-22 21:22:43 -08:00
parent bdfb6099b2
commit 37a2748e0d
2 changed files with 8 additions and 1 deletions

View File

@@ -194,7 +194,7 @@ struct PrintOptions {
Package // prints package, SPI, and public/inlinable decls
};
InterfaceMode InterfaceContentKind;
InterfaceMode InterfaceContentKind = InterfaceMode::Private;
bool printPublicInterface() const {
return InterfaceContentKind == InterfaceMode::Public;

View File

@@ -0,0 +1,7 @@
@_spi(Hello)
public struct World {}
// RUN: %sourcekitd-test -req=cursor -pos=2:15 %s -- %s | %FileCheck -check-prefix=CHECK %s
// CHECK: source.lang.swift.decl.struct (2:15-2:20)
// CHECK: <Declaration>@_spi(Hello) public struct World</Declaration>
// 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>