Commit Graph

4872 Commits

Author SHA1 Message Date
Alastair Houghton
e38c0652b6 Merge pull request #84906 from al45tair/eng/PR-101623384
[Backtracing] Add initial support for Windows.
2026-02-06 14:53:16 +00:00
Artem Chikin
e168a84355 Merge pull request #86980 from jamieQ/fix-diag-control-bug
[Diagnostics]: restore unknown warning group behavior
2026-02-05 18:59:27 +00:00
Henrik G. Olsson
4c5257d961 Merge pull request #86914 from hnrklssn/verify-expansion-skip-ignored
[DiagnosticVerifier] skip over unrelated diags in expansions
2026-02-05 09:27:07 -08:00
Jamie
94eab75e86 [Diagnostics]: restore unknown warning group behavior 2026-02-04 08:15:49 -06:00
Slava Pestov
9623b85b7b Parse: Remove last remnants of 'operator designated types' 2026-02-03 16:34:10 -05:00
Slava Pestov
2e60d29973 Sema: Add -solver-{disable,enable}-performance-hacks flags 2026-02-03 16:34:10 -05:00
Slava Pestov
061958f970 Sema: Eagerly filter out protocol extension operators
This optimizes for the case where we have a disjunction that contains an
operator defined in a protocol, and a protocol defined in a protocol
extension, and furthermore, the protocol extension operator's type is a
refinement of the protocol requirement operator's type.

In this case, there are three possibilities:

- Either the operator requirement is witnessed by a concrete operator
  in the conforming type, in which case the solution involving the
  protocol extension operator is going to be worse, so we can skip this
  choice.

- Otherwise, the protocol requirement operator is witnessed by the same
  protocol extension operator that we skipped, in which case we will find
  the same solution if we just pick the protocol requirement operator
  anyway.

- The only other possibility is that the protocol requirement operator
  is witnessed by a protocol extension operator, but also, a more
  refined protocol extension operator exists. However, it appears that in
  this case, solution ranking _also_ picks the solution involving the
  protocol requirement operator, as the new test case demonstrates.

Thus, we gain nothing by considering these protocol extension operators.
Skip them when forming the disjunction.
2026-02-03 16:34:09 -05:00
Alastair Houghton
a02fea9c7a [Frontend][Driver] Fix Windows paths for swiftCore.
For testing, we need to make sure that we pick up `libswiftCore.dll`
from the `bin` directory, rather than the copy in `lib`.  Otherwise,
when we use the interpreter mode, we'll `LoadLibrary` the one from
`lib`, but Windows found the one in `bin` already, so we end up with
two `libswiftCore.dll`s in the same process, which is bad.

rdar://101623384
2026-02-03 18:23:29 +00:00
Henrik G. Olsson
f2f15db224 [DiagnosticVerifier] skip over unrelated diags in expansions
This adds support for the following case:
```
expected-expansion@:1:2{{
  expected-warning@3{{foo}}
  expected-sometimes-warning@4{{bar}}
  expected-warning@5{{foobar}}
}}
```
This would work when parsing the additional "sometimes-" prefix, but for
invokations that didn't parse that prefix the "}}" on that line would
close the expansion, and `expected-warning@5{{foobar}}` would be parsed
as a top level statement.
2026-01-30 22:24:14 -08:00
Henrik G. Olsson
56ef1a9348 [DiagnosticVerifier] support quoting paths with ''
Windows paths can contain colons (etc. C:\foo\bar), which the diagnostic
verifier would confuse for the end of the path. By quoting them we can
ignore all colons until the matching single quote character.
2026-01-30 21:39:26 -08:00
Becca Royal-Gordon
fce99b3173 Merge pull request #86859 from beccadax/mod-squad-not-for-export 2026-01-29 09:02:50 -08:00
Becca Royal-Gordon
d8f38cfa71 [ModuleInterface] Disable aliasing with selectors
When both `-alias-module-names-in-module-interface` and `-enable-module-selectors-in-module-interface` are turned on, the compiler now disables the former with a warning. Eliminates workaround hacks that should no longer be necessary.

