Commit Graph

2434 Commits

Author SHA1 Message Date
Slava Pestov
3a92d2fc53 AST: Remove legacy GSB-based GenericSignature query implementation 2022-01-12 12:33:34 -05:00
Michael Gottesman
dd7aebfdc1 Merge pull request #40749 from gottesmm/pr-ae8e77c504f54100333e665adf46386b43e516e1
[gardening] Make count on BlotSetVector const.
2022-01-08 13:40:40 -08:00
Michael Gottesman
2ce233b134 [gardening] Make count on BlotSetVector const.
Just discovered this as I working on other code.
2022-01-05 17:47:08 -08:00
Nuri Amari
130f2de7fd Improve ClangImporter failure diagnostics
This patch introduces new diagnostics to the ClangImporter to help
explain why certain C, Objective-C or C++ declarations fail to import
into Swift. This patch includes new diagnostics for the following entities:

- C functions
- C struct fields
- Macros
- Objective-C properties
- Objective-C methods

In particular, notes are attached to indicate when any of the above
entities fail to import as a result of refering an incomplete (only
forward declared) type.

The new diangostics are hidden behind two new flags, -enable-experimental-clang-importer-diagnostics
and -enable-experimental-eager-clang-module-diagnostics. The first flag emits diagnostics lazily,
while the second eagerly imports all declarations visible from loaded Clang modules. The first
flag is intended for day to day swiftc use, the second for module linting or debugging the importer.
2022-01-02 12:43:59 -05:00
Erik Eckstein
3540c01125 rename initializeLibSwift -> InitializeSwiftModules
and some updates in comments.
2021-12-22 11:31:52 +01:00
Rintaro Ishizaki
473ecd8c80 Merge pull request #40645 from rintaro/sourcekit-compilerserver
[SourceKit] Add a request to generate object files in SourceKit
2021-12-21 22:29:11 -08:00
Doug Gregor
78e5846537 Add a feature for Builtin.assumeAlignment
Fixes rdar://86785846
2021-12-21 15:56:15 -08:00
Rintaro Ishizaki
7c92a8e555 [SourceKit] Add a request to generate object files in SourceKit
Add 'request.compile'
2021-12-21 14:35:38 -08:00
Alex Hoppen
669e3f34a6 Merge pull request #40155 from ahoppen/pr/improve-module-search-path-lookup
[Serialization] Improve module loading performance
2021-12-20 18:09:17 +01:00
Xi Ge
77f08f9396 Merge pull request #40585 from nkcsgexi/86559811 2021-12-16 07:40:05 -08:00
Xi Ge
28eef324d0 Frontend: support emitting ABI descriptor when specifying the path in supplementary output map. rdar://86559811 2021-12-15 22:42:15 -08:00
Slava Pestov
c1384f36a8 SIL: Add -disable-subst-sil-function-types flag to work around type lowering bugs 2021-12-15 12:14:34 -05:00
Alex Hoppen
fe7878ecce [Serialization] Improve module loading performance
When looking for a Swift module on disk, we were scanning all module search paths if they contain the module we are searching for. In a setup where each module is contained in its own framework search path, this scaled quadratically with the number of modules being imported. E.g. a setup with 100 modules being imported form 100 module search paths could cause on the order of 10,000 checks of `FileSystem::exists`. While these checks are fairly fast (~10µs), they add up to ~100ms.

To improve this, perform a first scan of all module search paths and list the files they contain. From this, create a lookup map that maps filenames to the search paths they can be found in. E.g. for
```
searchPath1/
  Module1.framework

searchPath2/
  Module1.framework
  Module2.swiftmodule
```
we create the following lookup table
```
Module1.framework -> [searchPath1, searchPath2]
Module2.swiftmodule -> [searchPath2]
```
2021-12-14 12:44:13 +01:00
Robert Widmann
0182414382 Eliminate Superfluous Trivial Copy Constructors
These force an implicit copy-assignment operator to be generated which is a deprecated behavior in modern C++.
2021-12-13 12:25:30 -08:00
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