Commit Graph

1288 Commits

Author SHA1 Message Date
Slava Pestov
0310a701d9 AST: Remove EnableASTScope flag and force it to always be on 2020-09-04 16:15:36 -04:00
Nathan Hawes
e882f15a1a Manually merge remote-tracking branch 'upstream/master' into HEAD
Conflicts:
	lib/Frontend/CompilerInvocation.cpp
	lib/Frontend/ModuleInterfaceLoader.cpp
	lib/Serialization/ModuleFile.cpp
2020-09-03 11:31:12 -07:00
Xi Ge
e107182f1a Merge remote-tracking branch 'apple/master' into master-rebranch 2020-09-02 18:36:37 -07:00
swift_jenkins
83745d90e0 Merge remote-tracking branch 'origin/master' into master-next 2020-09-02 13:50:40 -07:00
Kuba (Brecka) Mracek
5bf15f81b1 Add a -ignore-always-inline frontend flag which ignores @inline(__always) attributes. (#33466) 2020-09-01 20:20:09 -07:00
swift_jenkins
258b72273c Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-24 21:36:02 -07:00
swift_jenkins
adf903d271 Merge remote-tracking branch 'origin/master' into master-next 2020-08-24 20:52:27 -07:00
Brent Royal-Gordon
8fbd449501 Merge pull request #33114 from brentdax/check-your-interfaces-at-the-door
Verify that just-emitted module interfaces parse and typecheck
2020-08-24 20:33:58 -07:00
swift_jenkins
21c2e0ebac Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-20 20:54:07 -07:00
swift_jenkins
ba4b0bf393 Merge remote-tracking branch 'origin/master' into master-next 2020-08-20 20:09:45 -07:00
Xi Ge
29e655bac0 DependenciesScanner: implement protocol for batch module dependencies scan
This scanning mode allows swift-driver to query module dependencies in a batch
and in a more granular way. In short term, it could help solve a problem that
clang module dependencies may vary if target triple changes. In a longer term,
we could break a holistic dependencies graph into smaller pieces for better caching
and reusing.

This change doesn't include the implementation of using the specified scanner
arguments to set up Clang dependencies scanner. It will come in later commits.
2020-08-20 14:06:47 -07:00
Brent Royal-Gordon
3c69837102 Add a debug flag to emit invalid swiftinterface files 2020-08-07 16:00:15 -07:00
Nathan Hawes
ded5512cdc Manually merge remote-tracking branch 'upstream/master' into master-next 2020-08-06 10:42:21 -07:00
swift-ci
075dc7eedb Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-05 12:43:56 -07:00
Saleem Abdulrasool
8d21750ef3 Frontend: support dumping the JIT state
Add a debugging mechanism that enables the JIT to dump the LLVM IR and
object files to enable debugging the JIT.  This makes it easier to debug
the JIT mode failures.  The idea was from Lang Hames!
2020-08-05 09:13:49 -07:00
Nathan Hawes
8435dc7d20 Manually merge remote-tracking branch 'upstream/master' into HEAD 2020-08-04 14:21:08 -07:00
Nathan Hawes
607e2b8822 Manually merge remote-tracking branch 'upstream/master' into HEAD 2020-08-04 13:47:48 -07:00
Dario Rexin
7e60a73335 Merge pull request #33168 from drexin/wip-fix-resource-folder
Properly compute resource folder when linking statically
2020-08-04 12:52:38 -07:00
swift_jenkins
66ff05271c Merge remote-tracking branch 'origin/master' into master-next 2020-07-30 21:21:37 -07:00
swift-ci
18516c1549 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-30 20:46:19 -07:00
Xi Ge
1085746bc1 Merge pull request #33212 from nkcsgexi/pass-down-main-path
Front-end: pass down main executable path to the sub-ASTContext for building module interfaces. NFC
2020-07-30 19:38:49 -07:00
Dario Rexin
0850436d9f Properly compute resource folder when linking statically
- deduplicate the logic to compute the resource folder
- install headers and module files in shared and static resource folders
- forward -static flag when calling swiftc with -print-target-info
2020-07-30 15:07:03 -07:00
swift_jenkins
91782c03c7 Merge remote-tracking branch 'origin/master' into master-next 2020-07-30 15:06:53 -07:00
swift-ci
b04d3794a9 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-30 14:43:23 -07:00
Alexis Laferrière
fb364ae2b7 Merge pull request #33207 from xymus/spi-ioi-check-workaround
[ModuleInterface] Print some implementation-only imports in the private interface
2020-07-30 14:33:43 -07:00
Xi Ge
bfacad6f43 Front-end: pass down main executable path to the sub-ASTContext for building module interfaces. NFC 2020-07-30 12:17:02 -07:00
Alexis Laferrière
0cce54954a [ModuleInterface] Print some implementation-only imports in the private interface
Print implementation-only imports in the private textual interface
only if also importing SPI. This allows to export types from
implementation-only imports in SPI and brings the private textual
interfaces in line with the binary interfaces.

This is a temporary solution as we need to better design the language
feature around this.

This feature requires passing -experimental-spi-imports to the frontend
that generates the private swiftinterface file.
2020-07-30 09:20:12 -07:00
swift-ci
0d8e3e1d71 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-29 09:14:39 -07:00
swift_jenkins
ee07aa0f68 Merge remote-tracking branch 'origin/master' into master-next 2020-07-29 09:03:42 -07:00
Doug Gregor
41817229d5 Merge pull request #33147 from DougGregor/async-function-types
[Concurrency] Add `async` to the Swift type system.
2020-07-29 08:59:34 -07:00
swift-ci
113db8c6d8 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-28 14:43:59 -07:00
swift_jenkins
592089d570 Merge remote-tracking branch 'origin/master' into master-next 2020-07-28 14:43:34 -07:00
Artem Chikin
413bbab306 Merge pull request #33032 from artemcm/ExplicitPackageBuilds
[Dependency Scanner] Add a scanner for explicit placeholder module dependencies
2020-07-28 14:36:26 -07:00
swift-ci
0202740b0a Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-28 14:24:04 -07:00
swift_jenkins
d28c62b327 Merge remote-tracking branch 'origin/master' into master-next 2020-07-28 14:23:42 -07:00
Doug Gregor
06d322b211 [Concurrency] Rename -enable-experimental-async.
Use the more general name `-enable-experimental-concurrency` instead,
since async is one part of the model.
2020-07-28 09:38:54 -07:00
Doug Gregor
f6e9f352f0 [Concurrency] Add async to the Swift type system.
Add `async` to the type system. `async` can be written as part of a
function type or function declaration, following the parameter list, e.g.,

  func doSomeWork() async { ... }

`async` functions are distinct from non-`async` functions and there
are no conversions amongst them. At present, `async` functions do not
*do* anything, but this commit fully supports them as a distinct kind
of function throughout:

* Parsing of `async`
* AST representation of `async` in declarations and types
* Syntactic type representation of `async`
* (De-/re-)mangling of function types involving 'async'
* Runtime type representation and reconstruction of function types
involving `async`.
* Dynamic casting restrictions for `async` function types
* (De-)serialization of `async` function types
* Disabling overriding, witness matching, and conversions with
differing `async`
2020-07-27 18:18:03 -07:00
Artem Chikin
746e89b252 Rename external dependencies to placeholder dependencies. 2020-07-27 09:24:36 -07:00
Artem Chikin
c52982c9de Add option to accept external module dependency map as input
With: `-external-dependency-module-map-file`
2020-07-27 09:24:35 -07:00
Doug Gregor
1756979d8c [Trailing closures] Enable "fuzzy" heuristic by default everywhere.
SE-0286 states that the "fuzz" heuristic is part of the new language
behavior, so don't automatically disable it in Swift 6+ mode.
2020-07-24 08:10:54 -07:00
Doug Gregor
ed541f32e3 Forward matching of trailing closure arguments.
Introsuce a new "forward" algorithm for trailing closures where
the unlabeled trailing closure argument matches the next parameter in
the parameter list that can accept an unlabeled trailing closure.

The "can accept an unlabeled trailing closure" criteria looks at the
parameter itself. The parameter accepts an unlabeled trailing closure
if all of the following are true:

* The parameter is not 'inout'
* The adjusted type of the parameter (defined below) is a function type

The adjusted type of the parameter is the parameter's type as
declared, after performing two adjustments:

* If the parameter is an @autoclosure, use the result type of the
parameter's declared (function) type, before performing the second
adjustment.
* Remove all outer "optional" types.

For example, the following function illustrates both adjustments to
determine that the parameter "body" accepts an unlabeled trailing
closure:

    func doSomething(body: @autoclosure () -> (((Int) -> String)?))

This is a source-breaking change. However, there is a "fuzzy" matching
rule that that addresses the source break we've observed in practice,
where a defaulted closure parameter precedes a non-defaulted closure
parameter:

    func doSomethingElse(
       onError: ((Error) -> Void)? = nil,
       onCompletion: (Int) -> Void
    ) { }

    doSomethingElse { x in
      print(x)
    }

With the existing "backward" scan rule, the trailing closure matches
onCompletion, and onError is given the default of "nil". With the
forward scanning rule, the trailing closure matches onError, and there
is no "onCompletion" argument, so the call fails.

The fuzzy matching rule proceeds as follows:
* if the call has a single, unlabeled trailing closure argument, and
* the parameter that would match the unlabeled trailing closure
argument has a default, and
* there are parameters *after* that parameter that require an argument
(i.e., they are not variadic and do not have a default argument)

then the forward scan skips this parameter and considers the next
parameter that could accept the unlabeled trailing closure.

Note that APIs like doSomethingElse(onError:onCompletion:) above
should probably be reworked to put the defaulted parameters at the
end, which works better with the forward scan and with multiple
trailing closures:

    func doSomethingElseBetter(
       onCompletion: (Int) -> Void,
       onError: ((Error) -> Void)? = nil
    ) { }

    doSomethingElseBetter { x in
      print(x)
    }

    doSomethingElseBetter { x in
      print(x)
    } onError: { error in
      throw error
    }
2020-07-24 08:10:00 -07:00
swift-ci
cdcf7e3c56 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-22 17:04:32 -07:00
swift_jenkins
7b28a1f9cb Merge remote-tracking branch 'origin/master' into master-next 2020-07-22 17:00:02 -07:00
Alexis Laferrière
d9a88b948b Merge pull request #33052 from xymus/swiftmodule-files-are-volatile-opt
[Serialization] Move loading swiftmodule files as volatile behind a flag
2020-07-22 16:48:25 -07:00
Alexis Laferrière
2c66f0c75d [Serialization] Move loading swiftmodule files as volatile behind a flag
Introduce a new frontend flag -enable-volatile-modules to trigger
loading swiftmodule files as volatile and avoid using mmap. Revert the
default behavior to using mmap.
2020-07-22 12:04:44 -07:00
Nathan Hawes
9d4ed5f39c Manually merge remote-tracking branch 'upstream/master' into manually-merge-master-to-master-rebranch 2020-07-20 16:09:55 -07:00
swift_jenkins
a20879e924 Merge remote-tracking branch 'origin/master' into master-next 2020-07-18 21:58:25 -07:00
Xi Ge
f9396f2812 ModuleInterface: teach -compile-module-from-interface to emit forwarding module
-compile-module-from-interface action now takes arguments of -candidate-module-file.
If one of the candidate module files is up-to-date, the action emits a forwarding
module pointing to the candidate module instead of building a binary module.
2020-07-18 19:13:47 -07:00
Varun Gandhi
ee10198e9a Manually merge master into master-next.
Fixed merge conflicts in:
- lib/ClangImporter/ClangImporter.cpp
- lib/ClangImporter/ImportType.cpp
- lib/Frontend/CompilerInvocation.cpp
- lib/Serialization/ModuleFile.cpp
- lib/TBDGen/TBDGen.cpp
2020-07-15 21:36:13 -07:00
Xi Ge
8248f9c5fa Merge pull request #32856 from nkcsgexi/65488510
ModuleInterface: teach the compiler to look into SDK-versioned prebuilt module cache dir
2020-07-14 13:23:09 -07:00