Commit Graph

4049 Commits

Author SHA1 Message Date
Doug Gregor
3e4dd4304a Merge pull request #68278 from DougGregor/swift-int-type-bridging 2023-09-01 23:36:19 -07:00
Doug Gregor
45533851bc Apply suggestions from code review
Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
2023-09-01 18:27:15 -07:00
Doug Gregor
8a8fa2d778 Apply suggestions from code review
Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
2023-09-01 15:16:23 -07:00
Doug Gregor
566c71ff30 Fix handling of Swift(U)Int for Windows 2023-09-01 14:47:58 -07:00
swift-ci
225162a30f Merge remote-tracking branch 'origin/main' into rebranch 2023-09-01 14:36:50 -07:00
Doug Gregor
5927527419 Switch order of _WIN64/_WIN32 checks in computation of C types for Int/UInt
64-bit Windows defines both _WIN64 and _WIN32, so the logic here would
always end up defining 32-bit C types for Swift's `Int` and `UInt`.
Fix the ordering to check for 64-bit first, then 32-bit second.

Note that the SwiftShims version of this code has always been wrong,
but it's completely benign because SwiftShims is only used in the
Swift runtime itself, which is built with Clang (on all platforms),
and doesn't need to go through this code path. Still, we fix it in both
places, so we don't get a nasty surprise if the SwiftShims version of
the header later gets included in a non-Clang C++ compiler.
2023-09-01 12:40:46 -07:00
Doug Gregor
e0232742ce Define the C++ Swift(U)Int types using the same logic as SwiftShims
The C type tha corresponds to Swift's pointer-sized `Int` and `UInt`
types varies from one platform to the next. The canonical C types are
`ptrdiff_t` and `size_t`, but we're in the depths of the compiler we
can't include the C library headers that provide them because they
introduce cyclic module dependencies. Sigh.

SwiftShims has some logic to compute these types. However, SwiftShims
is part of the Swift runtime, not the compiler, so those headers
cannot be included here. So, we clone the logic and simplify it
somewhat for our use case.

This fixes truncation issues on Windows, where the uses of
`unsigned long` and `long` for Swift(U)Int are incorrect.
2023-09-01 12:28:22 -07:00
Doug Gregor
dadb863c08 [Swift bridging] Use Swift(U)Int consistently for bridging 2023-09-01 12:28:22 -07:00
Hamish Knight
6ee44f09b4 Introduce then statements
These allow multi-statement `if`/`switch` expression
branches that can produce a value at the end by
saying `then <expr>`. This is gated behind
`-enable-experimental-feature ThenStatements`
pending evolution discussion.
2023-09-01 14:32:14 +01:00
swift-ci
1582741df2 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-30 21:56:51 -07:00
Michael Gottesman
5c3a5808a5 Merge pull request #68195 from gottesmm/pr-1f647dd0c785123c93b7a25e78addfca45c2b473
[send-non-sendable] Convert some of the concurrency tests that test targeted concurrency to also test complete and complete + sis
2023-08-30 21:53:23 -07:00
Michael Gottesman
fa1558a175 [frontend] Add an option called -verify-additional-prefix to add additional check prefixes to the DiagnosticVerifier.
This enables one to use varying prefixes when checking diagnostics with the
DiagnosticVerifier. So for instance, I can make a test work both with and
without send-non-sendable enabled by adding additional prefixes. As an example:

```swift
// RUN: %target-swift-frontend ... -verify-additional-prefix no-sns-
// RUN: %target-swift-frontend ... -verify-additional-prefix sns-

let x = ... // expected-error {{This is always checked no matter what prefixes I added}}
let y = ... // expected-no-sns-error {{This is only checked if send non sendable is disabled}}
let z = ... // expected-sns-error {{This is only checked if send non sendable is enabled}}
let w = ... // expected-no-sns-error {{This is checked for a specific error when sns is disabled...}}
// expected-sns-error @-1 {{and for a different error when sns is enabled}}
```

