Commit Graph

4 Commits

Author SHA1 Message Date
Alexis Laferrière
471b228c1e [ModuleInterface] Test that ModuleInterfaceExportAs doesn't raise errors
Passing the flags `-enable-experimental-feature ModuleInterfaceExportAs`
has no effect anymore, test that it's not reported as an error.
2023-10-16 22:05:26 -07:00
Alexis Laferrière
6f1a774e7d [ModuleInterface] Always ignore export-as in private swiftinterfaces
Always print the real module name for references in private
swiftinterfaces, ignoring export-as declarations. Keep using the
export-as name for the public swiftinterface only.

The flag `ModuleInterfaceExportAs` used to enable this behavior and
we're removing it to make it the default.

rdar://115922907
2023-10-16 13:19:55 -07:00
Alexis Laferrière
c285c5e2ef [ModuleInterface] Improve swift-export-as test to use the swiftinterfaces 2023-01-27 11:37:47 -08:00
Alexis Laferrière
39fb1c5f55 [ModuleInterface] Intro export-as for Swift modules
Introduce a new flag `-export-as` to specify a name used to identify the
target module in swiftinterfaces. This provides an analoguous feature
for Swift module as Clang's `export_as` feature.

In practice it should be used when a lower level module `MyKitCore` is
desired to be shown publicly as a downstream module `MyKit`. This should
be used in conjunction with `@_exported import MyKitCore` from `MyKit`
that allows clients to refer to all services as being part of `MyKit`,
while the new `-export-as MyKit` from `MyKitCore` will ensure that the
clients swiftinterfaces also use the `MyKit` name for all services.

In the current implementation, the export-as name is used in the
module's clients and not in the declarer's swiftinterface (e.g.
`MyKitCore`'s swiftinterface still uses the `MyKitCore` module name).
This way the module swiftinterface can be verified. In the future, we
may want a similar behavior for other modules in between `MyKitCore` and
`MyKit` as verifying a swiftinterface referencing `MyKit` without it
being imported would fail.

rdar://103888618
2023-01-26 14:27:31 -08:00