Commit Graph

11548 Commits

Author SHA1 Message Date
Mariusz Borsa
5f4320568b Merge pull request #70508 from apple/eng/m_borsa/112915278
[Sanitizers] Add new sanitize-stable-abi flag for libsanitizers.
2023-12-18 09:58:55 -08:00
usama
3053fe01b5 [Sanitizers] Add new sanitize-stable-abi flag for libsanitizers.
This patch adds a new flag sanitize-stable-abi to support linking
against the Sanitizers stable ABI added recently in compiler-rt. The
patch also passes extra options for the ASan pass when using this flag
to outline instrumentation code and remove version check.

rdar://112915278
2023-12-16 14:13:00 -08:00
Arnold Schwaighofer
b4ef029fe6 IRGen: Add support for typed throws to thunk code generation
rdar://119725769
2023-12-15 15:39:29 -08:00
Becca Royal-Gordon
e9672194b4 Merge pull request #69468 from beccadax/c-implementation
Make @objcImpl work with @_cdecl
2023-12-14 00:36:12 -08:00
Becca Royal-Gordon
8651af4325 Make @objcImpl work with @_cdecl
No real diagnostics yet, but we’re emitting mostly correct code.
2023-12-13 11:09:49 -08:00
Erik Eckstein
e4ea7491a2 IRGen: fix and re-enable static read-only arrays
Static read-only arrays didn't work when passed to ObjectiveC as NSArray.
The storage class of static read-only arrays doesn't carry information about the Element type.
The new `__SwiftDeferredStaticNSArray` is generic over the element type and doesn't have to rely on the element type information of the array storage.

