Commit Graph

40425 Commits

Author SHA1 Message Date
Pavel Yaskevich
f75d02ab56 Merge pull request #71312 from xedin/promote-flag-for-infersendable-from-capture
[Frontend] NFC: Promote InferSendableFromCaptures to an upcoming feat…
2024-02-02 09:37:28 -08:00
Michael Gottesman
c89f63ff27 Merge pull request #71233 from gottesmm/transfernonsendable-more-insts
[region-isolation] Add support for more instructions
2024-02-02 02:20:17 -08:00
eeckstein
034a8a047f Merge pull request #71314 from eeckstein/fix-mandatory-specializtion
GenericCloner: make sure that we can always specialize in mandatory mode
2024-02-02 10:04:09 +01:00
Slava Pestov
a6dbfa9c53 Merge pull request #71303 from slavapestov/ncgenerics-fixes-2
Non-copyable generics fixes part 2
2024-02-02 02:34:05 -05:00
Rintaro Ishizaki
6f4abe7484 Merge pull request #71321 from rintaro/astgen-typeattr
[ASTGen] Cleanup type attribute generation
2024-02-01 23:01:16 -08:00
Erik Eckstein
7fb4fc0f36 MandatoryPerformanceOptimizations: fix the linkage of function-signature-specialized functions
We need to keep the original linkage because it would be illegal to call a shared not-serialized function from a serialized function.

Also, rename the API to create the specialized function.
2024-02-02 07:27:38 +01:00
Slava Pestov
acab50b21b AST: Update callers of ProtocolCompositionType::get() to handle inverses
And remove the old overload.
2024-02-01 23:35:33 -05:00
Slava Pestov
8092f18772 AST: Generalize GenericSignatureImpl::getUpperBound()
Handle inverses, and add a couple of flags (yuck!) to allow its
usage in diagnostics and code completion.
2024-02-01 23:35:33 -05:00
Adrian Prantl
23519bef9b Merge pull request #71318 from adrian-prantl/bridging-header-progress
Extend PreModuleImportCallback to support bridging header compilation
2024-02-01 19:56:44 -08:00
Allan Shortlidge
a6fb4215db Merge pull request #71330 from tshortli/import-resolution-underlying-clang-module-cache
AST: Cache underlying clang module during import resolution
2024-02-01 19:40:32 -08:00
Allan Shortlidge
e056c73fb1 AST: Cache underlying clang module during import resolution.
As recommended in feedback on https://github.com/apple/swift/pull/71302, cache
the underlying clang module after loading it in `ImportResolver`, rather than
filtering it out of the overall set of resolved imports. This is more efficient
and results in less duplicated code that must identify the underlying clang
module.
2024-02-01 17:00:11 -08:00
Steven Wu
32d5873eb8 Merge pull request #71319 from cachemeifyoucan/eng/PR-boiler-plate-supplementary-outputs
[SupplementaryOutputs][NFC] Simplify boilerplate output checks.
2024-02-01 16:38:11 -08:00
Allan Shortlidge
8fd77e3b51 Merge pull request #71302 from tshortli/suppress-retroactive-warning-for-types-from-underlying-module
[SE-0364] Handle retroactive conformance for types and protocols from underlying modules
2024-02-01 15:54:12 -08:00
Rintaro Ishizaki
cd7a31cddc [ASTGen] Cleanup type attribute generation
Use similar scheme as DeclAttribute.
* Create `BridgedTypeAttribute.createSimple()` and
  `BridgedTypeAttributes.add()`, instead of
  `BridgedTypeAttributes.addSimple()`
