Commit Graph

5054 Commits

Author SHA1 Message Date
swift-ci
9fd0ce37f4 Merge remote-tracking branch 'origin/main' into rebranch 2023-02-01 18:53:37 -08:00
John McCall
bbda52f7e5 Merge pull request #63345 from rjmccall/pack-allocation
Add SIL instructions to stack-allocate packs
2023-02-01 21:50:23 -05:00
swift-ci
aef75fa922 Merge remote-tracking branch 'origin/main' into rebranch 2023-02-01 08:53:31 -08:00
Artem Chikin
4eeaafa6fb Merge pull request #63310 from artemcm/ScanDepsNoImplOnlyDeps
[Dependency Scanning] Do not process transitive `@_implementationOnly` dependencies of binary Swift modules
2023-02-01 08:46:44 -08:00
John McCall
6bf9ac858b Add instructions to allocate and deallocate packs.
Having added these, I'm not entirely sure we couldn't just use
alloc_stack and dealloc_stack.  Well, if we find ourselves adding
a lot of redundancy with those instructions (e.g. around DI), we
can always go back and rip these out.
2023-01-31 22:39:34 -05:00
swift-ci
84d370548b Merge remote-tracking branch 'origin/main' into rebranch 2023-01-31 11:34:16 -08:00
Alexis Laferrière
2d8f075333 [Serialization] Drop any failed overriding relationship when allowing errors 2023-01-30 14:31:19 -08:00
Artem Chikin
957f49add9 [Dependency Scanning] Do not process transitive '@_implementationOnly' dependencies of binary Swift modules
These modules are not guaranteed to be found, which is okay, as compilation is meant to be possible in their absense since their contents are not used in the public API of the module which imports them as implementation-only.

Resolves rdar://103031296
2023-01-30 14:25:23 -08:00
Alexis Laferrière
38030dd2a8 [Serialization] Limit ignoring internal overriden decl to lib evolution
At deserialization, we can drop the overriding relationship if the
overriden decl is internal and only when the overrider is in a resilient
module.
2023-01-30 11:12:24 -08:00
Alexis Laferrière
9c16b4b013 [Serialization] Drop overridden relationship in constructors when safe
Deserialization recovery lead the compiler to drop public constructors
overridding internal constructors. This limits the logic to dropping the
overriding relationship instead of the whole constructor. This applies
when the overriden constructor fails to deserialize and only when the
overriding relationship was marked as not affecting ABI.

rdar://104704832
2023-01-30 11:12:24 -08:00
swift-ci
0b49ac49d7 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-29 10:33:27 -08:00
John McCall
d25a8aec8b Add explicit lowering for value packs and pack expansions.
- SILPackType carries whether the elements are stored directly
  in the pack, which we're not currently using in the lowering,
  but it's probably something we'll want in the final ABI.
  Having this also makes it clear that we're doing the right
  thing with substitution and element lowering.  I also toyed
  with making this a scalar type, which made it necessary in
  various places, although eventually I pulled back to the
  design where we always use packs as addresses.

- Pack boundaries are a core ABI concept, so the lowering has
  to wrap parameter pack expansions up as packs.  There are huge
  unimplemented holes here where the abstraction pattern will
  need to tell us how many elements to gather into the pack,
  but a naive approach is good enough to get things off the
  ground.

- Pack conventions are related to the existing parameter and
  result conventions, but they're different on enough grounds
  that they deserve to be separated.
