Commit Graph

2698 Commits

Author SHA1 Message Date
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
Slava Pestov
cc6b3c1cba AST: Simplify ValueDecl::findExistentialSelfReferences() 2024-09-02 21:42:04 -04:00
Slava Pestov
2ebef08f7e AST: Generalize findGenericParameterReferences() 2024-09-02 21:42:04 -04:00
Slava Pestov
56cefdc83f AST: Clean up findGenericParameterReferences() 2024-09-02 16:12:31 -04:00
Konrad `ktoso` Malawski
c55ad6fa88 Merge branch 'main' into mpokhylets/isolated-deinit 2024-09-02 23:16:17 +09: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
Hamish Knight
1cb0f8fdd5 [AST] Rename isPrivateStdlibDecl -> isPrivateSystemDecl
This better reflects what we're actually checking
here.
2024-08-28 18:31:51 +01:00
Doug Gregor
cccf6c1114 Introduce @unsafe and the ability to prohibit use of unsafe declarations
Allow any declaration to be marked with `@unsafe`, meaning that it
involves unsafe code. This also extends to C declarations marked with
the `swift_attr("unsafe")` attribute.

Under a separate experimental flag (`DisallowUnsafe`), diagnose any
attempt to use an `@unsafe` declaration or any unsafe language feature
(such as `unowned(unsafe)`, `@unchecked Sendable`). This begins to
define a "safe" mode in Swift that prohibits memory-unsafe constructs.
2024-08-19 14:33:07 -07:00
Mykola Pokhylets
50b1313175 Merge branch 'main' into mpokhylets/isolated-deinit
# Conflicts:
#	lib/SILGen/SILGenDistributed.cpp
#	lib/Sema/TypeCheckConcurrency.cpp
2024-08-15 16:58:43 +02:00
Ellie Shin
93f9a17c33 Merge pull request #75872 from swiftlang/elsh/pkg-switch-enum 2024-08-15 05:48:09 -07:00
elsh
4f0f774856 Rename -> isInterfacePackageEffectivelyPublic 2024-08-14 01:35:24 -07:00
Ellie Shin
fadf6ec96c [Sema] Remove @unknown default requirement for package enums.
`@unknown default` in switch statements are required for resilient enums since they
might be modified with new fields in the future and modules defining the enums are
generally not built together with the consuming modules.

However, if the modules are in the same package, they are required to be built together,
thus the requirement for `@unknown default` can be skipped. This PR removes the need for
that, enabling less boilerplate. Note this change only impacts typecheck and not SIL gen.

Resolves rdar://130015149.
2024-08-13 17:06:51 -07:00
Ellie Shin
dc1c34dfa1 [Sema] Treat @usableFromInline package decls from interface as public and skip access checks
Resolves rdar://133319906
2024-08-13 17:01:19 -07:00
Alex Hoppen
bdc6fc60d2 Merge pull request #75666 from ahoppen/share-is-static
[IDE] Call into `matchWitnessStructure` to check if we should inherit a comment from an overridden declaration
2024-08-12 18:02:56 -07:00
Alex Hoppen
3ed457ab3b [Sema] Move getDocCommentProvidingDecl and getCascadingDocComment from AST to Sema
This allows use to re-use logic from Sema in those requests.

This commit just moves functions around and does not change any functionality.
2024-08-09 11:38:26 -07:00
Egor Zhdan
bfe72b4be9 Merge pull request #75589 from swiftlang/egorzhdan/linux-libcxx-interop
[cxx-interop] Allow compiling with libc++ on Linux
2024-08-09 13:42:29 +01:00
Egor Zhdan
059f0f97d1 [cxx-interop] Allow compiling with libc++ on Linux
This makes sure that Swift respects `-Xcc -stdlib=libc++` flags.

Clang already has existing logic to discover the system-wide libc++ installation on Linux. We rely on that logic here.

Importing a Swift module that was built with a different C++ stdlib is not supported and emits an error.

The Cxx module can be imported when compiling with any C++ stdlib. The synthesized conformances, e.g. to CxxRandomAccessCollection also work. However, CxxStdlib currently cannot be imported when compiling with libc++, since on Linux it refers to symbols from libstdc++ which have different mangled names in libc++.

rdar://118357548 / https://github.com/swiftlang/swift/issues/69825
2024-08-08 16:24:58 +01:00
Allan Shortlidge
f7ff3f0001 SILGen: Introduce macCatalyst support for @backDeployed.
Upstreams the necessary changes to compile references to `@backDeployed`
declarations correctly when a `macabi` target triple or a `-target-variant` is
specified.
2024-07-23 17:00:10 -07:00
Ellie Shin
cb776089cb Merge pull request #75154 from swiftlang/elsh/drop-exp-prefix
Drop experimental prefixes from PackageCMO flags.
2024-07-11 12:12:29 -07: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
2cb7e8d7b8 Implemented suppressing isolated deinit for compatibility with older compiler versions 2024-07-11 13:09:08 +02:00
Mykola Pokhylets
f04f1de75e Fixed some typos 2024-07-11 13:09:07 +02:00
Mykola Pokhylets
95079aff06 Don't generate isolating destructor if dealloc was explicitly isolated in ObjC 2024-07-11 13:09:06 +02:00
Mykola Pokhylets
10ee94885e Generating errors when isolation of the subclass deinit is not compatible with superclass deinit 2024-07-11 13:09:05 +02:00
Ellie Shin
18681c43fb Drop experimental prefixes from PackageCMO flags.
Deprecate experimental- flags with prompts to use the proper flags.

