Commit Graph

154031 Commits

Author SHA1 Message Date
Rintaro Ishizaki
dc6877334f [CMake] Stop some exectuable link with swiftCore
swift-compatibility-symbols, swift-def-to-strings-converter,
and swift-serialize-diagnostics don't use any Swift modules. But when
SWIFT_SWIFT_PARSER was enabled, they are linked with swiftCore. But
these binaries can be executed before the runtime is being built.
We need to stop them linking with swiftCore.
2023-08-28 19:10:01 +00:00
Rintaro Ishizaki
4ccc866612 [CMake] Fix RUNPATH of lib_InternalSwiftScan in Linux
libSwiftScan is built in 'lib' but installed in 'lib/swift/host' RUNPATH
should have correct '$ORIGIN/../{platform}' to load 'swiftCore' runtime
library.
2023-08-28 18:45:53 +00:00
Rintaro Ishizaki
319b8bd691 [CMake] Fix install for macOS toolchain
recursive-lipo requires shared libraries have +x permissions.
Use PROGRAMS instead of FILES when installing swift-syntax libraries.
2023-08-28 09:53:56 -07:00
Rintaro Ishizaki
757aaa347d [CMake] Set LD_LIBRARY_PATH to builder's runtime when building stdlib
In Linux. Instead of setting temporary "fallback" RUNPATH, Set
LD_LIBRARY_PATH to builder's runtime when building standard library.
So we don't need to strip the temporary RUNPATH when installing.
2023-08-28 01:16:18 +00:00
Rintaro Ishizaki
602604be74 [CMake] Further cleanup for RUNPATH setting
`$ORIGIN` is only supported in Linux, BSD, etc. (i.e. not in Windows)
2023-08-25 23:42:19 +00:00
Rintaro Ishizaki
914a6fdf7a [CMake] Fix weiredness in swift runtime linking for SourceKit libraries
SourceKit components are never built while bootstrapping stages. So it
doen't need to have stage 0 or 1 handling.
2023-08-25 22:37:34 +00:00
Rintaro Ishizaki
9017ef51ce [CMake] Update for review comments 2023-08-25 21:58:38 +00:00
Rintaro Ishizaki
0f0c4925ae [CMake] Fatal error when bootstrapping is not "hosttools"
and Swift parser integration is enabled.
If swift parser integration is enabled, SwiftSyntax libraries are always
built with host tools. Other SwiftCompilerSources modules must use the
same runtime with parser libraries.
2023-08-24 23:31:47 +00:00
Rintaro Ishizaki
2a2787b2d0 Avoid adding redundant temporary RUNPATH to builder's stdlib
Many shared libs and executables are only run after stdlib/runtime are
built. They don't need to link with builders stdlib at all.
2023-08-24 23:10:20 +00:00
Rintaro Ishizaki
9c9010e5b7 [CMake] Support Macros in Linux
For compiling codes required for macro support, we now need swiftc
compiler in the build machine.

Unlike Darwin OSes, where swiftCore runtime is guaranteed to be present
in /usr/lib, Linux doesn't have ABI stability and the stdlib of the
build machine is not at the specific location. So the built compiler
cannot relies on the shared object in the toolchain.
2023-08-24 17:04:15 +00:00
Andrew Trick
5dd2cf706a Merge pull request #68110 from atrick/fix-silcombine-moveonly
Fix SILCombine miscompile for discard on non-copyable types
2023-08-24 08:48:55 -07:00
nate-chandler
3687ddfac6 Merge pull request #68090 from nate-chandler/rdar114323803
[CopyPropagation] Don't try to delete owned values on which canonicalization bails.
2023-08-24 07:03:06 -07:00
nate-chandler
89ef8cd080 Merge pull request #68108 from nate-chandler/rdar114351349
[InstructionDeleter] Don't delete-as dead instructions which produce owned move-only values.
2023-08-24 07:00:57 -07:00
swift-ci
b10560f3f6 Merge pull request #68113 from nate-chandler/gardening/20230823/1
[Gardening] Removed stray comment.
2023-08-23 23:50:09 -07:00
Allan Shortlidge
e3bf6bdf0e Merge pull request #68112 from tshortli/enum-equatable-all-elements-unavailable
Sema: Set type on pattern in synthesized enum equatable/hashable conformance
swift-DEVELOPMENT-SNAPSHOT-2023-08-24-a
2023-08-23 22:40:49 -07:00
Nate Chandler
91159ae217 [Gardening] Removed stray comment. 2023-08-23 21:01:58 -07:00
Allan Shortlidge
d47a9c6ee9 Sema: Set type on pattern in synthesized enum equatable/hashable conformance.
Fixes a regression caused by https://github.com/apple/swift/pull/67636 in which
the patterns for case statements generated to match unavailable enum elements
were missing a type. The missing type caused a crash during SILGen if the
unavailable element case was the first one in the swtich statement.

