Commit Graph

2428 Commits

Author SHA1 Message Date
swift-ci
287d711d03 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-01 11:14:00 -07:00
susmonteiro
e86099c26d [cxx-interop] Implements constructor for std::span from UnsafeBufferPointer
Tests: init span from UnsafeBufferPointer, for loop, map, filter, init Array from span, span of strings
2024-07-01 16:07:28 +01:00
swift-ci
f2e68e5db1 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-28 11:36:11 -07:00
Ben Barham
d72f5b12c4 Update StringRef::equals references to operator==
`equals` has been deprecated upstream, use `operator==` instead.
2024-06-27 19:14:06 -07:00
swift-ci
e6cfe95904 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-25 10:54:31 -07:00
fahadnayyar
0d59587eba Merge pull request #73559 from fahadnayyar/attribute-operator-star
[cxx-interop] Import the attributes from clang decl for synthesized s…
2024-06-25 10:39:55 -07:00
fahadnayyar
1d8ddc2697 [cxx-interop] Import the attributes from Clang decl for synthesized Swift decl for pointee and successor 2024-06-24 13:53:54 -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
4ccab4d6b6 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-18 13:34:52 -07:00
Pavel Yaskevich
68b6c7e58a Merge pull request #74492 from xedin/rdar-127520993
[ClangImporter] Always add `AnyObject` constraint to generic parameters
2024-06-18 13:24:35 -07:00
Pavel Yaskevich
4cc69b85d6 [ClangImporter] Always add AnyObject constraint to generic parameters
`: AnyObject` was added only if there were no other constraints because
all of them would imply it before, with introduction of `Sendable` this
is no longer the case. Let's add `AnyObject` constraint unconditionally
and let generic signature builder deal with the redundancy.

Resolves: rdar://127520993
2024-06-17 12:17:18 -07:00
swift-ci
0bbe4a8055 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-17 10:14:25 -07:00
Egor Zhdan
7c165272c5 Merge pull request #71396 from apple/egorzhdan/cxx-std-function
[cxx-interop] Allow initializing `std::function` from Swift closures
2024-06-17 12:31:56 +01:00
Egor Zhdan
3243228897 [cxx-interop] Allow initializing std::function from Swift closures
This adds a Swift initializer to instantiations of `std::function` that accepts a Swift closure with `@convention(c)`.

rdar://103979602
2024-06-14 19:05:45 +01:00
swift-ci
a2eb7713c4 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-12 15:33:10 -07:00
Alex Lorenz
2039b8d254 [cxx-interop] import static operator call from C++23 as member callAsFunction functions in Swift to preserve source compatibility 2024-06-12 09:11:15 -07: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
efcbe900f9 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-21 10:33:14 -07:00
Becca Royal-Gordon
d9912009b0 Merge pull request #73309 from beccadax/objcimpl-category-on-objc 2024-05-21 10:19:14 -07:00
swift-ci
b20fedebc6 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-18 02:54:31 -07:00
Michael Gottesman
b780ff6696 [sending] Begin parsing 'sending' while still accepting 'transferring'.
A few things:

1. Internally except for in the parser and the clang importer, we only represent
'sending'. This means that it will be easy to remove 'transferring' once enough
time has passed.

2. I included a warning that suggested to the user to change 'transferring' ->
'sending'.

3. I duplicated the parsing diagnostics for 'sending' so both will still get
different sets of diagnostics for parsing issues... but anywhere below parsing,
I have just changed 'transferring' to 'sending' since transferring isn't
represented at those lower levels.

4. Since SendingArgsAndResults is always enabled when TransferringArgsAndResults
is enabled (NOTE not vis-a-versa), we know that we can always parse sending. So
we import "transferring" as "sending". This means that even if one marks a
function with "transferring", the compiler will guard it behind a
SendingArgsAndResults -D flag and in the imported header print out sending.

rdar://128216574
2024-05-16 21:43:50 -07: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
692ca26160 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-04 10:34:18 -07:00
Becca Royal-Gordon
07b2b9a01f [NFC] Add @objc to imported ObjC categories
This contains the category name, if there is one.
2024-05-01 12:18:19 -07:00
Ben Barham
445ee1ec14 Manually merge rebranch into main
Conflicts:
  - `lib/ClangImporter/ImportDecl.cpp` as `isPure` is now
    `isPureVirtual`
2024-04-25 13:48:57 -07:00
Nate Chandler
b1fbe4ea91 [BitwiseCopyable] Remove underscore. 2024-04-25 11:44:15 -07:00
Nate Chandler
ed5c7ef7ae [BitwiseCopyable] Promote to feature.
SE-0426 was accepted.
2024-04-24 15:52:20 -07:00
Egor Zhdan
b330376a43 [cxx-interop] Pull changes from swift-6 compat mode into swift-5.9
This gives projects using C++ interop compat mode 5.9 access to the new features such as virtual methods and move-only types.

rdar://126485814
2024-04-24 11:53:31 +01:00
swift-ci
fa8b682652 Merge remote-tracking branch 'origin/main' into rebranch 2024-04-18 15:19:35 -07:00
Egor Zhdan
2bc41997b5 [cxx-interop] Do not try to import std::chrono::tzdb, part 2
`tzdb` is declared inside of `namespace chrono`, so the check needs to be adjusted.

