Commit Graph

20744 Commits

Author SHA1 Message Date
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
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
Slava Pestov
566e9dfea0 Frontend: Remove -enable-resilience flag 2019-06-22 21:37:04 -04:00
Slava Pestov
f01e384826 Frontend: Remove -enable-resilient-objc-class-stubs flag 2019-06-22 21:37:04 -04: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
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
Saleem Abdulrasool
38995f5d80 Merge pull request #25070 from moatom/fix-include-guard
Fix include guards
2019-06-20 17:26:08 -07: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
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
Rintaro Ishizaki
b1fae101f2 [AST] Restore previous behavior for DocCommentAsXML
Associate requirement decl with DocComment.
2019-06-20 12:05:04 -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
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
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
Slava Pestov
d27175db63 Merge pull request #25615 from slavapestov/lazy-storage-cleanup
Clean up implementation of lazy property underlying storage
2019-06-20 10:23:52 -04:00
Michael Gottesman
32fe5eba89 [gardening] Fix a file level comment to be a doxygen comment. 2019-06-19 22:46:51 -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
Jordan Rose
4c26f95c01 Treat 'some' types as having non-simple representations by default (#25620)
That is, if they appear inside a larger type, they may need to be
parenthesized. ASTPrinter is careful about this already, so this
doesn't actually change any existing behavior, but it makes the
default more conservative when no PrintOptions are in play.
2019-06-19 19:48:37 -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
Slava Pestov
1e1e812768 Sema: Use a request to create lazy property backing storage 2019-06-19 22:12:55 -04:00
Slava Pestov
2d18ba2ed5 IRGen: Simplify a bit of code with ProtocolDecl::getAssociatedTypeMembers() 2019-06-19 22:12:55 -04:00
Michael Gottesman
fce7454ada [reflection] Extract out ReflectionInfo from TypeRefBuilder -> ReflectionInfo.
The reason why I am doing this is so that I can create an adaptor class
(templated on Runtime) for reading protocol info from ReflectionInfo without
having to make ReflectionInfo itself generic. If ReflectionInfo becomes generic
on Runtime, it will cause a cascading need to mark classes in Reflection as
generic as well.
2019-06-19 15:16:17 -07:00
Michael Gottesman
68b987be8f [metadata] Change External::RelativeDirectPointer to be a real RelativeDirectPointer instead of an int32_t.
From talking with JoeG, this is due to historically RelativeDirectPointer not
having been ripped out of the runtime when this was written. This works now, so
it makes sense to change it. In terms of my goals, I want to use this to make it
easier to dump the names of protocols.
2019-06-19 15:16:17 -07:00
Slava Pestov
69c643b3d3 Merge pull request #25598 from slavapestov/storage-mutability-requests
Answer storage mutability-related questions with requests
2019-06-19 17:03:14 -04: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
Jordan Rose
896d53da55 Merge pull request #25603 from vguerra/SR-10915
[Diagnostics] Undefining REMARK macro.
2019-06-19 13:24:59 -07:00
Joe Groff
e71bfd38c7 Merge pull request #25600 from jckarter/opaque-xref-extension-module
Serialization: Deserialize opaque type xrefs from the right extension module.
2019-06-19 13:17:02 -07:00
Slava Pestov
0ec33bfa4a Sema: Use a request to compute AbstractStorageDecl::getOpaqueReadOwnership() 2019-06-19 14:38:43 -04:00
Slava Pestov
4df9543ee8 Sema: Use a request to compute AbstractStorageDecl::is{Getter,Setter}Mutating() 2019-06-19 14:38:43 -04:00
Slava Pestov
7913d30236 Sema: Use a request to compute FuncDecl::getSelfAccessKind() 2019-06-19 14:38:43 -04:00
Joe Groff
70aba4d1fe Serialization: Deserialize opaque type xrefs from the right extension module.
When deserializing an opaque type xref inside an extension context, we were looking
incorrectly in the base module of the type being extended, rather than in the module
of the extension, where the opaque type would really be. Fixes rdar://problem/51775500.

This includes a small refactoring of OpaqueTypeDecl deserialization to break the inevitable
cycle between deserializing the namingDecl, and the namingDecl turning around and re-
deserializing its opaque return type. This is NFC but avoids some unnecessary work.
2019-06-19 09:46:49 -07:00
Rintaro Ishizaki
e52feac6d0 Merge pull request #25565 from owenv/unnamed_static_var_diag
[Diagnostics]: Fix broken diagnostic for unnamed static class property
2019-06-19 09:44:32 -07:00
Victor Guerra
57aa612df4 [Diagnostics] Undefining REMARK macro.
Follow up on fix for SR-10915 where I forgot to undefine the REMARK
macro.

ref: https://github.com/apple/swift/pull/25585
2019-06-19 10:20:06 +02:00
Joe Groff
83f86f52cb Merge pull request #25581 from jckarter/no-opaque-type-in-protocol
Sema: Protocol requirements cannot use opaque return types.
2019-06-18 17:23:38 -07:00
Victor Guerra
96ddf4455d [Diagnostics] Hooking up remarks emitted from Clang. (#25585)
Now that Swift support remarks ClangImporter we pass them
to the Clang diagnostic producer instead of ignoring them.

Fixes SR-10915
2019-06-18 16:46:56 -07:00
Harlan Haskins
d23101d337 [Sema] Compute superclass of deserialized protocols via generic signature
We don't need to serialize the protocol's superclass, we can compute it from the
generic signature. Previously, we would drop the superclass while
serializing because we didn't check the generic signature in
SuperclassTypeRequest, which would cause us to cache `NULL` when we
called `setSuperclass` for a protocol with a superclass constraint.

Fixes rdar://50526401
2019-06-18 16:38:09 -07:00
Joe Groff
58a35f3430 Sema: Protocol requirements cannot use opaque return types.
We could invent a meaning for this in the future (such as having it be sugar for an unnamed
associated type), but for now raise an error with a fixit. rdar://problem/50678247
2019-06-18 14:59:48 -07:00
Jordan Rose
585ebbd523 Merge pull request #25447 from jrose-apple/override-the-train
Add the notion of @_implementationOnly overrides
2019-06-18 13:46:17 -07:00
Arnold Schwaighofer
27bfcd53dc Rework getRuntimeFn runtime availability
NFC.
2019-06-18 11:09:07 -07:00
Hamish Knight
e1f8af2389 Merge remote-tracking branch 'upstream/master' into a-couple-of-tangents 2019-06-18 19:09:06 +01:00
swift-ci
a1b281135a Merge pull request #25359 from hamishknight/five-minute-argument 2019-06-18 10:36:10 -07:00
Jordan Rose
2397bf4489 Under -enable-library-evolution, imports need Library Evolution too (#25549)
Otherwise, there's no guarantee of binary compatibility, and whoever
turned on library evolution support shouldn't be lulled into a false
sense of security.

This is just a warning for now, but will be promoted to an error later
once clients have shaken out any places where they're doing this.
Note that the still-experimental '@_implementationOnly' opts out of
this check, because that enforces that the import doesn't make its way
into the current module's public source or binary interface.

rdar://50261171
2019-06-18 09:22:56 -07:00
Arnold Schwaighofer
85bfbe2dd3 Merge pull request #25473 from aschwaighofer/back_deploy_dynamic_replacement
stdlib: Add backward deployment versions for the dynamic-replacement runtime functions
2019-06-18 09:02:22 -07:00
Arnold Schwaighofer
906f0b4e9e Address review comments 2019-06-17 19:47:52 -07:00
Jordan Rose
406a9d9cf1 Add the notion of @_implementationOnly overrides
When an @_implementationOnly import includes Objective-C categories
for existing types, it's useful to be able to override the members
provided in those categories without exposing them to clients of the
framework being built. Allow this as long as the overriding
declaration is marked as @_implementationOnly itself, with an
additional check that the type of the declaration does not change.
(Normally overrides are allowed to change in covariant ways.)

Part of rdar://50827914
2019-06-17 17:48:40 -07:00