Commit Graph

559 Commits

Author SHA1 Message Date
finagolfin
6611ea97e9 [android][test] Fix or disable the remaining failing tests on the Android CI (#81398)
Also, fix and enable `IRGen/lto_autolink` for all non-Wasm targets and
`IRGen/static_initializer` for aarch64.

This should get [the community Android
CI](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-24.04-android-build/)
green
[again](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-24.04-android-arm64/).
2025-06-11 21:52:04 +05:30
Doug Gregor
09dbbea774 Add optional language features to the supported features output
Optional language features don't have a specific "-enable-*" flag, because
they're rare and don't fit the same upcoming/experimental distinction. Add
a flag_name field to provide the flag name as well.

(cherry picked from commit 414adb55ca)
2025-06-04 00:20:41 -07:00
Doug Gregor
0ed5cff7cc Merge pull request #81744 from DougGregor/more-migratable-features-6.2
[6.2] Make `InferIsolatedConformances` and `StrictMemorySafety` migratable features
2025-05-30 00:52:37 -07:00
Doug Gregor
d0cb137778 Add the set of diagnostic categories to each migratable feature
The name of a migratable feature might differ from the names of the
diagnostic groups containing the diagnostics that are used to drive
migration for that feature. Provide the set of diagnostic categories
that are associated with each migratable feature as part of the
supported features list.

(cherry picked from commit 7f2649ff33)
2025-05-28 16:15:17 -07:00
Pavel Yaskevich
e39debae11 [Frontend] SupportedFeatures: print "enabled_in" as a string
This is future-proofing the version part of the upcoming
feature. There currently no features that require that
but it's possible that they'd be added in the future.

(cherry picked from commit 4909b9baed)
2025-05-28 16:15:10 -07:00
Ian Anderson
44b2c08a5a [6.2][Driver][Frontend] -nostdimport and -nostdlibimport should remove the default framework search paths
-nostdimport and -nostdlibimport only remove the toolchain and usr/lib/swift search paths, and they leave the framework search paths intact. That makes it impossible to get a fully custom SDK environment. Make their behavior match clang's -nostdinc/-nostdlibinc behavior: treat framework and non-framework paths the same. In other words, -nostdinc removes *all* compiler provided search paths, and -nostdlibinc removes *all* SDK search paths.

Rename SkipRuntimeLibraryImportPaths to SkipAllImportPaths, and ExcludeSDKPathsFromRuntimeLibraryImportPaths to SkipSDKImportPaths to reflect their updated behavior.

Move the DarwinImplicitFrameworkSearchPaths handling from SearchPathOptions to CompilerInvocation, where RuntimeLibraryImportPaths is managed. Rename it to just ImplicitFrameworkSearchPaths, and filter for Darwin when it's set up so that all of the clients don't have to do Darwin filtering themselves later.

rdar://150557632
2025-05-23 22:12:45 -07:00
Pavel Yaskevich
de6ef08d71 [Feature] Switch migration postfix from :adoption to :migrate
(cherry picked from commit 1ba077d922)
2025-05-14 20:28:46 -07:00
Pavel Yaskevich
8977d80adc [Frontend] Rework -emit-supported-features mode into -emit-supported-arguments
The "featues" part was never actually implemented and Swift Driver
is replying on information about arguments, so instead of removing
this mode, let's scope it down to "arguments" to be deprecated in
the future.

(cherry picked from commit 18703d64d6)
2025-05-14 20:28:46 -07:00
Pavel Yaskevich
e477143d58 [Frontend] Add -print-supported-features option
This is a replacement for `-emit-supported-features` that prints
all of the upcoming/experimental features supported by the compiler
with some additional meta information in JSON format to stdout.

(cherry picked from commit 55bd906906)
2025-05-14 20:28:40 -07:00
Anthony Latsis
fb5d1f0538 [6.2] Cherry-pick "[NFC][test] Move scattered DiagnosticVerifier tests into subdirectory"
(cherry picked from commit b0b0cff317)
2025-05-07 15:28:37 +01:00
Tony Allevato
8ca0b416c8 Merge pull request #80498 from allevato/json-usr-fixes
[AST] More JSON AST dump improvements.
2025-04-24 07:51:57 -04:00
Steven Wu
58087af610 [SymbolGraph] Make symbol-graph output deterministic
SymbolGraph generation iterating over llvm::DenseSet, which makes the
symbols and relationship fields appear in non-deterministic ordering.
Switch to use llvm::SetVector to preserve the insertion order from
SourceEntityWalker to make order deterministic.

Resolves: https://github.com/swiftlang/swift/issues/59602
(cherry picked from commit dfa4a27ec8)
2025-04-09 10:20:21 -07:00
Slava Pestov
3992fd9bbc Merge pull request #80327 from slavapestov/fix-useless-method
Small fixes for new abstract conformance representation
2025-04-01 07:52:42 -04:00
Daniel Rodríguez Troitiño
239bca9717 [test] Require asserts for dependencies-preservation-fine.swift (#80418)
PR #78793 moved the code that this test was testing for into `NDEBUG`
blocks, which means that only exist in assert toolchains. The test was
not changed, so it was failing in non-assert toolchains.
2025-04-01 00:48:01 -07:00
Slava Pestov
e3fdeaf501 ASTDumper: Dump conforming type of abstract conformance 2025-03-31 17:35:22 -04:00
Doug Gregor
92c16b2ce0 Test updates for change to diagnostic group printing 2025-03-29 18:18:31 -07:00
Steven Wu
4115be5e18 [FrontendTool] Use a null diagconsumer for verify instance
Use a null diagnostic consumer in the deterministic verify instance. The
constraint system will skip work if there are no consumer in the
diagnostic engine. Use a null consumer to make sure the same amount of
work is done for two runs.
2025-03-21 13:11:14 -07:00
Steven Wu
b8879eef88 [AST] Get it a deterministic traverse order for classMembers
Make sure the traversal order for classMembers in deterministic in the
mdoule by sorting them first.

Also fix the comparsion function for `DeclName` to make sure there
aren't two DeclNames with different OpaquePointer can be evaluated to
equal.

rdar://147513165
2025-03-21 13:11:14 -07:00
Steven Wu
4c1f1e6113 Merge pull request #79955 from cachemeifyoucan/eng/PR-104876331 2025-03-12 20:11:36 -07:00
Steven Wu
bb224a3598 [FineGrainedDeps] Fix the non-deterministic .swiftdeps output
Fix the non-deterministic .swiftdeps output. In contrary to the comments
in the `FineGrainedDependencies.h`, the non-determinism is not because
of the use of unordered_* data structure there. Those data structures
are not traversed so removing all the unused traversing methods to avoid
the confusion.

The true reason for the non-determinism is all the DenseSet in the
Evaluator dependency tracking, that causes the FineGrainedDependencies
to see arbitrary ordering. Use `SetVector` instead to keep track of the
insertion order to make dependency output to be deterministic.

rdar://104876331
2025-03-12 11:14:37 -07:00
Tony Allevato
0844e274b0 Ensure that #fileID wraps raw identifier module names in backticks.
`#fileID` never accounted for the possibility that someone one have
a module alias _itself_, so it always generated the module's real
(physical) name. This _technically_ changes the behavior of `#fileID`
for self-aliased modules, but since nobody would have ever had a reason
to do that before raw identifiers, it's unlikely that this change would
affect anyone in practice.
2025-03-11 17:18:44 -04:00
Tony Allevato
8752920875 Allow module aliases to be expressed in the explicit Swift module map JSON file.
For build systems that already generate these files, it makes sense to include the aliases so that the map file serves as a comprehensive index of how the module inputs are referenced.
2025-03-11 17:18:43 -04:00
Tony Allevato
2b0f9aa765 Allow module aliases to use escaped identifiers as the alias name.
The original module names themselves must still be valid unescaped identifiers; most of the serialization logic in the compiler depends on the name of a module matching its name on the file system, and it would be very complex to turn escaped identifiers into file-safe names.
2025-03-11 17:18:43 -04:00
Anthony Latsis
6a3903bb53 Revert "Revert "Introduce adoption mode for Swift features""
This reverts commit 393c59c078.
2025-03-05 15:21:01 +00:00
Rintaro Ishizaki
393c59c078 Revert "Introduce adoption mode for Swift features" 2025-03-04 19:13:05 -08:00
Anthony Latsis
0b542fc5e8 Basic: Define ExistentialAny as supporting adoption mode 2025-03-04 13:43:28 +00:00
Anthony Latsis
2a88419f5c Frontend: Do not suggest mode correction if adoption is not supported 2025-03-04 13:43:28 +00:00
Anthony Latsis
756abb9284 Frontend: Warn if adoption mode is requested but not supported 2025-03-04 13:43:28 +00:00
Anthony Latsis
2abf67872c Frontend: Parse a feature mode specifier 2025-03-04 13:43:28 +00:00
Anthony Latsis
d18425e3dc [NFC] test: Factor out feature frontend tests into subdirectory 2025-03-01 03:55:09 +00:00
Slava Pestov
b35f929dc8 Sema: Rename TypeCheckSourceFileRequest to TypeCheckPrimaryFileRequest 2025-02-25 17:22:41 -05:00
Doug Gregor
2989770cd6 Merge pull request #79352 from DougGregor/strict-sendable-metatypes
Add StrictSendableMetatypes to require Sendable requirements on metatypes
2025-02-14 03:40:36 -08:00
Doug Gregor
ed6dccf12c Diagnose captured of non-sendable metatypes crossing isolation boundaries
Keep track of all of the type parameters and archetypes that are captured
by a local function or closure. Use that information to diagnose cases
where a non-Sendable metatype crosses an isolation boundary.
2025-02-13 17:07:09 -08:00
Rintaro Ishizaki
71b24665fa [ASTDumper] Dump DeclContext
* Include `DeclContext` of the node where possible
* Add 'default-with-decl-contexts' dump style that dumps the dect context
  hierarchy in addition to the AST
* Support `-dump-parse` with `-dump-ast-format json`
2025-02-12 10:53:33 -08:00
Michael Gottesman
791d07d379 Revert "Test fixes"
This reverts commit 9c328a81d1.
2025-02-06 14:04:28 -08:00
Tony Allevato
c5f0200680 Merge pull request #79059 from allevato/json-ast-followups
[ASTDumper] Some followups from the initial JSON PR and macro dumping improvements.
2025-02-04 01:13:46 -05:00
Michael Gottesman
9c328a81d1 Test fixes 2025-02-03 13:35:08 -08:00
Tony Allevato
237e79a467 Print the macro's concrete decl ref for any macro expansions.
This gives us the macro's USR, letting us match it up to its
declaration elsewhere.
2025-01-31 11:15:02 -05:00
Arnold Schwaighofer
e1aabc614c Test Frontend/load-pass-plugin.swift requires executable_test
rdar://143945257
2025-01-31 06:19:28 -08:00
Tony Allevato
9d3bcca73f Ensure that top-level macro expansions are in the JSON AST dump. 2025-01-30 12:18:21 -05:00
Tony Allevato
5fe10ce86a ASTDumper: Label "interface type" -> "interface_type". 2025-01-29 13:55:00 -05:00
Tony Allevato
a15fddc4c0 Fix the macro test to use its own macro instead of relying on DebugDescription. 2025-01-29 08:23:39 -05:00
Tony Allevato
d2fd3479da Additional post-review fixes. 2025-01-24 14:11:20 -05:00
Tony Allevato
f249db3f85 Use cached evaluator results when looking up function types.
Also improve the output for thrown error destinations in
parsable modes.
2025-01-22 14:26:14 -05:00
Tony Allevato
8df48e52ff Address more reviewer feedback. 2025-01-22 14:26:14 -05:00
Tony Allevato
87cabb0f04 Print the buffer ID for non-main buffers and test via macro expansions. 2025-01-22 14:26:13 -05:00
Tony Allevato
a4c64b081d Address most of the simple review feedback. 2025-01-22 14:26:13 -05:00
Tony Allevato
52c009a2ec [AST] Improve JSON representation of various AST nodes. 2025-01-22 14:26:13 -05:00
Tony Allevato
a57fb4dfa9 [AST] Add minimal JSON support to ASTDumper.
This only takes the existing AST information and writes it as JSON
instead of S-expressions. Since many of these fields are stringified,
they're not ideal for the kind of analysis clients of the JSON format
would want to do. A future commit will update these values to use a
more structured representation.
2025-01-22 14:26:13 -05:00
Allan Shortlidge
24f5632ca1 Frontend: Implement optional parsing diagnostics for enabled language features.
Parsing for `-enable-upcoming-feature` and `-enable-experimental-feature` is
lenient by default because some projects need to be compatible with multiple
language versions and compiler toolchains simultaneously, and strict
diagnostics would be a nuisance. On the other hand, though, it would be useful
to get feedback from the compiler when you attempt to enable a feature that
doesn't exist. This change splits the difference by introducing new diagnostics
for potential feature enablement misconfigurations but leaves those diagnostics
ignored by default. Projects that wish to use them can specify `-Wwarning
StrictLanguageFeatures`.
2025-01-15 16:34:32 -08:00