Resolves rdar://113761850
2023-08-23 18:08:49 -07:00
Nate Chandler
073f4e21f3 [InstDeleter] Keep dead owned move-only values.
Deleting instructions which produce such values could result in
shortening the lifetime of a move-only value.  This is illegal because
according to language rules, the lifetime of move-only values is fixed.

rdar://114351349
2023-08-23 17:24:21 -07:00
Ben Barham
ffc0b98e2d Merge pull request #68091 from bnbarham/disable-early-linux
[Build] Skip early-* on non-darwin hosts
2023-08-23 17:13:41 -07:00
Andrew Trick
a946922798 Fix SILCombine miscompile for discard on non-copyable types
Fixes rdar://113214179 (Raw layout types don't adhere to discard self)

// swift-frontend ./rawdeinit.swift -enable-experimental-feature RawLayout \
// -enable-builtin-module -emit-sil -o rawdeinit.sil

import Builtin

@_rawLayout(like: T)
public struct Cell<T>: ~Copyable {
  var ptr: UnsafeMutablePointer<T> {
    .init(Builtin.unprotectedAddressOfBorrow(self))
  }

  init(_ initialValue: T) {
    ptr.initialize(to: initialValue)
  }

  deinit {
    ptr.deinitialize(count: 1)
  }

  public consuming func get() -> T {
    let value = ptr.move()
    discard self // SILCombine inserts a destroy of self here
    return value
  }
}
2023-08-23 17:07:07 -07:00
nate-chandler
49865f2ec6 Merge pull request #68054 from nate-chandler/opaque-values/20230821/2/closures
[OpaqueValues] Fix closure handling.
2023-08-23 15:44:47 -07:00
Volodymyr Sapsai
4bc24f57bc Merge pull request #66038 from vsapsai/parent-shim-modulemap
Add and install a parent module map for Swift shims. NFC intended.
2023-08-23 14:41:28 -07:00
Doug Gregor
fc8da01c05 Merge pull request #68087 from DougGregor/accessor-macro-single-binding-restriction
Ban the use of accessor macros on bindings with multiple variables in a single binding
swift-DEVELOPMENT-SNAPSHOT-2023-08-23-a
2023-08-23 13:50:49 -07:00
swift-ci
92de4d9a98 Merge pull request #68095 from apple/revert-67155-use_clang_arc_attachedcall
Revert "Use clang.arc.attachedcall for emission of objc_retainAutoreleasedReturnValue"
2023-08-23 12:31:41 -07:00
Ben Barham
8fbdae12fc [Build] Skip early-* on non-darwin hosts
These builds do not work outside of darwin currently. Rather than adding
the skip to all the necessary build presets, just disable in the product
instead.
2023-08-23 11:43:35 -07:00
Nate Chandler
a67c22d905 [CopyPropagation] Only delete if canonicalized.
Owned lifetime canonicalization bails on move-only values.

Previously, though, every value that was fed to canonicalization was
then attempted to be deleted.  For dead move-only values, the result
could be to shorten move-only lifetimes, which is illegal per language
rules.

Here, this is fixed by not attempting to delete owned values for which
canonicalization bailed.

