Commit Graph

2176 Commits

Author SHA1 Message Date
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
Tim Kientzle
4e91aca623 Enable full SIL verification with -compiler-assertions 2024-10-15 15:46:12 -07:00
Arnold Schwaighofer
8ebb3ec473 IRGen: Add the ability to mark certain generic entry points in back traces
Mark generic function calls with concrete parameters, generic v-table calls and
generic witness table calls where self is generic.
2024-10-14 14:06:10 -07:00
Rintaro Ishizaki
82914d1979 Merge pull request #76986 from rintaro/newparservalidation-on-by-default
[build-script] Enable new parser validation by default
2024-10-14 12:55:46 -07:00
Rintaro Ishizaki
4616c77a33 [Parser] Enable new parser validation only in 'assertions' builds 2024-10-14 09:02:56 -07:00
Nate Chandler
49a2831d3f [CoroutineAccessors] Old ABI may be used via flag.
Add a setting to IRGenOptions and key off of it to emit yield_once_2
coroutines using either (1) the same code-path as yield_once coroutines
or (2) a new, not-yet implemented code-path.

Add flags to set the value in both directions.  During bringup, by
default, use the existing caller-allocated ABI.
2024-10-11 08:25:02 -07:00
Nate Chandler
9e45aa5975 [NFC] Frontend: IRGen arg parsing gets LangOpts.
Among other things, facilitates using features rather than bespoke
flags.
2024-10-10 18:08:27 -07:00
Steven Wu
5fa12d31ae Merge pull request #76738 from cachemeifyoucan/eng/PR-136787368
[CAS] Use IncludeTreeFileList instead of full CASFS for caching
2024-10-08 10:42:24 -07:00
Allan Shortlidge
9e93b7b730 Frontend: Remove support for -experimental-spi-imports flag.
Its functionality has been superseded by `@_spiOnly import`. There are no
longer any known clients and the flag was already unsupported in Swift 6, so
the functionality is now removed (but the flag is only deprecated for Swift 5).

Resolves rdar://136867210.
2024-10-01 17:27:22 -07:00
Steven Wu
cd07d532af [CAS] Use IncludeTreeFileList instead of full CASFS for caching
Use IncludeTreeFileList instead of full feature CASFS for swift
dependency filesystem. This allows smaller CAS based VFS that is smaller
and faster. This is enabled by the CAS enabled compilation does not
need to iterate file system.

rdar://136787368
2024-09-30 16:01:33 -07:00
Doug Gregor
0aff85ced7 Emit mangled names for public symbols into the .swiftinterface
When the frontend option `-abi-comments-in-module-interface` is provided
during interface printing, the printed interface will contain
additional comments that provide the mangled names for public symbols.
This is an experiment in seeing how much information we can
meaningfully extract from a printed Swift interface for the purpose of
bridging with other languages.
2024-09-25 15:49:34 -07:00
Rintaro Ishizaki
c57025af67 Avoid #include AST headers in Basic headers
Resolve a layering violation. `DiagnosticBehavior` was used in
`LangOptions`. Introduce a dedicated 'enum' for the possible values.
2024-09-24 15:18:26 -07:00
Arnold Schwaighofer
b49e30c01b IRGen: Add an option to force emission of an async context pointer on the stack for leaf funclets
`-Xfrontend -enable-async-frame-pointer-all`

rdar://135746607
2024-09-19 12:28:57 -07:00
Ellie Shin
db2a4df6e1 Merge pull request #76450 from swiftlang/elsh/re-revert-pkg-name-pr
Revert "Revert "Do not print package-name in non-package interface by…
2024-09-13 12:53:59 -07:00