Commit Graph

184973 Commits

Author SHA1 Message Date
Kuba (Brecka) Mracek
749e9ee090 Merge pull request #81492 from kubamracek/import-values-apinotes
[ClangImporter] Fix enum conversion type when importing global values (unwrap if needed)
swift-DEVELOPMENT-SNAPSHOT-2025-05-14-a
2025-05-14 10:03:11 -07:00
Saleem Abdulrasool
62c384e21d Merge pull request #81479 from compnerd/configuration
Runtimes: tweak default configuration for Windows
2025-05-14 09:45:45 -07:00
Saleem Abdulrasool
0af5839320 Merge pull request #81477 from compnerd/conwarn
Concurrency: silence warning on Windows
2025-05-14 09:45:08 -07:00
Saleem Abdulrasool
25bcfedd5c Merge pull request #81490 from compnerd/compaction
Runtimes: correct CommandLineSupport build on Windows
2025-05-14 09:44:56 -07:00
Alex Hoppen
9d30958066 [SourceKit] Allow passing cancel_on_subsequent_request: 0 for all requests that use a OncePerASTToken
We need this option for `collectVariableType` (aka inlay type hints) but since I’m at it, I’m adding an option to disable the implicit request cancellation for all requests that have it since we don’t want it in LSP at all.

Prerequisite to fixing https://github.com/swiftlang/sourcekit-lsp/issues/2021 / rdar://145871554, need to adopt this option in SourceKit-LSP.
2025-05-14 18:42:19 +02:00
Steven Wu
1506a0d495 [Caching] Remove capture clang extra files
After removing the CASFS implementation for clang modules, there is no
need to capture clang extra file that sets up the VFS for the clang
modules since all content imported by ClangImporter is dependency
scanned and available via include-tree. This saves more ClangImporter
instance when caching is enabled.

Update the test to check that clang content found via `-Xcc` VFS options
can currently work without capture the headermaps and vfs overlays.
2025-05-14 09:35:03 -07:00
Steven Wu
3c81c1ca9f [Caching] Remove CASFS clang module implemenation
Remove the CASFS based clang module implemenation as it is not longer
used.
2025-05-14 09:35:03 -07:00
Hamish Knight
93c37b49c5 Merge pull request #81028 from hamishknight/fix-completion-sourceranges
[IDE] Avoid uses of `isBeforeInBuffer` in `TypeCheckASTNodeAtLocRequest`
2025-05-14 16:26:56 +01:00
Holly Borla
40b57094da Merge pull request #81022 from nickolas-pohilets/mpokhylets/fix-80992
Fixed no copying IsIsolated flag when cloning subscript params
2025-05-14 08:09:40 -07:00
Joe Groff
52d7781758 Merge pull request #81424 from jckarter/same-type-constraint-stop-copyable
Sema: Allow `T == NonCopyableOrEscapable` same-type constraints without a redundant `T: ~Copyable`.
2025-05-14 08:09:05 -07:00
Eric Miotto
a5261ae492 Merge pull request #81386 from edymtt/edymtt/do-not-crosscompile-llvm-under-linux
Reenable build of compiler-rt with LLVM_ENABLE_RUNTIMES in Linux bots...
2025-05-14 06:47:30 -07:00
Alastair Houghton
c0ccdffeb7 [Concurrency] Add underscore prefixes for not yet official API.
Custom main and global executors work hasn't passed Swift Evolution yet,
so we need to avoid leaking it as API until it does.

To that end, underscore all the things.

rdar://151147606
2025-05-14 11:57:06 +01:00
Hamish Knight
d00f45a0c6 [AST] Switch FuncDecl::get{Start,End}Loc to using early return 2025-05-14 11:42:26 +01:00
Hamish Knight
839e20b8ca [Completion] Assert we have a type in getClosureActorIsolation
Previously we could end up in cases where we pick the wrong
DeclContext in `TypeCheckASTNodeAtLocRequest` since we previously
weren't checking source ranges, which could result in skipping the
type-checking of an outer closure. Now that we correctly pick the
DeclContext, we should no longer hit that case, so we should be able
to fall into `getTypeForCompletion` and assert that the solution has
a type. Also while here let's upgrade that assert to a
`CONDITIONAL_ASSERT`.
2025-05-14 11:15:42 +01:00
Hamish Knight
110f11493a [IDE] Avoid uses of isBeforeInBuffer in TypeCheckASTNodeAtLocRequest
Use the higher level APIs on SourceManager that handle locations in
parent vs child buffers. This then allows us to fix `walkToDeclPre`
such that we don't set the found DeclContext unless the location is
actually within that decl (here the location may well be in a
separate buffer as we may have a replaced function body).
2025-05-14 11:15:42 +01:00
Hamish Knight
84febf639d [AST] Remove a couple of checks from FuncDecl::getSourceRange
These don't appear to be necessary, let's mirror the logic in
`getStartLoc` and remove them.
2025-05-14 11:15:42 +01:00
Hamish Knight
e0ceb85c6a [AST] Remove unparsed case from FuncDecl::getSourceRange
This wasn't really sound since it could result in source ranges that
have different buffers for the start and end loc. Instead, adjust
the parser logic to look at the brace range.
2025-05-14 11:15:42 +01:00
Hamish Knight
3c67271869 [AST] Handle a few more cases in getStartLoc()
Handle PatternBindingDecls with missing var locations, which can
happen for loop iterator vars, and FuncDecls with missing name and
func locations, which can happen for `defer`. Also while here make
sure we set the source location of a parser-produced ErrorExpr.
2025-05-14 11:15:42 +01:00
Hamish Knight
98c5fde31f [AST] Use SourceRange::combine in a couple of places 2025-05-14 11:15:42 +01:00
Hamish Knight
691b8c874c [Basic] Upgrade assert in findBufferContainingLocInternal
Almost all clients would crash for an invalid location, let's
always assert.
2025-05-14 11:15:42 +01:00
Erik Eckstein
5ab8e40597 embedded: enable serialization of debug info in embedded mode
This is important to get diagnostics for errors which are located in imported modules.
Such errors can sometimes only be detected when building the client module, because the error can be in a generic function which is specialized in the client module.

