Skip to content

Commit 7d6cc18

Browse files
committed
Frontend: add module interface flag to specify allowable clients
This new flag should allow module authors to specify allowable client list. This list is printed in the textual module interface. Diagnostics support can come later.
1 parent dcfeff7 commit 7d6cc18

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

include/swift/Option/Options.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,10 @@ def user_module_version : Separate<["-"], "user-module-version">,
13401340
HelpText<"Module version specified from Swift module authors">,
13411341
MetaVarName<"<vers>">;
13421342

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

13451349
def vfsoverlay : JoinedOrSeparate<["-"], "vfsoverlay">,
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %empty-directory(%t/textual)
3+
// RUN: %empty-directory(%t/binary)
4+
5+
// 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
6+
7+
// RUN: %FileCheck %s --check-prefix=INTERFACE-FLAG < %t/textual/Foo.swiftinterface
8+
9+
// INTERFACE-FLAG: swift-module-flags-ignorable:
10+
// INTERFACE-FLAG: -allowable-client FooFriend1 -allowable-client FooFriend2 -allowable-client FooFriend3

0 commit comments

Comments
 (0)