rdar://94185998
2023-12-13 11:45:01 +01:00
Alejandro Alonso
f365316d74 Merge pull request #70327 from Azoy/inject-get-enum-tag-builtins
[IRGen] Add getEnumTag and injectEnumTag builtins
2023-12-12 16:07:56 -08:00
Kuba (Brecka) Mracek
ec87fbcaca Merge pull request #70344 from kubamracek/embedded-nounwind
[embedded] Mark all functions as 'nounwind' in embedded Swift, add dependency tests
2023-12-12 10:37:54 -08:00
Tony Allevato
49dbf152e0 Merge pull request #70371 from allevato/c++20-fixes
[C++20] Make `operator==` const.
2023-12-12 08:04:47 -05:00
Konrad `ktoso` Malawski
828f589be4 Initial Task Executor implementation Task(on:), addTask(on:) etc. (#68793)
Co-authored-by: John McCall <rjmccall@gmail.com>
2023-12-12 17:14:24 +09:00
Doug Gregor
7a3e3aea15 Merge pull request #70353 from DougGregor/error-union-type
[Typed throws] Add an ErrorUnion type to the type system
2023-12-11 22:04:10 -08:00
Kuba Mracek
fdc69fb6a1 [embedded] Actually, use 'nounwind' even with C++ interop on, add comment 2023-12-11 13:37:41 -08:00
Alejandro Alonso
49b0a23561 Add getEnumTag and injectEnumTag builtins 2023-12-11 10:58:29 -08:00
Kuba Mracek
9e8db64f45 [embedded] Don't apply 'nounwind' if C++ interop is enabled 2023-12-11 09:08:06 -08:00
Tony Allevato
c7e52ca7da [C++20] Make operator== const.
C++20 considers calls to `operator==` ambiguous with calls that have
the arguments reversed if the argument is const but `this` is not.
2023-12-11 09:14:29 -05:00
eeckstein
484fc77a8c Merge pull request #70301 from eeckstein/fixed-array
Add experimental support for fixed arrays
2023-12-11 09:36:29 +01:00
Kavon Farvardin
e99ce1cc5d [NCGenerics] add ~Escapable
Basic implementation of `~Escapable` in the type system.

rdar://119216918
2023-12-10 01:25:43 -08:00
Erik Eckstein
dd9ce40ba1 add the allocVector builtin 2023-12-09 18:49:57 +01:00
Erik Eckstein
df9f480cdc IRGen: handle vector and alloc_vector in global initializers 2023-12-09 18:49:57 +01:00
Erik Eckstein
e652f2c92e SIL: add the alloc_vector and vector instructions
* `alloc_vector`: allocates an uninitialized vector of elements on the stack or in a statically initialized global
* `vector`: creates an initialized vector in a statically initialized global
2023-12-09 18:49:55 +01:00
Kuba Mracek
4e56d810fa [embedded] Mark all functions as 'nounwind' in embedded Swift, add dependency tests 2023-12-09 08:46:00 -08:00
Doug Gregor
b080b5f3d8 [Typed throws] An ErrorUnion type to the type system
The errorUnion type operation specifies how thrown error types are
combined when multiple errors are thrown in the same context. When
thrown error types can have type variables in them, we sometimes cannot
resolve the errorUnion until the type variables have substitutions. In
such cases, we need to persist the result of errorUnion in the
constraint solver.

Introduce the ErrorUnionType to do exactly that, and update the core
errorUnion operation to produce an ErrorUnionType when needed. At
present, this code is inert, because any errorUnion operation today
involves only concrete types. However, inference of thrown errors in
closures will introduce type variables, and depend on this.
2023-12-08 22:30:37 -08:00
Kavon Farvardin
63b3e7624d [NCGenerics] fold InverseType into PCT
We already need to track the inverses separate from the members in a
ProtocolCompositionType, since inverses aren't real types. Thus, the
only purpose being served by InverseType is to be eliminated by
RequirementLowering when it appears in a conformance requirement.

Instead, we introduce separate type InverseRequirement just to keep
track of which inverses we encounter to facilitate cancelling-out
defaults and ensuring that the inverses are respected after running
the RequirementMachine.
2023-12-07 22:14:23 -08:00
Nate Chandler
58677fe8e5 [IRGen] Always use BitwiseCopyable TypeInfo.
If an archetype conforms to the protocol, use the new TypeInfo.  This
allows clients to use code in the stdlib that's built with
BitwiseCopyable.
2023-12-05 17:21:05 -08:00
nate-chandler
d909073233 Merge pull request #70112 from nate-chandler/rdar96919870/2/typeinfo
[IRGen] Use memcpy for BitwiseCopyable archetypes.
2023-12-01 11:45:48 -08:00
Adrian Prantl
c70447c878 Merge pull request #70132 from adrian-prantl/difile-source-macro
[Debug Info] Store the source code for macro expansions in the debug …
2023-12-01 08:43:16 -08:00
Nate Chandler
fef7c77f08 [IRGen] Use memcpy for BitwiseCopyable archetypes.
Besides being an optimization, using memcpy directly rather than a value
witness is required in order to interact with unaligned instances of
such types: the value witness functions expect their arguments to be
aligned.

rdar://96919870
2023-12-01 06:58:36 -08:00
Nate Chandler
9562312c83 [IRGen] Add dynamic size variant of CreateMemCpy.
Similar to the existing variant which takes a fixed size, the new
variant which takes a dynamic size digs the relevant address and
alignment values out of the Address struct and passes them along.
2023-12-01 06:58:36 -08:00
Nate Chandler
b266abe5c0 [BitwiseCopyable] Add a marker protocol.
Behind the experimental feature BitwiseCopyable.
2023-11-30 15:25:46 -08:00
Adrian Prantl
8626aeff03 [Debug Info] Store the source code for macro expansions in the debug info
This patch stores the source code of macro in the source field of DIFile, which
can be used together with the DW_LLVM_LNCT_source extension to emit the source
code into DWARF debug info.

rdar://110926109
2023-11-30 14:49:57 -08:00
Pavel Yaskevich
4db2cf7b71 Merge pull request #70076 from xedin/sendable-keypath-literals
[ConstraintSystem] Implement sendability inference for key path expressions
2023-11-30 09:48:32 -08:00
Adrian Prantl
d812a83fc7 Merge pull request #70098 from adrian-prantl/difile-cache
[IRGenDebugInfo] Cache DIFile pointers instead of file names (NFC)
2023-11-29 18:12:21 -08:00
Adrian Prantl
e4dd71bd87 [IRGenDebugInfo] Cache DIFile pointers instead of file names (NFC)
This is an NFC refactoring that is slightly more efficient and needed for
subsequent commits.
2023-11-29 12:37:06 -08:00
Arnold Schwaighofer
d8fc85511e Merge pull request #70067 from aschwaighofer/fix_zero_sized_typed_error
IRGen: Allocate an address for the result of zero sized typed error results
2023-11-29 09:44:42 -08:00
Pavel Yaskevich
229e580174 [SIL] Add a way to retrieve key path type from KeyPathInst
Since the type of the instruction could be existential it's
better to keep retrival logic in one place.
2023-11-28 13:02:17 -08:00
Arnold Schwaighofer
e3a27a13d9 IRGen: Allocate an address for the result of zero sized typed error results
rdar://118657904
2023-11-28 11:37:09 -08:00
Kuba Mracek
5e4ae5e0ec [embedded] Avoid compiler crash when using an opaque result type 2023-11-27 22:00:18 -08:00
Richard Wei
51acf75cb5 Fix compiler crash when emitting objc header with C++ interop enabled
This was because `LoweredFunctionSignature::visitParameterList` has a special case for parameters with an empty LLVM representation (e.g. an empty struct) but forgot to increment the counter, which then tripped the assertion.

Resolves #70016.
2023-11-24 02:25:08 -08:00
Augusto Noronha
1296aeeb65 Merge pull request #69789 from augusto2112/gen-enum-debug
Generate full debug info for enums
2023-11-16 11:09:56 -08:00
nate-chandler
b944ab877a Merge pull request #69857 from nate-chandler/nfc/20231114/1/delete-dead-lowered-value-kind
[IRGen] NFC: Deleted dead LoweredValue kind.
2023-11-15 07:38:26 -08:00
Hamish Knight
6298d24781 Merge pull request #69782 from hamishknight/hash-it-out 2023-11-15 11:08:19 +00:00
Cyndy Ishida
831b098fcc Merge pull request #69779 from cyndyishida/Swift-tbdv5
[TBDGen] Capture segment symbols are defined in & emit tbd-v5 format
2023-11-14 15:36:38 -08:00
Hamish Knight
d31f76853a [SIL] Introduce skipped coverage ranges
Introduce a skipped region kind, printed using
a `skipped` keyword.
2023-11-14 20:41:35 +00:00
Nate Chandler
e673344060 [IRGen] NFC: Deleted dead LoweredValue kind.
Follow-up to https://github.com/apple/swift/pull/10077 .
2023-11-14 10:49:02 -08:00
Kuba (Brecka) Mracek
7d7cf1f102 Merge pull request #69822 from kubamracek/embedded-fallback-to-c-calling-conv
[embedded] Avoid using swiftcc on targets that don't support it
2023-11-14 09:07:48 -08:00
Cyndy Ishida
f869bd7e8a [TBDGen] Write tbd-v5 files by default
* Fixup tests to handle new json based output.
* Use llvm-nm & readtapi to verify tbd file outputs.

resolves: rdar://117604275
2023-11-14 08:06:24 -08:00
Augusto Noronha
594f51a13e Generate full debug info for enums
Replace the generation of debug info for enums from DW_TAG_union_type
to either DW_TAG_enumeration_type or DW_TAG_variant_part, as these
representation match Swift enums more closely.
2023-11-13 14:31:29 -08:00
Kuba Mracek
df09cf16b1 [embedded] Avoid using swiftcc on targets that don't support it 2023-11-13 12:59:41 -08:00
Doug Gregor
d2e0582a92 Move workaround for swifterror miscompile earlier
Thank you, Arnold for noting this miscompile on x86!
2023-11-13 11:44:25 -08:00
Cyndy Ishida
331b11f39c [TBDGen] Determine whether symbols belong in TEXT/DATA to record in tbd
files
2023-11-10 08:48:28 -08:00