rdar://151162353
2025-05-14 11:43:48 +02:00
Erik Eckstein
5dc71aa0a5 AST/SIL: support source location in diagnostics for de-serialized debug info
Diagnostics only work with `SourceLoc` which is basically a pointer into a buffer of the loaded source file.
But when debug info is de-serialized, the SIL `Location` consists of a filename+line+column.
To "convert" this to a `SourceLoc`, the file must be loaded.
This change adds `DiagnosticEngine.getLocationFromExternalSource` for this purpose.
Also, the new protocol `ProvidingSourceLocation` - to which `SourceLoc` and `Location` conform - help to generalize the helper struct `Diagnostic` and make this "conversion" happen automatically.
2025-05-14 11:43:47 +02:00
shiz
d12cb84586 [Parse] Avoid parsing unsafe expression before binary or postfix op (#81429)
rdar://150751248
2025-05-14 10:02:58 +01:00
eeckstein
7ff1066409 Merge pull request #81480 from eeckstein/fix-fso
FunctionSignatureOptimization: don't convert indirect `@in` to `@in_guaranteed` if the argument is mutated
2025-05-14 06:25:16 +02:00
eeckstein
01107f18da Merge pull request #81469 from eeckstein/temp-rvalue-elimination
TempRValueElimination: handle `store` instructions to the temporary stack location
2025-05-14 06:24:47 +02:00
Saleem Abdulrasool
1b5cb78a51 Runtimes: tweak default configuration for Windows
Enable command line support, library evolution, vector types, file
system support, runtime function counters, and optimization remark
emission. This brings the windows runtime configuration and Darwin
to parity.
2025-05-13 20:01:18 -07:00
Slava Pestov
9ace644add Merge pull request #81476 from slavapestov/test-rdar148357926
Add regression test for rdar://148357926
2025-05-13 22:05:01 -04:00
Saleem Abdulrasool
3a2beae485 Merge pull request #81478 from compnerd/silence
CommandLineSupport: prefer `_strdup` over `strdup`
2025-05-13 17:49:54 -07:00
Shubham Sandeep Rastogi
80e8d3a127 Merge pull request #81463 from rastogishubham/AttachDebugLoc
Set debug location to Coroutine call expression
2025-05-13 17:30:55 -07:00
Bassam (Sam) Khouri
1a6962f535 Merge pull request #81401 from bkhouri/t/main/update_presets
preset: treat swift testing the same as xctest
2025-05-13 19:42:42 -04:00
Steven Wu
7025bf816b Merge pull request #81264 from cachemeifyoucan/eng/PR-148752988
[Caching] Reduce the number of cas ID passed on frontend commandline
2025-05-13 16:15:29 -07:00
Kuba Mracek
1ecdb17fcc [ClangImporter] Fix enum conversion type when importing global values (unwrap if needed) 2025-05-13 16:02:15 -07:00
Evan Wilde
94e695037c Runtimes: Enable CommandLine support wholesale
CommandLine support builds on all platforms at this time. There is no
need to have a default disabling it anymore. Setting the default option
to enable it on all platforms without condition.
2025-05-13 15:58:20 -07:00
Saleem Abdulrasool
bbd26e823a Runtimes: correct CommandLineSupport build on Windows
We would fail to build the runtime with the new build with command line
support and a shared runtime. The reason for this was that
CommandLineSupport did not properly build against the headers and
attempted to import a locally defined symbol. Correct the build by
indicating that this library is compacted into the runtime.
2025-05-13 15:45:02 -07:00
Saleem Abdulrasool
f411fcd388 CommandLineSupport: prefer _strdup over strdup
This silences a warning on Windows as `strdup` is considered deprecated
in favour of the POSIX compliant `_strdup` spelling.
2025-05-13 13:21:01 -07:00
Joe Groff
e4a6faa3f2 Sema: Allow T == NonCopyableOrEscapable same-type constraints without a redundant T: ~Copyable.
Enhance the logic in `applyInverses` to also take into account same-type constraints spelled in
the generic signature, so that same-type-constraining a type parameter to a type that is itself
not `Copyable` or `Escapable` suppresses the default application of those constraints on the
type parameter. Fixes rdar://147757973.
2025-05-13 11:31:41 -07:00
Shubham Sandeep Rastogi
17e756ba81 Set debug location to Coroutine call expression
If debug info generation is enabled, set debug location to the
coroutine call instruction to make sure there are no issues with invalid
debug information in LTO.

This happens because in LTO, if a call to a function doesn't contain a
debug location, we see the warning:

inlinable function call in a function with debug info must have a
!dbg location

ld: warning: Invalid debug info found, debug info will be stripped

Which then strips the debug info from the entire .o file linked into the
dylib.
2025-05-13 11:11:38 -07:00
Guillaume Lessard
bb67d1ef0a Merge pull request #81465 from glessard/rdar151179266-flag-in-swiftinterface
[cmake] LifetimeDependenceMutableAccessors should be enabled
2025-05-13 11:01:19 -07:00
Mike Ash
9671d6b37c [swift-inspect] Fix corpse leaks when target doesn't have libswiftCore loaded.
In DarwinRemoteProcess's early return when libswiftCore.dylib isn't loaded in the process, we hadn't initialized all stored properties yet, which means our deinit didn't run. This leaked the task. This is especially bad when forking a corpse, as the system has a very limited number of corpses available.

Add a Cleanup helper to manage resources that need explicit cleanup. This is a noncopyable struct which takes a cleanup function and calls it whenever a new value is set or when the struct is destroyed. Use this for the DarwinRemoteProcess properties that need explicit cleanup. This allows us to remove DarwinRemoteProcess's deinit and always run these cleanups regardless of how we exit the initializer.

While we're here, fix the truncations of buffer in getAllProcesses.

rdar://151170155
2025-05-13 13:53:14 -04:00
Egor Zhdan
80cd764aff Merge pull request #76575 from swiftlang/egorzhdan/scs-bump-version
[SwiftCompilerSources][build] Bump the minimum supported compiler version to 5.9
2025-05-13 18:03:59 +01:00
Erik Eckstein
8cab792753 FunctionSignatureOptimization: don't convert indirect @in to @in_guaranteed if the argument is mutated
This fixes a verifier error because an `@in_guaranteed` argument must not be mutated.

https://github.com/swiftlang/swift/issues/81444
rdar://151147971
2025-05-13 18:53:31 +02:00
Erik Eckstein
dc0e7a34ae SIL: Make the verifier's ImmutableAddressUseVerifier generally available
Also, make it more tolerant to instructions and builtins, which are not explicitly handled.
This avoids crashes when new instructions are added. We got lucky that this didn't happen so far.
2025-05-13 18:53:31 +02:00
Saleem Abdulrasool
cab1f40218 Concurrency: silence warning on Windows
Prefer `strncpy_s` over `strncpy` which triggers a warning. This
function ensures that the copied string is null-terminated if the string
fits or simply returns an empty string (`\0`) if the string does not
fit. Prefer to use `_TRUNCATE` to copy as much of the name as fits and
ensure that it is null-terminated.
2025-05-13 09:48:33 -07:00
Alexis Laferrière
9c7f0c7550 Merge pull request #80917 from xymus/cdecl-print
PrintAsClang: Print a C block in the compatibility header for `@cdecl` functions
2025-05-13 09:21:30 -07:00
Steven Wu
201e4faea7 [Caching] Reduce the number of cas ID passed on frontend commandline
Using IncludeTree::FileList to concat the include tree file systems that
are passed on the command-line. This significantly reduce the
command-line size, and also makes the cache key computation a lot
faster.

rdar://148752988
2025-05-13 09:20:13 -07:00
Eric Miotto
fcc03898c7 Reenable build of compiler-rt with LLVM_ENABLE_RUNTIMES in Linux bots...
...we disabled in #81354

This requires a couple of supporting changes

* under Linux, do not cross compile LLVM when building for the host
 architecture -- that will ensure that the compiler-rt build will use
the just built compiler and not the system one (which may not be
new enough for this purpose);
* provide sanitizer flags depending on the linker the just built compiler
 will use -- this detection is brittle, so print a message advising the
user how to override this.

Addresses rdar://150849329
2025-05-13 08:34:11 -07:00
Slava Pestov
373d08e572 Add regression test for rdar://148357926
I believe this was fixed by https://github.com/swiftlang/swift/pull/81181.
2025-05-13 11:16:41 -04:00
Anthony Latsis
e7237fddc7 [presets] Escalate C++ "unused" warnings in 'smoketest=macosx' 2025-05-13 16:14:40 +01:00
Ian Anderson
69c5a02686 Merge pull request #81269 from ian-twilightcoder/nostdimport-remove-framework-paths
[Driver][Frontend] -nostdimport and -nostdlibimport should remove the default framework search paths
2025-05-13 03:01:29 -07:00
Doug Gregor
8fb4b1c134 Merge pull request #81466 from DougGregor/objc-enum-unsafe-bit-cast-warning
[Strict memory safety] Squash warning about unsafety in "@objc enum" synthesized code
2025-05-13 01:56:29 -07:00