Skip to content

Print package-name in .private.swiftinterface only for better abstraction #65336

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 2 commits into from
Apr 28, 2023

Conversation

elsh
Copy link
Contributor

@elsh elsh commented Apr 21, 2023

Print package-name in .private.swiftinterface only for better abstraction

  • Introduce a separate section swift-module-flags-ignorable-private to accommodate package-name and other future private flags
  • Add private flags from interface file to args to be parsed
  • Add a check for source file kind and show diagnostics if not an interface file

Resolves rdar://107638447

@elsh
Copy link
Contributor Author

elsh commented Apr 21, 2023

@swift-ci smoke test

// CHECK-PUBLIC: -module-name Utils
// CHECK-PUBLIC-NOT: -package-name swift-utils.log
// CHECK-PUBLIC: public func publicFunc()
// CHECK-PUBLIC-NOT: package func packageFunc()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend to list all the CHECK-PUBLIC-NOT check lines before the CHECK-PUBLIC lines. FileCheck looks for these in order. Here it would only error if a package func packageFunc() is after public func publicFunc(). Considering the order in the sources there could be a packageFunc printed before publicFunc and it wouldn't be reported.

@elsh
Copy link
Contributor Author

elsh commented Apr 27, 2023

@swift-ci smoke test

@elsh elsh merged commit e9f847d into main Apr 28, 2023
@elsh elsh deleted the es-private branch April 28, 2023 03:07
@drodriguez
Copy link
Contributor

@artemcm
Copy link
Contributor

artemcm commented Apr 28, 2023

Is a change in https://github.com/apple/swift-driver/blob/main/Sources/makeOptions/makeOptions.cpp planned?

Thanks for catching that @drodriguez. Yes, we need to update makeOptions.cpp to reflect this change.

@elsh
Copy link
Contributor Author

elsh commented Apr 29, 2023

Is a change in https://github.com/apple/swift-driver/blob/main/Sources/makeOptions/makeOptions.cpp planned?

Added to driver at swiftlang/swift-driver#1344

elsh added a commit that referenced this pull request May 31, 2023
…nterface

only as package symbols are not contained in public swiftinterface and the
clients of the swiftinterface should not be privy to the package-name input
value. The change has already landed in main; this PR is to enforce the same
behavior on 5.9.
Risk: Low. The change has been on main already and been tested.
Original PR: #65336
Reivewers: @xymus
Testing: Added tests to ensure the flag is abstracted away from public swiftinterface
Resolves: rdar://107638447
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants