Commit Graph

1087 Commits

Author SHA1 Message Date
Xi Ge
889c543e7f Merge pull request #62166 from nkcsgexi/allowable-client-flag 2022-11-17 23:13:35 -08:00
Xi Ge
7d6cc1875d 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.
2022-11-17 20:00:40 -08:00
Alexis Laferrière
888fe84013 Merge pull request #62073 from xymus/module-alias-disambiguate-more
[ModuleInterface] AliasModuleNames workaround support for indirect dependencies and missing imports
2022-11-17 10:33:56 -08:00
Alexis Laferrière
7ae02c02f5 [ModuleInterface] Always use the real name for modules not imported directly
In AliasModuleNames, avoid wrongfully printing aliased names for modules
that were not aliased. This can happen in the case of modules indirectly
imported via a reexport.

rdar://102262019
2022-11-16 10:40:55 -08:00
Artem Chikin
729ad402df [Dependency Scanning] Produce canonical output path for Swift binary modules.
Instead of relying on the client (driver) to perform its own computation of the matching output path.
2022-11-15 11:08:13 -08:00
Artem Chikin
5e208ff30e Merge pull request #62067 from artemcm/DepScanClangOutputPath
[Dependency Scanning] Produce canonical output path for Clang PCMs.
2022-11-15 08:39:04 -08:00
Artem Chikin
dc7cae21d2 [Dependency Scanning] Produce canonical output path for Clang PCMs.
Instead of relying on the client (driver) to perform its own computation of the matching output path.
2022-11-14 13:53:40 -08:00
Slava Pestov
a72ce0076c Disable variadic generics tests on noasserts builds
Fixes rdar://problem/102300174.
2022-11-14 12:14:23 -05:00
Slava Pestov
07b0c5c948 ASTPrinter: Print shape requirements in a way that parses 2022-11-12 02:13:54 -05:00
Alexis Laferrière
b526205f42 Merge pull request #62044 from xymus/module-alias-disambiguate-fix
[ModuleInterface] Support loading an aliased module with an underlying module
2022-11-11 11:55:44 -08:00
Alexis Laferrière
a1270f66cc [Serialization] Support loading an aliased module with an underlying module
Importing a module using an alias (set with -module-alias) fails if the
imported module has an underlying clang module.

rdar://102217790
2022-11-10 16:30:35 -08:00
Artem Chikin
2a84d6de1b Merge pull request #61919 from artemcm/InheritExtraClangStateForInterfaceSubInvocation
Inherit parent's extra Clang arguments when creating an interface build sub-invocation.
2022-11-09 09:24:18 -08:00
Allan Shortlidge
7782f862c0 Sema: Avoid adding nonisolated twice to synthesized Hashable methods.
https://github.com/apple/swift/pull/42041 introduced a centralized mechanism for adding the `nonisolated` attribute to synthesized decls but did not clean up the existing code that was already doing so for `Hashable` conformances.

Resolves rdar://102106591
2022-11-08 18:35:27 -08:00
Artem Chikin
d1cbf9c8d4 Inherit parent's extra Clang arguments when creating an interface build sub-invocation.
We would like to make sure they get propagated to downstream transitive Clang module dependencies also.

Resolves rdar://101923680
2022-11-08 09:32:30 -08:00
Slava Pestov
d88e70132a AST: Print parameterized protocols in opaque return types
The primary change was the refactoring of ArchetypeType::getExistentialType();
this commit just fixes the type sugar.

Fixes rdar://problem/100911362.
2022-11-07 18:38:06 -05:00
Alexis Laferrière
66586b5f63 [ModuleInterface] Print alias for module names in swiftinterface files
Ambiguities are introduced in generated swiftinterfaces when a type
shares a name with a module (i.e. XCTest). This workaround uses the
module-alias feature to avoid these ambiguities. Writing module
references with a distinguishable prefix should allow normal
type-checking to avoid the usual ambiguities.

We should still aim for a proper fully-qualified named syntax, but this
may help in the mean time.

