Commit Graph

6196 Commits

Author SHA1 Message Date
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
swift-ci
1ff8677f6d Merge remote-tracking branch 'origin/main' into rebranch 2024-07-01 21:13:48 -07:00
Artem Chikin
517667e41b Merge pull request #74872 from artemcm/SeparateScanCacheForHeaderDepsToo
[Dependency Scanning] Apply `-clang-scanner-module-cache-path` to header Clang module dependencies
2024-07-01 21:03:03 -07:00
Ben Barham
701800fbeb [ClangImporter] Handle DefaultArgument now being a TemplateArgmentLoc
This was changed in upstream LLVM 142c3f394e1b34dcefcaf0887a6fd4711b78eeb3.
2024-07-01 14:52:52 -07:00
Ben Barham
a6cf31036a Add AMDGPU builtin handling 2024-07-01 14:52:51 -07:00
artemcm
a89fde1898 [Dependency Scanning] Apply '-clang-scanner-module-cache-path' to header Clang module dependencies
Resolves rdar://117024665
2024-07-01 14:29:37 -07:00
swift-ci
1b2ed25dc0 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-01 11:53:28 -07:00
Saleem Abdulrasool
f011de6ce8 Merge pull request #74829 from compnerd/android-notes
ClangImporter: add support for Android API Notes
2024-07-01 11:34:46 -07:00
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
Saleem Abdulrasool
47f9d78990 ClangImporter: add support for Android API Notes
Introduce the first APINotes injection for the Android platform. This
follows the VCRuntime pattern of permitting the SDK to provide API Notes
that augment the system SDK. This adds a workaround for incorrect
nullability on the `fts_open` function in bionic. The system library
itself is fixed at:
https://android-review.googlesource.com/c/platform/bionic/+/3151616
2024-06-28 13:24:04 -07:00
swift-ci
f2e68e5db1 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-28 11:36:11 -07:00
Ben Barham
d8f381e660 Merge pull request #74804 from bnbarham/rename-equals
Update `StringRef::equals` references to `operator==`
2024-06-28 11:22:20 -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
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
Hamish Knight
3168d54eb3 Merge pull request #74683 from hamishknight/null-context
[ClangImporter] Switch `lookupGlobalsAsMembers` to take a non-optional EffectiveClangContext
2024-06-27 18:08:10 +01:00
Steven Wu
eacb045393 [ExplicitModule] Fix codegen target when using direct cc1 mode
When using direct-cc1 scanning mode, `-clang-target` is passed to
swift-frontend as `-Xcc` option, thus it causes swift IRGen to use
clang-target, instead of `-target` option of swift invocation. Teach
clang importer to restore target triple from swift for codegen option.

rdar://130547690
2024-06-26 14:46:35 -07:00
swift-ci
517860f681 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-25 23:55:09 -07:00
Alex Lorenz
466ae71e75 Merge pull request #74494 from hyp/eng/android-memcpy-nonnull-me-timbers
[cxx-interop] Builtin functions should ignore return type nullability…
2024-06-25 23:39:47 -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
swift-ci
ee72f594fb Merge remote-tracking branch 'origin/main' into rebranch 2024-06-25 08:55:18 -07:00
Alex Lorenz
0c7621d282 Merge pull request #74541 from hyp/eng/lookup-imported-member-operator-cxx
[cxx-interop][serialization] resolve x-refs to instantiated/synthesiz…
2024-06-25 08:45:02 -07:00
Hamish Knight
bb4d0126f4 [ClangImporter] Switch lookupGlobalsAsMembers to take a non-optional EffectiveClangContext
The only caller is `loadNamedMembers`, and that
passes in a non-optional EffectiveClangContext,
meaning that we'd miss the case when
`getEffectiveClangContext` returns `nullptr`, crashing
in `translateContext`. No test case unfortunately
as I haven't been able to come up with a reproducer.

