Skip to content

Frontend: add module interface flag to specify allowable clients. NFC #62166

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
Nov 18, 2022
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
4 changes: 4 additions & 0 deletions include/swift/Option/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,10 @@ def user_module_version : Separate<["-"], "user-module-version">,
HelpText<"Module version specified from Swift module authors">,
MetaVarName<"<vers>">;

def allowable_client : Separate<["-"], "allowable-client">,
Flags<[FrontendOption, ModuleInterfaceOptionIgnorable, NewDriverOnlyOption]>,
HelpText<"Module names that are allowed to import this module">,
MetaVarName<"<vers>">;
// VFS

def vfsoverlay : JoinedOrSeparate<["-"], "vfsoverlay">,
Expand Down
10 changes: 10 additions & 0 deletions test/ModuleInterface/allowable-client.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/textual)
// RUN: %empty-directory(%t/binary)

// RUN: %target-swift-frontend -emit-module %s -module-name Foo -swift-version 5 -disable-implicit-concurrency-module-import -allowable-client FooFriend1 -allowable-client FooFriend2 -allowable-client FooFriend3 -emit-module-interface-path %t/textual/Foo.swiftinterface -enable-library-evolution -emit-module-path %t/binary/Foo.swiftmodule

// RUN: %FileCheck %s --check-prefix=INTERFACE-FLAG < %t/textual/Foo.swiftinterface

// INTERFACE-FLAG: swift-module-flags-ignorable:
// INTERFACE-FLAG: -allowable-client FooFriend1 -allowable-client FooFriend2 -allowable-client FooFriend3