Commit Graph

779 Commits

Author SHA1 Message Date
swift-ci
04d8b3e7a2 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-07 17:15:02 -07:00
Slava Pestov
a142b19de5 ASTMangler: Convert an unreachable into abort 2024-08-06 14:45:33 -04:00
Mykola Pokhylets
816d62c972 Merge remote-tracking branch 'upstream/main' into mpokhylets/isolated-deinit
# Conflicts:
#	include/swift/Basic/Features.def
#	lib/SILGen/SILGenDestructor.cpp
#	test/Concurrency/flow_isolation.swift
#	test/abi/macOS/arm64/concurrency.swift
#	test/abi/macOS/x86_64/concurrency.swift
2024-07-11 13:11:59 +02:00
Mykola Pokhylets
b189495518 Introduced isolated deinit as a SIL entity 2024-07-11 13:09:05 +02:00
swift-ci
a32c1896dc Merge remote-tracking branch 'origin/main' into rebranch 2024-07-10 23:09:47 -07:00
Andrew Trick
12acde2215 Merge pull request #75096 from meg-gupta/lifetimedeparg
Add support for lifetime dependence in parameter position
2024-07-10 22:56:23 -07:00
Ben Barham
2715d0e9d6 Merge branch 'main' into 20240710-main-to-rebranch
Conflicts:
  - `test/Interop/Cxx/class/method/methods-this-and-indirect-return-irgen-itanium.swift`
    previously fixed on rebranch, now fixed on main (slightly differently).
2024-07-10 20:42:09 -07:00
Meghana Gupta
fecd2b452d Don't mangle lifetime dependencies in older runtimes 2024-07-10 14:48:34 -07:00
Meghana Gupta
7d2ff43fe3 Update mangling to support lifetime dependence in parameter position 2024-07-10 14:20:03 -07:00
Slava Pestov
977b444eb3 AST: Add a new overload of getContextSubstitutionMap() 2024-07-10 13:28:26 -04:00
swift-ci
b7921a8232 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-06 14:34:09 -07:00
Slava Pestov
fae01d9776 AST: Remove ModuleDecl parameter from more places 2024-07-06 12:05:46 -04:00
swift-ci
9148779681 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-04 00:15:21 -07:00
Doug Gregor
9604019c87 Drop typed throws from the mangling in closure and field reflection metadata
This follows what we just did for `@isolated(any)` function types.

Part of rdar://130858222.
2024-07-03 20:14:01 -07:00
swift-ci
f8b18eb54c Merge remote-tracking branch 'origin/main' into rebranch 2024-07-02 23:54:09 -07:00
John McCall
80e23d377d Merge pull request #74916 from rjmccall/strip-isolated-any-reflection-metadata
Suppress `@isolated(any)` in reflective metadata strings on old targets
2024-07-03 02:41:23 -04:00
John McCall
2c6e0efb9c Suppress @isolated(any) in reflective metadata strings on old targets
Fix another aspect of rdar://129861211
2024-07-02 18:12:20 -04:00
swift-ci
2201e05fb8 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-02 14:15:46 -07:00
Michael Gottesman
34195ff213 Merge pull request #74610 from gottesmm/pr-324fd70c13e87a329334341aae4667f2d1be152c
[sending] Remove transferring.
2024-07-02 14:02:18 -07:00
Ben Barham
b7954411ec Merge remote-tracking branch 'origin/main' into manually-merge-main-to-rebranch
Conflicts:
  - `include/swift/AST/PluginRegistry.h`