* Create `DeclAttributes::createSimple()` to align with `TypeAttribute`
2024-02-01 15:45:50 -08:00
Adrian Prantl
c6c688c648 Extend PreModuleImportCallback to support bridging header compilation 2024-02-01 15:11:11 -08:00
Steven Wu
b4e5e78bce [SupplementaryOutputs][NFC] Simplify boilerplate output checks.
Reduce some boilerplate code to check if supplementary outputs exist.
2024-02-01 13:43:40 -08:00
Pavel Yaskevich
c7c7df3329 [Frontend] NFC: Promote InferSendableFromCaptures to an upcoming feature in Swift 6 2024-02-01 10:56:22 -08:00
Allan Shortlidge
8846f4e691 [SE-0364] Handle retroactive conformance for types and protocols from underlying modules.
SE-0364 was implemented to discourage "retroactive" conformances that might
conflict with conformances that could be introduced by other modules in the
future. These diagnostics should not apply to conformances that involve types
and protocols imported from the underlying clang module of a Swift module since
the two modules are assumed to be developed in tandem by the same owners,
despite technically being separate modules from the perspective of the
compiler.

The diagnostics implemented in https://github.com/apple/swift/pull/36068 were
designed to take underlying clang modules into account. However, the
implementation assumed that `ModuleDecl::getUnderlyingModuleIfOverlay()` would
behave as expected when called on the Swift module being compiled.
Unfortunately, it would always return `nullptr` and thus conformances involving
the underlying clang module are being diagnosed unexpectedly.

The fix is to make `ModuleDecl::getUnderlyingModuleIfOverlay()` behave as
expected when it is made up of `SourceFile`s.

Resolves rdar://121478556
2024-02-01 10:43:53 -08:00
Meghana Gupta
2180221247 Serialize/deserialize LifetimeDependenceInfo 2024-02-01 07:39:51 -08:00
Meghana Gupta
180fccf37c Add some convenience functions to LifetimeDependenceInfo 2024-02-01 07:39:23 -08:00
Slava Pestov
80205ecf9c Merge pull request #71241 from slavapestov/ncgenerics-fixes
Non-copyable generics fixes
2024-02-01 07:18:29 -05:00
eeckstein
fb5228d453 Merge pull request #71267 from eeckstein/function-signature-opt
MandatoryPerformanceOptimizations: perform function signature optimization to remove metatype arguments
2024-02-01 07:53:36 +01:00
Holly Borla
b37d436d24 Merge pull request #71244 from hborla/swift-6-diagnostics
[Concurrency] Audit diagnostics for Swift 6.
2024-01-31 22:26:32 -08:00
Alex Hoppen
b3f9e08255 Merge pull request #71237 from ahoppen/ahoppen/attribute-parser-changes
Disallow spaces between `@`, attribute name and `(` in Swift 6
2024-01-31 20:53:34 -08:00
Rintaro Ishizaki
65eaf9532a Merge pull request #71195 from rintaro/astgen-declattr
[ASTGen] Decl attributes
2024-01-31 20:24:59 -08:00
Mike Ash
12de745160 Merge pull request #71254 from mikeash/libprespecialize-validation-test
[ExternalGenericMetadataBuilder] Add a test that validates built metadata against the runtime.
2024-01-31 22:19:23 -05:00
Slava Pestov
d8f85a3bf6 AST: Remove ProtocolDecl::getRequirementSignatureAsGenericSignature() 2024-01-31 21:56:57 -05:00
Slava Pestov
821c3a39c2 Sema: Introduce ResolveValueWitnessesRequest 2024-01-31 21:56:45 -05:00
Slava Pestov
af3ab14986 SILGen: Clean up substitution map construction to deal with Copyable 2024-01-31 21:55:52 -05:00
Slava Pestov
23b1690f6b ASTPrinter: Refactor printing of RequirementSignatures 2024-01-31 21:55:52 -05:00
Alex Hoppen
12fe866470 Merge pull request #71238 from ahoppen/ahoppen/source-location-parser-changes
Disallow multi-line filenames and non-decimal line numbers in `#sourceLocation` directive in Swift 6 mode
2024-01-31 18:31:29 -08:00
Alex Hoppen
c6e425a559 [Parse] Disallow space between attribute name and '(' in Swift 6 mode
This allows us to resolve disambiguities of whether a parenthesis belong to an argument to the attribute or if it is eg. the start of a tuple.
2024-01-31 18:24:42 -08:00
Hamish Knight
956d6d23f2 Merge pull request #71272 from hamishknight/cleanup-return
[CS] Unify ReturnStmt handling
2024-02-01 01:25:08 +00:00
Holly Borla
11cb94faa5 [Concurrency] Use .limitBehaviorUntilSwiftVersion for concurrency diagnostics
that are suppressed or downgraded until Swift 6.

