Commit Graph

330 Commits

Author SHA1 Message Date
Allan Shortlidge d78b08ae91 SymbolGraphGen: Introduce -active-platform-availability-only flag.
When -active-platform-availability-only is specified swift-symbolgraph-extract
should only emit availability metadata for the active platform (inferred from
the -target).

Resolves rdar://174557919.
2026-05-06 06:43:46 -07:00
Keith Smiley a6504b0578 Fix synthesize-interface C++ interop, make it exit on failures (#88666)
Previously swift-synthesize-interface would print errors about an
incompatible C++ stdlib, but it would still exit 0.

This is the same case as
https://github.com/swiftlang/llvm-project/commit/cfcd7d28389234d8cbd223889505042a5d8d2dc3
2026-04-30 09:07:16 -07:00
Ben Langmuir d7065a6d64 [cas] Adapt to clang::CASOptions change to remove internal cache of instances
Migrate all callers of getOrCreateDatabases to either create their own CAS
instances using createDatabases() or to use the ones stored in the
CompilerInstance. Also forwards the instances into the ClangImporter and its
various clang::CompilerInstance instances.

Validated locally that this does not result in any additional calls to
createDatabases across all the swift tests. In fact, there are fewer due to an
improvement on the clange side, so I also checked that the overall reduction
doesn't hide any issues. Looking at individual cas paths that are opened, which
are per-test paths, there are none that open more than before.
2026-03-13 14:16:47 -07:00
Steven Wu 083029a112 [DebugInfo][Caching] Using CASID for bridging header PCH
Fix the debug info emitted for bridging header PCH when compilation
caching is used. This includes:
* Bridging header should have the correct dwo_name that uses CASID
* The search_path for PCH should be the cache key that can load the PCH
  just like other modules.
2026-03-12 17:16:16 -07:00
Steven Wu 4493089aeb [Caching] Support Profile build
Fix build using profile data by setting up profiling data correctly
through the VFS layer.

rdar://172295490
2026-03-12 08:53:16 -07:00
Adrian Prantl fa71d1da59 [Serialization] Store the explicit module map in swiftmodules
Currently only the top level dependencies get serialized in Swift modules. In
practice this is not enough information to fully replay a module import
sequence, especially when the dependencies include binary SDK modules that were
built elsewhere. In this case we cannot follow the links to its depenencies,
since they refer to paths on a different machine or unavailable CAS. During an
EBM build, the dependency scanner writes the complete list of dependencies into
a json file called the explicit Swift module map -- including the local
locations of the dependencies of binary SDK modules. Using this LLDB can replay
a module import with 100% accuracy.

rdar://170514919
2026-02-23 14:07:08 -08:00
Ryan Mansfield ae78773ad8 Swap the alias relationship between -language-mode and -swift-version.
As specified in SE-0441, -language-mode should appear in help output
while -swift-version should be the hidden alias.

Related to swiftlang/swift-driver#1894
2026-02-18 16:06:08 -05:00
Henrik G. Olsson f853564db4 Merge pull request #87131 from hnrklssn/swiftify-enable-subset
[Swiftify] enable safe interop by default
2026-02-11 23:31:32 -08:00
Steven Wu ce64a73316 Merge pull request #87098 from cachemeifyoucan/eng/PR-169886913
[SDKInfo] Fix SDKInfo loading to use correct VFS
2026-02-11 09:58:40 -08:00
Henrik G. Olsson d480ea3eee [Swiftify] replace StabilizedSafeInteropWrappers with -disable-safe-interop-wrappers
swift-synthesize-interface needs to match the safe interop wrappers
setting of the compiler invocation that built the Swift module, but
doesn't have -enable/disable-experimental-feature options. Instead of
introducing them for a single feature, which isn't even experimental,
this introduces the -disable-safe-interop-wrappers instead.
2026-02-11 09:32:03 -08:00
Anthony Latsis abf1ca69b4 Basic: Switch upcoming features to LanguageMode 2026-02-10 16:06:58 +00:00
Steven Wu 17d969924c [SDKInfo] Fix SDKInfo loading to use correct VFS
Partially revert https://github.com/swiftlang/swift/pull/86309. Keep the
SDKInfo parsing in the ASTContext separately from the search path
configuration. This allows the availablity checking to load SDKSettings
from the correct VFS.

rdar://169886913
2026-02-09 15:03:53 -08:00
Ian Anderson 69fa949c01 [Triple] Support the new target triple "os" for firmware
Add support for the new Firmware llvm::Triple::OSType, and make a swift::DarwinPlatformKind to go with it.

rdar://165361368
2026-02-03 13:02:44 -08:00
Xi Ge 383407ce8a Merge pull request #86857 from sepy97/ignore-spi-group-new-api
ABIChecker: add -ignore-spi-group-new-api flag
2026-01-28 21:10:30 -08:00
Sam Pyankov a6697422e3 ABIChecker: add -ignore-spi-group-new-api flag
Add a new -ignore-spi-group-new-api flag that selectively suppresses
"new API without '@available'" diagnostics for specified SPI groups
while still reporting ABI-breaking changes.

rdar://167702700
2026-01-28 15:30:29 -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
Fabrice de Gans b47e0320d9 Adjust dependencies on LLVM components
Swift host libraries should depend on LLVM libraries as part of the
`LLVM_LINK_COMPONENTS` argument so the dependency graph can be properly
set up. This is a problem when building LLVM as a DLL on Windows as
Swift targets should depend on the LLVM DLL.

Bug: #85241
2026-01-15 17:57:41 +01: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
Owen Voorhees 24d4d200a4 API digester support for Xcc options 2025-12-16 14:51:18 -08:00
Saleem Abdulrasool 58035835d2 Merge pull request #85899 from compnerd/filename
DriverTool: adjust `argv[0]` scanning for CAS
2025-12-09 18:13:01 -08:00
finagolfin 6d4931986f [autolink-extract] Update deduplication list for Observation (#85856)
All linux and Android CI show this being repeated many times, eg when
[building the Docc binary on the linux
CI](https://ci.swift.org/job/swift-PR-Linux-smoke-test/24247/consoleText):
```
"/home/build-user/build/buildbot_linux/unified-swiftpm-build-linux-x86_64/x86_64-unknown-linux-gnu/release/docc.build/main.swift.o" "-lswiftObservation" ... repeated many times ... "-lswiftObservation" "-lswiftCore"
```
2025-12-09 19:46:07 +05:30
Saleem Abdulrasool 070916fef3 DriverTool: adjust argv[0] scanning for CAS
Ensure that we nativize the path and consider only the filename starting
prefix to account for file suffixes (e.g. `.exe` on Windows). This
ensures that we properly support other platforms.
2025-12-08 08:53:26 -06:00
Anthony Latsis 88220a33c3 [NFC] "SwiftVersion" → "LanguageMode" in DiagnosticEngine::warnUntilSwiftVersion, etc. 2025-12-04 15:11:07 +00:00
Steven Wu b56f541732 Merge pull request #85499 from cachemeifyoucan/eng/PR-164409895
[Caching] Fix multi-threaded WMO with MCCAS
2025-11-18 09:22:13 -08:00
Yuta Saito 8748213d52 Merge pull request #85524 from kateinoigakukun/yt/fix-non-reg2mem-rle-crash 2025-11-16 23:10:20 +09:00
Yuta Saito 32aa4d9aed sil-opt: Add flag to disable aggressive reg2mem mode 2025-11-15 12:12:46 +00:00
Steven Wu b1d669bea1 [Caching] Fix multi-threaded WMO with MCCAS
MCCAS wasn't setup correctly when using parallel WMO. Make sure the
CAS ObjectStore and ResultCallbacks are passed to LLVM backend when
using parallel WMO.

rdar://164409895
2025-11-13 12:20:31 -08:00
Ian Anderson 5cdf2a879a [ABIChecker] Remove -iframework from swift-api-digester
-iframework is a holdover from when swift-api-digester was an LLVM tool. Now that everything has switched over to -Fsystem, -iframework can be removed.

rdar://153665579
2025-11-12 16:37:49 -08:00
Dylan Sturgeon 4b4f9f18fc Add an option for symbol graph to support long module names. (#83782)
Currently symbol graphs are always written in files that contain 1 to 2
module names. It's possible for Swift module names to be very long, so
combining 2 of them in file name like `module1@module2...` in the same
path component means the name can be too long for some file systems. The
new option `-symbol-graph-shorten-output-names` changes the symbol graph
output files to use a MD5 hash of the module name(s) as the filename and
outputs an additional JSON file with the original names mapped to the
real filename. The module names JSON can be used to construct a VFS
overlay with the original naming scheme.

fix #83723

I considered using vfsoverlay, which seems like a viable solution, but
the vfsoverlay options don't seem to apply to any of the outputs from
the compiler. When I set an overlay to remap the symbol graph file
outputs, the remapped external paths aren't used so the root problem of
too long file names remains.
2025-11-06 19:30:44 -08:00
Erik Eckstein 65e4c10113 Optimizer: remove the obsolete SpeculativeDevirtualization pass
This pass has been disabled since a very long time (because it's terrible for code size).
It does not work for OSSA. Therefore it cannot be enabled anymore (as is) once we have OSSA throughout the pipeline.
So it's time to completely remove it.
2025-10-13 10:49:17 +02:00
Yuta Saito cd1db4a575 [autolink-extract] Update deduplication list for new Foundation, Testing, and WASI platform
We now have several new runtime libraries in the toolchain but they are
not listed in the autolink deduplication list. This can lead to an excessive
memory footprint when linking on platforms that use autolink-extract.

See https://github.com/swiftlang/swift/issues/58380
2025-10-09 06:57:48 +00:00
Michael Gottesman e4fb8819d2 Merge pull request #84622 from gottesmm/pr-7065a633780e3a54b56563650e321ec0801bcb45
[sil-llvm-gen] Run Sema before we attempt to emit IR.
2025-10-07 00:57:05 -07:00
Michael Gottesman 3a96e99bd8 [sil-llvm-gen] Run Sema before we attempt to emit IR. 2025-10-06 15:17:26 -07:00
Mishal Shah 03a599c5be Merge pull request #84606 from swiftlang/rebranch
Merge clang 21.x rebranch into main
2025-10-02 20:17:05 -07:00
Michael Gottesman d0d2163e0d [sil-llvm-gen] Allow for -Xllvm options to be passed to sil-llvm-gen.
Specifically, we ignore the -Xllvm bit and put the option into
FrontendOptions.LLVMArgs so that parts of CompilerInvocation that assumes that
-Xllvm flags will be placed there are actually there. We still pass through the
argument to llvm::cl so it gets set that way as well.
2025-10-01 09:26:57 -07:00
swift-ci 096394b77e Merge remote-tracking branch 'origin/main' into rebranch 2025-09-29 18:35:20 -07:00
Michael Gottesman 8c9f291f8b Merge pull request #84554 from gottesmm/pr-cd8090d1fb5e8fd9fbb2ae8dbdd5eb34dc24df99
[sil-llvm-gen] Add support for emitting IR before LLVM optimizations run
2025-09-29 18:32:31 -07:00
Michael Gottesman ca2fb094d2 [sil-llvm-gen] Update some settings setup from sil-opt. 2025-09-29 12:58:18 -07:00
swift-ci b2a0c63a95 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-27 18:14:12 -07:00
Michael Gottesman 52a163fa5e Merge pull request #84555 from gottesmm/pr-4f37ab5228b75850c247af4f8dd913996a0390bd
[irgen] Make HasAArch64TBI an IRGen option instead of a LangOpts.
2025-09-27 18:09:12 -07:00
Michael Gottesman 361e63c815 [irgen] Make HasAArch64TBI an IRGen option instead of a LangOpts.
With some changes that I am making, we will no longer need this flag at the SIL
level, so we can just make it an IRGen flag (which it really should have been
in the first place).
2025-09-27 14:44:36 -05:00
Michael Gottesman 5c8a95f27a [sil-llvm-gen] Add support for emitting IR before LLVM optimizations run.
Specifically, I renamed the old llvm-as which printed with optimization as
llvm-as-opt and made llvm-as just test IRGen. That is really the true reason
that I created this utility many years ago: to test how IRGen lowers specific
SIL instruction sequences. How LLVM optimizes such sequences once lowered is a
different problem. I updated the one test that used sil-llvm-gen and required
optimizations to use llvm-as-opt so that the tests output did not change.
2025-09-27 14:42:04 -05:00
swift-ci d5a03fa0e4 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-26 22:36:42 -07:00
Erik Eckstein a322fd9209 Serialization: remove the IS_OSSA flag from the module file header 2025-09-26 08:01:08 +02:00
Erik Eckstein 2f124cf564 Remove the -enable-ossa-modules option.
OSSA modules are enabled by default.
The compiler still accepts this option but it has no effect.
2025-09-26 08:01:08 +02:00
swift-ci e35756ef85 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-23 15:38:03 -07:00
Doug Gregor 0737723c5c Merge pull request #84465 from DougGregor/has-feature-library-evolution
Add an optional language feature for Library Evolution
2025-09-23 15:18:48 -07:00
Doug Gregor c68ef1cf71 Add an optional language feature for Library Evolution
Replace the one-off compiler flag for Library Evolution with an
optional language feature. This makes the
`hasFeature(LibraryEvolution)` check work in an `#if`, and is
otherwise just cleanup.

Tracked by rdar://161125572.
2025-09-22 17:45:34 -07:00