Commit Graph

2550 Commits

Author SHA1 Message Date
swift-ci
b8a5d2d6d7 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-03 01:35:42 -07:00
Konrad `ktoso` Malawski
45b97f146b Merge branch 'main' into wip-experimental-isolated-deinit 2024-09-30 13:47:39 +09:00
swift-ci
21ca39540e Merge remote-tracking branch 'origin/main' into rebranch 2024-09-27 22:54:31 -07:00
fahadnayyar
bd9095e69f Merge pull request #76733 from fahadnayyar/cxx-interop-frt-retain-release-diagnostics-patch-2
[cxx-interop] Add diagnostic notes when retain/release are not import…
2024-09-27 22:37:07 -07:00
fahadnayyar
d1b380ffd6 [cxx-interop] Add diagnostic notes when retain/release are not imported into swift for SWIFT_SHARED_REFERENCE types 2024-09-27 18:57:31 -07:00
swift-ci
59a7eb4710 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-27 06:15:16 -07:00
Gabor Horvath
cbd8cdfe95 [cxx-interop] Add rules to recognize escapability of aggregates
For now, this logic is used for importing fewer unannotated types as
unsafe. In the future, this logic will be used by escapability inference
for other (non-aggregate) types.
2024-09-24 16:41:00 +01:00
swift-ci
2bd533ccda Merge remote-tracking branch 'origin/main' into rebranch 2024-09-24 07:55:58 -07:00
Gabor Horvath
72ce39ce07 [cxx-interop] Fix off-by-one error when importing lifetimebound attrs 2024-09-24 12:01:26 +01:00
Konrad `ktoso` Malawski
d89347bed0 Merge branch 'main' into wip-experimental-isolated-deinit 2024-09-20 18:34:45 +09:00
swift-ci
df338c19a8 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-19 09:34:45 -07:00
Gabor Horvath
929c0ca7d8 [cxx-interop] Introduce a safe C++ interop mode
In this mode all C++ types are imported as unsafe by default. Users
explicitly marking types are escapable or not escapable can make them
imported as safe. In the future, we also want to import unannotated
functions as unsafe and add more logic to infer types that are actually
safe, like agregates of escapable types.
2024-09-19 12:34:07 +01:00
swift-ci
6964118e7e Merge remote-tracking branch 'origin/main' into rebranch 2024-09-18 13:17:04 -07:00
Doug Gregor
3a570e060c Merge pull request #76551 from DougGregor/one-loc-to-file-lookup
Reimplement ModuleDecl::getSourceFileContainingLocation() using SourceManager
2024-09-18 12:55:08 -07:00
swift-ci
5039a2d86c Merge remote-tracking branch 'origin/main' into rebranch 2024-09-18 10:55:29 -07:00
Doug Gregor
da0c70f301 Merge pull request #76512 from DougGregor/sourcefile-nonopt-buffer
Ensure that SourceFiles always have a backing buffer in the SourceManager
2024-09-18 10:54:52 -07:00
Doug Gregor
8febd3fb32 Reimplement ModuleDecl::getSourceFileContainingLocation() using SourceManager
ModuleDecl kept track of all of the source files in the module so that it
could find the source file containing a given location, which relied on
a sorted array all of these source files. SourceManager has its own
similar data structure for a similar query mapping the locations to
buffer IDs.

Replace ModuleDecl's dats structure with a use of the SourceManager's version
with the mapping from buffer IDs to source files.
2024-09-18 07:45:50 -07:00
swift-ci
72a4f929b0 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-18 07:33:29 -07:00
Gábor Horváth
ffa1014c30 Merge pull request #76311 from swiftlang/gaborh/import-lifetimebound
[cxx-interop] Teach importer to interpret lifetimebound annotations
2024-09-18 15:24:32 +01:00
Gabor Horvath
16e012bb5e [cxx-interop] Teach importer to interpret lifetimebound annotations
The lifetimebound annotations are now imported as lifetime dependencies.
This works for basic cases but there are still some parts missing:
* Support lifeitmebound annotations on constructors
* A way to represent immortal/static lifetimes on the C++ side
2024-09-18 10:51:05 +01:00
swift-ci
24e41cb1b0 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-17 09:35:17 -07:00
Egor Zhdan
5981833c17 [cxx-interop] NFC: Remove unused method
`importer::hasUnsafeAPIAttr` is being used instead of this method.
2024-09-17 13:48:53 +01:00
Konrad `ktoso` Malawski
7d1ce789ad Revert "Revert "Isolated synchronous deinit"" 2024-09-17 17:35:38 +09:00
Doug Gregor
4e7fb73b0c Provide the buffer ID for source files created for C swift_attr attributes
When rendering a swift_attr attribute for parsing, we were creating both
the backing buffer and a source file, but not providing the buffer's ID
to the source file, so we couldn't find the source code again. Fix that.

While here, also register the source file with the module, so we can
find the source file again based on location.
2024-09-16 21:45:34 -07:00
Ben Barham
a7b50f357f Merge remote-tracking branch 'origin/main' into manual-main-merge
Conflicts:
  - `lib/Driver/ToolChains.cpp` conflicting with the `addAllArgs` rename
    for multiple options
