Commit Graph

2062 Commits

Author SHA1 Message Date
Xi Ge
67bbab7e02 serialization: encode allowable client names in binary module format 2022-11-25 18:43:40 -08:00
Holly Borla
8ec5405a30 [GenericEnvironment] Store a substitution map for the outer generic parameters
of an opened pack element generic environment.
2022-11-23 11:17:05 -05:00
Erik Eckstein
ab1b343dad use new llvm::Optional API
`getValue` -> `value`
`getValueOr` -> `value_or`
`hasValue` -> `has_value`
`map` -> `transform`

The old API will be deprecated in the rebranch.
To avoid merge conflicts, use the new API already in the main branch.

rdar://102362022
2022-11-21 19:44:24 +01:00
Doug Gregor
51fcde7b76 Merge pull request #62086 from DougGregor/macro-decl 2022-11-13 20:25:48 -08:00
Doug Gregor
5ab6b72604 [Macros] Turn Macro into a declaration node.
Although the declaration of macros doesn't appear in Swift source code
that uses macros, they still operate as declarations within the
language. Rework `Macro` as `MacroDecl`, a generic value declaration,
which appropriate models its place in the language.

The vast majority of this change is in extending all of the various
switches on declaration kinds to account for macros.
2022-11-13 12:21:29 -08:00
Slava Pestov
1e00c3107a Serialization: Support PackType and PackExpansionType 2022-11-12 02:13:54 -05:00
Allan Shortlidge
af032afb9d Serialization: Break the cycle between Serialization and SymbolGraphGen.
Push the top level logic for writing out swiftmodules and associated files into the frontend library which has access to all the necessary dependencies.
2022-10-29 21:37:09 -07:00
Alexis Laferrière
2854c1b3cb [Serialization] Write in the swiftmodule if it's built from a swiftinterface
This information will allow us to distinguish swiftmodule built from
source vs swiftinterface.
2022-10-27 18:51:28 -07:00
Slava Pestov
9dfb6ea067 Merge pull request #61675 from slavapestov/element-generic-environment
AST: Opened element generic environments
2022-10-22 00:58:26 -04:00
Slava Pestov
68514b10b5 AST: Introduce ElementArchetypeType 2022-10-21 21:55:35 -04:00
Richard Wei
56e7cce809 [Macros] Parse MacroExpansionExpr and MacroExpansionDecl
Introduce `MacroExpansionExpr` and `MacroExpansionDecl` and plumb it through. Parse them in roughly the same way we parse `ObjectLiteralExpr`.

