Commit Graph

2420 Commits

Author SHA1 Message Date
Holly Borla
69be7b17fc Merge pull request #40282 from hborla/existential-any
[SE-0335] Introduce existential `any`
2021-12-10 08:56:03 -08:00
Holly Borla
7cdda6dc80 [FrontendOptions] Add a frontend flag -enable-explicit-existential-types
to enable the 'any' keyword.
2021-12-09 09:26:12 -08:00
Slava Pestov
c1339240cd RequirementMachine: Add flags to enable and disable merged associated types
On by default, no change from current behavior. I'm going to try turning
this off (and hopefully ripping it out entirely) once I fix a few bugs.
2021-12-08 21:32:42 -05:00
Michael Gottesman
2e018aff5b [move-function] Implement move function support for address only vars.
I have to make a few other changes to make this work for loadable vars, but I
wanted to get this in.

Behind a flag.
2021-12-07 12:03:01 -08:00
Alex Hoppen
1739c23a9b Merge pull request #40158 from ahoppen/pr/cancel-code-completion
[SourceKit] Support cancellation of code completion like requests
2021-12-07 17:10:05 +01:00
Xi Ge
b8a2d0752f Merge pull request #40379 from apple/revert-40368-revert-40357-obfuscate-searialized-paths
Re-apply "serialization: obfuscate the serialized search paths"
2021-12-02 19:21:04 -08:00
Holly Borla
47b375fb3f Merge pull request #40361 from hborla/enable-structural-opaque-types
[SE-0328] Enable structural opaque result types.
2021-12-02 15:00:18 -08:00
Xi Ge
6377c3a742 Revert "Revert "serialization: obfuscate the serialized search paths"" 2021-12-02 13:21:04 -08:00
Saleem Abdulrasool
11d5d6d4ca Revert "serialization: obfuscate the serialized search paths" 2021-12-02 08:18:23 -08:00
Alex Hoppen
9042536323 [SourceKit] Move the cancellation flag from TypeCheckerOptions to ASTContext
We need to modify the pointer pointing to the cancellation flag when reusing an ASTContext for code completion. This is not possible by the previous design because `TypeCheckerOptions` was `const`. Moving the cancellation flag to `ASTContext` will also allow other stages of the compiler to honor a cancellation request.
2021-12-02 12:57:34 +01:00
Xi Ge
0047d81f9a serialization: obfuscate the serialized search paths
We noticed some Swift clients rely on the serialized search paths in the module to
find dependencies and droping these paths altogether can lead to build failures like
rdar://85840921.

