Commit Graph

1344 Commits

Author SHA1 Message Date
Varun Gandhi
022314a640 Merge pull request #28643 from kitaisreal/using-located-instead-of-pair
[Compiler]: Using Located<T> instead of std::pair<SourceLoc, T>
2020-01-06 14:22:29 -08:00
swift_jenkins
70bfa0cfc1 Merge remote-tracking branch 'origin/master' into master-next 2020-01-06 12:17:27 -08:00
Harlan Haskins
8e45f44da4 [Serialization] Serialize hasMissingDesignatedInitializers
Since this is going to be something modules tell clients, rather than something clients discover about modules, serialize it.
2020-01-06 10:15:07 -08:00
Kita, Maksim
ea6a2dc094 SR-11889: Fixed code review issues
1. Updated Located field names with Pascal Case
2. Updated Located constuctor
3. Formatted lines with more than 80 symbols
2019-12-20 17:18:59 +03:00
Kita, Maksim
b7cb3b67bf SR-11889: Using Located<T> instead of std::pair<SourceLoc, T> 2019-12-20 17:18:58 +03:00
swift_jenkins
5c9b0a8831 Merge remote-tracking branch 'origin/master' into master-next 2019-12-19 14:19:31 -08:00
Marc Rasi
72194c547b Merge branch 'master' into ast-nondiff 2019-12-18 17:25:09 -08:00
swift_jenkins
5a29d539e1 Merge remote-tracking branch 'origin/master' into master-next 2019-12-18 12:00:11 -08:00
Argyrios Kyrtzidis
a9c9f260d0 Merge pull request #27545 from apple/transposing-attr
[AutoDiff upstream] Add `@transpose` attribute.
2019-12-18 11:52:14 -08:00
swift_jenkins
0848984d9a Merge remote-tracking branch 'origin/master' into master-next 2019-12-17 16:00:12 -08:00
Dan Zheng
6b072ecb2a [AutoDiff] NFC: gardening.
Add accidentally deleted newline.
2019-12-17 22:12:18 +00:00
Dan Zheng
cd1400d675 Merge branch 'master' of github.com:apple/swift into upstream-transpose-attr 2019-12-17 12:44:29 -08:00
Dan Zheng
c842fee0a4 [AutoDiff upstream] Add @transpose(of:) attribute.
The `@transpose(of:)` attribute registers a function as a transpose of another
function. This patch adds the `@transpose(of:)` attribute definition, syntax,
parsing, and printing.

Resolves TF-827.

Todos:
- Type-checking (TF-830, TF-1060).
- Enable serialization (TF-838).
- Use module-qualified names instead of custom qualified name syntax/parsing
  (TF-1066).
