Commit Graph

1064 Commits

Author SHA1 Message Date
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-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-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
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
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
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
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
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
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
Xi Ge
f5477d67af ModuleInterface: teach the compiler to look into SDK-versioned prebuilt module cache dir
To support multiple versions of SDKs of the same platform, we should move prebuilt
module cache into an SDK-versioned sub-directory and teach the compiler to look into
the directory if present.

rdar://65488510
2020-07-14 10:40:16 -07:00
Pavel Yaskevich
ba70da0e5a [Frontend] Add missing diagnostics component to the default translations path 2020-07-13 22:24:04 -07:00
Hamish Knight
241c5d95e3 Merge pull request #32461 from hamishknight/its-all-linked 2020-07-08 11:07:17 -07:00
Hamish Knight
0c9c606d28 Remove MergePartialModules from SILOptions
Its use in deserialization can be replaced with a
more general check for whether we're deserializing
into the same module. Its use in the SILVerifier
is subsumed by the check for whether the SILModule
is canonical, which it isn't during merge-modules.
2020-07-01 23:14:50 -07:00
Yuta Saito
20bc0af42b [LTO] Support LLVM LTO for IRGen and frontend
This commit adds -lto flag for frontend to enable LTO at LLVM level.
When -lto=llvm given, compiler emits LLVM bitcode file instead of object
file and adds index summary for LTO.
In addition for ELF format, emit llvm.dependent-libraries section to
embed auto linking information
2020-07-01 23:30:58 +00:00
swift_jenkins
f496210e1a Merge remote-tracking branch 'origin/master' into master-next 2020-07-01 14:59:55 -07:00
Hamish Knight
890df57515 Merge pull request #32654 from hamishknight/all-for-ir-and-ir-for-all 2020-07-01 14:55:20 -07:00
Hamish Knight
bf2f4af827 NFC: Move NumThreads from SILOptions to IRGenOptions
The option is only needed for IRGen.
2020-07-01 09:43:52 -07:00
swift_jenkins
0b243773f6 Merge remote-tracking branch 'origin/master' into master-next 2020-07-01 03:18:10 -07:00
HassanElDesouky
8ee34b7557 Add an else statement 2020-07-01 00:34:14 +02:00
HassanElDesouky
063e92aa53 Create frontend flags for localization 2020-06-30 23:12:40 +02:00
swift_jenkins
22ae05a5f7 Merge remote-tracking branch 'origin/master' into master-next 2020-06-30 08:19:10 -07:00
David Zarzycki
621cecbe71 Revert "[Diag] Create frontend flags for localization and write tests (#32568)"
This reverts commit 621b3b4223.

The driver is double faulting on my Linux box (Fedora 32 / x86-64). It
crashes due to heap corruption, then hangs trying to introspect and
print the stack. There also appears to be an unrelated(?) uninitialized
memory error that valgrind detects (as opposed to malloc's own self
diagnostics).
2020-06-30 08:31:38 -04:00
swift_jenkins
f376272f21 Merge remote-tracking branch 'origin/master' into master-next 2020-06-29 23:38:11 -07:00
Hassan ElDesouky
621b3b4223 [Diag] Create frontend flags for localization and write tests (#32568)
* Create frontend flags for localization

* Remove assertion
2020-06-29 23:32:44 -07:00
swift_jenkins
82453cf560 Merge remote-tracking branch 'origin/master' into master-next 2020-06-17 18:19:18 -07:00
Xi Ge
ec9cd91c1b ExplicitModuleLoader: take a JSON file that specifies details of explicit Swift modules
Instead of taking paths of Swift module files from front-end command line
arguments, we should take a JSON file specifying details of explicit modules.
The advantages is (1) .swiftdoc and .swiftsourceinfo can be associated
with a .swiftmodule file, and (2) module names are explicitly used as
keys in the JSON input so we don't need to eagerly deserialize a .swiftmodule
file to collect the module name.
2020-06-17 14:02:50 -07:00
swift_jenkins
cfa5113e72 Merge remote-tracking branch 'origin/master' into master-next 2020-06-16 16:39:16 -07:00
Michael Gottesman
b2a8ff5f89 Merge pull request #32407 from gottesmm/pr-f0452984219b1947bbe97d25c2a159a16736d090
[ownership] Remove dead option: enable-ownership-stripping-after-serialization.
2020-06-16 16:27:23 -07:00
swift_jenkins
90dd9dbae8 Merge remote-tracking branch 'origin/master' into master-next 2020-06-16 14:18:53 -07:00
Michael Gottesman
46432404f3 [ownership] Remove dead option: enable-ownership-stripping-after-serialization.
We always lower ownership now after the diagnostic passes (what this option
actually controlled). So remove it.

NFC.
2020-06-16 10:52:02 -07:00
Keith Smiley
1b77448d37 Add path remapping with -coverage-prefix-map to coverage data
Previously the path to covered files in the __LLVM_COV / __llvm_covmap
section were absolute. This made remote builds with coverage information
difficult because all machines would have to have the same build root.
This change uses the values for `-coverage-prefix-map` to remap files in
the coverage info to relative paths. These paths work correctly with
llvm-cov when it is run from the same source directory as the
compilation, or from a different directory using the `-path-equivalence`
argument.

This is analogous to this change in clang https://reviews.llvm.org/D81122
2020-06-15 17:38:34 -07:00
swift_jenkins
73e4e60598 Merge remote-tracking branch 'origin/master' into master-next 2020-06-10 10:20:02 -07:00
Robert Widmann
3228a5903a [NFC] Rename Flags
-enable-experimental-private-intransitive-dependencies -> -enable-direct-intramodule-dependencies
-disable-experimental-private-intransitive-dependencies -> -disable-direct-intramodule-dependencies

While we're here, rename DependencyCollector::Mode's constants and clean
up the documentation.
2020-06-09 16:00:59 -07:00