This change teaches the serialization to obfuscate the search paths and the deserialization
to recover them. This allows clients to keep accessing these paths without exposing
them when shipping the module to other users.
2021-12-01 11:47:41 -08:00
Holly Borla
9196c9ad41 [FrontendOptions] Enable structural opaque result types and remove
the -enable-experimental-structural-opaque-types frontend flag.
2021-11-30 15:41:23 -08:00
Kuba (Brecka) Mracek
c89eca6c34 Enforce consistent usage of -experimental-hermetic-seat-at-link flag (#39986)
We've recently added the -experimental-hermetic-seal-at-link compiler flag,
which turns on aggressive dead-stripping optimizations and assumes that library
code can be optimized against client code because all users of the library
code/types are present at link/LTO time. This means that any module that's
built with -experimental-hermetic-seal-at-link requires all clients of this
module to also use -experimental-hermetic-seal-at-link. This PR enforces that
by storing a bit in the serialized module, and checking the bit when importing
modules.
2021-11-30 10:44:58 -08:00
Saleem Abdulrasool
349af3707d Merge pull request #40305 from compnerd/semitruck
gardening: make c++98-compat-extra-semi an error
2021-11-30 08:18:36 -08:00
Ben Barham
e78abc2b80 Merge pull request #40319 from bnbarham/loc-leaks
[AST] Prevent memory leak when allocating `ExternalSourceLocs`
2021-11-30 19:58:07 +10:00
Pavel Yaskevich
bc54bc6bb7 Revert "[TypeChecker] SE-0326: Enable multi-statement closure inference by default" 2021-11-29 17:26:08 -08:00
Ben Barham
50a73a3965 [AST] Prevent memory leak when allocating ExternalSourceLocs
c763ab5d1e fixed an issue in
`getSerializedLocs` where it never actually cached its result (and thus
always allocated a new `CachedExternalSourceLocs`). Unfortunately it
missed a leak that could occur when `DocRanges` grows beyond its initial
size of 4.

Allocate `DocRanges` upfront in the `ASTContext` as well in order to
prevent this leak.

Resolves rdar://85472403.
2021-11-30 10:31:31 +10:00
Saleem Abdulrasool
910fbee14e gardening: make c++98-compat-extra-semi an error
This cleans up 90 instances of this warning and reduces the build spew
when building on Linux.  This helps identify actual issues when
building which can get lost in the stream of warning messages.  It also
helps restore the ability to build the compiler with gcc.
2021-11-27 11:40:17 -08:00
Slava Pestov
163293e6f9 RequirementMachine: Split up -requirement-machine-generic-signatures flag into -requirement-machine-{abstract,inferred}-signatures 2021-11-19 17:06:00 -05:00
swift-ci
17f1cf9297 Merge pull request #40240 from rxwei/string-processing-module 2021-11-19 12:12:06 -08:00
Richard Wei
65bffd7ad7 Add _MatchingEngine and _StringProcessing modules.
These modules are part of the experimental declarative string processing feature. If accepted to the Standard Library, _StringProcessing will be available via implicit import just like _Concurrency, though _MatchingEngine will still be hidden as an implementation detail.

`_MatchingEngine` will contain the general-purpose pattern matching engine ISA, bytecode, and executor. `_StringProcessing` will contain regular expression and pattern matching APIs whose implementation depends on the matching engine..

Also consolidates frontend flag `-enable-experimental-regex` as `-enable-experimental-string-processing`.

Resolves rdar://85478647.
2021-11-19 09:27:33 -08:00
Doug Gregor
6d5d23aa18 Add a feature flag for Builtin.stackAlloc and friends
... and use it in inlinable code so older compilers don't break on
newer standard libraries, fixing rdar://85574956.
2021-11-18 21:00:05 -08:00
Pavel Yaskevich
63f355fde0 Merge pull request #39989 from xedin/more-diag-improvements-for-multi-stmt-closures
[TypeChecker] SE-0326: Enable multi-statement closure inference by default
2021-11-17 10:14:58 -08:00
Pavel Yaskevich
b231cdeed4 [TypeChecker] SE-0326: Enable multi-statement closure inference by default 2021-11-15 18:32:40 -08:00
John McCall
c5c78c55f2 Add an insertAtFront method to the list merger.
The existing insert method preserves insertion order, but the
atomic queue use case actually wants to *reverse* the natural
insertion order.
2021-11-15 17:28:51 -05:00
Michael Ilseman
2740e2707c Experimental Regex Strawperson (use Swift in the parser) (#40117)
[regex] Use Swift in the parser

Add in a strawperson use of Swift by the parser, for
future regex support.
2021-11-14 07:11:47 -07:00
Artem Chikin
b10696ed5f Merge pull request #40160 from artemcm/SwiftScanTargetInfoQuery
Add `libSwiftScan` entry-point to query target info.
2021-11-13 09:16:09 -08:00
Artem Chikin
40a1b321f5 Add libSwiftScan entry-point to query target info.
This provides the library with functionality to answer `-print-target-info` queries in place of calls to `swift-frontend`.
2021-11-12 11:01:45 -08:00
Slava Pestov
d0a8abb533 RequirementMachine: Add -requirement-machine-generic-signatures flag
Just as with the others, this has three values: on, off, and verify.
Not hooked up for now.
2021-11-12 00:32:43 -05:00
Arnold Schwaighofer
dcfd916761 Define a feature for _specialize with availability
rdar://84782342
2021-10-30 06:16:27 -07:00
Michael Gottesman
f9122a79b7 [moveOnly] Implement a new _copy function that performs an explicit copy value.
The key thing is that the move checker will not consider the explicit copy value
to be a copy_value that can be rewritten, ensuring that any uses of the result
of the explicit copy_value (consuming or other wise) are not checked.

Similar to the _move operator I recently introduced, this is a transparent
function so we can perform one level of specialization and thus at least be
generic over all concrete types.
2021-10-29 15:37:46 -07:00
Michael Gottesman
44bd180d85 [moveOnly] Add a frontend flag -enable-experimental-move-only to control usage of move only features.
These include _move and @_noImplicitCopy. I still need to wire up the parsing of
those behind this feature.

The reason that I am adding this now is that I am going to now need to make some
changes behind a feature flag and I have not yet needed to add one. The specific
reason I needed to add one here is to ensure that I properly guard inside _move
the call to Builtin.move so as to prevent a "cond_fail" incident.

P.S.: This work depends on experimental lexical lifetimes being enabled as well,
so I did that at the same time in this PR.
2021-10-27 18:45:33 -07:00
Michael Gottesman
ac85770329 [moveOnly] Add a feature for BuiltinMove that we can use to prevent cond_fail errors.
We use it in a subsequent commit in this PR to guard BuiltinMove.
2021-10-27 18:45:33 -07:00
John McCall
28c07c56bd [NFC] Add a utility for handling sorted linked lists
We'll be using this in the default actor implementation.
2021-10-21 21:46:55 -04:00
Nate Chandler
42f318d9ef [Basic] Renamed GraphNodeWorklist.
Addressed the TODO saying that DAGNodeWorklist should be renamed
GraphNodeWorklist.
2021-10-18 08:55:13 -07:00
Ben Barham
624337148b [NFC] Formatting cleanup to help with next conflicts 2021-10-15 17:15:51 +10:00
Nate Chandler
23a9a1d4c9 Moved lexical lifetime flag to SILOptions.
Previously, the flag was a LangOptioins.  That didn't make much sense because
this isn't really a user-facing behavior.  More importantly, as a member
of that type type it couldn't be accessed when setting up pass
pipelines.  Here, the flag is moved to SILOptions.
2021-10-13 13:47:44 -07:00
Slava Pestov
ab2a799b99 Merge pull request #39700 from slavapestov/two-rqm-fixes
RequirementMachine: Fix a couple of minor problems
2021-10-12 14:25:54 -04:00
Slava Pestov
6ee74b35db RequirementMachine: Bump default step limit from 2000 to 4000 2021-10-11 23:06:19 -04:00
Xi Ge
2d43a9259e Frontend: teach final module emitting jobs to dump a placeholder file for module semantic info
This additional supplement output should capture semantic info the compiler has
captured while building a Swift module. Similar to the source info file, the content of
the semantic info file should only be consumed by local tooling written in Swift.
2021-10-11 18:19:26 -07:00
Mishal Shah
c2fd49cebb Merge pull request #39473 from apple/rebranch
Update swift:main to support llvm-project:stable/20210726 changes (Rebranch merge)
2021-10-11 09:00:51 -07:00
Slava Pestov
5fd48a08a1 Merge pull request #39629 from slavapestov/rqm-protocol-signatures
RequirementMachine: Wire up protocol requirement signature minimization
2021-10-09 22:30:05 -04:00
Slava Pestov
0e21d85325 RequirementMachine: Add -requirement-machine-protocol-signatures= flag
There are three settings, on, off and verify. Not hooked up quite yet.
2021-10-09 19:11:14 -04:00
Pavel Yaskevich
790b5499b9 Merge pull request #38577 from xedin/multi-statement-closure-type-checking
[TypeChecker] Incremental multi-statement closure type-checking (disabled by default)
2021-10-09 11:49:13 -07:00
Doug Gregor
e845af8fc2 Merge pull request #39550 from DougGregor/require-explicit-sendable
Add `-require-explicit-sendable` to warn about non-Sendable public types
2021-10-08 16:13:06 -07:00
Pavel Yaskevich
a1c0823f46 [AST] Add a flag to guard exprimental multi-statement closures feature 2021-10-08 10:08:00 -07:00
Alexis Laferrière
a34953ece9 [Sema] Intro flag to limit availability checks to the API
Intro the frontend flag `-check-api-availability-only` that limits
availability checking to the API and SPI. This mode doesn't check the
availability of non-inlinable function bodies and of non-ABI-public decl
signatures.

This mode goal is to check all that is printed in the swiftinterface
file. It should be used in place of the wider
`-disable-availability-checking` when generating an interface for
platforms with no binaries.

rdar://81679692
2021-10-07 17:14:55 -07:00
Doug Gregor
bc4ae04f1f Add -require-explicit-sendable to warn about non-Sendable public types
Introduce a compiler flag that warnings about any public types defined in
a module that are neither explicitly `Sendable` nor explicitly
non-`Sendable` (the latter of which has no spelling currently), which
is intended to help with auditing a module for Sendable conformances.
2021-10-06 12:30:57 -07:00
swift-ci
3f8fea8508 Merge remote-tracking branch 'origin/main' into rebranch 2021-10-06 10:17:29 -07:00
Richard Howell
140c02466a Add -prefix-serialized-debugging-options (#39555)
This commit adds a new frontend flag that applies debug path prefixing to the
paths serialized in swiftmodule files. This makes it possible to use swiftmodule
files that have been built on different machines by applying the inverse map
when debugging, in a similar fashion to source path prefixing.

The inverse mapping in LLDB will be handled in a follow up PR.

Second pass at #39138

Tests updated to handle windows path separators.

This reverts commit f5aa95b381.
2021-10-04 22:41:32 -07:00