Commit Graph

4421 Commits

Author SHA1 Message Date
Max Desiatov
04d077d353 docs: clarify sccache installation in Docker containers (#61446) 2022-10-07 09:44:57 -07:00
Alex Lorenz
407e8a6b1c [interop][SwiftToCxx] update status doc for class init support
Class initializers are supported.
Also mention that methods aren't virtual ATM.
2022-10-07 09:05:07 -07:00
Luciano Almeida
be8e7dbb35 Merge pull request #61399 from MarcoEidinger/spiOnlyDocImpr
[Docs] improve @_spiOnly attribute info
2022-10-05 12:44:15 -03:00
Erik Eckstein
66f07fe3da Swift SIL: rework function effects and add function side-effects
So far, function effects only included escape effects.
This change adds side-effects (but they are not computed, yet).
It also involves refactoring of the existing escape effects.
Also the SIL effect syntax changed a bit. Details are in docs/SIL.rst
2022-10-05 07:38:11 +02:00
Erik Eckstein
81ac311c83 Swift Optimizer: add the DeadEndBlocks utility for finding dead-end blocks.
Dead-end blocks are blocks from which there is no path to the function exit (`return`, `throw` or unwind).
These are blocks which end with an unreachable instruction and blocks from which all paths end in "unreachable" blocks.
2022-10-05 07:37:41 +02:00
swift-ci
75548fc49d Merge pull request #61439 from meg-gupta/fixdoc
[NFC] Update store_borrow specification
2022-10-04 14:33:42 -07:00
swift-ci
9811f774fd Merge pull request #61198 from beccadax/the-names-of-const
[NFC] Emit descriptive string constant names
2022-10-04 12:27:37 -07:00
Meghana Gupta
f6451bc059 Update store_borrow specification 2022-10-04 11:08:55 -07:00
Marco Eidinger
9c23df238c [Docs] improve @_spiOnly attribute info
Related to b680084748
2022-09-30 18:09:33 -07:00
Egor Zhdan
be972c2ab0 Merge pull request #61354 from apple/egorzhdan/cxx-docs-update
[cxx-interop][docs] Update getting started guide
2022-09-30 13:02:03 +01:00
Max Desiatov
46a032f0d9 docs: link to Ubuntu 22.04 deps in GettingStarted.md
Currently, only a link to Ubuntu 20.04 dependencies is present. Those dependencies won't work for Ubuntu 22.04.
2022-09-29 22:58:54 +01:00
Egor Zhdan
e8ae3f7100 [cxx-interop][docs] Update getting started guide
* Do not use `Cxx` as a user module name, since we now ship a built-in module called `Cxx`.
* Describe creating an Xcode target that builds the C++ module.
* Do not provide libc++ include paths manually to the Swift compiler, Swift should detect the C++ stdlib automatically.
2022-09-29 18:47:15 +01:00
swift-ci
f49c2f1cd9 Merge pull request #61308 from hyp/eng/raw-enum-test
[interop][SwiftToCxx] NFC, add a test for raw representable enum
2022-09-26 22:03:26 -07:00
Alex Lorenz
717c29992d [interop][SwiftToCxx] NFC, add a test for raw representable enum 2022-09-26 19:37:27 -07:00
Alex Lorenz
fd936c5025 [interop][SwiftToCxx] update status doc for static property support 2022-09-26 18:08:14 -07:00
Andrew Trick
76bf8a0117 Add debug_value [trace] to SIL.rst 2022-09-26 08:59:54 -07:00
Alex Lorenz
b04fd155b9 [interop][docs] update status page for recent generic enum, Array and Optional changes 2022-09-22 20:57:58 -07:00
Slava Pestov
10cc835d11 docs: Work-in-progress generics implementation documentation 2022-09-22 14:24:58 -04:00
Becca Royal-Gordon
04f82b424c [NFC] Emit descriptive string constant names
Modify IRGen to emit “anonymous” string constants with names of the form `@.str.<len>.<contents>` (with a special mangling for internal `\0` characters). This makes it much easier to write IRGen tests that check for the contents of strings, because matching the constant name also implies that the constant has the expected content.
2022-09-21 11:40:15 -07:00
buttaface
c4c48c0e84 [android] Update to LTS NDK 25b (#60938)
Also, remove `SWIFT_ANDROID_NDK_CLANG_VERSION` and just extract the
resource directory from the NDK using `file(GLOB)`.
2022-09-21 10:46:29 -07:00
Erik Eckstein
a8b58735fc Swift Optimizer: improve ergonomics of EscapeUtils
Replace the `struct EscapeInfo` with a simpler API, just consisting of methods of `ProjectedValue` and `Value`:
* `isEscaping()`
* `isAddressEscaping()`
* `visit()`
* `visitAddress()`
2022-09-19 14:39:10 +02:00
Erik Eckstein
2137e41502 Swift SIL: add ProjectedValue.
A projected value consists of the original value and a projection path.
For example, if the `value` is of type `struct S { var x: Int }` and `path` is `s0`, then the projected value represents field `x` of the original value.

Also, use ProjectedValue instead of AccessStoragePath.
2022-09-19 11:30:35 +02:00
Pavel Yaskevich
5190d9dd24 Merge pull request #61136 from amritpan/update-output-example
[Documentation] Update type checker output example to match new debug output.
2022-09-15 13:07:13 -07:00
Amritpan Kaur
7ed3763503 Update Type Checker output example. 2022-09-14 20:32:56 -07:00
eeckstein
cedd2c51ee Merge pull request #61057 from gottesmm/pr-3984492b3bbec784cf4495388af69cd65fe0f56a
[SIL.rst] Fix warning.
2022-09-13 10:22:14 +02:00
Michael Gottesman
deaaea0f99 [SIL.rst] Fix warning. 2022-09-12 14:49:53 -07:00
nate-chandler
6075af2652 Merge pull request #61048 from nate-chandler/no_eager_move_attr
Renamed _noEagerMove attribute.
2022-09-12 13:14:32 -07:00
Nate Chandler
5642a46378 Renamed _noEagerMove attribute.
Avoid introducing extra terminology via an underscored attribute.

rdar://99723104
2022-09-12 08:21:18 -07:00
Erik Eckstein
8e2e7a73c5 SIL: make argument effects more readable in textual SIL
So far, argument effects were printed in square brackets before the function name, e.g.
```
sil [escapes !%0.**, !%1, %1.c*.v** => %0.v**] @foo : $@convention(thin) (@guaranteed T) -> @out S {
bb0(%0 : $*S, %1 : @guaranteed $T):
...
```

As we are adding more argument effects, this becomes unreadable.
To make it more readable, print the effects after the opening curly brace, and print a separate line for each argument. E.g.
```
sil [ossa] @foo : $@convention(thin) (@guaranteed T) -> @out S {
[%0: noescape **]
[%1: noescape, escape c*.v** => %0.v**]
bb0(%0 : $*S, %1 : @guaranteed $T):
...
```
2022-09-12 09:14:54 +02:00
Michael Gottesman
0a16cc362a [move-only] Implement an initial version of the move only address checker.
Some notes:

1. I added support for both loadable/address only types.

2. These tests are based off of porting the move only object tests for inout,
vars, mutating self, etc.

3. I did not include already written tests for address only types in this
specific merge since I need to change us to borrow move only var like types.
Without that, we get a lot of spurious error msgs and the burden of writing that
is not worth it. So instead in a forthcoming commit where I fix that issue in
SILGen, I will commit the corresponding address only tests for this work.

4. I did not include support for trivial types in this. I am going to do
object/address for that at the same time.
2022-09-11 18:57:32 -07:00
Alexis Laferrière
7b9d4e645c Merge pull request #61011 from xymus/spi-only-exportability
[Sema] Check exportability of @_spiOnly imported decls
2022-09-09 11:56:24 -07:00
Alex Lorenz
0914496c86 [cxx-interop] update status docs for reverse experimental String and Array support 2022-09-09 09:33:25 -07:00
Alex Lorenz
8b4b397257 [cxx-interop] update status docs for generics reverse support and enum members 2022-09-09 09:30:43 -07:00
Alexis Laferrière
d1e36b0a12 [Sema|lit] Intro lit substitution for generating the 2 swiftinterfaces
Intro the lit substitution
`%target-swift-emit-module-interfaces(Main.swiftinterface,
Main.private.swiftinterface` to generate both the public and private
swiftinterface. And use it in spi-only-import-exportability.swift.

To verify the generated interfaces I would recommend to keep two calls
to `%target-swift-typecheck-module-from-interface` as each is a
different invocation likely to fail.
2022-09-09 09:20:51 -07:00
Tongjie Wang
5a55cd7ba2 [Interop][SwiftToCxx] Support printing methods and properties for enums 2022-09-08 11:05:20 -07:00
Erik Eckstein
97b2354be6 SIL: add needsStackProtection flags for address_to_pointer and index_addr instructions.
Also add new "unprotected" variants of the `addressof` builtins:
* `Builtin.unprotectedAddressOf`
* `Builtin.unprotectedAddressOfBorrow`
2022-09-08 08:42:22 +02:00
Erik Eckstein
fdca208335 SIL: add the SILFunction.needsStackProtection flag
Indicates that stack protectors are inserted into this function to detect stack related buffer overflows.
2022-09-08 08:37:21 +02:00
Hamish Knight
b12015c343 [SIL] Introduce the increment_profiler_counter instruction
This is a dedicated instruction for incrementing a
profiler counter, which lowers to the
`llvm.instrprof.increment` intrinsic. This
replaces the builtin instruction that was
previously used, and ensures that its arguments
are statically known. This ensures that SIL
optimization passes do not invalidate the
instruction, fixing some code coverage cases in
`-O`.

rdar://39146527
2022-09-07 17:55:13 +01:00
Robert Widmann
604f29945d Merge pull request #60759 from DevYeom/indentation_rst_files
Fix indentation of sample code in rst files.
2022-09-06 14:31:40 -07:00
QuietMisdreavus
f674b473ec introduce a @_documentation(...) attribute to influence SymbolGraphGen (#60242)
* add @_documentation(...) attribute to influence SymbolGraphGen

rdar://79049241
2022-09-06 14:12:42 -06:00
Alexis Laferrière
7ed3ed8167 [Docs] Document the @_spiOnly attribute 2022-09-01 15:18:40 -07:00
Andrew Trick
c14059e92c [comment] Add a semantics note to SIL BindMemory 2022-08-29 13:20:45 -07:00
Alex Lorenz
64b90e8245 [interop][SwiftToCxx] docs: add section on converting Swift's String to NSString * 2022-08-25 15:25:46 -07:00
eeckstein
937d3b9079 Merge pull request #60745 from eeckstein/swift-sil-infrastructure
Add some swift SIL+Optimizer infrastructure
2022-08-25 07:21:53 +02:00
DevYeom
f0cc6df0da Fix indentation of sample code in rst files. 2022-08-25 09:20:57 +09:00
Alex Lorenz
8de79390be [interop][SwiftToCxx] add @_expose(Cxx) attribute support
This attribute instructs the compiler that this declaration should be included in the generated C++ bindings
2022-08-24 10:14:07 -07:00
Erik Eckstein
1407846656 docs: update SIL-Utilities.md
And move it out of the "proposals" folder, directly into "docs". It's now more a documentation of what we have and useful as a programming guide.
2022-08-24 18:18:50 +02:00
Evan Wilde
943852d491 Merge pull request #60686 from Jager-yoo/fix-typo-meantime
[docs] Fix typo in DevelopmentTips.md
2022-08-24 07:42:44 -07:00
nate-chandler
064b713db0 Merge pull request #60599 from nate-chandler/eager_move
Add hooks for emitting lifetimes.
2022-08-22 19:34:27 -07:00
a4z
f96bfb2914 Adopt Cxx header/implementation in example
* Fix header/implemenation content in C++ code listning
* Minor whitespace fix in caption
2022-08-22 20:21:04 +02:00