There are a few benefits to using a `UntilSwiftVersion` diagnostic engine API,
including the diagnostic wrapping to communicate that the mistake will be an
error in Swift 6, and to include the mistake in the frontend statistic for
Swift 6 errors.
2024-01-31 17:08:01 -08:00
Alex Hoppen
4a386d40a6 [Parse] Disallow multiline string literals for filename in #sourceLocation and similar locations
This should allow us to eventually simplify parsing of simple string literals in the new parse by not having to handle indentation of multiline string literals.
2024-01-31 16:03:20 -08:00
Slava Pestov
2355cb4090 Sema: Move -debug-generic-signatures behavior to TypeCheckDeclPrimary.cpp 2024-01-31 18:41:43 -05:00
Slava Pestov
45f31b4516 AST: Refactor ASTPrinter to use getRequirementsWithInverses() 2024-01-31 18:40:35 -05:00
Slava Pestov
6ed553da59 AST: Introduce GenericSignature::getRequirementsWithInverses() 2024-01-31 18:40:35 -05:00
Mike Ash
b8b59c4bac [ExternalGenericMetadataBuilder] Add a test that validates built metadata against the runtime.
We run the builder, then use a small program that converts the JSON output into C code that generates the data. Compile that into a bundle, then load it as the prespecializations library. Then scan all the entries in the table and compare them with what the runtime builds dynamically.
2024-01-31 17:03:27 -05:00
Kavon Farvardin
5f977ca763 NCGenerics: force module mismatches 2024-01-31 14:00:08 -08:00
Rintaro Ishizaki
a0120ad884 [ASTGen] Decl attributes 2024-01-31 12:58:41 -08:00
Hamish Knight
deaf2dd372 [CS] Unify ReturnStmt handling
Unify the implementation between single-expression
and multi-statement closures. Because we're now
storing a contextual type for single expression
closure returns, update a code completion test to
bring its behavior inline with the multi-statement
case.
2024-01-31 20:26:20 +00:00
Hamish Knight
d9fd4c75b1 [CS] Remove isInputExpression parameter
This wasn't consistently used, and consequently
could result in some expressions getting their
parents invalidated. Instead, replace it with a
query to make sure we don't try and add an
expression we've already computed the parent info
for.
2024-01-31 20:26:20 +00:00
Hamish Knight
c2716e4b2f Merge pull request #71270 from hamishknight/ast-for-lldb
[AST] Add some ASTNode constructors for lldb
2024-01-31 18:11:19 +00:00
Meghana Gupta
76c95854b7 Merge pull request #71265 from meg-gupta/initlifetimedepinference
Enable lifetime dependence inference on initializers of ~Escapable types
2024-01-31 10:06:00 -08:00
Erik Eckstein
31f3102540 swift SIL: fix Function.isGeneric
It didn't work for functions in generic contexts, which don't add a generic parameter themselves
2024-01-31 17:16:18 +01:00
Erik Eckstein
3b239b25f3 swift SIL: add Function thunk APIs
* `var thunkKind`
* `set(thunkKind:)`
2024-01-31 17:16:13 +01:00
Erik Eckstein
250e2680aa SwiftCompilerSources: add some module-level APIs
* `Context.lookupFunction`
* `ModulePassContext.loadFunction`
* `ModulePassContext.createSpecializedFunctionDeclaration`
* `ModulePassContext.moveFunctionBody`
* `ModulePassContext.mangle(withDeadArguments:)`
2024-01-31 17:16:13 +01:00
Erik Eckstein
fa0be3c10f SwiftCompilerSources: bridge some SIL APIs
* `TryApplyInst.specializationInfo`
* `BasicBlock.addFunctionArgument`
* `Function.appendNewBlock`
2024-01-31 17:16:12 +01:00
Erik Eckstein
a98448b89a swift Builder: add a few instruction creation functions 2024-01-31 17:16:12 +01:00