Commit Graph

6755 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 429416cabd [CAS] Store the input index along the compiler results
This allows replaying the cached compiler results from an upstream CAS,
if we know the key, without needing access to the caching key input CAS tree.
2026-05-19 11:09:35 -07:00
Keith Smiley 9d484d4ca1 Early return computeCXXStdlibOptions if disabled
https://github.com/swiftlang/swift/pull/88664/changes#r3141083622
2026-04-27 12:04:04 -07:00
Rintaro Ishizaki 90866ee140 [Macros] Set binary I/O mode in MockPlugin in Windows
In Windows, stdin/stdout is "text" mode by default, but macro plugin
message is binary data.

rdar://174235365
2026-04-10 20:25:53 +09:00
Alexis Laferrière 1af6d6d28e Merge pull request #87353 from xymus/polyglot-ast-gen
ClangImporter: Services to parse Objective-C code and generate a `@objc @implementation` stub
2026-03-27 12:18:56 -07:00
Saleem Abdulrasool 02961bd097 utils: trim down libxml2 to what is needed for Foundation
This trims down what we include in the libxml2 build so that we can
minimise code size and build times. Add a more precise check for libxml2
to ensure that a libxml2 enabling LLVM has sufficient functionality for
use here.
2026-03-26 09:35:32 -07:00
Alexis Laferrière 31906d8bba IDE: Intro request to parse an ObjC implementation file and return AST
The new request in SourceKit allows to query this JSON format via the
usual SourceKit APIs. We use it here for testing but it can be
integrated in a client as needed.
2026-03-25 11:36:15 -07:00
Argyrios Kyrtzidis b0537d7a7b [CAS][SwiftScan] Introduce APIs for creating a CASFS root
These are APIs that are wrapping `llvm::cas::CASFSBuilder`
2026-03-20 10:58:11 -07:00
Artem Chikin e3f07a58f5 [Diagnostics] Display full diagnostic group parent chains
When a diagnostic belongs to a group that has a parent group (`GROUP_LINK` in `DiagnosticGroups.def`), display the full inheritance chain in the diagnostic output, including documentation hyperlinks and footnotes for each.

For example, a diagnostic in `ExistentialType` (child of `PerformanceHints`) now renders as:
```
warning: ... [#PerformanceHints::ExistentialType]
```
Groups without parents continue to display as before (`[#DeprecatedDeclaration]`).

Resolves rdar://170805800
2026-03-16 10:04:10 +00:00
Hamish Knight 451f7df952 [Sema] Fix type-checker assertion for SourceKit
We ought to properly fix this, but for now let's avoid asserting for
SourceKit.
2026-03-08 00:19:10 +00:00
Henrik G. Olsson b0df0c70c5 [utils] don't call unavailable functions 2026-02-28 11:38:24 -08:00
Henrik G. Olsson 9a64df890a [utils] remove open from free functions 2026-02-28 11:30:03 -08:00
Henrik G. Olsson 189e1f49c3 [utils] print #if statements
This prevents decls from the two branches from clashing.
2026-02-28 11:22:40 -08:00
Henrik G. Olsson 17da8285e3 [utils] move unsafe keyword before self for method call 2026-02-26 20:34:34 -08:00
Henrik G. Olsson c4af98cd5e [utils] don't add trailing comma after self if only param 2026-02-26 20:34:34 -08:00
Henrik G. Olsson f25d7aa525 [utils] remove mutating from signature when generating call to method
Free functions can't be `mutating` because there is not `self`.
2026-02-26 20:34:32 -08:00
Henrik G. Olsson e68829e055 [utils] don't copy comments when generating callers 2026-02-25 22:45:17 -08: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
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
Henrik G. Olsson 2a972d8723 consolidate langopt
DisableSafeInteropWrappers accidentally had one field in LangOpts and
one in ClangImporterOpts. Remove the one in ClangImporterOpts.

Also updates -disable-safe-interop option in swift-ide-test to align
with the -disable-safe-interop-wrappers option in the compiler.
2026-02-11 09:32:05 -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
Henrik G. Olsson 9b3d5298ed fix tests that require a different safe interop mode
This adds -disable-safe-interop to swift-ide-test so that
import-bounds-attributed-function.swift can test invalid bounds
attributes without too much churn.

std-span-transformed-execution.swift requires the legacy lifetimebound
mode, so revert to that.
2026-02-10 22:39:48 -08:00
Henrik G. Olsson b39aa89e48 [Swiftify] enable safe interop by default
This enables the stable subset of safe interop wrappers by default. It
can be manually disabled using
`-disable-experimental-feature StabilizedSafeInteropWrappers`.

