Commit Graph

2039 Commits

Author SHA1 Message Date
Holly Borla
c4b65be753 Merge pull request #79048 from hborla/delete-infer-public-sendable-flag
[Concurrency] Remove `EnableInferPublicSendable`.
2025-01-30 20:48:40 +00:00
Holly Borla
430d25f7e6 [Concurrency] Remove EnableInferPublicSendable. 2025-01-30 16:10:51 +00:00
Artem Chikin
41e471288a [Dependency Scanning] Deprecate/Remove batch scanning capability
Batch dependency scanning was added as a mechanism to support multiple compilation contexts within a single module dependency graph.
The Swift compiler and the Explicitly-built modules model has long since abandoned this approach and this code has long been stale. It is time to remove it and its associated C API.
2025-01-28 15:30:39 -08:00
Alastair Houghton
ab8e561583 Merge pull request #78516 from al45tair/eng/PR-124913332
[Backtracing] Implement API per SE-0419
2025-01-28 10:48:33 +00:00
Artem Chikin
a00c1ee7e5 [ModuleInterface] Determine package-only resolution need based on input mode
Instead of requested action. In implicit builds, implicit interface build sub-invocations inherit their parent invocation's requested action, which the code was failing to detect that we were building an interface, not source, and erroneously resulted in enabling in-package module dependency resolution.

Resolves rdar://143505814
2025-01-23 14:11:16 -08:00
Egor Zhdan
752cb36239 Merge pull request #78014 from swiftlang/egorzhdan/libcxx-overlay-linux
[cxx-interop] Support CxxStdlib overlay for libc++ on Linux
2025-01-20 15:09:26 +00:00
Alastair Houghton
18496c5626 [Backtracing] Remove support for implicit import of _Backtracing.
We're going to rename the module to Runtime, and it isn't going to be an
implicit import, so we don't need any of this.

rdar://124913332
2025-01-17 10:09:36 +00:00
Slava Pestov
d1d2411bf3 Merge pull request #78267 from slavapestov/incremental-bindings-part-0
Sema: Some small cleanups in CSBindings.cpp and related code
2025-01-16 09:03:32 -05:00
Slava Pestov
cfcc73f164 Sema: Add -solver-disable-splitter flag for debugging
We're not planning on removing the splitter because it is a big win
in some cases, but we want to run it less often since it can also
be a source of overhead. This flag allows us to compare performance
to understand the tradeoffs better.
2025-01-15 22:30:33 -05:00
Allan Shortlidge
24f5632ca1 Frontend: Implement optional parsing diagnostics for enabled language features.
Parsing for `-enable-upcoming-feature` and `-enable-experimental-feature` is
lenient by default because some projects need to be compatible with multiple
language versions and compiler toolchains simultaneously, and strict
diagnostics would be a nuisance. On the other hand, though, it would be useful
to get feedback from the compiler when you attempt to enable a feature that
doesn't exist. This change splits the difference by introducing new diagnostics
for potential feature enablement misconfigurations but leaves those diagnostics
ignored by default. Projects that wish to use them can specify `-Wwarning
StrictLanguageFeatures`.
2025-01-15 16:34:32 -08:00
Allan Shortlidge
4ea157efdb Frontend: Parse diagnostic options earlier.
Diagnostics may be emitted while parsing command line arguments. This implies
that the options which affect how diagnostics are emitted and presented need to
be parsed first.
2025-01-15 16:34:32 -08:00
Hiroshi Yamauchi
4a94fc95aa Merge pull request #78556 from hjyamauchi/compilerperf
Sink unnecessary steps for Windows in CompilerInvocation::computeCXXS…
2025-01-13 13:23:34 -08:00
Ellie Shin
727fb8c32d Merge pull request #78258 from swiftlang/elsh/disallow-bypass-deser-check
Package CMO: add deserialization checks to ensure correct memory layout
2025-01-11 05:40:49 -08:00
Hiroshi Yamauchi
e767b74790 Sink unnecessary steps for Windows in CompilerInvocation::computeCXXStdlibOptions 2025-01-10 11:20:11 -08:00
Ian Anderson
e73c08c773 Merge pull request #78378 from ian-twilightcoder/nostdlibimport
[Driver][Frontend] Add a -nostdlibimport argument
2025-01-08 15:15:05 -08:00
Doug Gregor
c9b2d8ba5f Diagnose the use of -disable-access-checking with strict safety checking 2025-01-08 09:47:17 -08:00
elsh
c03abed00d Package optimization allows bypassing resilience, but that assumes the memory layout of the
decl being accessed is correct. When this assumption fails due to a deserialization error
of its members, the use site accesses the layout with a wrong field offset, resulting in
UB or a crash. The deserialization error is currently not caught at compile time due to
LangOpts.EnableDeserializationRecovery being enabled by default to allow for recovery of some
of the deserialization errors at a later time. In case of member deserialization, however,
it's not necessarily recovered later on.