Fixes rdar://problem/169132519.
2026-01-28 15:47:52 -08:00
Becca Royal-Gordon
f02b2f1532 Use export_as name in some private swiftinterfaces
Previously, if a declaration belonged to a module with an `export_as` attribute, Swift always used the exported module name in the public module interface and the real module name in the private module interface. However, this is only a rough approximation of the behavior we really want, which is to use the real name in module interfaces that might be imported by dependencies of the exported name.

Change this logic so that public interfaces always use the exported name, and private interfaces use the exported name *only* if a module with that name has been loaded. This should make it so that if you’re building the `export_as` module or anything that imports it, you use the exported name; otherwise you use the real name.

Fixes rdar://167874630.
2026-01-28 14:28:14 -08:00
Alexis Laferrière
fce039e841 Merge pull request #86794 from xymus/enable-recovery-from-broken-modules-by-default
Serialization: Enable recovery from broken modularization by default
2026-01-27 15:24:39 -08:00
Slava Pestov
0a6c34325a Frontend: Add -solver-enable-prune-disjunctions flag
Off while I work on this feature.
2026-01-26 21:48:59 +00:00
Alexis Laferrière
be0b7595fe Serialization: Enable recovery from types moving between modules by default 2026-01-26 09:56:30 -08:00
Slava Pestov
d860523944 Merge pull request #86760 from slavapestov/solver-shuffle
Sema: Add -solver-shuffle-disjunctions= and -solver-shuffle-choices= flags for debugging
2026-01-24 12:30:43 -05:00
Slava Pestov
30f1b0187a Sema: Add -solver-shuffle-disjunctions= and -solver-shuffle-choices= flags for debugging 2026-01-23 20:02:21 -05:00
Alexis Laferrière
e3e68b7124 Merge pull request #86727 from xymus/internal-header-warn-no-more
BridgingHeader: Don't warn on using the internal bridging header without library-evolution
2026-01-23 11:22:26 -08:00
Doug Gregor
b47a2ab2e7 Merge pull request #86735 from DougGregor/embedded-dynamic-exclusivity-staging
[Embedded] Put dynamic exclusivity behind a second experimental feature
2026-01-23 02:21:17 -08:00
Doug Gregor
cc2fc8ae65 [Embedded] Put dynamic exclusivity behind a second experimental feature
We need to stage in the behavior change to enable dynamic exclusivity
checking for Embedded Swift. For now, ignore
`-enforce-exclusivity=checked` in Embedded Swift unless the
experimental feature `EmbeddedDynamicExclusivity` is also enabled.

Addresses rdar://168618037, a regression in Embedded Swift code that
is passing `-enforce-exclusivity=checked` explicitly.
2026-01-22 21:22:19 -08:00
eeckstein
ee398d1b18 Merge pull request #86644 from eeckstein/lifetime-completion
Optimizer: enable complete OSSA lifetimes throughout the pass pipeline
2026-01-23 06:14:10 +01:00
Alexis Laferrière
81cff6d4b5 InternalBridgingHeader: Don't warn on use without library-evolution 2026-01-22 14:59:14 -08:00
Erik Eckstein
8158b95a5a Remove the now unused -enable-ossa-complete-lifetimes and -disable-ossa-complete-lifetimes frontend options 2026-01-22 17:41:48 +01:00
Erik Eckstein
18063707b5 Optimizer: enable complete OSSA lifetimes throughout the pass pipeline
This new OSSA invariant simplifies many optimizations because they don't have to take care of the corner case of incomplete lifetimes in dead-end blocks.