rdar://114323803
2023-08-23 11:42:57 -07:00
eeckstein
b6ed12715e Merge pull request #68084 from eeckstein/fix-memory-lifetime-verifier
MemoryLifetimeVerifier: relax the check for trivial enums a bit
2023-08-23 19:42:20 +02:00
nate-chandler
c3b8091815 Revert "Use clang.arc.attachedcall for emission of objc_retainAutoreleasedReturnValue" 2023-08-23 10:11:35 -07:00
Nishith Kumar M Shah
056b4943a3 Fix String.hasPrefix and String.hasSuffix when self and arg are in NFC form (#67729) 2023-08-23 11:23:59 -05:00
Evan Wilde
0f0e68fc4c Merge pull request #68029 from etcwilde/ewilde/delete-backdeploy-concurrency
Delete backdeploy concurrency library
2023-08-23 09:03:09 -07:00
Artem Chikin
352632bc9b Merge pull request #68071 from artemcm/AllowScanningCrossImportOverlays
[Dependency Scanning] Avoid adding a cross-import-overlay dependency when  scanning the cross-import overlay module itself.
2023-08-23 08:40:06 -07:00
Doug Gregor
10a5cc991c Merge pull request #68085 from DougGregor/macro-expansion-with-operators 2023-08-23 08:11:30 -07:00
nate-chandler
309a147d80 Merge pull request #68076 from nate-chandler/opaque-values/20230822/2/consume-addronly-var
[OpaqueValues] Consume addr-only vars as loadable.
2023-08-23 07:07:14 -07:00
Doug Gregor
8ed1853b61 Ban the use of accessor macros on bindings with multiple variables
As with property wrappers, we can't properly desugar the application of
accessor macros to bindings with multiple variables. Prohibit them up
front.

Fixes rdar://112783811.
2023-08-23 06:24:48 -07:00
Holly Borla
d4f3bc6cd3 Merge pull request #68081 from hborla/sendable-self-in-reference 2023-08-23 06:13:38 -07:00
Doug Gregor
8371d3b517 [Macros] Ensure that we find operators in any macro-expanded context.
In any nominal declaration or extension thereof that is produced by a
macro expansion, make sure we perform qualified name lookup when
resolving operators so that we're guaranteed to find the
macro-introduced operators. Otherwise, expanding a macro that defines
a new type with conformances involving operators doesn't work.

Fixes rdar://114257019,
2023-08-23 04:54:56 -07:00
Luciano Almeida
c48836cb62 Merge pull request #68073 from apple/remove-diags
Removing code for 'initializes' and 'accesses' attributes old syntax
2023-08-23 08:50:49 -03:00
Erik Eckstein
bad87c4c1e MemoryLifetimeVerifier: relax the check for trivial enums a bit
Trivial enum cases in a memory location don't need to be destroyed.
Don't require that the store to such a memory location is statically known as a trivial enum case.
Instead just require that it's below a switch_enum successor for a trivial case.

Fixes a false alarm.

rdar://114274714
2023-08-23 12:48:46 +02:00
Holly Borla
84eaeb766f [Concurrency] Diagnose non-Sendable 'self' arguments crossing actor isolation
boundaries in member reference expressions.
2023-08-22 21:28:33 -07:00
swift-ci
edd6a3b5d4 Merge pull request #68070 from meg-gupta/disablecfgtest
Disable a swift test for simplifycfg
2023-08-22 18:21:04 -07:00
Pavel Yaskevich
a7f9182d28 Merge pull request #68048 from amritpan/kp-refs
[ConstraintSystem] Handle incorrect key path member references earlier
2023-08-22 18:01:20 -07:00
Nate Chandler
49e76caca5 [OpaqueValues] Consume addr-only vars as loadable. 2023-08-22 17:41:15 -07:00
Dario Rexin
fb438e019b Merge pull request #68074 from bnbarham/disable-early-swift
[Presets] Disable early* on more Linux presets
2023-08-22 17:34:56 -07:00
Ben Barham
42683bc4af [Presets] Disable early* on more Linux presets
We don't handle building early swift-syntax on Linux yet. Disable it on
more failing presets.
2023-08-22 17:29:08 -07:00
Artem Chikin
2dda2576b5 Merge pull request #68053 from artemcm/AvailabilityRenameLookThroughFunctionConversions
Look through function conversion expressions when querying the called function decl of a deprecated-renamed API in order to emit a fix-it
2023-08-22 17:11:06 -07:00
Luciano Almeida
499547a3b8 [Serialization] Remove serialization code for initializes() and accesses() attributes 2023-08-22 20:57:30 -03:00
Luciano Almeida
e88012488c [Sema] Remove type check verification for initializes and accesses attr 2023-08-22 20:56:39 -03:00
Luciano Almeida
4c24384f5f [Parse] Remove initializes and accesses attr parse code 2023-08-22 20:55:30 -03:00
Luciano Almeida
76becb4cd0 [AST] Remove initializes and accesses attr reference 2023-08-22 20:54:37 -03:00
nate-chandler
c16bbd9666 Merge pull request #68064 from nate-chandler/opaque-values/20230822/1/consume-addronly
[OpaqueValues] Emit consume expr for addr-only as loadable.
2023-08-22 16:53:06 -07:00