This PR tracks whether member deserialization had an error by recursively loading members and
checking for deserialization error, and fails and emits a diagnostic. It provides a way to
prevent resilience bypassing when the deserialized decl's layout is incorrect.

Resolves rdar://132411524
2025-01-07 21:51:49 -08:00
Ian Anderson
87d6979dae Merge pull request #78303 from ian-twilightcoder/clang-importer-search-paths
[ClangImporter] clang's -iframework comes before builtin usr/local/include, but Swift's -Fsystem comes after
2025-01-06 13:05:25 -08:00
Ian Anderson
ae753e61a1 [Driver][Frontend] Add a -nostdlibimport argument
Add a -nostdlibimport (analagous to clang's -nostdlibinc) to remove the SDK paths from the import search paths, but leave the toolchain paths.

rdar://139322299
2024-12-28 22:04:56 -05:00
Ian Anderson
cdb42c3535 [ClangImporter] clang's -iframework comes before builtin usr/local/include, but Swift's -Fsystem comes after
When Swift passes search paths to clang, it does so directly into the HeaderSearch. That means that those paths get ordered inconsistently compared to the equivalent clang flag, and causes inconsistencies when building clang modules with clang and with Swift. Instead of touching the HeaderSearch directly, pass Swift search paths as driver flags, just do them after the -Xcc ones.

Swift doesn't have a way to pass a search path to clang as -isystem, only as -I which usually isn't the right flag. Add an -Isystem Swift flag so that those paths can be passed to clang as -isystem.

rdar://93951328
2024-12-23 22:15:52 -08:00
Doug Gregor
ba3e197841 Diagnose the combination of -Ounchecked with strict memory safety
Aligns with the current proposal and fixes rdar://127128995
2024-12-20 23:15:41 -08:00
Slava Pestov
bb55d9c59a Sema: Remove -experimental-one-way-closure-params 2024-12-19 13:14:11 -05:00
Meghana Gupta
8b1ecb8a71 Add new flag -sil-ownership-verify-all
This flag enables ownership verification after every transform.
2024-12-12 23:55:37 -08:00
Egor Zhdan
282f3b127b [cxx-interop] Support CxxStdlib overlay for libc++ on Linux
This teaches Swift to rebuild the CxxStdlib overlay module from its interface when using a C++ standard library that is not the platform default, specifically libc++ on Linux.

rdar://138838506
2024-12-10 14:19:59 +00:00
Slava Pestov
8b61c9b442 Merge pull request #77723 from slavapestov/too-complex-stats
Sema: Progress towards an improved "too complex" check
2024-11-20 19:43:32 -05:00
Allan Shortlidge
a8fd7576dd Merge pull request #77741 from tshortli/always-warn-for-redundant-features
SE-0362: Only warn about features that are enabled by the language mode
2024-11-20 16:11:14 -08:00
Arnold Schwaighofer
c5463bdf92 Merge pull request #68985 from antoniofrighetto/feature/load-pass-plugin
[Driver][Frontend] Introduce `load-pass-plugin` option
2024-11-20 14:22:12 -08:00
Allan Shortlidge
d7b2d921e7 SE-0362: Only warn about features that are enabled by the language mode. 2024-11-20 11:36:13 -08:00
Slava Pestov
c8415aeac4 Sema: Record the trail step count in solver statistics
Also introduce two new frontend flags:

The -solver-scope-threshold flag sets the maximum number of scopes, which was
previously hardcoded to 1 million.

The -solver-trail-threshold flag sets the maximum number of trail steps,
which defaults to 64 million.
2024-11-20 13:46:19 -05:00
Artem Chikin
77fde76150 Ignore in-package transitive dependencies when building from non-package textual interface
This change ensures that when loading some module dependency 'Bar' which has a package-only dependency on 'Foo', only the following clients attempt to resolve/load 'Foo':
- Source compilation with package-name equal to that of 'Bar'.
- Textual interface compilation of a *'package'* interface with package-name equal to that of 'Bar'.

Ensuring that the following kinds of clients do not attempt to resolve/load 'Foo':
- Source compilation with package-name different to that of 'Bar'
- Textual interface compilation of a public or private interface, regardless of package name.

This fixes the behavior where previously compilation of a Swift textual interface dependency 'X' from its public or private interface, with an interface-specified package-name, from a client without a matching package-name, resulted in a lookup of package-only dependencies of modules loaded into 'X'. This behavior is invalid if we are not building from the package textual interface, becuase the module dependency graph is defined by the package name of the source client, not individual module dependency package name. i.e. In-package module dependencies are resolved/loaded only if the parent source compile matches the package name.

Resolves rdar://139979180
2024-11-18 13:29:30 -08:00
Allan Shortlidge
e76bcac17d Frontend: Introduce -disable-upcoming-feature and -disable-experimental-feature.
To allow feature build settings to be composed more flexibly, allow an
`-enable-upcoming-feature` flag to be overridden by a
`-disable-upcoming-feature` flag. Whichever comes last on the command line
takes effect. Provide the same functionality for `-enable-experimental-feature`
as well.

Resolves rdar://126283879.
2024-11-15 18:20:28 -08:00
Doug Gregor
34c020d5f4 Revert "Emit mangled names for public symbols into the .swiftinterface"
This reverts commit 0aff85ced7.
2024-11-12 22:38:47 -08:00
Arnold Schwaighofer
05db4f091e Fix spelling in comment 2024-11-08 15:58:38 -08:00
Arnold Schwaighofer
e07f4d4f85 Disable UseAggressiveReg2MemForCodeSize on WASM
It causes an LLVM WASM backend instruction selection failure.

rdar://139541259
2024-11-08 15:52:23 -08:00
Antonio Frighetto
377c03fa7e [Driver][Frontend] Introduce load-pass-plugin option
Allow dynamic loading of LLVM passes via `load-pass-plugin`
option passed to the Swift compiler driver.
2024-11-07 17:25:24 +01:00
Allan Shortlidge
e49b248bee Frontend: Remove -disable-print-package-name-for-non-package-interface.
It is unsound to expose `package` declarations in textual interfaces without a
package identity for them to belong to so we should not offer this flag.

Resolves rdar://139361524.
2024-11-06 11:16:18 -08:00
Allan Shortlidge
fa5b783e3f Revert https://github.com/swiftlang/swift/pull/76244.
Partially resolves rdar://139236053.
2024-11-05 14:13:39 -08:00
Steven Wu
0a18baa510 Merge pull request #76732 from cachemeifyoucan/eng/PR-136682810
[Macro] Precise macro plugin dependency during scanning
2024-11-04 09:21:33 -08:00
Meghana Gupta
c0a55e11d4 Merge pull request #77314 from meg-gupta/ossaflag
Remove -enable-ossa-modules for Synchronization and Distributed
2024-11-04 02:40:54 -08:00
Meghana Gupta
3c29c5e4f1 Add a new flag -enable-recompilation-to-ossa-module 2024-11-02 17:04:07 -07:00
Rintaro Ishizaki
d4db99ce9d [Parse] Remove unnecessary dependencies to Parser.h
C++ swift::Parser is going to be replaced with SwiftParser+ASTGen.
Direct dependencies to it should be removed. Before that, remove
unnecessary '#include "swift/Parse/Parser.h"' to clarify what actually
depends on 'swift::Parser'.

Split 'swift::parseDeclName()' et al. into the dedicated files.
2024-11-02 01:23:59 -07:00
Allan Shortlidge
2518691944 Merge pull request #77359 from tshortli/downgrade-upcoming-feature-already-enabled
Frontend: Downgrade 'already enabled' to a warning for experimental features
2024-11-01 21:42:19 -07:00
Kavon Farvardin
86601fcbbf Merge pull request #76532 from kavon/samplepgo
Add support for SamplePGO
2024-11-01 17:52:52 -07:00
Allan Shortlidge
2fa75bd0bd Frontend: Downgrade 'already enabled' to a warning for experimental features.
If an upcoming feature was enabled by passing it via `-enable-experimental-feature`,
downgrade the `already enabled` diagnostic to a warning.

Resolves rdar://139087679.
2024-11-01 15:41:05 -07:00
Kavon Farvardin
19e593bc07 PGO: new -debug-info-for-profiling frontend flag
This achieves the same as clang's `-fdebug-info-for-profiling`, which
emits DWARF discriminators to aid in narrowing-down which basic block
corresponds to a particular instruction address. This is particularly
useful for sampling-based profiling.

rdar://135443278
2024-11-01 11:59:54 -07:00
Kavon Farvardin
2b01714fba PGO: new -profile-sample-use= frontend flag
This is meant to match clang's `-fprofile-sample-use=` and accepts a
file with the same format.

rdar://135443278
2024-11-01 11:59:54 -07:00
Steven Wu
47b3efdb6e [Macro] Add a new macro loading option that do not involve searching
Add flag `-load-resolved-plugin` to load macro plugin, which provides a
pre-resolved entry into PluginLoader so the plugins can be loaded based
on module name without searching the file system. The option is mainly
intended to be used by explicitly module build and the flag is supplied
by dependency scanner.
2024-10-31 10:56:21 -07:00
Arnold Schwaighofer
328b8695f3 Add a SILOption to control whether we should use an aggressive form of
keeping large values indirect
2024-10-30 08:43:22 -07:00
Tim Kientzle
8144323413 Merge pull request #77036 from tbkka/tbkka-verifiers-are-assertions
Enable full SIL verification with `-compiler-assertions`
2024-10-17 08:23:46 -07:00
Tim Kientzle
c93cd2097c Enable SIL verification in a more-appropriate way 2024-10-16 14:41:50 -07:00