rdar://129619711
2024-06-25 12:27:48 +01: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
swift-ci
8179c1c4a2 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-21 12:55:46 -07:00
Egor Zhdan
d07e8ce424 Merge pull request #74619 from swiftlang/egorzhdan/std-function-inout
[cxx-interop] Instantiate the `std::function` constructor with a const pointer argument
2024-06-21 20:39:25 +01:00
Alex Lorenz
e4ad3c19c7 [cxx-interop] C library builtin functions from 'string.h' should ignore return type nullability to be compatible with C interop
In C interop mode, the return type of builtin functions like 'memcpy' from headers like 'string.h' drops any nullability
specifiers from their return type, and preserves it on the declared return type. Thus, in C
mode the imported return type of such functions is always optional. However, in C++ interop mode, the
return type of builtin functions can preseve the nullability specifiers on their return type,
and thus the imported return type of such functions can be non-optional, if the type is annotated with
`_Nonnull`. The difference between these two modes can break cross-module Swift serialization, as
Swift will no longer be able to resolve an x-ref such as 'memcpy' from a Swift module that uses
C interop, within a Swift context that uses C++ interop. In order to avoid the x-ref resolution
failure, normalize the return type's nullability for builtin functions in C++ interop mode, to
match the imported type in C interop mode.

This fixed an issue when using 'memcpy' from the Android NDK in a x-module context, like
between Foundation (that inlines it) and another user module.
2024-06-21 11:04:57 -07:00
Egor Zhdan
d38067c2ba [cxx-interop] Instantiate the std::function constructor with a const pointer argument
We were trying to instantiate a constructor for `std::function` from a C function pointer with a non-const function pointer type. That worked well on most platforms, where `std::function` defines a single constructor for const and non-const function pointers, but failed on UBI 9.

This fixes a test (`Interop/Cxx/stdlib/use-std-function.swift`) on UBI Linux.

rdar://118026392
2024-06-21 14:22:11 +01:00
Xi Ge
736ccef626 Merge remote-tracking branch 'apple/main' into rebranch 2024-06-20 15:16:55 -07:00
Alex Lorenz
983fb8025a [cxx-interop][serialization] resolve x-refs to instantiated/synthesized C++ iterator conformance operators
These x-refs might not be resolvable using regular lookup from the 'std' module as they could be instantiated/synthesized
by the clang importer. Augment the lookup logic in that case to try clang importer lookup logic that is used during
the conformance to the C++ iterator protocol.
2024-06-20 14:51:34 -07:00
Tim Kientzle
598e5104ef Merge pull request #74184 from tbkka/tbkka-assertions2
Add `#include "swift/Basic/Assertions.h"` to a lot of source files
2024-06-20 12:13:28 -07:00
swift-ci
3aff53eb62 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-19 03:34:03 -07:00
Gábor Horváth
2fb164b13f Merge pull request #74334 from apple/gaborh/name-collision-tests
[cxx-interop] Fix inadvertently renaming static method to Mutating
2024-06-19 12:29:00 +02: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
swift-ci
08c89c3ee6 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-18 09:14:51 -07:00
Steven Wu
fef4ee4935 Merge pull request #74199 from cachemeifyoucan/eng/PR-128876895
[ScanDependencies] Make sure `canImport` resolution agrees with `import`
2024-06-18 09:14:19 -07:00
Gabor Horvath
d17d17e96e [cxx-interop] Fix inadvertently renaming static method to Mutating
When we have both const and non-const version of a function, we import
the non-cont version with the "Mutating" suffix. This logic, however, is
redundant for static member functions as those can never be marked as
"const" since they don't have a "self" or "this" to mutate.

rdar://120858502
2024-06-18 16:19:23 +01:00
swift-ci
12ad8c462c Merge remote-tracking branch 'origin/main' into rebranch 2024-06-18 07:14:46 -07:00
Holly Borla
cdfe3364be Merge pull request #74509 from hborla/fix-infer-sendable-from-global-actor
[Concurrency] Fix `@Sendable` inference for global-actor-isolated function types.
2024-06-18 07:08:10 -07:00
Holly Borla
1406b28de0 [Concurrency] Consider the upcoming feature flags in the originating module when
applying `@Sendable` inference for global-actor-isolated function types.

Otherwise, for libraries that do not enable `GlobalActorIsolatedTypesUsability`,
clients that do will encounter mangling mismatches for any library APIs that
have global-actor-isolated function types that are not explicitly `@Sendable`.
2024-06-17 18:01:45 -07:00
Steven Wu
7d85aa423d [ScanDependencies] Make sure canImport resolution agrees with import
Fix the problem that when the only module can be found is an
invalid/out-of-date swift binary module, canImport and import statement
can have different view for if the module can be imported or not.

Now canImport will evaluate to false if the only module can be found for
name is an invalid swiftmodule, with a warning with the path to the
module so users will not be surprised by such behavior.

rdar://128876895
2024-06-17 14:14:48 -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