Commit Graph

11880 Commits

Author SHA1 Message Date
swift-ci
0cbfcbb517 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-06 21:44:26 -08:00
Robert Widmann
1ed846d852 Merge pull request #25696 from kelvin13/comparable-enums
synthesized comparable for enums
2020-02-06 21:38:36 -08:00
swift-ci
c8671f672b Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-06 21:04:42 -08:00
John McCall
b46938924f Merge pull request #29670 from rjmccall/ciliainig-teyepee-sieeriiieaileiizieaitieieoiniie
Implement Swift serialization and deserialization of Clang types
2020-02-07 00:04:30 -05:00
John McCall
faee21b626 Implement Swift serialization and deserialization of Clang types.
As part of this, we have to change the type export rules to
prevent `@convention(c)` function types from being used in
exported interfaces if they aren't serializable.  This is a
more conservative version of the original rule I had, which
was to import such function-pointer types as opaque pointers.
That rule would've completely prevented importing function-pointer
types defined in bridging headers and so simply doesn't work,
so we're left trying to catch the unsupportable cases
retroactively.  This has the unfortunate consequence that we
can't necessarily serialize the internal state of the compiler,
but that was already true due to normal type uses of aggregate
types from bridging headers; if we can teach the compiler to
reliably serialize such types, we should be able to use the
same mechanisms for function types.