rdar://148994016
2026-02-10 16:52:34 -08:00
Hamish Knight 3b5c77be34 [test] Enforce working directory doesn't change in sourcekitd-test 2026-02-09 09:46:34 +00:00
Hamish Knight eb45f2396d Replace vfs::getRealFileSystem -> vfs::createPhysicalFileSystem
Calling `setCurrentWorkingDirectory` on `getRealFileSystem` sets the
working directory for the process itself. This is unsafe for clients
such as SourceKit which can process multiple concurrent requests,
and may be used as an in-process library in e.g sourcekit-lsp. Switch
to `createPhysicalFileSystem` instead, where setting the working
directory is done locally on the FileSystem itself.
2026-02-09 09:46:34 +00:00
Hamish Knight bb9b5bf8c9 [IDE] Remove some redundant checks
`getRealFileSystem` returns a new FileSystem object each time so this
check is effectively `if (true)`.
2026-02-09 09:46:34 +00:00
Slava Pestov aae77c16bb Merge pull request #86412 from slavapestov/shrink-smallvectors
Shrink obscenely large SmallVectors
2026-01-09 20:15:36 -05:00
Tim Kientzle adec1f6cbe Merge pull request #86277 from tbkka/tbkka-rdar149303951-try1
[SE-0474] Implement final `yielding borrow`/`yielding mutate` naming for coroutine accessors
2026-01-09 08:52:21 -08:00
Slava Pestov fa337cc10c IDE: Fix Fix obscenely large SmallVectors 2026-01-09 09:31:42 -05: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 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
Tim Kientzle 8eabeeb8ca [SE-0474] Read2/Modify2 => YieldingBorrow/YieldingMutate
This updates a large number of internal symbols, function names,
and types to match the final approved terminology.  Matching the
surface language terminology and the compiler internals should
make the code easier for people to understand into the future.
2026-01-03 16:05:12 -08:00
Saleem Abdulrasool 54f5837c7b swift-scan-test: adjust frontend detection for Windows
Ensure that we account for file system arc separators and extensions by
using the LLVM functions rather than trying to simply do string
matching. This allows us to properly handle inputs on Windows.
2025-12-11 15:29:56 -08:00
Hamish Knight f0d4572a92 [SourceKit] Always check buffer in SemanticAnnotator
Make sure we don't ever try to record semantic tokens for a different
buffer. This works around an ASTWalker issue where it will walk macro
expanded bodies even in non-macro-expansion mode.

rdar://165420658
2025-12-10 17:41:00 +00:00
Egor Zhdan 69be33d3ba [cxx-interop] Remove compatibility versions
This removes the C++ interop compat version mechanism. It was added in mid-2023 and was never used. It complicates the testing story, and makes it harder to reason about the compiler's behavior. It also isn't compatible with explicit module builds.

The flag `-cxx-interoperability-mode` is preserved, so projects that use the flag will continue to build normally.

rdar://165919353
2025-12-05 18:01:09 +00:00
Anthony Latsis 345c601626 Address some overload deprecations in llvm::support::endian
See:
* https://github.com/llvm/llvm-project/pull/161045
* https://github.com/llvm/llvm-project/pull/160979
2025-12-01 11:19:25 +00:00
Ben Barham 632233003d [SourceKit] Remove flakey test assertion
Exactly when this happens is still somewhat of a mystery, but given we
allow annotations in either response, it doesn't seem worth asserting
over.

Resolves rdar://139356981.
2025-11-21 13:13:08 +10:00
Slava Pestov 819738c83e AST: Rename mapTypeIntoContext() => mapTypeIntoEnvironment(), mapTypeOutOfContext() => mapTypeOutOfEnvironment() 2025-11-12 14:48:19 -05:00
Anthony Latsis bda6edb85c AST: Rename GenericContext::isGeneric to hasGenericParamList
`isGeneric` is a misleading name because this method checks for the
existence of a `GenericParamList`, which is not implied by genericity.
2025-11-11 15:55:16 +00:00
Alex Hoppen 893340d4f6 Merge pull request #85175 from ahoppen/swift-access-level
[Index] Record the access level of declarations in the index
2025-11-04 16:38:38 +01:00
Alex Hoppen aa9c295ad5 [Index] Record the access level of declarations in the index
rdar://163256878
2025-10-30 14:36:29 +01:00
Becca Royal-Gordon 393965090e Merge pull request #34556 from beccadax/mod-squad-2
[SE-0491] Implement lookup and diagnostics for module selectors (MyMod::someName)
2025-10-28 16:00:26 -07:00
Allan Shortlidge 92227ad1cf AST: Introduce the Swift, anyAppleOS, and DriverKit platform kinds.
This change just stages in a few new platform kinds, without fully adding
support for them yet.

- The `Swift` platform represents availability of the Swift runtime across all
  platforms that support an ABI stable Swift runtime (see the pitch at
  https://forums.swift.org/t/pitch-swift-runtime-availability/82742).
- The `anyAppleOS` platform is an experimental platform that represents all of
  Apple's operating systems. This is intended to simplify writing availability
  for Apple's platforms by taking advantage of the new unified OS versioning
  system announced at WWDC 2025.
- The `DriverKit` platform corresponds to Apple DriverKit which is already
  supported by LLVM.
2025-10-27 19:15:04 -07:00
Becca Royal-Gordon ffaa35810c Handle lookup into Builtin with module selector
Lookups like Builtin::Int64 were failing because BuiltinUnit rejected all unqualified lookups. Make it allow unqualified lookups with a module selector.
2025-10-24 16:23:48 -07:00
Hamish Knight 6f1417135b [SourceKit] Fix handling of @abi in AnnotatingPrinter
Make sure we avoid adding these to the entity stack entirely, which
avoids hitting the assertion that a top-level entity isn't encountered
with a non-empty stack.
2025-10-23 09:11:17 +01:00
Mads Odgaard c92e5b47f3 Merge pull request #84574 from madsodgaard/android-availability 2025-10-20 10:40:37 +09:00
Henrik G. Olsson 328e07ac91 address comments, add copyright header 2025-10-17 15:13:59 -07:00
Henrik G. Olsson ce806415c9 Remove swift-function-caller-generator's dependency on Foundation
Building Foundation seems to be optional in the Linux build script,
which makes it tricky to link against outside of Darwin platforms. This
removes the dependency on Foundation and calls libc for I/O instead.
2025-10-17 15:13:58 -07:00
Henrik G. Olsson de49d687b0 add swift-function-caller-generator
This helper utility takes a module interface as input, and emits a Swift
file importing the module and calling every function in the module. It's
intended for testing of safe interop wrappers to make sure they go
through the entire pipeline of the compiler instead of succumbing to
laziness.
2025-10-17 15:13:55 -07:00
Mike Ash 3869cb50ea Fix integer type mismatches in swift-inspect when building 32-bit. 2025-10-07 14:00:01 -04:00