rdar://131498517
2024-07-10 16:19:16 -07:00
Meghana Gupta
154989463b Add support for lifetime dependence in parameter position 2024-07-10 14:20:03 -07:00
Pavel Yaskevich
65fb35c3bd Revert "Convert ActorIsolationRequest to use split caching"
There are a few spots in `ActorIsolationRequest` that produce
`unspecified` isolation with `preconcurrency` bit set and diagnostics
rely on that to make downgrade decisions in Swift 5 mode.

This reverts commit 0097ef68a6.
2024-07-09 13:34:25 -07:00
Slava Pestov
4c7ca3ea72 Convert ApplyAccessNoteRequest to use separate caching 2024-07-06 23:36:00 -04:00
Slava Pestov
ec28d62d61 Convert AttachedPropertyWrappersRequest to use split caching 2024-07-06 23:36:00 -04:00
Slava Pestov
6489b60f8a Convert DynamicallyReplacedDeclRequest to use split caching 2024-07-06 23:36:00 -04:00
Slava Pestov
010ddfc816 Convert LifetimeDependenceInfoRequest to use split caching 2024-07-06 23:36:00 -04:00
Slava Pestov
0097ef68a6 Convert ActorIsolationRequest to use split caching 2024-07-06 23:36:00 -04:00
Slava Pestov
6b9267aaac Convert ExpandPeerMacroRequest to use split caching 2024-07-06 23:35:59 -04:00
Slava Pestov
edf8237df2 Convert SPIGroupsRequest to use split caching 2024-07-06 23:35:59 -04:00
Slava Pestov
80ddc3275f Convert PropertyWrapperAuxiliaryVariablesRequest to use split caching 2024-07-06 23:35:59 -04:00
Slava Pestov
9d163c4139 Convert GlobalActorAttributeRequest to use split caching 2024-07-06 23:35:59 -04:00
Slava Pestov
8a92c9cfc5 Convert ExpandMemberAttributeMacros to use split caching 2024-07-06 23:35:59 -04:00
Hamish Knight
0f30a1ab35 [Completion] Handle body macro attribute completion
Add support for function-attached macros, and
complete body and preamble macros in those
positions.

rdar://130740590
2024-07-02 09:44:32 +01: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
Kavon Farvardin
4b98498bf2 Merge pull request #74672 from kavon/post-vacation-misc-cleanups
Handful of small NoncopyableGenerics fixes / cleanups.
2024-06-25 18:35:40 -07:00
Slava Pestov
17a6a80204 AST: Use separate caching for ProtocolDecl::getAllInheritedProtocols() 2024-06-25 15:20:42 -04:00
Kavon Farvardin
80c99973d7 NFC: introduce isAddingConformanceToInvertible
Removes duplicated code between Sema and the ASTPrinter.
2024-06-24 15:34:58 -07:00
Meghana Gupta
470fa2f365 Remove resultDependsOn/resultDependsOnSelf 2024-06-05 11:36:16 -07:00
Doug Gregor
525e245e0a Merge pull request #73909 from DougGregor/let-instance-property-mutability-fix
Ensure that we do not turn rvalues into lvalues
2024-05-24 22:34:58 -07:00
Doug Gregor
d051b62676 Ensure that we do not turn rvalues into lvalues
The computation that determined whether an access to a `let` instance
property within a constructor should be an initialization conflated the
cases of "we don't have a base expression" and "the base expression is
not something that could be `self`", and incorrectly identified rvalue
bases as being "initializable". Make the interface properly separate
out these cases, so we don't turn an lvalue into an rvalue access.

Fixes rdar://128661833.
2024-05-24 18:22:04 -07:00
Ellie Shin
c0720d5fb3 Merge pull request #73686 from apple/elsh/ir-global-accessor
Fix global accessor and class linker errors in package.
2024-05-21 22:59:10 -07:00
Ellie Shin
063d159d1b Rename isFragile() as isStrictlyResilient() in var decl.
Add isStrictlyResilient() to nominal type and module decl.
2024-05-21 18:25:10 -07:00
Becca Royal-Gordon
d9912009b0 Merge pull request #73309 from beccadax/objcimpl-category-on-objc 2024-05-21 10:19:14 -07:00
Ellie Shin
80855c872b Fix global accessor and class linker errors.
Add global accessors to symbol list if VarDecl is fragile, i.e.
is non-resilient or its defining module allows non-resilient
access.

Don't set the class decl to hidden if it's in a package resilience
domain; even though its defining module is built resilently, the
class symbol should be visible across modules if they are in the
same package with resilience-bypass optimization. In such case,
treat its SubclassScope to Internal.

Resolves rdar://127321129
2024-05-20 14:39:37 -07:00