Commit Graph

1034 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
Robert Widmann
fdf31c88a6 Add Flags to Enable or Disable EnableExperientalPrivateIntransitiveDependencies
Turn the existing flag into an on-off switch and migrate all the tests in preparation for it being on by default
2020-06-09 12:24:57 -07:00
Karoy Lorentey
68351d2110 Revert "Merge remote-tracking branch 'origin/master-next'"
This reverts commit 1c9b0908e6, reversing
changes made to 3eb82c1836.
2020-06-08 16:48:38 -07:00
Karoy Lorentey
1c9b0908e6 Merge remote-tracking branch 'origin/master-next'
# Conflicts:
#	include/swift/Frontend/FrontendInputsAndOutputs.h
2020-06-08 16:43:40 -07:00
Saleem Abdulrasool
71309a8fa9 Revert "[LTO] Support LLVM level link time optimization on Darwin, Linux and Windows" 2020-06-07 11:25:48 -07:00
Doug Gregor
64f903fe2a [Type checker] Experimental support for one-way parameter constraints.
Introduce an experimental mode (behind the flag
`experimental-one-way-closure-params`) that places one-way
constraints between closure parameter types and references to those
parameters within the body of the closure. The intent here is to
break up constraint systems further, potentially improving type
checking performance and making way for larger closure bodies to be
supported.

This is a source-breaking change when the body of a single-expression
closure is used to determine the parameter types. One obvious example
is when there is no contextual type, e.g.,

    let _ = { $0 + 1 }

this type-checks today because `1` becomes `Int`, which matches the
`+` overload with the type `(Int, Int) -> Int`, determining the
parameter type `Int` for the closure. Such code would not type-check
with one-way constraints.
2020-06-05 22:47:21 -07:00
Saleem Abdulrasool
d0131ba6be Merge pull request #31146 from kateinoigakukun/katei/enable-lang-agnostic-lto
[LTO] Support LLVM level link time optimization on Darwin, Linux and Windows
2020-06-05 11:38:09 -07:00
Arnold Schwaighofer
3f903b4891 Merge pull request #31986 from aschwaighofer/irgen_inherit_clangs_fp_elim
IRGen: Default to clang's frame pointer elimination settings
2020-06-03 07:38:24 -07:00
Xi Ge
0d74428575 Front-end: use separate flag for -swift-module-file instead of EQ 2020-06-02 16:51:45 -07:00
Xi Ge
01c18d01c1 Frontend: move ExplicitSwiftModules into SearchPathOptions, NFC 2020-06-02 16:51:45 -07:00
Xi Ge
9e88549199 ModuleInterface: teach module interface building to use explicitly built PCMs 2020-06-02 16:51:45 -07:00
Yuta Saito
915c4a6997 [LTO] Support LLVM level link time optimization
This commit adds -lto flag for driver to enable LTO at LLVM level.
When -lto=llvm given, compiler emits LLVM bitcode file instead of object
file and perform thin LTO using libLTO.dylib plugin.
When -lto=llvm-full given, perform full LTO instead of thin LTO.
2020-05-31 08:12:52 +09:00
Arnold Schwaighofer
20f4ef93de IRGen: Default to clang's frame pointer elimination settings
Clang provides options to override that default value.
These options are accessible via the -Xcc flag.

Some Swift functions explicitly disable the frame pointer.

The clang options will not override those.
2020-05-28 12:21:42 -07:00
swift_jenkins
0b2d4f6963 Merge remote-tracking branch 'origin/master' into master-next 2020-05-27 20:38:47 -07:00
Owen Voorhees
e40e86fc94 Merge pull request #32017 from owenv/diag-style-opt
[Diagnostics] Add -diagnostic-style=(llvm|swift) to control printed output
2020-05-27 20:22:23 -07:00
swift_jenkins
6af6576725 Merge remote-tracking branch 'origin/master' into master-next 2020-05-23 09:58:24 -07:00
Hamish Knight
9e2cdf49b3 Merge pull request #31506 from hamishknight/hello-operator 2020-05-23 09:48:21 -07:00
swift_jenkins
170896de1e Merge remote-tracking branch 'origin/master' into master-next 2020-05-22 16:39:06 -07:00
Arnold Schwaighofer
109813ffe5 Add option to disable leaf frame pointer elimination 2020-05-21 13:19:24 -07:00
Owen Voorhees
c4e67e29ed [Diagnostics] Add -diagnostic-style=(llvm|swift) to control printed output
This default formatting style remains the same "LLVM style". "Swift style"
is what was previously enabled via -enable-experimental-diagnostic-formatting
2020-05-20 19:34:15 -05:00
swift_jenkins
df9ba33d11 Merge remote-tracking branch 'origin/master' into master-next 2020-05-19 11:39:09 -07:00
Robert Widmann
4c5d87e07c [Gardening] Move options setup code into argument parsing 2020-05-18 22:49:22 -07:00
Hamish Knight
54df0a4e8d [Frontend] Add flag to enable new operator lookup
For now disabled by default, but once we get a new
language mode, we should flip it on by default.
2020-05-18 14:33:42 -07:00
swift_jenkins
10e1981971 Merge remote-tracking branch 'origin/master' into master-next 2020-05-13 13:37:47 -07:00
Robert Widmann
52ddcea0d2 Diagnose Building SwiftONoneSupport with -experimental-skip-function-bodies
This allows us to push the validation and, importantly, the mutation of this flag into the compiler invocation where it belongs.
2020-05-13 09:13:44 -07:00
Robert Widmann
eac92e3df0 [NFC] Const-Qualify LangOptions Accesses Through ASTContext 2020-05-13 09:13:44 -07:00
swift_jenkins
b89b233b2e Merge remote-tracking branch 'origin/master' into master-next 2020-05-07 14:19:21 -07:00
Hamish Knight
72bb47ee90 [Frontend] Remove InputFileKind::SwiftREPL 2020-05-07 11:00:02 -07:00
swift_jenkins
8069dd1be9 Merge remote-tracking branch 'origin/master' into master-next 2020-05-07 08:20:47 -07:00
Slava Pestov
b81c0d63d1 AST: Remove SourceFileKind::REPL 2020-05-07 02:04:05 -04:00