The implementation basically consists of these changes:
* add the lifetime completion utility
* add a flag in SILFunction which tells optimization that they need to run the lifetime completion utility
* let all optimizations complete lifetimes if necessary
* enable the ownership verifier to check complete lifetimes
2026-01-22 17:41:48 +01:00
Pavel Yaskevich
b564e8c1bd [Frontend] Remove -enable-constraint-solver-performance-hacks frontend flag
This flag is obsolete and it doesn't have any users.
2026-01-21 11:56:06 -08:00
Yuta Saito
e1e99e896f Merge pull request #86624 from kateinoigakukun/yt/enable-aggressive-reg2mem
[wasm] Enable aggressive reg2mem optimization
2026-01-20 20:13:10 +09:00
Yuta Saito
7826dd263a [wasm] Enable aggressive reg2mem optimization 2026-01-18 09:23:01 +09:00
Alexis Laferrière
0ce07f1cd7 Merge pull request #86565 from xymus/exportability-internal-header
Sema: Enforce non-library-evolution exportability checking with the internal bridging header
2026-01-15 16:06:22 -08:00
Alexis Laferrière
9885eab3a2 Sema: Enable CheckImplementationOnly with internal bridging headers 2026-01-13 14:48:46 -08:00
Ian Anderson
60f2c405d0 Merge pull request #86309 from ian-twilightcoder/system-prefix
[Frontend][Darwin] Use the system prefix from SDK when constructing the default search paths
2026-01-10 00:03:58 -08:00
Doug Gregor
f4aa5c1051 Merge pull request #86424 from DougGregor/unchecked-never-call-beginendaccess
Always suppress swift_(begin|end)Access calls with `-enforce-exclusivity=unchecked`
2026-01-09 22:10:50 -08:00
Ian Anderson
48ab4b0595 [Frontend][Darwin] Use the system prefix from SDK when constructing the default search paths
Some Darwin platforms like DriverKit use a system prefix on all of their search paths. Even though DriverKit isn't supported, add support to get the system prefix from SDKSettings when constructing the default search paths.

This requires the DarwinSDKInfo to be gotten earlier in CompilerInvocation, pass that down to ASTContext through CompilerInstance.

-platform-availability-inheritance-map-path is no longer needed to support visionOS in tests, remove that and its supporting code that gets an alternative DarwinSDKInfo.