rdar://114643840
2023-08-30 13:40:17 -07:00
swift-ci
ec7514f712 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-30 05:14:03 -07:00
Tony Allevato
cfc8ca6418 Replace generic basic_string overloads of StableHasher::combine with concrete ones.
The generic `char_traits` implementation was deprecated and has since
been removed from libc++ (https://reviews.llvm.org/D157058). When
building with a libc++ that has it removed, the `basic_string<T>`
overloads cause errors during template substitution.
2023-08-29 13:27:13 -04:00
swift-ci
fca0dc0a16 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-29 07:34:13 -07:00
Allan Shortlidge
3a02629be4 Frontend: Make lazy typechecking a TC opt instead of a frontend action. 2023-08-28 08:28:56 -07:00
swift-ci
787a51879c Merge remote-tracking branch 'origin/main' into rebranch 2023-08-25 19:33:11 -07:00
Doug Gregor
339d31fabb [Macros] Add a frontend flag -Rmacro-loading to remark on macro resolution
Macro implementations can come from various locations associated with
different search paths. Add a frontend flag `-Rmacro-loading` to emit
a remark when each macro implementation module is resolved, providing
the kind of macro (shared library, executable, shared library loaded
via the plugin server) and appropriate paths. This allows one to tell
from the build load which macros are used.

Addresses rdar://110780311.
2023-08-25 15:09:49 -07:00
Cory Benfield
955927eceb Update scudo runtime library name
The scudo runtime was renamed to indicate that it now must run
standalone from other sanitizers. This patch updates the driver to
search for the appropriate filename.

LLVM rename: https://reviews.llvm.org/D138157
2023-08-23 15:36:24 -07:00
swift-ci
8d3034d4a4 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-19 08:33:53 -07:00
Sophia Poirier
aec59f2f9c Merge pull request #67974 from sophiapoirier/global-static-data-race-safety
enforce under strict concurrency that globals and statics be either…
2023-08-19 08:28:02 -07:00
swift-ci
174b6bc00c Merge remote-tracking branch 'origin/main' into rebranch 2023-08-18 19:34:12 -07:00
Zak Kent
2abca625d7 Merge branch 'main' into update-immediate 2023-08-18 16:07:14 -07:00
Sophia Poirier
936ab20e5d enforce under strict concurrency that globals and statics be either isolated to a global actor or Sendable plus immutable
rdar://81629027 Global and static variable data-race safety
2023-08-18 15:08:42 -07:00
Allan Shortlidge
0c957a2090 Merge pull request #68009 from tshortli/deprecate-warn-on-potentially-unavailable-enum-case
Frontend: Deprecate -warn-on-potentially-unavailable-enum-case option
2023-08-18 12:37:46 -07:00
Allan Shortlidge
be70c568cb Frontend: Deprecate -warn-on-potentially-unavailable-enum-case option.
When `-warn-on-potentially-unavailable-enum-case` was introduced, the build
system was required to invoke `swift-frontend` at artificially low deployment
targets when emitting `.swiftinterface` files for legacy architectures. Because
the deployment target was low, some availability diagnostics needed to be
de-fanged in order to allow module interface emission to succeed. Today, the
build system is able to use the correct deployment target when emitting module
interfaces and the `-warn-on-potentially-unavailable-enum-case` is superfluous,
so deprecate it.

Resolves rdar://114092047
2023-08-18 10:02:39 -07:00
zachary0kent
25f078adb5 Merge branch 'main' into lazy-immediate 2023-08-16 19:45:27 -07:00
swift-ci
73cf37d597 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-16 17:33:42 -07:00
Pavel Yaskevich
ae37df58e5 [Frontend] NFC: Remove experimental flag for runtime discoverable attributes feature 2023-08-15 12:17:31 -07:00
Zak Kent
289b812a14 [Immediate] Add frontend option for lazy compilation 2023-08-14 13:28:22 -07:00
Zak Kent
148cd6acc4 [Immediate] [Sema] Implemented Lazy Type Checking
Implements lazy type checking in Swift Immediate mode,
allowing functions to be type-checked as they are
executed.
2023-08-14 13:28:22 -07:00
swift-ci
525350af1b Merge remote-tracking branch 'origin/main' into rebranch 2023-08-10 22:14:25 -07:00
Artem Chikin
8501f99cb2 [Dependency Scanning] Add option to specify a separate Clang Dependency scanner module cache.
Clang dependency scanning produces scanner PCMs which we may want to live in a
different filesystem location than the main build module cache.

Resolves rdar://113222853
2023-08-10 11:10:18 -07:00
swift-ci
5dc6d1bb72 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-10 02:55:46 -07:00
Hamish Knight
35a98f3828 [ASTGen] Allow querying of enabled features
For now this is using C interop, we ought to be
using C++ interop, but that's a much bigger
change.
2023-08-09 19:35:50 +01:00
swift-ci
6da5bed7fb Merge remote-tracking branch 'origin/main' into rebranch 2023-08-05 18:36:02 -07:00
Tony Allevato
b2fd3eb754 Merge pull request #67707 from allevato/no-u8-prefixes 2023-08-05 21:24:05 -04:00
Tony Allevato
300a952ede Replace u8 string literal prefixes with SWIFT_UTF8 macro.
In C++20, `u8` literals create values of type `char8_t` instead of
`char`, and these can't be implicitly converted. This macro
mitigates the difference and allows the same code to compile under
C++14/17 modes and C++20, preserving the `char` type while ensuring
that the text is interpreted as UTF-8.
2023-08-04 16:41:36 -04:00
Evan Wilde
4f27bb28ba Add missing headers
Found a few more missing headers. Adding them in now.
2023-08-03 10:06:44 -07:00
swift-ci
91ca12528b Merge remote-tracking branch 'origin/main' into rebranch 2023-08-01 15:58:54 -07:00
Pavel Yaskevich
bb135181bd Merge pull request #67625 from xedin/enable-init-accessors-feature
[Frontend/NFC] SE-0400: Enable `InitAccessors` feature by default
2023-08-01 15:54:43 -07:00
swift-ci
981d52d426 Merge remote-tracking branch 'origin/main' into rebranch 2023-07-31 17:15:11 -07:00
Holly Borla
4b09d4c513 [Macros] Add back the ExtensionMacro feature identifier as a language feature
that can be used in swiftinterfaces.
2023-07-31 13:39:13 -07:00
Pavel Yaskevich
2a0651e8b0 [Frontend/NFC] SE-0400: Enable InitAccessors feature by default 2023-07-31 13:18:59 -07:00
swift-ci
e24988e633 Merge remote-tracking branch 'origin/main' into rebranch 2023-07-28 09:44:12 -07:00
Joshua Turcotti
2eade1d1b5 Merge pull request #67511 from JTurcotti/tweaks
[SendNonSendable] Assorted Bugfixes and Tweaks
2023-07-28 09:24:36 -07:00
swift-ci
e1d21fe05c Merge remote-tracking branch 'origin/main' into rebranch 2023-07-27 16:56:57 -07:00
jturcotti
bb2f3c011e rename DeferredSendableChecking pass to SendNonSendable pass, handle more instructions such as try_apply and begin_apply, and fix bugs 2023-07-27 16:45:29 -07:00
Allan Shortlidge
f9a93a55d7 NFC: Fix duplicate definition of macro warnings.
Centralize the `SWIFT_{BEGIN/END}_NULLABILITY_ANNOTATIONS` definitions in a new
Nullability.h header to share.
2023-07-27 13:02:22 -07:00
swift-ci
1969199a8e Merge remote-tracking branch 'origin/main' into rebranch 2023-07-26 23:13:08 -07:00