rdar://101969500
2022-11-04 12:30:33 -07:00
Alexis Laferrière
1ce67099de [ModuleInterface] Support aliasing a module loaded from a swiftinterface 2022-11-04 11:10:59 -07:00
Alexis Laferrière
fec0498c65 [Test] Use a clean module cache for more tests
Use a clean module cache in tests printing path to the
swiftmodule/swiftinterface used as it may change depending on previous
tests.
2022-10-31 10:58:56 -07:00
Artem Chikin
625048a43f Merge pull request #61545 from artemcm/PropagateApplicationExtensionStatus
Propagate '-application-extension' to module interface loader sub-invocations.
2022-10-13 08:51:23 -07:00
Artem Chikin
0c470f238b Propagate '-application-extension' to module interface loader sub-invocations.
This flag restricts availability of certain symbols to ensure the code cannot use declarations that are explicitly unavalable to extensions. This restriction should be passed down to dependency modules also.
2022-10-11 11:24:48 -07:00
Allan Shortlidge
8d10065b50 Test: Add availability annotations to ModuleInterface/global-actor.swift. 2022-10-03 17:22:44 -07:00
Allan Shortlidge
670f395b90 Frontend: Enable $GlobalActors feature by default.
Global actors have been an accepted language feature for a couple of compiler releases now, but the feature definition was associated with the `--enable-experimental-concurrency` flag. This caused some `.swiftinterface`s containing global actor declarations to be unparsable because the logic for surrounding declarations with the `$GlobalActors` feature guard was incomplete (for example, classes with a global actor attribute were not guarded even though the declarations of global actor types were).

Rather than trying to fix the logic of `usesFeatureGlobalActors()`, enable it by default.

Adds a test that demonstrates that modules defining and using public global actors produce module interfaces that can be parsed successfully.

Resolves rdar://100150703
2022-10-03 14:49:11 -07:00
Allan Shortlidge
863b088696 NFC: Move global-actor.swift test case to SILGen directory. 2022-10-03 14:15:27 -07:00
Anthony Latsis
f547826276 Merge pull request #60894 from AnthonyLatsis/migrate-test-suite-to-gh-issues-16
Gardening: Migrate test suite to GH issues p. 16
2022-09-08 12:45:17 +03:00
Allan Shortlidge
145609248c ModuleInterface: Avoid attempting to print protocols inherited from superclasses.
"Extra" protocols from a superclass are already handled when printing the superclass, so we should not accumulate them when recording protocols for a subclass.

Resolves rdar://98523784
2022-08-31 23:55:29 -07:00
Anthony Latsis
6da51d2b2f Gardening: Migrate test suite to GH issues: ModuleInterface 2022-09-01 06:41:44 +03:00
Artem Chikin
256c0ff04a [Explicit Modules] On an explicit interface build, early exit if the expected output is up-to-date. 2022-08-16 18:31:13 -07:00
Artem Chikin
aee45799b8 Invoke Explicit Interface Build when '-explicit-interface-module-build' is specified on a '-compile-module-from-interface' frontend action, using the CompilerInstance instantiated directly from the command-line in order to build the module. 2022-08-16 08:36:58 -07:00
Allan Shortlidge
fb411c85d9 NFC: Add tests verifying that @_weakLinked import is not transitive. 2022-08-11 11:02:57 -07:00
Artem Chikin
4e2c1d16f6 Add '@_alwaysEmitConformanceMetadata' protocol attribute
This attribute will, in the near future, be used to inform IRGen that a nominal type that conforms to such protocol must have its type metadata always emitted into the binary, regardless of whether it is used/public.
2022-08-04 14:19:33 -07:00
Artem Chikin
7bdec998b1 Add flag that allows ignoring compiler flags specified in an interface file when running a '-compile-module-from-interface' frontend action. 2022-08-02 10:54:52 -07:00
Allan Shortlidge
1b9d53941d Sema: Diagnose when typealiases used in public declarations would desugar to types from non-public imports.
Resolves rdar://91447971
2022-07-31 11:59:02 -07:00
Allan Shortlidge
1a7b23cd98 Disable availability checking in cross-module-typealias.swift to avoid errors about using some types when they might be unavailable. 2022-07-21 13:43:49 -07:00
Allan Shortlidge
7655b48d0a NFC: Test printing swiftinterfaces that include declarations that were written using typealiases from another module.
This test establishes a baseline for the behavior of swiftinterface emission when public declarations of all kinds reference typealiases from another module. It seems that for many types of declarations, the printer is looking through the typealias definition and printing the original type instead of a fully qualified reference to the typealias. This behavior can cause swiftinterfaces to be unparsable since the original type may not be declared in the module declaring the typealias.

Every CHECK line in this test that includes a reference to fully qualified type from the `Original` module represents an instance of this bug.

Once this behavior is corrected, it should be possible to succesfully parse `UsesAliases.swiftinterface` and the `RUN:` line for doing so should be uncommented.
2022-07-21 11:30:46 -07:00
Xi Ge
cfb5fcda0f ModuleInterface: avoid remarking missing prebuilt module for stdlib by default
Prebuilt modules are only available for certain toolchain and SDK combinations. Therefore,
building modules from interface, even for the stdlib, is expected to happen.

