Commit Graph

48521 Commits

Author SHA1 Message Date
Michael Gottesman
24cff27f0c Revert "Revert "[ownership] If we have an undef address, do not treat it as being owned. It is any.""
This reverts commit 7a28a02189.
2019-06-24 11:14:45 -07:00
Xi Ge
107d27a6e5 Revert "[mark-uninit-fixup] Change a SILBuilder => SILBuilderWithScope."
This reverts commit 612cd9bd35.
2019-06-24 11:03:54 -07:00
Xi Ge
f9c586fae5 Revert "[ownership] Verify functions before we strip ownership."
This reverts commit 7bd15bdb81.
2019-06-24 11:03:41 -07:00
Xi Ge
f53525b0a1 Revert "[ownership] Ignore non-consuming uses in dead end blocks when we are analyzing objects that are consumed once in the same block in which they are defined."
This reverts commit 9a67f2d3ba.
2019-06-24 11:02:44 -07:00
Xi Ge
7a28a02189 Revert "[ownership] If we have an undef address, do not treat it as being owned. It is any."
This reverts commit e2c540461e.
2019-06-24 11:02:35 -07:00
Jordan Rose
b6680175f3 [ModuleInterface] Explicitly print implied Hashable et al on enums (#25650)
Enums have a handful of conformances that are implied by their
structure: Equatable and Hashable if they have no payloads, and
RawRepresentable if they have a raw value. In the spirit of making
implicit things explicit, these should be printed in the module
interface.

rdar://problem/50100142
2019-06-24 10:36:48 -07:00
David Ungar
e676a130eb Merge pull request #25694 from davidungar/delayed-parse-fix
[Parser] Handle TopLevelCode case
2019-06-24 10:07:40 -07:00
Slava Pestov
de3284baae Merge pull request #25686 from slavapestov/flag-day
Remove a couple of obsolete frontend flags
2019-06-24 10:10:12 -04:00
swift-ci
e9d827ca3c Merge pull request #25703 from gottesmm/pr-9ce7ee5ae4fd57ea34dec6d0684787ff04fcf634 2019-06-24 00:24:59 -07:00
swift-ci
dd9a9fe195 Merge pull request #25704 from gottesmm/pr-4bfe70900a409216e2b3f647d33d6644012367d6 2019-06-24 00:08:16 -07:00
Michael Gottesman
0627ea60e5 Merge pull request #25702 from gottesmm/pr-6780a2b72e15cebcf1c470110b4062997a910b41
[ownership] Ignore non-consuming uses in dead end blocks when we are …
2019-06-23 23:46:11 -07:00
swift-ci
f6c7c456b4 Merge pull request #25701 from gottesmm/pr-b1a6decb052267904eb3f0892f311d0512a5b023 2019-06-23 23:32:02 -07:00
Michael Gottesman
e2c540461e [ownership] If we have an undef address, do not treat it as being owned. It is any. 2019-06-23 23:06:51 -07:00
Michael Gottesman
7bd15bdb81 [ownership] Verify functions before we strip ownership.
Today before/after running optimizations, the driver always verifies the entire
SILModule. Sadly since we are stripping ownership in the /middle/ of the
pipeline, we do not get the same benefit for ownership SIL.

With this change, we verify before we strip ownership to ensure that the code is
[ossa] correct /before/ we strip.

This will only run in asserts builds unless -sil-verify-all is passed in.
2019-06-23 22:30:49 -07:00
Michael Gottesman
9a67f2d3ba [ownership] Ignore non-consuming uses in dead end blocks when we are analyzing objects that are consumed once in the same block in which they are defined. 2019-06-23 22:15:26 -07:00
Michael Gottesman
612cd9bd35 [mark-uninit-fixup] Change a SILBuilder => SILBuilderWithScope.
A small part of the effort to purge SILBuilder from the code base. Without this,
we will hit debug holes.
2019-06-23 20:39:43 -07:00
David Ungar
7c7c77c0ae Handle TopLevelCode case 2019-06-23 13:46:56 -07:00
Michael Gottesman
5d9675392e [cast-opt] Improve handling of arguments when optimizing Swift -> ObjC bridging casts.
Specifically:

1. I removed an extra defensive copy that we put in place some time ago that
isn't really warranted. We know that we have an @owned value, so can safely just
pass the value as a @guaranteed parameter. This also eliminates an ownership
error that would occur due to my not having updated this code for ownership in
tree.

2. I also ensured that if we are performing a loadable address bridging cast ->
value bridging cast that we store the loadable value back into memory after we
perform the cast. Otherwise, it appears to leak to the ownership verifier.

I also centralized the non-ownership tests for this into one place
(const_fold_objc_bridge.sil => constant_propagation_objc.sil).
2019-06-23 13:17:10 -07:00
ravikandhadai
bcdd46cdfe Merge pull request #25677 from ravikandhadai/constexpr-intliteral-trunc
[Const Evaluator] Make compile-time constant evaluator correctly handle s_to_s_checked_trunc_IntLiteral_IntNN where the bit width of the source symbolic value (an APInt) could be smaller than the destination bits
2019-06-23 10:45:01 -07:00
Michael Gottesman
4b31d37307 [cast-opt] Rename misnamed variable.
This is actually an out parameter of the apply that we are then switching upon.
2019-06-22 22:12:00 -07:00
Slava Pestov
566e9dfea0 Frontend: Remove -enable-resilience flag 2019-06-22 21:37:04 -04:00
Slava Pestov
e2d660f148 SILGen: Fix generated vtable thunk when a final override is more visible than the base
Don't re-dispatch to the override's vtable slot if the override
is final; there's no vtable slot and this will result in an
infinite loop.

Fixes <rdar://problem/52006394>.
2019-06-21 22:56:48 -04:00
Ravi Kandhadai
11efa58a6c [Const Evaluator] Make compile-time constant evaluator correctly handle
s_to_s_checked_trunc_IntLiteral_IntNN where the bit width of the source
symbolic value (an APInt) could be smaller than the destination bits.
2019-06-21 19:35:06 -07:00
swift-ci
88a5c00b34 Merge pull request #25672 from akyrtzi/index-remove-module-hash 2019-06-21 18:16:29 -07:00
Jordan Rose
15bcd23e37 [ModuleInterface] Propagate availability for nested types too (#25662)
Previously the module interface printing would scrape the
AvailableAttrs from the containing decl in order to print synthesized
extensions for conformances that wouldn't otherwise be printed...but
that missed the case where a containing lexical scope had the
availability attributes instead. Now it walks up the chain of parent
DeclContexts and collects the most specific AvailableAttr for each
platform.

This /still/ isn't formally correct because it doesn't merge
availability for one platform (if something inside is deprecated
unconditionally but outside has an "introduced" version), but it's
going to match the vast majority of code out there.

Pre-requisite for rdar://problem/50100142
2019-06-21 18:00:44 -07:00
Argyrios Kyrtzidis
3332b37d00 [Index/SourceKit] Remove the code related to calculating a module hash from the indexing walker
This has been an unnecessary code path for a long time now and should be removed particularly because it triggers wasteful `stat` calls.

rdar://51523161
2019-06-21 17:09:12 -07:00
Ben Langmuir
f5f3b5c9cf Merge pull request #25654 from rintaro/ide-completion-declattr-independent-rdar50441643
[CodeCompletion] Don't attach attr to decl if blank line exists
2019-06-21 15:08:29 -07:00
Rintaro Ishizaki
bb3edd5dde [CodeCompletion] contextual attribute completion only on the same line
It's common to have decls on consecutive lines. Better to show too many
attributes than too few.
2019-06-21 14:03:09 -07:00
Pavel Yaskevich
ef96e8904f Merge pull request #25638 from xedin/rdar-51576862
[Diagnostics] Don't suggest argument destructuring fix-it if closu…
2019-06-21 12:32:44 -07:00
Rintaro Ishizaki
bc037967d1 [CodeCompletion] Stop using DeclKind::Module as a isIndependent indicator 2019-06-21 11:15:25 -07:00
Arnold Schwaighofer
7e8ce6ce4a Merge pull request #25631 from aschwaighofer/ReplaceOpaqueTypesWithUnderlyingTypes_primary_file_mode
ReplaceOpaqueTypesWithUnderlyingTypes: In primary-file mode there mig…
2019-06-21 08:12:47 -07:00
Arnold Schwaighofer
7e030512fc Merge pull request #25573 from aschwaighofer/runtime_avail_rework
Rework getRuntimeFn runtime availability
2019-06-21 06:47:37 -07:00
Sam Lazarus
ebcbaca968 [Diagnostics] Add a diagnostic for inserting a $ to remove an extraneous property wrapper unwrap (#25507) 2019-06-20 20:28:25 -04:00
Rintaro Ishizaki
09ca68e485 [CodeCompletion] Don't attach attr to decl if blank line exists
```
@#^COMPLETE^#

public func something() {}
```
In this case, we can't say the user is adding attribute to the func or
starting a new declaration. So if there're one or more blank lines after the
completion, suggest context free attribute list.

rdar://problem/50441643
2019-06-20 17:06:32 -07:00
Rintaro Ishizaki
16bc322cd3 Merge pull request #24813 from rintaro/comment-refactor
[AST] Inherit doc-brief comment from protocol, superclass, and requirement
2019-06-20 15:54:17 -07:00
swift-ci
747c69c1ba Merge pull request #25639 from gottesmm/pr-1a8f63344dc43882494dc2472df5727dc9604d38 2019-06-20 14:26:52 -07:00
Jordan Rose
3243f21280 Make sure all failures to load module interfaces are diagnosed (#25636)
...specifically, diagnosed in the parent DiagnosticEngine. This not
only provides a better user experience, but makes sure that the
compiler exits with a nonzero exit code even if the module goes
unused.

rdar://problem/50789839
2019-06-20 14:14:38 -07:00
Michael Gottesman
1980d57cdc Move MarkUninitializedFixup to ./lib/SILOptimizer/Mandatory since it is only used in the mandatory pipeline. 2019-06-20 13:16:07 -07:00
Arnold Schwaighofer
9b3206f415 Add flag that exists on swift-5.1-branch 2019-06-20 12:53:08 -07:00
Pavel Yaskevich
ebe0e42461 [Diagnostics] Don't suggest argument destructuring fix-it if closure is malformed
If closure expression is malformed don't try to suggest a fix-it
about destructuring, because there is no way to figure out where
it would actually go in the source.

Resolves: rdar://problem/51576862
2019-06-20 12:35:26 -07:00
swift-ci
de1c0cdd85 Merge pull request #25634 from davidungar/Fix-SR-10949b 2019-06-20 12:20:03 -07:00
Rintaro Ishizaki
b1fae101f2 [AST] Restore previous behavior for DocCommentAsXML
Associate requirement decl with DocComment.
2019-06-20 12:05:04 -07:00
David Ungar
aac3a3d2ae Add a test & don’t look for a module with a special name. 2019-06-20 11:19:12 -07:00
Arnold Schwaighofer
dcd1732761 Merge pull request #25616 from aschwaighofer/fix_multi_object_file_replacements_runtime
Fix dynamic replacement runtime when generating replacements from multiple object files
2019-06-20 10:44:09 -07:00
Arnold Schwaighofer
311edcf56d ReplaceOpaqueTypesWithUnderlyingTypes: In primary-file mode there might not be an underlying type because the body of the opaque type providing decl has not been type checked yet.
rdar://51949476
2019-06-20 10:43:04 -07:00
Rintaro Ishizaki
87c1c5c41a [AST] Enable inheritance node for protocol conformance
rdar://problem/49043711
2019-06-20 10:04:05 -07:00
Rintaro Ishizaki
db2c11787b [AST] Inherit doc-brief comment from protocol, superclass, and requirement
rdar://problem/38422822
2019-06-20 10:04:05 -07:00
swift-ci
bb2e003a21 Merge pull request #25628 from akyrtzi/index-disable-typo-correction 2019-06-20 09:38:37 -07:00
Jordan Rose
543632deda Merge pull request #25202 from troughton/static-libraries-driver
[Driver] Add -static flag for generating static archives
2019-06-20 09:10:02 -07:00
Argyrios Kyrtzidis
e23d3e3fbb [driver] For -index-file mode add -disable-typo-correction
We don't need typo-correction for that since the errors will be ignored and it can be expensive to do typo-correction.
2019-06-20 08:22:15 -07:00