2024-06-27 14:56:11 -07:00
Akira Hatanaka
42bc49d3fe Add a new parameter convention @in_cxx for non-trivial C++ classes that are passed indirectly and destructed by the caller (#73019)
This corresponds to the parameter-passing convention of the Itanium C++
ABI, in which the argument is passed indirectly and possibly modified,
but not destroyed, by the callee.

@in_cxx is handled the same way as @in in callers and @in_guaranteed in
callees. OwnershipModelEliminator emits the call to destroy_addr that is
needed to destroy the argument in the caller.

rdar://122707697
2024-06-27 09:44:04 -07:00
Michael Gottesman
112071e57d [sending] Remove transferring.
Out of an abundance of caution, we:

1. Left in parsing support for transferring but internally made it rely on the
internals of sending.

2. Added a warning to tell people that transferring was going to
be removed very soon.

Now that we have given people some time, remove support for parsing
transferring.

rdar://130253724
2024-06-21 16:03:21 -07:00
Xi Ge
736ccef626 Merge remote-tracking branch 'apple/main' into rebranch 2024-06-20 15:16:55 -07:00
Tim Kientzle
1098054291 Merge branch 'main' into tbkka-assertions2 2024-06-18 17:52:00 -07:00
swift-ci
3187a295cd Merge remote-tracking branch 'origin/main' into rebranch 2024-06-17 17:36:12 -07:00
Hamish Knight
ddd1bde60e [Completion] Don’t generate USRs for local decls
Doing so can cause issues since we cannot guarantee
that e.g any parent closures have been type-checked.

rdar://128294522
2024-06-17 22:20:57 +01:00
swift-ci
b97b52f8ff Merge remote-tracking branch 'origin/main' into rebranch 2024-06-13 22:55:26 -07:00
Slava Pestov
9793f77daa AST: New mangling for expansion locations to avoid request cycles
Fixes rdar://127078338.
2024-06-13 17:45:30 -04:00
swift-ci
86259518bf Merge remote-tracking branch 'origin/main' into rebranch 2024-06-12 01:59:24 -07:00
Hamish Knight
d98cb9e2b3 [Mangler] Mangle function type for invalid enum element
Previously we would mangle a single ErrorType as
the type for the element, but that would fail to
demangle since we expect a function type. Use the
same logic as AbstractFunctionDecl, mangling a
function type of ErrorType. While here, also
handle SubscriptDecls and check for error types
rather than `isInvalid()`.

rdar://129065620
2024-06-11 21:24:11 +01:00
Tim Kientzle
1d961ba22d Add #include "swift/Basic/Assertions.h" to a lot of source files
Although I don't plan to bring over new assertions wholesale
into the current qualification branch, it's entirely possible
that various minor changes in main will use the new assertions;
having this basic support in the release branch will simplify that.
(This is why I'm adding the includes as a separate pass from
rewriting the individual assertions)
2024-06-05 19:37:30 -07:00
swift-ci
5abac881ad Merge remote-tracking branch 'origin/main' into rebranch 2024-06-02 15:34:45 -07:00
Michael Gottesman
ce1dd43395 [sending] Change CheckedContinuation/AsyncThrowingStream.Continuation APIs to use sending parameters and results.
Specifically:

1. CheckedContinuation.resume now takes a sending parameter.
2. Async{Throwing,}Stream.yield takes a sending parameter.
3. withCheckedContinuation returns a transferring parameter.

Importantly due to the previous changes around mangling, this is a mangling
neutral change.

rdar://120420024
2024-06-01 23:25:16 -07:00
Michael Gottesman
a890c6011e [sending] Do not mangle shared into function signatures if they are paired with sending.
I am doing this b/c we are going to ban borrowing sending so that we can leave
open that space for further design. In the short term, we need the ability to
create +0 sending parameters without messing with mangling. By special casing
this, we get what we want.

rdar://129116141
2024-06-01 23:25:16 -07:00
Michael Gottesman
2bf497d131 [sending] Do not mangle sending into function/methods but keep mangling into vars/storage.
We want to ensure that functions/methods themselves do not have sending mangled
into their names, but we do want sending mangled in non-top level positions. For
example: we do not want to mangle sending into a function like the following:

```swift
// We don't want to mangle this.
func test(_ x: sending NonSendableKlass) -> ()
```

But when  it comes  to actually  storing functions  into memory,  we do  want to
distinguish in  between function values  that use sending  vs those that  do not
since we do not want to allow for  them to alias. Thus we want to mangle sending
into things like the following:

```swift
// We want to distinguish in between Array<(sending T) -> ()> and
// Array((T) -> ()>
let a = Array<(sending T) -> ()>

// We want to distinguish in between a global contianing (sending T) -> () and a
// global containing (T) -> ().
var global: (sending T) -> ()
```

This commit achieves that by making changes to the ASTMangler in getDeclType
which causes getDeclType to set a flag that says that we have not yet recursed
through the system and thus should suppress the printing of sendable. Once we
get further into the system and recurse, that flag is by default set to true, so
we get the old sending parameter without having to update large amounts of code.

rdar://127383107
2024-06-01 23:25:16 -07:00
swift-ci
b20fedebc6 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-18 02:54:31 -07:00
Michael Gottesman
d759ec97ea Merge pull request #73696 from gottesmm/rdar128216574
[sending] Add support for 'sending'
2024-05-18 05:42:41 -04:00
swift-ci
f8b3740f15 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-17 04:56:41 -07:00
Slava Pestov
cf2766336a ASTMangler: Support closures whose types contain local archetypes 2024-05-16 23:00:44 -04:00
Michael Gottesman
e3e78ad6bb [sending] Change the internals of sending to be based around 'sending' instead of 'transferring'.
We still only parse transferring... but this sets us up for adding the new
'sending' syntax by first validating that this internal change does not mess up
the current transferring impl since we want both to keep working for now.

rdar://128216574
2024-05-16 12:20:45 -07:00
swift-ci
c8d364261c Merge remote-tracking branch 'origin/main' into rebranch 2024-05-01 16:55:47 -07:00
Slava Pestov
818f47918c AST: Use getNextDepth()/getMaxDepth() 2024-05-01 12:09:01 -04:00
swift-ci
54c793601b Merge remote-tracking branch 'origin/main' into rebranch 2024-04-18 01:12:49 -07:00
Augusto Noronha
01bd68e8a2 Respect the module ABI name when mangling for the debugger
The mangled name produced for the debugger should match the one emitted
in reflection metadata, otherwise LLDB will not be able to lookup types
when the module is compiled with the -module-abi-name flag.

rdar://125848324
2024-04-17 13:56:18 -07:00
swift-ci
5b6eadf416 Merge remote-tracking branch 'origin/main' into rebranch 2024-04-12 13:37:42 -07:00
Meghana Gupta
9c57458163 Fix index numbering in lifetime dependence 2024-04-08 22:33:28 -07:00
Ben Barham
96c339d75a [ClangImporter] Rename mangleTypeName to mangleCanonicalTypeName
LLVM 9c89b29555a7ccfc3942340f558c3bbea8d10532 changed `mangleTypeName`
to instead mangle the canonical type name and thus also changed the
method name.
2024-04-08 08:58:58 -07:00
Slava Pestov
480592a7d5 Merge pull request #72847 from slavapestov/fix-rdar123645784
Fix two problems with opaque return types -vs- parameter packs
2024-04-05 07:31:34 -04:00
Slava Pestov
1b798d03f5 ASTMangler: Consolidate duplicated code for conditional requirements 2024-04-04 19:36:14 -04:00
Slava Pestov
50794eec90 ASTMangler: Remove an unused parameter 2024-04-04 19:35:56 -04:00