Commit Graph

12816 Commits

Author SHA1 Message Date
Ben Barham
cbcfc85777 Merge pull request #72323 from bnbarham/rename-startswith
Rename startswith to starts_with
2024-03-14 09:06:54 -07:00
Ben Barham
9779c18da3 Rename startswith to starts_with
LLVM is presumably moving towards `std::string_view` -
`StringRef::startswith` is deprecated on tip. `SmallString::startswith`
was just renamed there (maybe with some small deprecation inbetween, but
if so, we've missed it).

The `SmallString::startswith` references were moved to
`.str().starts_with()`, rather than adding the `starts_with` on
`stable/20230725` as we only had a few of them. Open to switching that
over if anyone feels strongly though.
2024-03-13 22:25:47 -07:00
Doug Gregor
4035b998a6 Merge pull request #72316 from DougGregor/noncopyable-mangle-enum-cases 2024-03-13 22:07:58 -07:00
Doug Gregor
3446fc789a [Noncopyable] Mangle enum elements as "always in the primary definition"
For entities that must be part of the primary definition of a type,
mangle without inverses on the generic parameters of the enclosing
type. This ensures that we can adopt noncopyable on the generic
parameters without breaking the mangling of the fundamental entities
that describe the layout of the type.

Do this for enum elements first, so we don't break the mangling of
`Optional`. There will be other cases to consider as well.
2024-03-13 16:49:54 -07:00
Adrian Prantl
e3197e971f Merge pull request #72200 from adrian-prantl/124233848
Root the virtual <compiler-generated> file in the root directory.
2024-03-13 14:38:11 -07:00
eeckstein
a24539171c Merge pull request #72265 from eeckstein/fix-mandatory-inlining
MandatoryInlining and ConstExpr: look through sendable function conversions
2024-03-13 18:52:43 +01:00
Emil Pedersen
2ebae40261 Merge pull request #72270 from Snowy1803/fix-empty-tuple-fragments-crash
[DebugInfo] Fix crash on empty tuple fragments
2024-03-13 09:51:47 -07:00
Ellie Shin
56d337d322 Merge pull request #72249 from apple/es/pkg-cmo 2024-03-13 09:26:35 -07:00
Arnold Schwaighofer
315a763c28 Merge pull request #72218 from aschwaighofer/fragile_resilient_protocols
IRGen: Add code to support building fragile resilient protocol witnesses
2024-03-13 08:40:44 -07:00
Erik Eckstein
3c76464c1c rename withConcurrent -> withSendable
That was missed when "concurrent" was renamed to "sendable"
2024-03-13 09:58:31 +01:00
Emil Pedersen
ffb8ece8e0 [DebugInfo] Fix crash on empty tuple fragments
rdar://124408249
2024-03-12 17:38:00 -07:00
Doug Gregor
1cd7a56ea6 [Noncopyable] Many protocol members without the inverse requirements of the protocol itself
This eliminates the ABI impact of making `Self` or associated types in
a protocol `~Copyable`.
2024-03-12 17:06:12 -07:00
Adrian Prantl
aab0cb09cc Root the virtual <compiler-generated> file in the root directory.
Using CWD gives a false sense of accuracy.

rdar://124233848
2024-03-12 16:57:04 -07:00
John McCall
27e0edfacc Merge pull request #72244 from rjmccall/builtin-initial-serial-executor
Add builtin support for starting a task on a specific executor
2024-03-12 18:54:29 -04:00
Ellie Shin
a3250e426d Support Package CMO
* Add a new flag -experimental-package-cmo that requires -experimental-allow-non-resilient-access.
* Support serializing package decls for CMO in package if enabled.
* Only applies to default mode CMO.
* Unlike the existing CMO, package CMO can be built with -enable-library-evolution as package
modules are required to be built together in the same project.
* Create hasPublicOrPackageVisibility to opt in for package decls; needed for CMO, SILVerifier,
and other call sites that verify or determine codegen.

Resolves rdar://121976014
2024-03-12 15:00:24 -07:00
Doug Gregor
26226f662c Merge pull request #72157 from DougGregor/more-inverse-mangling-suppression
[Noncopyable generics] Suppress inverse conformance mangling for more symbols
2024-03-11 20:54:19 -07:00
John McCall
0901b2b0b3 Add builtin support for starting a task on a specific executor.
This should be close enough to the creation of this builtin that we don't
need a new feature for it specifically.
2024-03-11 19:44:50 -04:00
eeckstein
20896183bb Merge pull request #72226 from eeckstein/fix-offset-of-empty-field
IRGen: Don't let the offset of an empty field be undef.
2024-03-11 23:03:57 +01:00
Emil Pedersen
8df1abe111 Merge pull request #72158 from Snowy1803/simplify-dbg-type-size
[DebugInfo] Move type size information to CompletedDebugTypeInfo
2024-03-11 10:31:45 -07:00
Arnold Schwaighofer
9639e007d8 Teach TBD that in fragile resilient protocol mode the protocol table is visible 2024-03-11 09:49:38 -07:00
Erik Eckstein
c11408ea2f IRGen: Don't let the offset of an empty field be undef.
If the field address comes from a struct_element_addr which is a result of an optimized `MemoryLayout<S>.offset(of: \.field)` we cannot return undef.
We have to be consistent with `offset(of:)`, which returns 0.
Therefore we need to return the base address of the struct.

rdar://117265274
2024-03-11 15:21:03 +01:00
Konrad `ktoso` Malawski
143d8f9801 [Distributed] Handle distributed thunk requirements/witnesses (#72151)
Co-authored-by: Pavel Yaskevich <pyaskevich@apple.com>
2024-03-11 02:07:22 -07:00
Arnold Schwaighofer
b35be130a6 Simplify code 2024-03-10 16:14:16 -07:00
Arnold Schwaighofer
d8936ff51f Guard a call to dump() in NDEBUG 2024-03-10 09:22:49 -07:00
Arnold Schwaighofer
ea70aea43c IRGen: Add code to support building fragile resilient protocol witnesses
We don't currently support building resilient relative protocol witness tables.
One might want to build with relative witness tables but not need
resilient protocols. Allow for that scenario.

Add a test configuration to test library-evolution + fragile resilient
protocols + relative protocol witness tables.
2024-03-10 09:14:08 -07:00
nate-chandler
877f471c97 Merge pull request #72211 from nate-chandler/var_decl-alloc_stack
[SIL] Key consume addr checking off var_decl attr.
2024-03-09 13:58:57 -08:00
Nate Chandler
34dd4aa0cb [IRGen] Collect metadata for empty types fields.
Previously, when the metadata collector only collected for layout, it
was wasteful to visit the empty fields of records.  Now that the field
may require a deinit call, it's necessary to visit it.

rdar://123577998
2024-03-08 22:19:28 -08:00
Nate Chandler
5ccec0e31c [NFC] SIL: Shortened member name.
Renamed "getUsesMoveableValueDebugInfo" to "usesMoveableValueDebugInfo".
Clarifies the predicate from "does the receiver have the
usesMoveableValueDebugInfo field set?" to "does the receiver use moveable
value debug info?".
2024-03-08 21:24:38 -08:00
Nate Chandler
571a673f21 [NFC] IRGen: Added debugging info.
In debug builds, provide some context when a witness table fails to be
found.
2024-03-08 21:01:16 -08:00
Adrian Prantl
7f5194b57e Merge pull request #72197 from adrian-prantl/better-scope-check
Detect methods by their scope rather than their representation.
2024-03-08 17:21:12 -08:00
Adrian Prantl
654df59161 Detect methods by their scope rather than their representation.
In the end this condition exists to avoid a BitCode Verifyer check that operates
off the scope, so looking for that directly is more future-proof.

rdar://123334375
2024-03-08 13:29:44 -08:00
Pavel Yaskevich
b17f0b534c Merge pull request #71855 from xedin/fix-sendable-keypath-conformance-issues
[AST] Special handling for existentials with superclass and marker pr…
2024-03-08 13:06:01 -08:00
Doug Gregor
0ef978acc0 Merge pull request #72163 from DougGregor/noncopyable-field-reflection-heuristic 2024-03-07 20:32:12 -08:00
John McCall
8499640224 Merge pull request #72143 from rjmccall/builtin-create-task
Unify and simplify the task-creation builtins
2024-03-07 21:45:06 -05:00
Emil Pedersen
653e8fd036 [DebugInfo] Add labels when constructing DebugTypeInfo (NFC) 2024-03-07 15:52:17 -08:00
Emil Pedersen
4ede40e2f7 [DebugInfo] Remove passing of the unused SizeIsFragmentSize (NFC) 2024-03-07 15:21:44 -08:00
Doug Gregor
73552d0a1b Emit reflection metadata for noncopyable fields more often
When emitting reflection metadata for fields that have noncopyable
type with deployment targets that predate support for noncopyable
types, we introduce some indirection to make sure that these fields
are only visible to reflection clients (e.g., mirrors) when running on
a sufficiently-new Swift runtime. However, this indirection has the
downside that out-of-process clients (such as LLDB) can no longer
reflect the fields.

Tweak the heuristic to only introduce the indirection if the field is
*guaranteed* to have noncopyable type. If it somehow could be
copyable, e.g., based on the properties of its generic arguments, then
still emit the normal metadata. This eliminates regressions when
existing generic types like Optional become conditionally Copyable
(based on their Wrapped functions).
2024-03-07 14:24:00 -08:00
Pavel Yaskevich
0ab7e12aa2 [IRGen] Strip marker protocols from type symbol's mangling 2024-03-07 13:31:39 -08:00
Emil Pedersen
456b5a0ac8 [DebugInfo] Move type size information to CompletedDebugTypeInfo (NFC) 2024-03-07 13:07:43 -08:00
Kavon Farvardin
d5ca8ee13e Merge pull request #72137 from kavon/ncgenerics-conditional-conformances
GenProto: drop conditional Copyable reqs from protocol conformance descriptors
2024-03-07 11:14:51 -08:00
Doug Gregor
e1ee19ac5e [Noncopyable generics] Suppress inverse conformance mangling for more symbols
Don't mangle inverse conformances for symbols related to dispatch thunks,
protocol members, and other entities that are inexorably tied to the
primary definition of the type and must have stable names.

Extend the conditional suppression of inverse conformance mangling to
property descriptors and more conformance-related symbols.
2024-03-07 10:01:20 -08:00
Doug Gregor
ed745a5c07 Merge pull request #72142 from DougGregor/preinversegenerics-extensions
Allow @_preInverseGenerics on extensions
2024-03-07 10:00:40 -08:00
Doug Gregor
66801fd572 Merge pull request #72145 from apple/revert-72130-no-inverse-mangle-reabstraction
Revert "Don't mangle inverse protocols within reabstraction thunks"
2024-03-07 08:23:54 -08:00
Pavel Yaskevich
d66eeae5ed Merge pull request #72107 from xedin/rework-getting-types-from-system
[AST/Sema] Distributed: Refactor type and member queries
2024-03-07 00:14:53 -08:00
John McCall
0a282c044f Unify all of the task-creation builtins coming out of SILGen.
We've been building up this exponential explosion of task-creation
builtins because it's not currently possible to overload builtins.
As long as all of the operands are scalar, though, it's pretty easy
to peephole optional injections in IRGen, which means we can at
least just use a single builtin in SIL and then break it apart in
IRGen to decide which options to set.

I also eliminated the metadata argument, which can easily be recreated
from the substitutions.  I also added proper verification for the builtin,
which required (1) getting `@Sendable` right more consistently and (2)
updating a bunch of tests checking for things that are not actually
valid, like passing a function that returns an Int directly.
2024-03-06 22:21:12 -05:00
Doug Gregor
5ec97ae4d7 Revert "Don't mangle inverse protocols within reabstraction thunks" 2024-03-06 19:11:32 -08:00
Doug Gregor
66651de832 Merge pull request #72130 from DougGregor/no-inverse-mangle-reabstraction
Don't mangle inverse protocols within reabstraction thunks
2024-03-06 18:26:13 -08:00
Doug Gregor
3745b5a5e7 Allow @_preInverseGenerics on extensions 2024-03-06 17:42:50 -08:00
Emil Pedersen
75015b5050 [DebugInfo] Remove accessor for type size in DebugTypeInfo 2024-03-06 17:42:40 -08:00
Emil Pedersen
01c752e6db [DebugInfo] Use LLVM type size instead of an estimate for types 2024-03-06 17:23:26 -08:00