Commit Graph

16 Commits

Author SHA1 Message Date
Allan Shortlidge
082f0ac4b5 Tests: Use a more natural spelling for ABI triple lit substitutions.
`%target-swift-5.8-abi-triple` instead of `%target-swift-abi-5.8-triple`, for
example.
2024-10-18 10:11:36 -07:00
Alexis Laferrière
8714b6592e Tests: Use a Swift version where actors are available for skip-function-bodies 2024-04-01 15:23:33 -07:00
Alexis Laferrière
1e4b75d5b5 Parser: Don't skip nested protocols for LLDB 2024-03-29 16:36:09 -07:00
Alexis Laferrière
6e0334240c Parser: Don't skip functions with a nested typealias or actor for LLDB
The flag -experimental-skip-non-inlinable-function-bodies-without-types
is built in the emit-module-separately phase to quickly extract the API
of the target module. It is designed to not skip functions with nested
types as these are used by LLDB.

This logic relies on a simple heuristic to find nested type. Let's make
sure it detects tyealiases and actors.

rdar://120928396
2024-03-29 16:11:41 -07:00
Allan Shortlidge
84098f9fb1 Sema: Always mark initializers of lazy vars as subsumed.
Previously, the initializer expressions of lazy vars would only be marked as
subsumed when the getter body for the var was synthesized. This didn't work
with `-experimental-lazy-typechecking` since accessor synthesis was not
guaranteed to happen. Consequently, SILGen would emit the initializer even
though it was already subsumed and then assert/crash since the init had also
not been checked and contextualized. Now lazy var inits are marked subsumed in
the request creating storage.

Resolves rdar://118421753
2023-11-16 18:01:54 -08:00
Allan Shortlidge
1d8fc104c3 AST/SILGen: Requestify function body skipping.
Function bodies are skipped during typechecking when one of the
-experimental-skip-*-function-bodies flags is passed to the frontend. This was
implemented by setting the "body kind" of an `AbstractFunctionDecl` during decl
checking in `TypeCheckDeclPrimary`. This approach had a couple of issues:

- It is incompatible with skipping function bodies during lazy typechecking,
  since the skipping is only evaluated during a phase of eager typechecking.
- It prevents skipped function bodies from being parsed on-demand ("skipped" is
  a state that is distinct from "parsed", when they ought to be orthogonal).
  This needlessly prevented complete module interfaces from being emitted with
  -experimental-skip-all-function-bodies.

Storing the skipped status of a function separately from body kind and
requestifying the determination of whether to skip a function solves these
problems.

Resolves rdar://116020403
2023-09-28 19:18:35 -07:00
Allan Shortlidge
62d1fe4097 Tests: Re-design skip-function-bodies.swift test.
The skip-function-bodies.swift test previously relied on `-emit-sorted-sil` to
control the order of SIL emission for matching CHECK: lines. I found that this
made the test too difficult to evolve, so I've re-written the test to instead
use SILGen's natural output order. This makes it much more straightforward to
add new test cases at the right location in the file.

There are a number of additional improvements to the test:
- SILGen without any function body skipping is now checked as a baseline to
  ensure that all the checks are in the right order. Previously, most of the
  negative CHECK lines were not properly ordered in the file, so they could have
  missed regressions.
- Every declaration in the test has a set of exhaustive CHECK lines covering
  each of the outputs explicitly. While more verbose, it should be clearer what
  is expected for every declaration.
- Module interfaces are emitted with the proper flags and are typechecked to
  verify they are valid.
- Superfluous diagnostics (e.g. unused variables) have been minimized to
  improve the experience of debugging failures.
2023-09-26 13:32:10 -07:00
Allan Shortlidge
8a88dd2362 Revert "Tests: Re-design skip-function-bodies.swift test."
This reverts commit 43e36cc184.
2023-09-26 13:20:13 -07:00
Allan Shortlidge
43e36cc184 Tests: Re-design skip-function-bodies.swift test.
The skip-function-bodies.swift test previously relied on `-emit-sorted-sil` to
control the order of SIL emission for matching CHECK: lines. I found that this
made the test too difficult to evolve, so I've re-written the test to instead
check SILGen's output by extracting just the `string_literal` lines and then
sorting them. This makes it much more straightforward to add new test cases at
the right location in the file.

There are a number of additional improvements to the test:
- SILGen without any function body skipping is now checked as a baseline to
  ensure that all the checks are in the right order. Previously, most of the
  negative CHECK lines were not properly ordered in the file, so they could have
  missed regressions.
- Every declaration in the test has a set of exhaustive CHECK lines covering
  each of the outputs explicitly. While more verbose, it should be clearer what
  is expected for every declaration.
- Module interfaces are emitted with the proper flags and are typechecked to
  verify they are valid.
- Superfluous diagnostics (e.g. unused variables) have been minimized to
  improve the experience of debugging failures.
2023-09-26 10:22:46 -07:00
Allan Shortlidge
bb035af00e Tests: Split skip-function-bodies.swift into multiple tests.
This makes the main skip-function-bodies.swift test easier to maintain because
there are fewer `RUN:` lines to wade through in the output. The early `RUN:`
lines that redirect stderr to stdout were also making iterative debugging very
painful.
2023-09-23 23:30:44 -07:00
Allan Shortlidge
51e61aab0a Tests: Re-enable skip-function-bodies.swift.
It doesn't appear to be failing anymore.
2023-09-22 17:46:49 -07:00
Andrew Trick
f428b512cc [test] Disable tests until we fix _StringProcessing #59653
These are failing due to #42611.
2022-06-23 14:09:23 -07:00
Ben Barham
79b7d5fa99 [Frontend] Disable skipping any function bodies for SwiftOnoneSupport 2020-11-16 15:09:53 +10:00
Alexis Laferrière
02c134372f [Sema] Add option to skip non-inlinable functions without types
This frontend flag can be used as an alternative to
-experimental-skip-non-inlinable-function-bodies that doesn’t skip
functions defining nested types. We want to keep these types as they are
used by LLDB. Other functions ares safe to skip parsing and
type-checking.

rdar://71130519
2020-11-12 14:28:09 -08:00
Alexis Laferrière
92d2c236b8 [Tests] Fix and refactor skip-function-bodies.swift 2020-11-12 14:22:22 -08:00
Ben Barham
7cee600bcd [SILGen] Add flag to skip typechecking and SIL gen for function bodies
Adds a new flag "-experimental-skip-all-function-bodies" that skips
typechecking and SIL generation for all function bodies (where
possible).

`didSet` functions are still typechecked and have SIL generated as their
body is checked for the `oldValue` parameter, but are not serialized.
Parsing will generally be skipped as well, but this isn't necessarily
the case since other flags (eg. "-verify-syntax-tree") may force delayed
parsing off.
2020-11-06 12:08:19 +10:00