Commit Graph

1313 Commits

Author SHA1 Message Date
Max Desiatov e37274c5c8 lib/Basic: Emscripten triple support in swift-frontend (#88732)
- **Explanation**:  Adding support for `swift-frontend -print-target-info -target wasm32-unknown-emscripten`, which is required before this triple is supported in `swiftc`.
- **Scope**: Limited to Emscripten Wasm support.
- **Issues**: rdar://175887675
- **Risk**: Very low due to limited scope.
- **Testing**: Added a new case to the lit test suite.
2026-04-30 10:23:59 +01:00
Saleem Abdulrasool 2b8ee6e5a2 test: disallow llvm-bcanalyzer and use new macro
This ensures that we use the correct llvm-bcanalyzer from the just built
compiler tools.
2026-04-13 16:22:02 -07:00
Steven Wu 12f8d9c6c9 [TEST] Switch to use new swift-driver when running tests
Default to use new swift-driver to run lit tests as legacy swift driver
is deprecated for a long time. The lit tests for legacy drivers are also
disable when running new swift-driver.

Tests that relies on legacy swift driver (for example, tests merge
module) can be enabled on conditions `legacy_swift_driver`. Fix and
split up some existing tests that relies on legacy driver.
2026-03-23 09:48:45 -07:00
Tony Allevato ca737c9b94 Support -sanitize=fuzzer-no-link.
This mirrors Clang's `-fsanitize=fuzzer-no-link`, which applies the
appropriate instrumentations but does not attempt to link to the
runtime library. More importantly, this suppresses the check in the
driver that fails the build if the library cannot be found. Since
libfuzzer is not distributed with Xcode, this allows users to build
it themselves or take it from a swift.org toolchain and use it
without having to physically copy/link it into their toolchain's
runtime directory.
2026-03-07 09:39:53 -05:00
finagolfin 1af61400be [Frontend][Driver] Update a last note to refer to -language-mode instead (#87394)
Also, fix a no-asserts test that was missed, this is a follow-up to
#87284.
2026-02-22 07:57:54 +05:30
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 9d158b91b4 Merge pull request #87107 from ramonasuncion/remove-shell-driver-environment
[Test][Driver] Replace shell syntax with lit substitutions for internal shell compatibility
2026-02-10 10:34:12 -08:00
Ramon Asuncion c4a93cada3 [Test][Driver] Replace shell syntax with lit substitutions for internal shell compatibility 2026-02-10 03:18:31 -05:00
Henrik G. Olsson 9787029809 Merge pull request #86929 from ramonasuncion/fix-subcommands-unsupported
[Test][Driver] Replace REQUIRES: shell with UNSUPPORTED: OS=windows-msvc in subcommands
2026-02-06 19:22:20 -08:00
Ramon Asuncion 8c4371fe42 [Test] Add TODO to try making disabled tests work on Windows 2026-02-06 02:04:34 -05:00
Ramon Asuncion 4e98ba34f7 [Test][Driver] Replace REQUIRES: shell with UNSUPPORTED: OS=windows-msvc in subcommands 2026-02-01 21:30:59 -05:00
Ramon Asuncion ae16863916 [Test] Replace REQUIRES:shell with UNSUPPORTED: OS=windows-mscv 2026-02-01 20:56:50 -05:00
Adrian Prantl dadba1cdb8 Merge pull request #86588 from adrian-prantl/168107340
[driver] Implement -debug-module-path in the legacy driver
2026-01-26 18:32:47 -08:00
Ian Anderson fc628a8bfb [test][NFC] Add more keys to test SDKSettings files
Every time DarwinSDKInfo reads a new key out of SDKSettings, a boatload of test SDKSettings files need to be updated across several repositories and forks and branches. It’s tedious to be careful to update those with real values so that the tests are properly regression testing older SDKs. It’s important to be careful so that the tests are accurate, e.g. to prevent the scenario where DarwinSDKInfo starts reading a new key out of SDKSettings and assumes that it’s always available everywhere, when in reality it was only added a few releases ago and will break with older SDKs. If the test SDKSettings files continue to be updated ad hoc, it’s going to be really easy to copy/paste a default value everywhere, and then clients will see incorrect behaviors with the real SDKs, or even compiler crashes if the key is unconditionally read. Preemptively add all of the maybe-possibly-compiler relevant keys to the test SDKSettings files from the real SDKs so that the test files are an accurate representation and shouldn't need to be touched in the future. Where the test SDKSettings have intentionally doctored data, add a Comments key explaining what is changed from the real SDK, and alter the SDK name with a tag indicating the change.

rdar://168700857
2026-01-23 02:19:36 -08:00
Adrian Prantl 0ec2762f96 [driver] Implement -debug-module-path in the legacy driver
Not having suport for this option causes confusing and non-obvious failures in
the LLDB testsuite, and some people build LLDB without also compiling the driver.

rdar://168107340
2026-01-22 17:03:32 -08:00
Henrik G. Olsson 2e7bc6e88a Merge pull request #86555 from ramonasuncion/fix-legacy-driver-lit
[Test][Driver] Migrate legacy-driver-propagates-response-file test to…
2026-01-16 19:48:01 -08:00
Ramon Asuncion 3e94ef5c1e [Test][SourceKit] Add UNSUPPORTED directive for legacy driver 2026-01-14 14:23:01 -05:00
Ramon Asuncion 2f7814dfc5 [Test][Driver] Migrate legacy-driver-propagates-response-file test to internal shell 2026-01-14 09:13:28 -05:00
Ian Anderson c0d0d73c4f [Test][Darwin] Add CanonicalName and SupportedTargets to all applicable SDKSettings
clang will start looking at CanonicalName and SupportedTargets soon, and error if those aren't as expected in the shipping SDKs. Pre-emptively add those to the test SDKSettings.

rdar://166277280
2026-01-07 23:59:29 -08:00
Dan Blackwell 161d00f803 [Sanitizers] Add support for -sanitize=memtag-stack (#85515)
This sanitizer adds MTE (memory tagging extension) checks to stack
variable accesses. Enablement simply requires setting an attribute on
function definitions, and the instrumentation is added by LLVM.

The corresponding swift-driver change is at:
https://github.com/swiftlang/swift-driver/pull/2016.

rdar://161721201
2025-12-05 08:51:42 +00:00
Henrik G. Olsson d494a31a89 Merge pull request #84988 from ramonasuncion/test-driver-filecheck-prefix
[Test][Driver] Clean up FileCheck prefixes for internal shell
2025-11-10 04:49:32 +00:00
Ramon Asuncion 7c10009eab [Test][Driver] Keep only LINUX_LAX checks for LD_LIBRARY_PATH 2025-11-06 15:55:50 -05:00
Ramon Asuncion 34a2557369 [Test][Driver] Clean up FileCheck prefixes for internal shell 2025-10-17 13:03:17 -07:00
Henrik G. Olsson c8fc00500f Merge pull request #84923 from ramonasuncion/test-driver-remove-bashisms-filelists
[Test][Driver] Remove bashisms from filelists test
2025-10-17 10:09:15 -07:00
Henrik G. Olsson 81f1e75b4f Merge pull request #84843 from hnrklssn/filecheck-sanitize-tmp-dir
[Utils] Sanitize %t with PathSanitizingFileCheck
2025-10-15 15:43:58 -07:00
Ramon Asuncion df96bda8fc [Test][Driver] Use xargs instead of command substitution 2025-10-15 11:57:38 -07:00
Ramon Asuncion 29677e3881 [Test][Driver] Use -tools-directory flag in filelists test
Replace env PATH manipulation with Swift driver's -tools-directory flag
to specify location of fake linker.

This seems to work with lit's internal shell, though I'm not 100% certain
it's the right approach.
2025-10-15 11:57:38 -07:00
Ramon Asuncion c0fc417d66 [Test][Driver] Remove subshells from filelists test
Replace (cd %t && ...) with cd %t && ...
2025-10-15 11:57:30 -07:00
Henrik G. Olsson 9e2a18d401 fix tests with TMP_DIR 2025-10-12 16:01:30 -07:00
Allan Shortlidge 7f3c8d8cfc Tests: Update tests to verify that LibraryEvolution appears in module trace files.
Follow up to https://github.com/swiftlang/swift/pull/84465.
2025-10-10 14:20:34 -07:00
Doug Gregor 90a5a0f87d Merge pull request #84410 from DougGregor/internal-import-bridging-header 2025-09-22 23:09:07 -07:00
Owen Voorhees e6c9dceae9 Update OS versions requiring stdlib OS rpaths 2025-09-21 09:47:18 -07:00
Doug Gregor ffa6d65f12 [Options] Make -import-bridging-header the canonical spelling instead of -import-objc-header
This command-line option hasn't been Objective-C specific ever, really.
Make the language-independent spelling the primary one to make that
more obvious.
2025-09-19 16:49:11 -07:00
Allan Shortlidge cfe9f90347 Merge pull request #84244 from tshortli/require-swift-version-in-module-interfaces
Frontend: Require `-language-mode` option when emitting swiftinterfaces
2025-09-15 10:08:23 -07:00
Hamish Knight 46a093a100 [Frontend] Only enable request reference tracking when needed
Only enable when we have a reference dependency output, or are
validating dependencies or collecting statistics. This avoids enabling
for SourceKit.
2025-09-12 20:39:58 +01:00
Allan Shortlidge 13d61b0709 Frontend: Require -language-mode option when emitting swiftinterfaces.
If a `.swiftinterface` file does not include an explicit `-language-mode`
option (or its predecessor `swift-version`) and needs to be built as a
dependency of a client compilation, then the invocation to build the module
from interface would end up inheriting the language mode that the client code
is built with. This can result in spurious type checking diagnostics or even
mis-compilation. To ensure that a module interface is always built using the
language mode that its source code was originally built with, require an
explicit `-language-mode` option when emitting swiftinterface files.

Resolves rdar://145168219.
2025-09-12 09:10:23 -07:00
Evan Wilde e5364fda0d FreeBSD: Disable driver/filelists.swift test
This test is flaky and creates noise. The compiler is occasionally
killed for some reason.

rdar://159456203
2025-09-03 09:43:27 -07:00
Arnold Schwaighofer c6b7b1f6b8 Merge pull request #82110 from tobias-stadler/remarks-fix-mangled-functionnames
[SIL] RemarkStreamer: Use mangled function names
2025-06-27 09:57:15 -07:00
Artem Chikin 66b8f35a5e Merge pull request #81569 from artemcm/NoBatchForYou
[Legacy Driver] Obsolete and remove batch compilation mode from the legacy driver
2025-06-17 10:49:16 -07:00
Tobias Stadler 4b0c0001bc [SIL] RemarkStreamer: Use mangled function names
Remarks emitted by LLVM use the mangled function name. Be consistent
with LLVM when serializing SIL remarks, so external tools can properly
filter for all remarks attributed to a certain function.
2025-06-12 18:29:35 +01:00
Artem Chikin 10cd7baef0 [Legacy Driver] Obsolete and remove batch compilation mode from the legacy driver
It is a maintenance burden and having the legacy driver exist in a simplified state reduces the possibility of things going wrong and hitting old bugs.
2025-06-06 09:51:00 -07:00
Allan Shortlidge a019419467 Frontend: Add language mode and enabled features to .SWIFT_TRACE.
To allow tooling to analyze use of language mode and experimental/upcoming
features, add that information to the `.SWIFT_TRACE` file.

Resolves rdar://152673681.
2025-06-05 13:47:24 -07:00
Anthony Latsis 0a1b8b0d50 [test] Fix misspelled FileCheck directives 2025-05-29 15:09:36 +01:00
Evan Wilde 500ddfeba4 [Driver] Don't hardcode default linker on Linux
This is the C++ driver counterpart to a change that landed in the Swift
driver a while ago to use the clang-linker to determine what the default
linker is. This is to avoid hard-coding gold, which is deprecated and
not available on some newer Linux distributions. The challenge is that
these newer Linux distributions don't already have Swift so we have to
use the old C++ driver implementation.
2025-04-02 16:32:44 -07:00
Doug Gregor 998dea25be Update module-trace tests for strictly memory-safe standard libraries 2025-02-26 14:28:20 -08:00
Saleem Abdulrasool a04c75a43a Basic: query the target pointer width from clang
Use the `clang::TargetInfo` to query the target pointer size for the
given triple. This is meant to enable us to properly determine
`CMAKE_SIZEOF_VOID_P`.
2025-02-10 09:20:02 -08:00
Allan Shortlidge 78ecec7cf3 Merge pull request #78987 from tshortli/more-target-info
Tests: Add more `CHECK` lines to print-target-info-extended.swift
2025-01-28 18:39:57 -08:00
Allan Shortlidge 50c9158e0f Tests: Add more CHECK lines to print-target-info-extended.swift.
Resolves rdar://143327298.
2025-01-28 13:51:16 -08:00
Stefan Gränitz 76243a25db [windows][toolchain] Build sanitizers and builtins standalone for all SDKs (#78861)
Unified builds of compiler-rt together with LLVM failed for the Android SDKs. It got too complicated to redirect the way LLVM would configure the nested build-trees. Standalone builds slightly increase build time, but they turned out much simpler and we end up with less duplication of definitions.
2025-01-28 22:08:07 +01:00
Allan Shortlidge c6ecb185fd Driver: Add missing CHECK lines to print-target-info-extended.swift. 2025-01-24 18:59:10 -08:00