rdar://166277280
2026-01-09 12:41:32 -08:00
Hiroshi Yamauchi
a3e5f0bcef Set up the AST-affecting ClangImporter CodeGenOpts options early (#86175)
This is to keep clang module cache hashes consistent throughout the
build and avoid inconsistent hash errors due to the CodeGenOpts
changing at the IRGen phase in the middle of a build.

https://github.com/swiftlang/swift/issues/86116
2026-01-09 10:38:46 -08:00
Doug Gregor
d73cd34805 Always suppress swift_(begin|end)Access calls with -enforce-exclusivity=unchecked
The exclusivity enforcement command-line flags currently impact the
generation of SIL within the current module. However, it does not
impact any SIL that was deserialized from another module, which means
that `-enforce-exclusivity=unchecked` doesn't actually remove all of
the dynamic exclusivity checks.

When dynamic exclusivity is disabled, lower SIL
begin_access/end_access instructions to nothing to ensure that we
won't do any dynamic exclusivity checks.

Use this to better model the reality of dynamic exclusivity checking
in Embedded Swift, which effectively turned off all dynamic
exclusivity checking by having empty stub implementations of
swift_(begin|end)Access. Instead, have Embedded Swift default to
`-enforce-exclusivity=unchecked`, so that it never emits calls to
swift_(begin|end)Access. Remove the stub implementations of
swift_(begin|end)Access from the Embedded Swift runtime, since we will
no longer generate calls to them by default.

Moving forward, this will allow us to conditionally enable the new
implementation of dynamic exclusivity checking by specifying
`-enforce-exclusivity=checked` for Embedded Swift builds. We'll stage
that in over time to avoid breaking existing Embedded Swift clients.
2026-01-09 09:26:39 -08:00
Steven Wu
a9aa57ee0b Reapply "[DependencyScan] Correct setup clang VFS for dependency scanning"
This reverts commit e60ae24052 and fix
non-deterministic failures introduced by the commit.

Fix two issues when attempting to testing parallel scanning using
`swift-scan-test` tools:
* Make sure the BumpPtrAllocator in ScanningService is thread-safe so
  there are no race condition when a new slab is allocated.
* Make sure the output of `swift-scan-test` only written from one
  thread. This prevents some race conditions when writing to the same
  raw_fd_ostream.

rdar://167760262
2026-01-08 14:14:22 -08:00
Steven Wu
e60ae24052 Revert "[DependencyScan] Correct setup clang VFS for dependency scanning"
This reverts commit e0e69f7ac0. This
causes flaky tests ScanDependencies/scanner_api_working_dir.swift.

rdar://167742034
2026-01-08 08:14:23 -08:00
Steven Wu
4490c656c0 Merge pull request #86104 from cachemeifyoucan/eng/PR-clang-importer-vfs
[DependencyScan] Correct setup clang VFS for dependency scanning
2026-01-07 15:26:03 -08:00
Steven Wu
e0e69f7ac0 [DependencyScan] Correct setup clang VFS for dependency scanning
Currently, dependency scanner is not reporting the redirecting files
that are baked inside swift-frontend for platform support. This causes
dependency scanner returns virtual path for those files, and
swift-driver/build-system will not be able to correct validate the files
on incremental build, causing incremental build to be almost clean
builds.

This behavior issue is caused by the dependency scanning file system
layer inside clang dependency scanner that caches stats. If the
redirecting files are created underneath the layer, the real path is
lost. This fixes the issue by moving the redirecting files above the
caching layer using `-ivfsoverlay` option.

In addition to that, this commit also unifies how clang importer and
clang dependency scanner initiate the VFS, making the logic much
simpler.
2026-01-07 10:00:25 -08:00
Henrik G. Olsson
1351798ff7 Merge pull request #86138 from hnrklssn/swiftify-swift-shims
[Swiftify] don't attach macro when module does not import stdlib
2026-01-06 22:57:37 -08:00
Becca Royal-Gordon
5fffb3ce2d Merge pull request #86135 from beccadax/mod-squad-independent 2026-01-03 12:01:03 -08:00
Arnold Schwaighofer
bd7d724c89 [embedded] Replace custom -disable-embedded-existentials logic in favor of standard Feature handling mechanism 2025-12-22 14:11:46 -08:00
Becca Royal-Gordon
ad7785713e Disable preserve-types when using module selectors
The old `-module-interface-preserve-types-as-written` workaround flag prevents module selectors from being printed into module interfaces even when they have been explicitly requested. Disable it and emit a warning when it’s used in combination with `-enable-module-selectors-in-module-interface`.

Fixes rdar://166237384.
2025-12-19 14:06:27 -08:00
Mike Ash
6b3e561320 Merge pull request #86015 from mikeash/client-rr-cmake-default
[IRGen] Add a CMake option to configure direct retain/release enablement.
2025-12-19 12:20:59 -05:00
Henrik G. Olsson
75a110cdc6 [Swiftify] don't attach macro when module does not import stdlib
This prevents stuff like memcmp from SwiftShims from being imported with
@_SwiftifyImport, which would then result in name lookup errors as it
does not import the Swift standard library module. This makes the
previous approach to disable safe interop when compiling with
-parse-stdlib redundant.

irdar://165856959
2025-12-18 21:14:58 -08:00
Artem Chikin
dad62f8017 Merge pull request #86079 from artemcm/DependencyScanningMetrics
[Dependency Scanning] Add tracking of the number of dependency queries and emit them as remarks
2025-12-17 17:55:44 -08:00
Artem Chikin
7017034d20 [Dependency Scanning] Add tracking of the number of dependency queries and emit them as remarks
This change adds collection of three metrics to the scanner:
- number of Swift module lookups
- number of named Clang module lookups
- recorded number of Clang modules which were imported into a Swift module by name

It introduces '-Rdependency-scan', which acts as a super-set flag to the existing '-Rdependency-scan-cache' and adds emission of the above metrics as remarks when this flag is enabled. Followup changes will add further remarks about dependency scanner progress.
2025-12-17 12:50:33 -08:00
Adrian Prantl
76c7949ea2 Merge pull request #86035 from adrian-prantl/166494766
[LLDB|CAS] Implement ExplicitCASModuleLoader::addExplicitModulePath()
2025-12-15 22:42:04 -08:00
Adrian Prantl
753a83e545 Merge pull request #86036 from adrian-prantl/166494895
[LLDB] Add LLDB accessor for ModuleInterfaceLoaderOptions
2025-12-15 17:26:22 -08:00
Steven Wu
ce2cff574a Merge pull request #86064 from cachemeifyoucan/eng/PR-166557713
[ModuleLoader] Remove `llvm_unreachable` in findModuleFilesInDirectory()
2025-12-15 17:17:13 -08:00