2019-12-16 12:23:08 -08:00
swift_jenkins
ae164a5967 Merge remote-tracking branch 'origin/master' into master-next 2019-12-13 19:20:21 -08:00
Dan Zheng
27dad91d64 [AutoDiff upstream] Upstream @derivative attribute serialization. (#28781)
Upstream `@derivative` attribute serialization/deserialization.
Test all original declaration kinds and various `wrt:` parameter clauses.

Resolves TF-837.
2019-12-13 19:02:06 -08:00
swift_jenkins
3140acc993 Merge remote-tracking branch 'origin/master' into master-next 2019-12-10 21:20:05 -08:00
Robert Widmann
06d27f08fd Define @_implicitly_synthesizes_nested_requirement
State the previously unstated nested type requirement that CodingKeys adds to the witness requirements of a given type. The goal is to make this member cheap to synthesize, and independent of the expensive protocol conformance checks required to append it to the member list.

Further, this makes a clean conceptual separation between what I'm calling "nested type requirements" and actual type and value requirements.

With luck, we'll never have to use this attribute anywhere else.
2019-12-10 16:28:50 -08:00
swift_jenkins
51b2144406 Merge remote-tracking branch 'origin/master' into master-next 2019-12-10 16:20:02 -08:00
Joe Groff
fb34044408 Merge remote-tracking branch 'origin/master' into master-next 2019-12-10 12:46:41 -08:00
Joe Groff
4742968454 Serialization support for SIL substituted function types 2019-12-10 12:09:06 -08:00
Dan Zheng
0585eb0e90 [AutoDiff upstream] Add @derivative(of:) attribute. (#28321)
The `@derivative(of:)` attribute registers a function as a derivative of another
function. This patch adds the `@derivative(of:)` attribute definition, syntax,
parsing, and printing.

Resolves TF-826.

Todos:
- Type-checking (TF-829).
- Serialization (TF-837).
2019-12-10 09:29:43 -08:00
Brent Royal-Gordon
63ec1cf5af Introduce a separate #filePath, remove -pound-file
This makes the path behavior more first-class. The feature is now hidden behind an experimental flag, -enable-experimental-concise-pound-file.
2019-12-04 16:35:13 -08:00
Varun Gandhi
e7be41d0cb Merge pull request #27479 from varungandhi-apple/vg-track-clang-function-types
Track Clang function types in the AST
2019-12-04 08:47:35 -08:00
Robert Widmann
4e36fc0bd5 Replace semantic usages of DynamicReplacementAttr with the request
Complete the refactoring by splitting the semantic callers for the original decl of a dynamically replaced declaration.

There's also a change to the way this attribute is validated and placed.  The old model visited the attribute on any functions and variable declarations it encountered in the primary.  Once there, it would strip the attribute off of variables and attach the corresponding attribute to each parsed accessor, then perform some additional ObjC-related validation.

The new approach instead leaves the attribute alone.  The request exists specifically to perform the lookups and type matching required to find replaced decls, and the attribute visitor no longer needs to worry about revisiting decls it has just grafted attributes onto.  This also means that a bunch of parts of IRGen and SILGen that needed to fan out to the accessors to ask for the @_dynamicReplacement attribute to undo the work the type checker had done can just look at the storage itself.  Further, syntactic requests for the attribute will now consistently succeed, where before they would fail dependending on whether or not the type checker had run - which was generally not an issue by the time we hit SIL.
2019-12-03 15:30:04 -08:00
Varun Gandhi
8021795672 [AST] Setup AST and SIL to accomodate Clang function types.
We still don't store compute or store the type anywhere; we will do so in
later commits.
2019-11-22 12:42:08 -08:00
Xi Ge
5a862e49bd Merge pull request #28369 from nkcsgexi/originally-defined-in-attribute
AST: introduce a new attribute @_originallyDefinedIn to the AST
2019-11-21 20:26:29 -08:00
Xi Ge
7f8c04e0b7 AST: introduce a new attribute @_originallDefinedIn to the AST
We need this attribute to teach compiler to use a different name from the current
module name when generating runtime symbol names for a declaration. This is to serve
the workflow of refactoring a symbol from one library to another without breaking the existing
ABI.

This patch focuses on parsing and serializing the attribute, so @_originallyDefinedIn
will show up in AST, swiftinterface files and swiftmodule files.

rdar://55268186
2019-11-21 14:25:57 -08:00
swift_jenkins
8be3f2244f Merge remote-tracking branch 'origin/master' into master-next 2019-11-20 23:40:29 -08:00
Slava Pestov
53bfc767a3 SIL: Track target formal type for casts
SIL type lowering erases DynamicSelfType, so we generate
incorrect code when casting to DynamicSelfType. Fixing this
requires a fair amount of plumbing, but most of the
changes are mechanical.

Note that the textual SIL syntax for casts has changed
slightly; the target type is now a formal type without a '$',
not a SIL type.

Also, the unconditional_checked_cast_value and
checked_cast_value_br instructions now take the _source_
formal type as well, just like the *_addr forms they are
intended to replace.
2019-11-20 21:30:28 -05:00
swift_jenkins
be06b455b9 Merge remote-tracking branch 'origin/master' into master-next 2019-11-18 14:39:34 -08:00
Slava Pestov
86f6570662 Stop using SharedTimer except to implement FrontendStatsTracer
Name binding can trigger swiftinterface compilation, which creates
a new ASTContext and runs a compilation job. If the compiler was
run with -stats-output-dir, this could trigger an assertion because
SharedTimer is not re-entrant.

Fix this by replacing all direct uses of SharedTimer in the frontend
with FrontendStatsTracer. SharedTimer is still used to _implement_
FrontendStatsTracer, however we can collapse some of the layers in
the implementation later. Many of the usages should also become
redundant over time once more code is converted over to requests.
2019-11-18 12:05:49 -05:00
swift_jenkins
d5ca3542c3 Merge remote-tracking branch 'origin/master' into master-next 2019-11-16 18:40:34 -08:00
swift-ci
9a1d482bde Merge pull request #28307 from dan-zheng/autodiff-cleanup 2019-11-16 18:30:27 -08:00
Dan Zheng
2d2a5ded9d [AutoDiff upstream] Minor cleanup for @differentiable attribute.
Add TODO comments referencing JIRA issues.

Add disabled `@differentiable` attribute serialization test.
TF-836 tracks enabling the test.
Blocked by TF-828: `@differentiable` attribute type-checking.
2019-11-16 15:12:47 -08:00
Marc Rasi
6e559ab8fa rename nondiff => noDerivative 2019-11-15 16:36:26 -08:00
Marc Rasi
f5677cbe42 add @nondiff to AnyFunctionType params 2019-11-14 16:49:22 -08:00
Alex Lorenz
2f78afa4a2 Merge pull request #28214 from francisvm/bitstream-changes/master
Cherry-pick LLVM Bitstream changes
2019-11-14 10:14:29 -08:00
swift-ci
9b98492953 Merge remote-tracking branch 'origin/master' into master-next 2019-11-12 17:30:10 -08:00
Marc Rasi
6413f4341a [AutoDiff upstream] AST bits for @differentiable fn ty 2019-11-12 15:19:03 -08:00
Francis Visoiu Mistrih
47c6ce2af7 [Bitcode] Update includes: llvm/Bitcode -> llvm/Bitstream
The Bitstream part of Bitcode moved to llvm/Bitstream in LLVM. This
updates the uses in swift.

See r365091 [Bitcode] Move Bitstream to a separate library.

(cherry picked from commit 1cd8e19357)
2019-11-12 10:46:07 -08:00
swift-ci
c10a5f7cb1 Merge remote-tracking branch 'origin/master' into master-next 2019-11-11 14:10:53 -08:00
Gogul Balakrishnan
5accda22b2 [AutoDiff upstream] Introduce @differentiable attribute to mark functions as differentiable. (#27506)
This PR introduces `@differentiable` attribute to mark functions as differentiable. This PR only contains changes related to parsing the attribute. Type checking and other changes will be added in subsequent patches.

See https://github.com/apple/swift/pull/27506/files#diff-f3216f4188fd5ed34e1007e5a9c2490f for examples and tests for the new attribute.
2019-11-11 13:58:34 -08:00
swift-ci
5f9e32b974 Merge remote-tracking branch 'origin/master' into master-next 2019-11-04 17:30:26 -08:00
Hamish Knight
92c42ec791 [AST] Add @_nonEphemeral parameter attribute
This non-user-facing attribute is used to denote pointer parameters
which do not accept pointers produced from temporary pointer conversions
such as array-to-pointer, string-to-pointer, and in some cases
inout-to-pointer.
2019-11-03 08:40:59 -08:00
swift-ci
0b41d02a4d Merge remote-tracking branch 'origin/master' into master-next 2019-10-31 20:49:50 -07:00
Brent Royal-Gordon
17169fc1fe Merge pull request #27950 from brentdax/dumpster-fire
[NFC] Standardize dump() methods in frontend
2019-10-31 20:36:26 -07:00
Brent Royal-Gordon
99faa033fc [NFC] Standardize dump() methods in frontend
By convention, most structs and classes in the Swift compiler include a `dump()` method which prints debugging information. This method is meant to be called only from the debugger, but this means they’re often unused and may be eliminated from optimized binaries. On the other hand, some parts of the compiler call `dump()` methods directly despite them being intended as a pure debugging aid. clang supports attributes which can be used to avoid these problems, but they’re used very inconsistently across the compiler.

This commit adds `SWIFT_DEBUG_DUMP` and `SWIFT_DEBUG_DUMPER(<name>(<params>))` macros to declare `dump()` methods with the appropriate set of attributes and adopts this macro throughout the frontend. It does not pervasively adopt this macro in SILGen, SILOptimizer, or IRGen; these components use `dump()` methods in a different way where they’re frequently called from debugging code. Nor does it adopt it in runtime components like swiftRuntime and swiftReflection, because I’m a bit worried about size.

Despite the large number of files and lines affected, this change is NFC.
2019-10-31 18:37:42 -07:00
swift-ci
2689ff9343 Merge remote-tracking branch 'origin/master' into master-next 2019-10-30 07:49:45 -07:00
Robert Widmann
b849e51768 Use operator bool to claw back some readability 2019-10-29 16:56:21 -07:00
Robert Widmann
37e82a6133 [NFC] getWitnessMethodConformanceOrNone -> getWitnessMethodConformanceOrInvalid 2019-10-29 16:56:20 -07:00