related: rdar://96701615
2022-07-14 15:04:27 -07:00
Doug Gregor
77757c4a4c Merge pull request #59941 from DougGregor/nonsendable-available-nested 2022-07-07 07:30:26 -07:00
Doug Gregor
8ff7e0b3ab Look to enclosing declarations for @available attributes on @_nonSendable types
`@_nonSendable` types get a synthesized, unavailable extension that
declares the Sendable conformance. This extension also needs to have
appropriate platform availability for the type that is being marked
non-Sendable, so the platform-specific attributes are copied from the
nominal type declaration. However, for nested types, we might need to
copy those attributes from an enclosing declarations. Do so when
appropriate.

Fixes rdar://90330588.
2022-07-06 22:16:16 -07:00
Holly Borla
609733bb88 [SE-0361] Update tests for bound generic extensions. 2022-06-30 17:25:17 -07:00
Richard Wei
94e8f5393e Enable string processing by default.
Make frontend flag `-enable-experimental-string-processing` default to true.
2022-06-12 20:25:16 -07:00
Slava Pestov
beec309c9d AST: Fix debug info mangling of opaque result types with @_originallyDefinedIn
If a function's parameter or return types involve nominal types that
have been moved across modules using @_originallyDefinedIn, we must
take care to always mangle the opaque result type's name using the
original module names and not the current module names.

This was a problem with DWARF mangling, which normally disables
@_originallyDefinedIn for other purposes. Make sure to always
temporarily re-enable it when mangling an opaque result type.

Fixes rdar://problem/93822207.
2022-06-02 18:15:31 -04:00
Allan Shortlidge
7b1d4df8bc ModuleInterface: Fix decl attribute corruption in private swiftinterfaces
Erroneous declaration attributes were sometimes being printed in the private swiftinterfaces of modules because the changes from https://github.com/apple/swift/pull/42276 were effectively corrupting the attribute list for any decl with sythesized conformances (e.g. `Equatable`, `Hashable`). It is necessary to clone the attributes before adding them to the synthesized conformance extension decls.

Resolves rdar://94009296
2022-05-31 08:24:49 -07:00
Allan Shortlidge
5326cb031f Tests: Adjust the swift-module-flags of the SilencePreconcurrency.swiftinterface test case to avoid over-specifying a target with a specific arch. This test currently fails when the locally built compiler lacks x86_64 support. 2022-05-27 10:43:55 -07:00
Ben Barham
efc9469444 Merge pull request #58975 from bnbarham/make-features-consistent
[Tests] Make OS features consistent
2022-05-25 16:02:43 -07:00
Holly Borla
e9c14cd88b [ASTPrinter] Print the desugared constraint type following the 'any'
keyword.
2022-05-23 19:43:51 -07:00
Ben Barham
c163e0fe5e [Tests] Make OS features consistent
lit.py currently allows any substring of `target_triple` to be used as a
feature in REQUIRES/UNSUPPORTED/XFAIL. This results in various forms of
the OS spread across the tests and is also somewhat confusing since they
aren't actually listed in the available features.

Modify all OS-related features to use the `OS=` version that Swift adds
instead. We can later remove `config.target_triple` so that these don't
the non-OS versions don't work in the first place.
2022-05-20 19:51:23 -07:00
Allan Shortlidge
7c9a626171 Merge pull request #58801 from tshortli/accept-existential-without-any-in-swiftinterfaces 2022-05-11 00:24:46 -07:00
Arnold Schwaighofer
e3b715bc2a Merge pull request #58760 from aschwaighofer/swiftinterface_print_specialize_with_targetFunction
swiftinterface: print _specialize functions with targetFunction parameter in .swiftinterface
2022-05-10 19:45:30 -07:00
Allan Shortlidge
60146b32b4 Sema: Accept existentials without any in swiftinterfaces.
Resolves rdar://93052306
2022-05-10 17:43:05 -07:00
Slava Pestov
dac8d666ee Stop passing -requirement-machine-{abstract,inferred,protocol}-signatures flags in tests
These flags are now no-ops.
2022-05-10 12:56:17 -04:00
Allan Shortlidge
e0e748c35a ModuleInterface: Print existential any in swiftinterfaces since any is required for protocols with associated types in 5.7.
Resolves rdar://92976269
2022-05-09 14:10:07 -07:00