2023-01-29 03:29:06 -05:00
swift-ci
0db0a3e7a5 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-27 21:35:06 -08:00
Alexis Laferrière
93704f6513 Merge pull request #63248 from xymus/swift-export-as
[ModuleInterface] Intro the flag `-export-as` for Swift modules
2023-01-27 21:23:35 -08:00
swift-ci
7bab68c056 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-27 07:37:00 -08:00
Holly Borla
f6f57a8099 [Macros] Rename "synthesized member macros" to "member macros". 2023-01-26 21:52:36 -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
swift-ci
668dde7e39 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-26 08:53:43 -08:00
Egor Zhdan
ee6b9b2a67 [cxx-interop] Disallow import std, require import CxxStdlib
`CxxStdlib` will now be the only accepted module name for the C++ standard library module in Swift.
2023-01-26 14:15:56 +00:00
swift-ci
809cb9dd33 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-26 06:13:15 -08:00
Richard Wei
dbbf6aa4f1 Merge branch 'main' into freestanding-macro-attr-cleanup 2023-01-26 18:09:45 +08:00
swift-ci
de845e608f Merge remote-tracking branch 'origin/main' into rebranch 2023-01-26 00:54:08 -08:00
Pavel Yaskevich
c86c741eb7 Merge pull request #63198 from xedin/enable-runtime-attrs-on-enums
[AST] RuntimeMetadata: Allow using enums as custom runtime metadata types
2023-01-26 00:47:38 -08:00
Doug Gregor
af7ce9e945 [Macros] Remove the @declaration attribute.
We have @freestanding working appropriately now.
2023-01-25 17:07:38 -08:00
Doug Gregor
d74f235eb9 Generalize @attached parsing and representation to also include @freestanding.
The attached and freestanding macro attributes use the same parsing
logic and representation, so generalize the "attached" attribute into
a more general "macro role" attribute.
2023-01-25 17:07:38 -08:00
swift-ci
e0b16dbdf4 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-25 16:07:15 -08:00
Pavel Yaskevich
3eaa2d60d4 [Serialization] RuntimeMetadata: Bump format version due to attribute flags change 2023-01-25 10:14:30 -08:00
Holly Borla
8b9be30783 [Macros] Add a new macro role for synthesized member macros. 2023-01-22 21:19:21 -08:00
swift-ci
2e477fd38b Merge remote-tracking branch 'origin/main' into rebranch 2023-01-20 14:13:44 -08:00
Ellie Shin
91f785441f Merge pull request #62652 from apple/es-pkg-acl
[NFC] Add 'package' access modifier to AccessLevel
2023-01-20 13:58:15 -08:00
swift-ci
8ec1f5847b Merge remote-tracking branch 'origin/main' into rebranch 2023-01-20 10:30:05 -08:00
John McCall
374c202b99 Add SIL instructions to generate pack indices 2023-01-19 23:57:22 -05:00
Ellie Shin
37af51dc4c Merge branch 'main' into es-pkg-acl 2023-01-19 16:18:17 -08:00
Ellie Shin
1c66d02f92 Add package access level to enum AccessLevel
Resolves rdar://104198440
2023-01-19 15:54:18 -08:00
swift-ci
7ba41d4112 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-19 13:33:35 -08:00
Alexis Laferrière
e032b3191d Merge pull request #63096 from xymus/deser-safety-writing
[Serialization] Introduce main deserialization safety logic, on the writer side
2023-01-19 13:22:25 -08:00
Alexis Laferrière
a91bb4965a [Serialization] Tweaks to deserialization safety writer logic
Apply reviewers comments and fix test.
2023-01-19 09:47:32 -08:00
Alexis Laferrière
77d8c464df [Serialization] Recover from deserialization failures in ModuleFile::lookupObjCMethods
This was reported by deserialization safety in:

Interpreter/SDK/Foundation_NSString.swift
2023-01-18 16:36:33 -08:00
Alexis Laferrière
4e8011179a [Serialization] Main deserialization safety logic on the writer side
When writing decls to a swiftmodule files, the serialization logic
evaluates whether the decl will be safe to deserialize. This is inferred
from the access level of the decl, whether it's local, if the module is
built for testing, etc. If the decl in unsafe to deserialize, a record
will be written down before the decl itself in the swiftmodule file.

On the reader side, attempting to deserialize a decl marked as unsafe
raises a deserialization error early. This error is handled by the existing
deserialization recovery logic.

In theory, we want to consider as safe only decls that are actually needed by
the client. Marking as many internal details as possible as unsafe will
prevent more errors. Getting the right scope may require more work in
the future.
2023-01-18 14:41:22 -08:00
swift-ci
9bb23e9523 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-17 21:34:06 -08:00
Holly Borla
20f51b2981 Merge pull request #63075 from hborla/macro-attribute-serialization
[Serialization] Don't serialize macro custom attributes.
2023-01-17 21:23:24 -08:00
Holly Borla
ae1f8248b3 [Serialization] Don't serialize macro custom attributes. 2023-01-17 17:24:52 -08:00
swift-ci
a267f1f2fe Merge remote-tracking branch 'origin/main' into rebranch 2023-01-17 15:53:33 -08:00
Alexis Laferrière
ce91d77ab7 Merge pull request #63068 from xymus/serial-pub-override
[Serialization] Public overrides of internal decls are ignorable by clients
2023-01-17 15:37:59 -08:00
Alexis Laferrière
6c6cd41afd [Serialization] Public overrides of internal decls are ignorable by clients
This change reflects the behavior of `DeclAttribute.printImpl` that
prints the `override` keyword in a swiftinterface only when the
overriden decl is also public.

This issue was detected when working on deserialization safety by public
overrides of private functions in the following tests:

test/Interpreter/vtables_multifile.swift
test/Interpreter/vtables_multifile_testable.swift
test/SILGen/accessibility_vtables_testable.swift
test/SILGen/accessibility_vtables_usableFromInline.swift
test/SILGen/vtables_multifile.swift
2023-01-17 09:39:59 -08:00
swift-ci
d2d8b07634 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-15 16:34:43 -08:00
Holly Borla
5d7b280889 [Macros] Use @attached for member attribute macros.
Add MemberAttributes to MacroRole that corresponds to a `memberAttributes`
argument to the `@attached` attribute.
2023-01-15 10:11:00 -08:00
Holly Borla
3f462f0f43 [Decl] Add MissingDecl to use for parser recovery. 2023-01-15 09:55:15 -08:00
swift-ci
d6329dbe13 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-15 07:53:25 -08:00
Doug Gregor
43cadcad3a [Macros] Serialization and printing for @attached. 2023-01-14 21:48:43 -08:00