This PR doesn't flip the switch to use Clang function types
by default, so many of the clang-function-type-serialization
FIXMEs are still in place.
2020-02-06 22:09:00 -05:00
swift-ci
ac3ce0d3c4 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-06 13:43:41 -08:00
Hamish Knight
2b8583581d Merge pull request #29664 from hamishknight/inout-decls
Create a new module and SourceFile for REPL completion
2020-02-06 13:43:00 -08:00
swift-ci
ce39ec797e Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-06 13:24:23 -08:00
swift-ci
94784f13de Merge pull request #29676 from nate-chandler/generic-metadata-prespecialization-components/swift-53 2020-02-06 13:08:41 -08:00
swift-ci
339fad4910 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-06 13:04:45 -08:00
Dan Zheng
9205758e00 [AutoDiff upstream] Add SILFunctionType utilities. (#29674)
Upstream AutoDiff-related `SILFunctionType` utilities:
- `SILFunctionType::getDifferentiabilityParameterIndices`
- `SILFunctionType::getWithDifferentiability`
- `SILFunctionType::getWithoutDifferentiability`

Resolves TF-1125.
2020-02-06 12:47:12 -08:00
Nate Chandler
4300f711b4 [metadata prespecialization] Available in 5.3. 2020-02-06 11:13:21 -08:00
swift-ci
1a6ffc8b0e Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-06 09:24:55 -08:00
nate-chandler
4a97914196 Merge pull request #29488 from nate-chandler/generic-metadata-prespecialization-components/default-on
[metadata prespecialization] On by default.
2020-02-06 09:10:10 -08:00
John McCall
b3750a7c13 Add a PrettyStackTrace for working with Clang types. 2020-02-06 12:09:05 -05:00
Nate Chandler
0ae9e68607 [metadata prespecialization] On by default.
Previously, -Xfrontend -prespecialize-generic-metadata had to be passed
in order for generic metadata to be prespecialized.  Now it is
prespecialized unless -Xfrontend
-disable-generic-metadata-prespecialization is passed.
2020-02-05 17:53:09 -08:00
swift-ci
70ebdb7629 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-05 17:44:45 -08:00
Holly Borla
0cdaeb5708 Merge pull request #29649 from hborla/function-builder-syntactic-diags
[MiscDiagnostics] Walk into the body of a non single-statement closure if the closure had a function builder transform applied.
2020-02-05 17:43:03 -08:00
swift-ci
cf3c4aa3f5 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-05 16:06:28 -08:00
Hamish Knight
9208f5bd88 Remove StartElem params from various entry points
Now that REPL code completion no longer injects
temporary decls into source files, this parameter
is no longer needed.
2020-02-05 14:01:21 -08:00
Hamish Knight
8037f2feb0 Merge pull request #29619 from hamishknight/a-buffet-of-tokens
Parse Swift decls in one shot
2020-02-05 13:58:31 -08:00
swift-ci
b713e90ffb Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-05 12:23:45 -08:00
Pavel Yaskevich
99856ed42c Merge pull request #29655 from xedin/rdar-41416758
[ConstraintSystem] Make variadics work with anonymous closure parameters
2020-02-05 12:10:25 -08:00
swift-ci
0709ae2ee6 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-05 10:44:37 -08:00
Robert Widmann
960b5a2d9d Merge pull request #29629 from CodaFi/big-generator
Add SILGenSourceFileRequest
2020-02-05 10:31:36 -08:00
Pavel Yaskevich
07a69c425f [ConstraintSystem] Make variadics work with anonymous closure parameters
Since opening closure body is now delayed until contextual type becomes
available it's possible to infer anonymous parameters as being variadic
based on context and propagate that information down to the closure body.

Resolves: rdar://problem/41416758
2020-02-05 09:35:49 -08:00
Kelvin
19a8759cee Merge branch 'master' into comparable-enums 2020-02-04 22:08:40 -06:00
Holly Borla
778f8941ee [MiscDiagnostics] Walk into the body of a non single-statement closure
if the closure had a function builder transform applied.

This way, function builder closures can have syntactic restrictions
diagnosed the same way as other expressions.
2020-02-04 16:29:02 -08:00
Robert Widmann
4570ba8426 Refactor GenerateSILRequest into WMO and per-SF SILGen Requests 2020-02-04 15:20:52 -08:00
Hamish Knight
312f7ddc50 Parse Swift decls in one shot
Instead of interleaving typechecking and parsing
for SIL files, first parse the file for Swift
decls by skipping over any intermixed SIL decls.
Then we can perform type checking, and finally SIL
parsing where we now skip over Swift decls.

This is an intermediate step to requestifying the
parsing of a source file for its Swift decls.
2020-02-04 13:04:50 -08:00
swift-ci
973405621c Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-04 13:03:59 -08:00
Dan Zheng
849bd62a26 [AutoDiff upstream] Add SIL differentiability witnesses. (#29623)
SIL differentiability witnesses are a new top-level SIL construct mapping
"original" SIL functions to derivative SIL functions.

SIL differentiability witnesses have the following components:
- "Original" `SILFunction`.
- SIL linkage.
- Differentiability parameter indices (`IndexSubset`).
- Differentiability result indices (`IndexSubset`).
- Derivative `GenericSignature` representing differentiability generic
  requirements (optional).
- JVP derivative `SILFunction` (optional).
- VJP derivative `SILFunction` (optional).
- "Is serialized?" bit.

This patch adds the `SILDifferentiabilityWitness` data structure, with
documentation, parsing, and printing.

Resolves TF-911.

Todos:
- TF-1136: upstream `SILDifferentiabilityWitness` serialization.
- TF-1137: upstream `SILDifferentiabilityWitness` verification.
- TF-1138: upstream `SILDifferentiabilityWitness` SILGen from
  `@differentiable` and `@derivative` attributes.
- TF-20: robust mangling for `SILDifferentiabilityWitness` names.
2020-02-04 12:53:27 -08:00
swift-ci
20124f3397 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-04 12:22:51 -08:00
Suyash Srijan
543d649278 [Diagnostics] Warn when the result of a Void-returning function is ignored (by assigning into '_') (#29576) 2020-02-04 20:19:37 +00:00
swift-ci
712d7829d1 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-04 09:03:29 -08:00
Pavel Yaskevich
956b9f27b4 Merge pull request #29628 from owenv/condition_diags
[Diagnostics] Improve diagnostics for optional/integer as boolean condition
2020-02-04 08:49:36 -08:00
Owen Voorhees
166555c34f [Diagnostics] Better diagnostic for integer used as a boolean condition 2020-02-03 21:20:41 -08:00
Robert Widmann
676436640c Add SILGenSourceFileRequest
Replace SILGenModule::emitSourceFile with SILGenSourceFileRequest so we
have an explicit source file to associate any lookups with.
2020-02-03 18:26:19 -08:00
swift-ci
0fff1d6f4d Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-03 17:42:52 -08:00
Dan Zheng
0c0018fb9b [AutoDiff] Improve getConstrainedDerivativeGenericSignature helper. (#29620)
Move `getConstrainedDerivativeGenericSignature` under `autodiff` namespace.
Improve naming and documentation.
2020-02-03 17:40:49 -08:00
Owen Voorhees
4aca39e18e [Diagnostics] Provide a better fix-it when trying to boolean-negate an optional 2020-02-03 17:40:03 -08:00
swift-ci
782b4e1bfa Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-03 15:42:56 -08:00
Robert Widmann
4be78281c2 [Gardening] Const-qualify some PoundDiagnosticDecl members 2020-02-03 13:54:53 -08:00
swift-ci
b2583fd508 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-31 10:44:03 -08:00
Pavel Yaskevich
d24537f032 Merge pull request #29024 from xedin/diagnose-shadowing
[Diagnostics] Port name shadowing diagnostics
2020-01-31 10:39:58 -08:00
swift-ci
86520fc853 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-29 19:03:10 -08:00
David Ungar
2e1e4284ac Added ability to add fingerprint via # 2020-01-29 13:39:24 -08:00
Adrian Prantl
4bd1ffc67f Serialize whether a VarDecl is a top-level global.
The current way that VarDecl::isLazilyInitializedGlobal() is implemented does
not work in the debugger, since the DeclContext of all VarDecls are deserialized
Swift modules. By adding a bit to the VarDecl we can recover the fact that a
VarDecl was in fact a global even in the debugger.

<rdar://problem/58939370>
2020-01-29 09:21:02 -08:00
Pavel Yaskevich
c9c20afe27 [Diagnostics] Port name shadowing diagnostics
Diagnose an attempt to reference a top-level name shadowed by
a local member e.g.

```swift
extension Sequence {
  func test() -> Int {
    return max(1, 2)
  }
}
```

Here `min` refers to a global function `min<T>(_: T, _: T)` in `Swift`
module and can only be accessed by adding `Swift.` to it, because `Sequence`
has a member named `min` which accepts a single argument.
2020-01-29 09:14:24 -08:00
swift-ci
3a1c28977d Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-29 08:04:01 -08:00