Skip to content

[ModuleInterface] Print the @_spiOnly attribute in private swiftinterfaces without comments #64260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Frontend/ModuleInterfaceSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ static void printImports(raw_ostream &out,
// compatible swiftinterfaces and we can live without
// checking the generate code for a while.
if (spiOnlyImportSet.count(import))
out << "/*@_spiOnly*/ ";
out << "@_spiOnly ";

// List of imported SPI groups for local use.
for (auto spiName : spis)
Expand Down
6 changes: 3 additions & 3 deletions test/SPI/spi_only_import_swiftinterfaces.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@

@_spiOnly @_spi(SomeSPIGroup) import A_SPIOnlyImported
// CHECK-PUBLIC-NOT: A_SPIOnlyImported
// CHECK-PRIVATE: {{^}}/*@_spiOnly*/ @_spi(SomeSPIGroup) import A_SPIOnlyImported
// CHECK-PRIVATE: {{^}}@_spiOnly @_spi(SomeSPIGroup) import A_SPIOnlyImported

/// This is also imported as SPI only via FileB.swift
@_spiOnly import ConstantSPIOnly
// CHECK-PUBLIC-NOT: ConstantSPIOnly
// CHECK-PRIVATE: {{^}}/*@_spiOnly*/ import ConstantSPIOnly
// CHECK-PRIVATE: {{^}}@_spiOnly import ConstantSPIOnly

/// This is also imported as SPI only via FileB.swift
@_implementationOnly import InconsistentIOI
// CHECK-PUBLIC-NOT: InconsistentIOI
// CHECK-PRIVATE: {{^}}/*@_spiOnly*/ import InconsistentIOI
// CHECK-PRIVATE: {{^}}@_spiOnly import InconsistentIOI

/// This is also imported as SPI only via FileB.swift
import InconsistentPublic
Expand Down