2024-09-16 13:53:18 -07:00
Allan Shortlidge
02dbb96b94 AST: Rename AvailabilityContext to AvailabilityRange.
The generality of the `AvailabilityContext` name made it seem like it
encapsulates more than it does. Really it just augments `VersionRange` with
additional set algebra operations that are useful for availability
computations. The `AvailabilityContext` name should be reserved for something
pulls together more than just a single version.
2024-09-13 16:25:18 -07:00
fahadnayyar
7753ad0885 Merge pull request #76131 from fahadnayyar/cxx-interop-frt-retain-release-diagnostics
Fixed diagnostics for incorrect parameters of retain/release function…
2024-09-11 10:24:20 -07:00
fahadnayyar
f3f4e1913b Fixed diagnostics for incorrect signature of retain/release functions of SWIFT_SHARED_REFERENCE C++ types. 2024-09-10 16:15:07 -07:00
swift-ci
f3fac46bbc Merge remote-tracking branch 'origin/main' into rebranch 2024-09-09 08:35:46 -07:00
Alex Lorenz
8ea7569b14 Merge pull request #76286 from hyp/eng/bodyParamsimport
[cxx-interop] do not rely on bodyParams being always non-null when im…
2024-09-09 08:24:30 -07:00
swift-ci
9717c082ca Merge remote-tracking branch 'origin/main' into rebranch 2024-09-06 09:16:29 -07:00
fahadnayyar
e3ea4e1b54 Merge pull request #75897 from fahadnayyar/f-dev-frt-return-ownership-annotations-pr
[cxx-interop] Add SWIFT_RETURNS_RETAINED and SWIFT_RETURNS_UNRETAINED…
2024-09-06 09:16:08 -07:00
swift-ci
da55e84c74 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-05 15:35:33 -07:00
fahadnayyar
ea4328384d [cxx-interop] Add SWIFT_RETURNS_RETAINED and SWIFT_RETURNS_UNRETAINED annotations to specify ownership of FRT returned by a C++ method or function
rdar://135306908
2024-09-05 11:44:31 -07:00
Alex Lorenz
86886d96c9 [cxx-interop] do not rely on bodyParams being always non-null when importing function's name
This change fixes a swift-ide-test crash that occured in the Interop\Cxx\stdlib\msvcprt-module-interface.swift testcase with a newer MSVC, as one of its operator() had a parameter with a type that couldn't have been imported. The change ensures that body params are not used if they're null.
2024-09-05 10:54:52 -07:00
Alejandro Alonso
f4f60f4344 Remove Value requirement Add GenericTypeParamKind 2024-09-04 15:13:43 -07:00
Alejandro Alonso
75c2cbf593 Implement value generics
Some requirement machine work

Rename requirement to Value

Rename more things to Value

Fix integer checking for requirement

some docs and parser changes

Minor fixes
2024-09-04 15:13:25 -07:00
swift-ci
756fe355fa Merge remote-tracking branch 'origin/main' into rebranch 2024-09-03 22:34:34 -07:00
Alex Hoppen
c5aa49ba64 Revert "Isolated synchronous deinit" 2024-09-03 18:11:26 -07:00
swift-ci
33cd94ec00 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-03 10:04:55 -07:00
Allan Shortlidge
3f626f50fe Merge pull request #76203 from tshortli/availability-context-cleanup
AST: Clean up `AvailabilityContext` and uses
2024-09-03 09:42:25 -07:00
swift-ci
dd7533d4e7 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-03 09:33:55 -07:00
Konrad `ktoso` Malawski
c86e4a8738 Merge pull request #60057 from nickolas-pohilets/mpokhylets/isolated-deinit
Co-authored-by: Konrad `ktoso` Malawski <ktoso@apple.com>
2024-09-04 01:16:56 +09:00
swift-ci
f1877410ef Merge remote-tracking branch 'origin/main' into rebranch 2024-09-03 02:53:13 -07:00
Gábor Horváth
54efb012f9 Merge pull request #76209 from swiftlang/gaborh/nonescapable-attr
[cxx-interop] Add a SWIFT_NONESCAPABLE attribute to the bridging header
2024-09-03 10:48:55 +01:00
Allan Shortlidge
8ab7f54cd4 AST/Sema: Favor AvailabilityContext over VersionTuple/VersionRange.
For the purposes of availability calculations, direct use of
`llvm::VersionTuple` and `VersionRange` is discouraged, since these fundamental
version representations are divorced from their context. For example, comparing
an iOS platform version to a visionOS platform version is invalid since the
versioning systems of the two platforms differ. Although visionOS inherits
avialability from iOS, an iOS version must be converted to a visionOS version
prior to comparison. In the future, `AvailabilityContext` can be enriched to
carry the information necessary to verify that its algebraic operations are
being performed on compatible values.

NFC.
2024-09-02 18:24:31 -07:00
Allan Shortlidge
8052e3f9dc AST: Remove 'OS' from AvailabilityContext member names.
An `AvailabilityContext` represents an abstract version range in which
something is available. In the future, these version ranges may not necessarily
always correspond to operating system version ranges.

NFC.
2024-09-02 16:47:14 -07:00
Gabor Horvath
1842867de2 [cxx-interop][NFC] Fix some clang-tidy warnings
Mostly remove redundant includes, adding missing namespace end comments
and using isa_and_nonnull.
2024-09-02 15:24:47 +01:00
Gabor Horvath
738b4c6d8d [cxx-interop] Add a SWIFT_NONESCAPABLE attribute to the bridging header
This makes it easier to experiment with noescapable types in interop.
Moreover, we always wanted to have this annotation for completeness,
similar to SWIFT_NONCOPYABLE.
2024-09-02 14:51:27 +01:00
Mykola Pokhylets
e0ad7bde82 Merge branch 'main' into mpokhylets/isolated-deinit
# Conflicts:
#	include/swift/Basic/Features.def
#	lib/AST/ASTPrinter.cpp
#	lib/AST/FeatureSet.cpp
2024-08-29 11:28:43 +02:00