rdar://126486849 / https://github.com/apple/swift/issues/73037
2024-04-18 15:29:41 +01:00
swift-ci
0cf01c3fbe Merge remote-tracking branch 'origin/main' into rebranch 2024-04-17 15:46:01 -07:00
Nate Chandler
c43f87101f Merge branch 'main' into rebranch
Conflicts:
      lib/Basic/Platform.cpp

```
diff --git a/lib/Basic/Platform.cpp b/lib/Basic/Platform.cpp
index 240edfa144a..1797c87635f 100644
--- a/lib/Basic/Platform.cpp
+++ b/lib/Basic/Platform.cpp
@@ -200,10 +200,7 @@ StringRef swift::getPlatformNameForTriple(const llvm::Triple &triple) {
   case llvm::Triple::CUDA:
   case llvm::Triple::DragonFly:
   case llvm::Triple::DriverKit:
-<<<<<<< HEAD
   case llvm::Triple::ELFIAMCU:
-=======
->>>>>>> main
   case llvm::Triple::Emscripten:
   case llvm::Triple::Fuchsia:
   case llvm::Triple::HermitCore:
```
2024-04-17 13:32:48 -07:00
Egor Zhdan
c90cb4bc38 [cxx-interop] Do not try to import std::tzdb
In libstdc++13 on Ubuntu 23.10 the type `std::tzdb` is non-copyable but does not explicitly delete its copy constructor. It instead triggers template instantiation errors when trying to use the copy constructor. This is problematic for Swift, since we try to instantiate copy constructors for most C++ types we import.

This disables the import of `std::tzdb` to unblock nightly toolchains for Ubuntu 23.10 until we come up with a better solution.

rdar://126486849 / https://github.com/apple/swift/issues/73037
2024-04-17 19:49:52 +01:00
Artem Chikin
01d891ad99 Merge pull request #72834 from artemcm/UpstreamVisionOS
Introduce visionOS Platform
2024-04-15 09:33:49 -07:00
swift-ci
5b6eadf416 Merge remote-tracking branch 'origin/main' into rebranch 2024-04-12 13:37:42 -07:00
Artem Chikin
1f14158a1d Introduce VisionOS Platform
This change introduces a new compilation target platform to the Swift compiler - visionOS.

- Changes to the compiler build infrastrucuture to support building compiler-adjacent artifacts and test suites for the new target.
- Addition of the new platform kind definition.
- Support for the new platform in language constructs such as compile-time availability annotations or runtime OS version queries.
- Utilities to read out Darwin platform SDK info containing platform mapping data.
- Utilities to support re-mapping availability annotations from iOS to visionOS (e.g. 'updateIntroducedPlatformForFallback', 'updateDeprecatedPlatformForFallback', 'updateObsoletedPlatformForFallback').
- Additional tests exercising platform-specific availability handling and availability re-mapping fallback code-path.
- Changes to existing test suite to accomodate the new platform.
2024-04-10 09:38:02 -07:00
Erik Eckstein
3097cceba0 clang importer: import __attribute__((swift_attr("sensitive"))) on C structs as @sensitive attributes 2024-04-09 12:01:10 +02:00
Ben Barham
65a2f093c8 [ClangImporter] Rename CXXMethodDecl::isPure to isVirtualPure
Renamed in LLVM e90e43fb9cd1d305f7196cd526aa503374e0f616.
2024-04-08 08:58:59 -07:00
Ben Barham
247d81338c [ClangImporter] Copy APSInt rather than taking its address
142f270c279f2576e4618fc0d1121181c7531fdf fixed a memory leak involving
`APSInt`. It is now returned by value in `getInitVal`.
2024-04-08 08:58:59 -07:00
Ben Barham
5b61aab224 [ClangImporter] Remove ClassScopeFunctionSpecializationDecl
Removed in LLVM 3a3b84b180278207731451dfac24f47d02b50e84.
2024-04-08 08:58:58 -07:00
Ben Barham
a30de11b89 [ClangImporter] Add missing include for llvm::size
Presumably this was previously transitively included, who knows from
where.
2024-04-08 08:58:58 -07:00
Ben Barham
a9077d7129 FileEntry to FileEntryRef updates 2024-04-08 08:58:58 -07:00
Ben Barham
0f52071c22 Fix up various references to renamed/moved enums
A bunch of enums were moved to enum classes and slightly renamed. Fix up
their references.
2024-04-08 08:58:58 -07:00
Ben Barham
1fdda023b3 Rename StringRef::endswith references to StringRef::ends_with
Missed this when doing the `startswith` renaming. `endswith` has also
been deprecated upstream (and presumably soon to be removed).
2024-04-01 10:59:16 -07:00
Michael Gottesman
363c5634f1 [transferring] Implement swift_attr support for transferring results and parameters.
rdar://125211624
2024-03-23 17:59:01 -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
Nate Chandler
cf77b9f98b [BitwiseCopyable] Allow conformance via swift_attr
If an imported type's conformance cannot be implicitly inferred, allow
it to be explicitly stated via
`__attribute__((__swift_attr__("_BitwiseCopyable")))`.
2024-03-05 16:52:17 -08:00
Egor Zhdan
8ead7224b7 [cxx-interop] Overhaul virtual method support
This adds a new implementation of virtual method dispatch that handles reference types correctly.

Previously, for all C++ types an invocation of a virtual method would actually get dispatched statically. For value types this is expected and matches what C++ does because of slicing. For reference types, however, this is incorrect, we should do dynamic dispatch.

rdar://123852577
2024-03-01 19:45:58 +00:00