Commit Graph

1950 Commits

Author SHA1 Message Date
swift-ci
f52fc06ac7 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-06 18:14:46 -07:00
zoecarver
9f75a262ab [embedded] Error if embedded Swift enables library evolution. 2023-09-06 10:48:17 -07:00
swift-ci
1582741df2 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-30 21:56:51 -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
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
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
Artem Chikin
753d54576e Merge pull request #67994 from artemcm/NoPostSerializationOptimizationForExplicitInterface
Enable `StopOptimizationAfterSerialization` SIL Option for explicit `-compile-module-from-interface` tasks
2023-08-18 15:40:28 -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
Artem Chikin
e6361aee0e Enable 'StopOptimizationAfterSerialization' SIL Option for explicit
'-compile-module-from-interface' tasks
2023-08-17 14:17:12 -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
1969199a8e Merge remote-tracking branch 'origin/main' into rebranch 2023-07-26 23:13:08 -07:00
Alex Lorenz
d7b62b3c40 [cxx-interop] add 'upcoming-swift' compat version
This version will be used to gate new source breaking changes for C++ interoperability
2023-07-25 16:19:58 -07:00
swift_jenkins
a83d659e62 Merge remote-tracking branch 'origin/main' into next 2023-07-18 18:25:07 -07:00
Nate Chandler
8959d4ccb6 [Frontend] Added option to bypass resilience.
This functionality was added awhile back to support the debugger.
Provide a flag for use by other cliients.
2023-07-18 11:57:02 -07:00
Evan Wilde
41d59b215a Update Triple.h location
Triple moved from ADT to TargetParser. Updating includes to reflect
that.
2023-07-17 10:53:42 -07:00
Dario Rexin
29ce7a341d [Stdlib] Add some prespecializations to the stdlib (#66446)
* [Stdlib] Add some prespecializations to the stdlib

This adds prespecializations for commonly used types to the stdlib

* Add false positives to ABI checker ignore list

* Update multithread_module.swift

* Update multithread_module.swift

* Update multithread_module.swift
2023-07-06 15:27:09 -07:00
Gwynne Raskind
5ab86d969c Add StrictConcurrency as an always-enabled experimental feature
Upcoming and experimental features are supported via command-line flags
and also in the SwiftPM manifest. Introduce it as an experimental
feature so that it can be enabled via SwiftPM without having to resort
to unsafe flags.

The `StrictConcurrency` experimental feature can also provide a
strictness level in the same manner as `-strict-concurrency`, e.g.,
`StrictConcurrency=targeted`. If the level is not provided, it'll be
`complete`.

Note that we do not introduce this as an "upcoming" feature, because
upcoming features should be in their final "Swift 6" form before
becoming available. We are still tuning the checking for concurrency.
2023-06-28 12:06:17 -07:00
Evan Wilde
250082df25 [NFC] Reformat all the LLVMs
Reformatting everything now that we have `llvm` namespaces. I've
separated this from the main commit to help manage merge-conflicts and
for making it a bit easier to read the mega-patch.
2023-06-27 09:03:52 -07:00
Evan Wilde
f3ff561c6f [NFC] add llvm namespace to Optional and None
This is phase-1 of switching from llvm::Optional to std::optional in the
next rebranch. llvm::Optional was removed from upstream LLVM, so we need
to migrate off rather soon. On Darwin, std::optional, and llvm::Optional
have the same layout, so we don't need to be as concerned about ABI
beyond the name mangling. `llvm::Optional` is only returned from one
function in
```
getStandardTypeSubst(StringRef TypeName,
                     bool allowConcurrencyManglings);
```
It's the return value, so it should not impact the mangling of the
function, and the layout is the same as `std::optional`, so it should be
mostly okay. This function doesn't appear to have users, and the ABI was
already broken 2 years ago for concurrency and no one seemed to notice
so this should be "okay".

I'm doing the migration incrementally so that folks working on main can
cherry-pick back to the release/5.9 branch. Once 5.9 is done and locked
away, then we can go through and finish the replacement. Since `None`
and `Optional` show up in contexts where they are not `llvm::None` and
`llvm::Optional`, I'm preparing the work now by going through and
removing the namespace unwrapping and making the `llvm` namespace
explicit. This should make it fairly mechanical to go through and
replace llvm::Optional with std::optional, and llvm::None with
std::nullopt. It's also a change that can be brought onto the
release/5.9 with minimal impact. This should be an NFC change.
2023-06-27 09:03:52 -07:00
Steven Wu
b78b569450 [CAS] Consolidate compile cache flags
Rename `-enable-cas` to `-compile-cache-job` to align with clang option
names and promote that to a new driver only flag.

Few other additions to driver flag for caching behaviors:
* `-compile-cache-remarks`: now cache hit/miss remarks are guarded behind
  this flag
* `-compile-cache-skip`: skip replaying from the cache. Useful as a
  debugging tool to do the compilation using CAS inputs even the output
  is a hit from the cache.
2023-06-26 10:34:27 -07:00
Steven Wu
2b7d38dc16 [CAS] Improve swift cas options
Using the same CASOption from clang to communicate CAS configurations so
it is easier to exchange CAS configuration between them.
2023-06-26 10:34:26 -07:00
Rauhul Varma
6b9fb171bf Address rewview feedback
- Renames ExperimentalPlatformCCallingConvention to
  PlatformCCallingConvention.
- Removes non-arm calling convention support as this feature is working
  around a clang bug for some arm triples which we hope to see resolved.
- Removes misleading MetaVarName from platform-c-calling-convention
  argument.
- Replaces other uses of LLVM::CallingConv::C with
  IGM.getOptions().PlatformCCallingConvention().
2023-06-15 22:06:43 -07:00
Rauhul Varma
19f74e22e6 Add frontend flag for explicitly setting ccc
Adds a new swift-frontend flag to allow users to choose which calling
convention is used to make c function calls. This hidden flag is called
`-experimental-platform-c-calling-convention`.

This behavior is needed to workaround rdar://109431863 (Swift-frontend
produces trapping llvm ir for non-trapping sil). The root cause of this
issue is that IRGen always emits c function calls with llvm's default C
calling convention. However clang may select a different (incompatible)
calling convention for the function, eventually resulting--via
InstCombine and SimplifyCFG--in a trap instead of the function call.
This failure mode is most readily seen with the triple
`armv7em-apple-none-macho` when attempting to call functions taking
struct arguments. Example unoptimized ir below:

```llvm-ir
call void @bar([4 x i32] %17, i32 2), !dbg !109
...
define internal arm_aapcs_vfpcc void @bar(
  [4 x i32] %bar.coerce, i32 noundef %x)
```

In the future it would be better to use the clang importer or some other
tool to determine the calling convention for each function instead of
setting the calling convention frontend invocation wide.

Note: I don't know for sure whether or not clang should be explicitly
annotating these functions with a calling convention instead of
aliasing C to mean ARM_AAPCS_VFP for this particular combination of
`-target`, `-mfloat-abi`, and `-mcpu`.
2023-06-15 21:52:03 -07:00
Rintaro Ishizaki
5791a2cb37 [Macros] Plugin search options group
'load-plugin-library', 'load-plugin-executable', '-plugin-path' and
'-external-plugin-path' should be searched in the order they are
specified in the arguments.

Previously, for example '-plugin-path' used to precede
'-external-plugin-path' regardless of the position in the arguments.
2023-06-14 15:46:39 -07:00
Steven Wu
b1f99b8e93 [CAS] swift dependency scanning using CAS for compiler caching (#66366)
Teach swift dependency scanner to use CAS to capture the full dependencies for a build and construct build commands with immutable inputs from CAS.

This allows swift compilation caching using CAS.
2023-06-12 10:55:53 -07:00
Alex Lorenz
ba8d4d7801 [cxx-interop] compilations that do not enable C++ interoperability should not be able to import modules that do enable C++ interoperability by default
A supplemental hidden frontend option allows advanced users to opt-out of this requirement.

Fixes https://github.com/apple/swift/issues/65833
Fixes https://github.com/apple/swift/issues/65832
2023-06-09 15:38:16 -07:00
swift-ci
4ef135cc10 Merge pull request #66201 from nate-chandler/dealloc-on-stack-packs
[IRGen] Dealloc on-stack metadata/wtable packs on the dominance frontier.
2023-06-05 13:30:18 -07:00
Nate Chandler
e200f164a9 [Frontend] Add flag for pack metadata stack promo. 2023-06-05 08:11:27 -07:00
Doug Gregor
234534e0ce [Member name lookup] Eliminate non-lazy member loading.
Lazy member loading has been in use and the default for several years
now. However, the lazy loading was disabled for any type whose primary
definition was parsed even though some of its extensions could have
been deserialized, e.g., from a Clang module. Moreover, the non-lazy
path walked all of the extensions of such a type for all member name
lookup operations. Faced with a large number of extensions to the same
type (in my example, 6,000), this walk of the list of the extensions
could dominate type-checking time.

Eliminate all effects of the `-disable-named-lazy-member-loading`
flag, and always use the "lazy" path, which effectively does no work
for parsed type definitions and extensions thereof. The example with
6,000 extensions of a single type goes from type checking in 6 seconds
down to type checking in 0.6 seconds, and name lookup completely
disappears from the profiling trace.

The deleted tests relied on the flag that is now inert. They aren't by
themselves providing much value nowadays, and it's better to have the
simpler (and more efficient) implementation of member name lookup be
the only one.
2023-06-02 14:56:03 -07:00
Alexis Laferrière
814ca434f0 Merge pull request #66186 from xymus/force-workaround
[Serialization] Add flag to force unsafe recovery from some xref failures
2023-05-30 08:55:17 -07:00
Alexis Laferrière
261f32cb84 Merge pull request #66139 from xymus/r-module-recovery 2023-05-26 16:00:43 -07:00
Alexis Laferrière
642980cbb1 [Serialization] Add flag to force unsafe recovery from some xref failures
Intro a deserialization mode controlled by the flag
`-experimental-force-workaround-broken-modules` to attempt unsafe
recovery from deserialization failures caused by project issues.

The one issue handled at this time is when a type moves from one module
to another. With this new mode the compiler may be able to pick a
matching type in a different module. This is risky to use, but may help
in a pinch for a client to fix and issue in a library over which they
have no control.
2023-05-26 14:36:28 -07:00
Alexis Laferrière
4f66fcfadb [Serialization] Intro -Rmodule-recovery to remark about silent errors
Deserialization recovery silently drops errors and the affected decls.
This can lead to surprises when a function from an imported module
simply disappears without an explanation.

This commit introduces the flag -Rmodule-recovery to report as remarks
some of these previously silently dropped issues. It can be used to
debug project configuration issues.
2023-05-25 10:44:08 -07:00
Dario Rexin
2bb08e37f6 [ModuleInterface] Add mechanism to exclude experimental flags from th… (#66088)
* [ModuleInterface] Add mechanism to exclude experimental flags from the module interface

rdar://109722548

* Separate filtered flags from the typical/unfiltered case
2023-05-24 09:03:01 -07:00
Artem Chikin
61ea49c840 Merge pull request #65869 from artemcm/ClangImporterExplicitBuildOptions
[Explicit Module Builds] Add 'ClangImporter' setting for explicitly-built modules
2023-05-15 15:46:29 -07:00
Artem Chikin
e2ea6cb824 [Explicit Module Builds] Add 'ClangImporter' setting for explicitly-built modules
This will mean that '-disable-implicit-swift-modules' also automatically implies two things:
1. Clang modules must also be explicit, and the importer's clang instance will get '-fno-implicit-modules' and '-fno-implicit-module-maps'
2. The importer's clang instance will no longer get a '-fmodules-cache-path=', since it is not needed in explicit builds
2023-05-15 09:45:42 -07:00
Slava Pestov
c2338aa0f6 Backward deployment shim for swift_allocate{Metadata,WitnessTable}Pack() 2023-05-12 15:44:12 -04:00
Erik Eckstein
85052a1489 deprecate the -experimental-performance-annotations option
Performance annotations can now be used without specifying this option
2023-05-11 08:03:19 +02:00
Allan Shortlidge
c7352728ff Frontend: Introduce stub mode for -unavailable-decl-optimization.
Part of rdar://107388493
2023-05-03 15:19:31 -07:00
Ellie Shin
b081404daa Print package-name in .private.swiftinterface only for better abstraction
Resolves rdar://107638447
2023-04-20 17:45:22 -07:00