The syntax is gated under `-enable-experimental-feature Macros`.
2022-10-21 01:50:35 -07:00
Becca Royal-Gordon
f2a0ab79c7 Add basic Sema support for @_objcImplementation
Does not validate members yet; nor does it emit different metadata.
2022-10-18 17:21:56 -07:00
Hamish Knight
6aa44a1754 [AST] Remove @_typeSequence attribute
This is no longer needed now that we have the
ellipsis spelling.
2022-10-14 15:40:13 +01:00
Holly Borla
c4b946195e [AST] Replace the "type sequence" terminology with "parameter pack". 2022-10-10 16:28:13 -07:00
Holly Borla
9bb837a241 [AST] Rename SequenceArchetype to PackArchetype. 2022-10-10 16:25:26 -07:00
Holly Borla
38a2c8218b [Requirement] Rename RequirementKind::SameCount to SameShape. 2022-10-06 20:48:40 -07:00
Dario Rexin
210c68d8aa [SILOptimizer] Add prespecialization for arbitray reference types (#58846)
* [SILOptimizer] Add prespecialization for arbitray reference types

* Fix benchmark Package.swift

* Move SimpleArray to utils

* Fix multiple indirect result case

* Remove leftover code from previous attempt

* Fix test after rebase

* Move code to compute type replacements to SpecializedFunction

* Fix ownership when OSSA is enabled

* Fixes after rebase

* Changes after rebasing

* Add feature flag for layout pre-specialization

* Fix pre_specialize-macos.swift

* Add compiler flag to benchmark build

* Fix benchmark SwiftPM flags
2022-09-22 16:29:01 -07:00
Slava Pestov
c1b8690401 AST: Introduce special Builtin.TheTupleType singleton 2022-09-10 00:26:42 -04:00
QuietMisdreavus
f674b473ec introduce a @_documentation(...) attribute to influence SymbolGraphGen (#60242)
* add @_documentation(...) attribute to influence SymbolGraphGen

rdar://79049241
2022-09-06 14:12:42 -06:00
Alex Lorenz
8de79390be [interop][SwiftToCxx] add @_expose(Cxx) attribute support
This attribute instructs the compiler that this declaration should be included in the generated C++ bindings
2022-08-24 10:14:07 -07:00
Slava Pestov
5c32f2136e AST: Introduce RequirementKind::SameCount 2022-08-23 11:12:00 -04:00
Slava Pestov
cfb4e60a48 Merge pull request #60523 from slavapestov/fix-opened-generic-environment-identity
Serialization: Preserve identity of opened generic environments
2022-08-16 14:33:44 -04:00
Slava Pestov
b36f37cc72 Serialization: Preserve identity of opened generic environments
We used to create a new environment for each opened archetype, which is
incorrect when deserializing a nested type of another opened archetype.
2022-08-15 13:59:12 -04:00
swift-ci
73280e6ed5 Merge remote-tracking branch 'origin/main' into rebranch 2022-08-02 12:13:17 -07:00
Hamish Knight
9da53193da [AST] Remove ParameterTypeFlags from ParenType and TupleType
The last clients that relied on stashing parameter
type flags on these types are now gone.
2022-08-02 13:56:32 +01:00
swift-ci
2e1140c767 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-29 09:14:45 -07:00
Ben Barham
ee8bc34795 [Serialization] Output precedence higher/lowerThan relations when valid
When allowing errors, do not output higher/lowerThan relations for
invalid precedencegroup declarations.

Resolves rdar://97362356.
2022-07-28 12:23:12 -07:00
swift-ci
5706f48a31 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-20 19:14:34 -07:00
Pavel Yaskevich
225341e3d2 [Decl] Start storing and serializing "unavailability" bit per condition 2022-07-20 13:26:43 -07:00
Pavel Yaskevich
8185db433a [Serialization] Add a "unavailable" bit to conditional substitution record
A step towards supporting different opaque result type produced by a
`if #unavailable` block.
2022-07-20 13:26:41 -07:00
swift-ci
e9c324099a Merge remote-tracking branch 'origin/main' into rebranch 2022-07-18 16:13:31 -07:00
Alexis Laferrière
36b87d3c5c [Serialization] Use a more reliable macro to get the compiler tag
Use only the SWIFT_COMPILER_VERSION macro to check for swiftmodules
being written by the same compiler that reads it. In practice, it's the
macro used for release builds of the compiler.

rdar://96868333
2022-07-18 13:20:20 -07:00
Ben Barham
4dfaa820ac [rebranch] Remove now unused function 2022-07-08 10:17:16 -07:00
swift-ci
5c8f1fcb12 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-02 17:03:37 -07:00
Michael Gottesman
198b974622 Merge pull request #59859 from gottesmm/pr-276c4e4220a25490659a285e8b94a36bd28ffede
[no-implicit-copy] Rename SILMoveOnlyType -> SILMoveOnlyWrappedType.
2022-07-01 23:17:43 -07:00
Michael Gottesman
8f3fe63fed [no-implicit-copy] Rename SILMoveOnlyType -> SILMoveOnlyWrappedType.
Since I am beginning to prepare for adding real move only types to the language,
I am renaming everything that has to do with copyable types "move only wrapped"
values instead of move only. The hope is this reduces/prevents any confusion in
between the two.
2022-07-01 17:26:13 -07:00
swift-ci
31af44324e Merge remote-tracking branch 'origin/main' into rebranch 2022-06-30 00:14:54 -07:00
Pavel Yaskevich
b2b1efd268 [Distributed] Decl: Add a new distributed-thunk bit
The flag is used to distinguish between regular functions/accessors
and synthesized distributed thunks.
2022-06-29 14:49:10 -07:00
swift-ci
55000f53be Merge remote-tracking branch 'origin/main' into rebranch 2022-06-17 10:15:14 -07:00
Becca Royal-Gordon
9b5f89963b [NFC] Serialize ObjC selectors for protocols
The ObjCMethodLookupTable for protocols was not being serialized and rebuilt on load, so NominalTypeDecl::lookupDirect() on selectors was not working correctly for deserialized types. Correct this oversight.
2022-06-16 14:07:49 -07:00
swift-ci
11797556b7 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-14 21:34:11 -07:00
Doug Gregor
25a7988982 Teach witness thunks to hop to the actor when needed.
When a synchronous, actor-isolated declaration witnesses an
asynchronous, not-similarly-isolated requirement, emit an actor hop
within the witness thunk to ensure that we properly enter the context
of the actor.

Fixes #58517 / rdar://92881539.
2022-06-14 16:45:28 -07:00
swift-ci
22dd6786a8 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-03 15:58:11 -07:00
Michael Gottesman
c66061a783 [moveOnly] Add a new SIL specific AST type called SILMoveOnly.
It can only be used in SIL contexts to express that a wrapped type is
MoveOnly.
2022-06-03 11:27:16 -07:00
swift-ci
75f7d2e957 Merge remote-tracking branch 'origin/main' into rebranch 2022-05-16 14:13:30 -07:00
Ben Barham
47721d25e6 Merge pull request #42394 from DavidGoldman/hermeticindexstore
Support hermetic indexing information + introduce `-file-prefix-map`
2022-05-16 14:09:25 -07:00
David Goldman
c232ed2913 Support hermetic indexing information
Swiftc port of https://github.com/apple/llvm-project/pull/4207.

This introduces a new flag, `-file-prefix-map` which can be used
instead of the existing `-debug-prefix-map` and `-coverage-prefix-map`
flags, and also remaps paths in index information currently.
2022-05-16 11:00:14 -04:00
Ben Barham
8148c763cd Merge pull request #58847 from bnbarham/rebranch-test-fixes
[next] Fixes for various test failures on rebranch
2022-05-12 09:30:39 -07:00
Ben Barham
427a689a96 [next] Convert const char * fields to StringRef
llvm/llvm-project d0262c2394f46bb7da2a75529413d625c70908e5 added a new
default bool param to the two constructors in `SmallVectorMemoryBuffer`.
Since `options.OutputPath` is a `const char *` and that can be promoted
to a `bool`, the constructor being called was changed to the first
constructor (with a default buffer name) - promotion is preferred over
conversion.

Convert the various output paths to a `StringRef` - all their uses
converted to `StringRef` anyway. Also specify the default parameter in
order to maintain the old behaviour, which didn't require a null
terminator.
2022-05-11 17:06:29 -07:00
Anton Korobeynikov
a1e138b2af [AutoDiff] Implement cross-file lookup of derivatives (#58644)
Look-up for functions with @derivative attributes defined in non-primary source files

Fixes #55170
2022-05-11 08:18:51 -07:00