Commit Graph

33197 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
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
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
dd9a9fe195 Merge pull request #25704 from gottesmm/pr-4bfe70900a409216e2b3f647d33d6644012367d6 2019-06-24 00:08:16 -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
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
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
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
Arnold Schwaighofer
b47aeb1ae8 Fix test/IRGen/abi_v7k.swift
rdar://51992998
2019-06-21 11:53:16 -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
Brent Royal-Gordon
29bff80d49 Unskip most of associated_type_demangle_private (#25657)
There’s only one specific case that isn’t working correctly right now; re-enable the rest of the test. rdar://problem/51959305
2019-06-20 21:34:38 -07:00
Xi Ge
56049cea2c Merge pull request #25649 from nkcsgexi/SR-10972
[SR-10972] swift-api-digester: avoid diagnosing the removal of __derived_enum_equals and __derived_struct_equals
2019-06-20 18:55:46 -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
Xi Ge
2160f65283 [SR-10972] swift-api-digester: avoid diagnosing the removal of __derived_enum_equals and __derived_struct_equals
These functions are compiler implementation details and diagnosing
them is redundant and may be confusing to framework authors.
2019-06-20 16:14:43 -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
Saleem Abdulrasool
40a49cee87 Merge pull request #25595 from drodriguez/windows-i-give-up
[windows] Use both directory separators in test patterns.
2019-06-20 15:48:16 -07:00
Xi Ge
179a0ac99e test: disable Runtime/associated_type_demangle_private.swift
Related: rdar://51959305
2019-06-20 15:19:20 -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
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
Brent Royal-Gordon
4149c8f97d [Runtime] Fix private generic type witness demangling failure (#25611)
This one’s screwily specific--if you have:

* a private generic type,
* with a nested generic type in it,
* and the nested type conforms to a protocol with an associated type,
* and that associated type’s witness is a generic type,
* and some of the witness type’s generic parameters are generic parameters of the nested type,

demangling would fail. The problem is that the substitution machinery in the runtime would consider there to be three, not two, generic context depths involved. Depth 1, which should correspond to the nested type, would instead have no generic parameters. The fix is to skip over depths with zero generic parameters.

Fixes <rdar://problem/47773183>.
2019-06-20 12:02:01 -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
Arnold Schwaighofer
d662c5cc62 Fail dynamic_replacement_multifile in optimize mode
rdar://51944415
2019-06-20 08:31:03 -07:00
Xi Ge
5295ef7bde Revert "[reflection-dump] Teach reflection dump how to dump protocols from the __swift5_protos section of a .o" 2019-06-20 08:29:49 -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
Michael Gottesman
db3997d05e Merge pull request #25617 from gottesmm/pr-0749a889482066e40ee2f5681a4bb0020007fa7f
[reflection-dump] Teach reflection dump how to dump protocols from the __swift5_protos section of a .o
2019-06-19 21:40:31 -07:00
Michael Gottesman
476a7de34b [reflection] Teach swift-reflection-dump how to dump protocols from the protocol section on Darwin.
NOTE: I used YAMLIO to simplify dumping this information which required me to
use llvm::outs() instead of std::cout like the rest of libReflection. We really
should remove std::cout from libReflection (iostream is a smell we try to avoid
generally). As a result, there is a little bit of finagling in the commit to
work around flushing issues with respect to use llvm::outs(), std::cout... but
it isn't too bad overall.
2019-06-19 20:27:34 -07:00
Joe Groff
0800dda9ce Merge pull request #25618 from jckarter/external-keypath-override
Judge the need for an external key path reference by the overridden base.
2019-06-19 19:40:15 -07:00
Joe Groff
aa35e4d62f Merge pull request #25571 from linux-on-ibm-z/switch
IRGen: simplify code generation for enum switch statements
2019-06-19 19:29:16 -07:00
Jordan Rose
9e471e4124 Don't offer a fix-it to convert to a 'some' type (#25619)
There's no way to spell an opaque type in a cast, and that means
there's no way to force the conversion today (even if you know the
types are dynamically the same).

Part of rdar://problem/50346954
2019-06-19 19:17:32 -07:00
Joe Groff
9c08fccf08 Judge the need for an external key path reference by the overridden base.
We identify overrides using the same key path descriptor as the base, but an overridden base
may not have a property descriptor if it's @objc or fragile. Fixes rdar://problem/51479334.
2019-06-19 16:07:50 -07:00
Arnold Schwaighofer
fb08153de0 Fix dynamic replacement runtime when generating replacements from multiple object files
The sections with the replacements get merged and we need to consider all replacements.

SR-10947
rdar://51913012
2019-06-19 15:11:33 -07:00
Harlan Haskins
d29e6be3e4 Merge pull request #25551 from harlanhaskins/i-saw-lookup-ignoring-super-clause
[Sema] Compute superclass of deserialized protocols via generic signature
2019-06-19 14:02:37 -07:00