Commit Graph

20516 Commits

Author SHA1 Message Date
Jordan Rose
c88c8b5f90 [ParseableInterface] Don't serialize deps for explicit builds
If the frontend is invoked with
-build-module-from-parseable-interface, we might be trying to persist
and distribute the swiftmodule that gets built. In that case, any
dependencies we list might not be relevant.

This probably isn't really the final answer here; what we want is some
way to say /which/ dependencies are relevant, and how they're related
to how the swiftmodule that gets used. Most likely the right answer
here is to limit this to dependencies within the SDK or something.
2018-12-21 15:41:23 -08:00
Jordan Rose
614deb640b [ParseableInterface] Pass prebuilt cache path down to sub-invocations
Otherwise, the top-level compilation gets the benefit of the prebuilt
cache path, but the sub-invocations for swiftinterfaces that /do/
need to be compiled do not.
2018-12-21 15:41:17 -08:00
Jordan Rose
7562137fab [ParseableInterfaces] Move call to helper to the one place it's needed
This is a little trickier than it sounds because we have 'friend'
access into the FrontendInputsAndOutputs structure, which means all
the helpers need to be declared in the header file. But it makes the
two use sites simpler, and does slightly less work in the cache hit
path.
2018-12-21 15:41:10 -08:00
Jordan Rose
5417ca0aa2 [ParseableInterfaces] Handle swiftdoc files correctly
The previous 'openModuleFiles' interface in SerializedModuleLoaderBase
still assumed that swiftmodule files and swiftdoc files would be found
next to each other, but that's not true anymore with
swiftinterfaces-built-to-modules. Give up on this assumption (and on
the minor optimization of passing down a scratch buffer) and split out
the interface into the customization point
'findModuleFilesInDirectory' and the implementation 'openModuleFiles'.
The latter now takes two full paths: one for the swiftmodule, one for
the swiftdoc.
2018-12-21 15:37:32 -08:00
Brent Royal-Gordon
1a6ca82d6b [NFC] Extract helper for making NSError domains
Avoids having to coordinate changes in two different parts of the compiler.
2018-12-21 15:30:35 -08:00
Slava Pestov
ae21b8b80f Sema: Resilient classes cannot have @inlinable deinits 2018-12-21 17:51:32 -05:00
swift-ci
36c0ebfe1d Merge pull request #21502 from DougGregor/dynamic-replacement-ambiguity 2018-12-21 12:50:30 -08:00
Doug Gregor
5d968621d7 [Type checker] Basic ambiguity resolution + diagnostics for dynamic replacement.
We weren't doing much validation when dynamically replacing storage
declarations, and has an assert() that should be an error. Clean up this
area a bit, dealing with simple ambiguities (i.e., there are two
properties or subscripts with different type signatures; pick the
matching one) and reporting an error when there is a true ambiguity.

Fixes rdar://problem/46737657.
2018-12-21 11:47:59 -08:00
Andrew Trick
83950babc9 Merge pull request #21490 from atrick/fix-getobjc-after-free
Fix SILCombine metatype cast optimization to avoid extending lifetimes.
2018-12-21 11:22:19 -08:00
Andrew Trick
65c95dd840 Fix SILCombine metatype cast optimization to avoid extending lifetimes.
This cannot be correctly done as a SILCombine because it must create
new instructions at a previous location. Move the optimization into
CastOptimizer. Insert the new metatype instructions in the correct
spot. And manually do the replaceAllUsesWith and eraseInstruction
steps.

Fixes <rdar://problem/46746188> crash in swift_getObjCClassFromObject.
2018-12-21 09:52:38 -08:00
Robert Widmann
2efbeb3912 Merge pull request #21451 from CodaFi/logicd
[SR-8272] Drop the last remnants of LogicValue
2018-12-20 23:33:20 -05:00
Slava Pestov
f1bce6d3fb Merge pull request #21476 from slavapestov/sil-witness-table-cleanup
Clean up SIL witness table deserialization
2018-12-20 21:12:46 -05:00
Jordan Rose
117dc276a9 Merge pull request #21450 from jrose-apple/conditionally-retro
[ABI] [Mangling] Only look for retroactive conformances in conditional reqs
2018-12-20 18:02:46 -08:00
swift-ci
67e9b99fbd Merge pull request #21470 from ravikandhadai/witnesss-method-subs-branch 2018-12-20 16:07:32 -08:00
Slava Pestov
983e077a0c SIL: Remove SILModule::createWitnessTableDeclaration()
The code becomes simpler if we fold it into its only caller.
2018-12-20 17:36:38 -05:00
Slava Pestov
39c93b9f85 SIL: Remove linkage parameter from SILModule::createWitnessTableDeclaration()
All callers were doing the same thing here, so move it inside the
function. Also, change getRootNormalConformance(), which is deprecated,
to getRootConformance().
2018-12-20 17:36:38 -05:00
Jordan Rose
0ca4d557f4 [Mangling] Split up protocol-conformance-ref further
New(er) grammar:

    // same module as conforming type, or non-unique
    protocol-conformance-ref ::= protocol 'HP'
    // same module as protocol
    protocol-conformance-ref ::= protocol 'Hp'
    // retroactive
    protocol-conformance-ref ::= protocol module

We don't make use of this distinction anywhere yet, but we could in
the future.
2018-12-20 14:00:06 -08:00
Pavel Yaskevich
73a757d247 Merge pull request #21457 from xedin/nit-fix-for-witness_not_usable_from_inline-diag
[Diagnostics] NFC: Remove redundant "because" from `witness_not_usabl…
2018-12-20 13:19:19 -08:00
Ravi Kandhadai
92260f9a93 [Devirtualizer] Make the getWitnessMethodSubstitutions function of
Devirtualizer.cpp available to other passes.

This will enable the compile-time interpreter to use this functionality.
2018-12-20 12:27:19 -08:00
Nathan Hawes
625cd94ab9 Merge pull request #21447 from nathawes/r42162571-rename-calls-with-trailing-closure-ignored-if-param-has-label
[Refactoring][Migrator] Fix rename of callsites with a trailing closure argument
2018-12-20 09:48:12 -08:00
Pavel Yaskevich
46afe3bb41 [Diagnostics] NFC: Remove redundant "because" from witness_not_usable_from_inline 2018-12-20 00:53:51 -08:00
Robert Widmann
426fe886dc [SR-8272] Drop the last remnants of LogicValue
Removes the _getBuiltinLogicValue intrinsic in favor of an open-coded
struct_extract in SIL.  This removes Sema's last non-literal use of builtin
integer types and unblocks a bunch of cleanup.

This patch would be NFC, but it improves line information for conditional expression codegen.
2018-12-19 23:14:59 -05:00
Michael Gottesman
4b95ca82b9 Merge pull request #21439 from gottesmm/pr-8067c5675a42d8ecfc248e2b2fe644ee2795fc06
[ownership] Eliminate -assume-parsing-unqualified-ownership-sil now that it is a no-op.
2018-12-19 17:35:40 -08:00
Nathan Hawes
43c2f27783 [Refactoring][Migrator] Fix rename of callsites with a trailing closure argument
A label range of 0 length was being reported as the label of trailing closure
arguments, just before the opening '{'.

For the rename refactoring, this meant that if the corresponding parameter had
an external label (e.g. 'a') the occurrence would be treated as not matching the
expected symbol name, and so not be updated at all.

For the migrator, when renaming a function with an unlabelled closure for its
last parameter to have a label, it would incorrectly insert the new label in
front of the opening '{' on all of that function's callsites with trailing
closures.

Resolves rdar://problem/42162571
2018-12-19 16:24:14 -08:00
Karoy Lorentey
624135641d Merge pull request #21057 from lorentey/actually-deprecate-hashValue
[Sema] Emit a deprecation warning if a Hashable type only implements hashValue
2018-12-19 22:47:16 +00:00
Michael Gottesman
9dc8bbb866 [ownership] Eliminate -assume-parsing-unqualified-ownership-sil now that it is a no-op. 2018-12-19 12:54:13 -08:00
John McCall
6e5ce64db1 Ban variadic enum cases.
These should be supported in the long term, but in the short term,
crashing is not accepable behavior.

rdar://46821582
2018-12-18 17:27:48 -05:00
swift-ci
5debcddeaf Merge pull request #21402 from lanza/runtime 2018-12-18 13:26:27 -08:00
Xi Ge
6b405a4624 Merge pull request #21387 from nkcsgexi/syntactic-opts
migrator: run try? migration pass only when migrating from swift<5.
2018-12-18 10:53:26 -08:00
Doug Gregor
4ab61dbddd Merge pull request #21397 from DougGregor/mangle-protocol-conformance-ref-operator
[Mangling] Give protocol-conformance-ref an operator.
2018-12-18 00:06:20 -08:00
Nathan Lanza
6d92dfaaa2 Remove check for including Runtime due to CmakeConfig.h dependencies
Various files include Runtime/Config.h which depends on
Runtime/CMakeConfig.h and thus this check does not work.
2018-12-17 20:31:32 -08:00
Jordan Rose
4bfe4eff6d [ParseableInterfaces] Add -prebuilt-module-cache-path to the frontend
When trying to load a swiftinterface, search this directory before
doing all the work of building a swiftmodule.
2018-12-17 18:23:28 -08:00
Doug Gregor
510b64fcd5 [Mangling] Give protocol-conformance-ref an operator.
Due to some unfortunate refactoring, protocol-conformance-ref is a
nonterminal in the mangling grammar that doesn't have its own
operator:

```
protocol-conformance-ref ::= protocol module?
```

Both "module" and "protocol" can be an "identifier", which introduces
a mangling collision. Address the mangling collision by using the
operator "HP".

Fixes rdar://problem/46735592.
2018-12-17 18:11:47 -08:00
Xi Ge
74ef5ebe86 migrator: run try? migration pass only when migrating from swift<5.
This migration pass is version specific, so we should add an option
controlling whether we should perform it.
2018-12-17 14:54:34 -08:00
Doug Gregor
388f4b825a Merge pull request #21370 from DougGregor/shadow-of-the-resultus
[Name lookup] Enable shadowing for type lookup and of the Swift module.
2018-12-17 13:37:03 -08:00
Doug Gregor
aa5dc6c77a [AST] Use a proper “empty key” encoding for CanType in DenseMaps.
… rather than co-opting NULL, which is a valid CanType type.
2018-12-16 21:59:16 -08:00
Michael Gottesman
23378cc16f [sil] Rename QualifiedOwnership => Ownership.
Done using Xcode's refactoring engine.
2018-12-16 15:21:52 -08:00
Michael Gottesman
8f7620f627 [semantic-arc-opts] Implement a simple load [copy] -> load_borrow optimization for arguments to create optimization scaffolding.
This is the first in a sequence of patches that implement various optimizations
to transform load [copy] into load_borrow.

The optimization works by looking for a load [copy] that:

1. Only has destroy_value as consuming users. This implies that we do not need
to pass off the in memory value at +1 and that we can use a +0 value.

2. Is loading from a memory location that is never written to or only written to
after all uses of the load [copy].

and then RAUW the load [copy] with a load_borrow and convertes the destroy_value
to end_borrow.

NOTE: I also a .def file for AccessedStorage so we can do visitors over the
kinds. The reason I want to do this is to ensure that people update these
optimizations if we add new storage kinds.
2018-12-16 12:32:46 -08:00
Argyrios Kyrtzidis
51bf7cc6ed Merge pull request #21362 from akyrtzi/parserunit-parse
[Parser] Introduce ParserUnit::parse() function to avoid duplication of code
2018-12-16 11:03:50 -08:00
Argyrios Kyrtzidis
66be4a58b4 [Parser] Introduce ParserUnit::parse() function to avoid duplication of code 2018-12-16 09:52:15 -08:00
David Ungar
7ae7038f10 Merge pull request #20823 from davidungar/master-with-comments
[Driver] NFC: Added some comments around incremental compilation.
2018-12-15 13:16:15 -08:00
swift-ci
518f26af06 Merge pull request #19657 from apple/marcrasi-const-evaluator-part-2 2018-12-15 09:03:37 -08:00
Marc Rasi
8dcf89cfd6 constant interpreter: addresses and memory
Adds memory objects and addresses to the constant interpreter, and
teaches the constant interpreter to interpret various instructions that
deal with memory and addresses.
2018-12-14 20:21:35 -08:00
Greg Parker
b875dca8ba [runtime] Fix include guard in Runtime/CMakeConfig.h. (#21227) 2018-12-14 13:29:10 -08:00
Greg Parker
41f048410a [build] Fix generated header files in standalone overlay builds. (#21206) 2018-12-14 13:28:53 -08:00
Jordan Rose
cb6fa8debb Merge pull request #21278 from jrose-apple/build-parseable-interface-to-module
Add frontend mode -build-module-from-parseable-interface
2018-12-13 14:20:26 -08:00
Jordan Rose
37708ede6e Add frontend mode -build-module-from-parseable-interface
Makes it easier to test the caching behavior, and may also be useful
for "prebuilding" swiftinterfaces in the future, or having the Driver
kick off a bunch of separate builds as proper tasks.
2018-12-13 11:18:05 -08:00
Jordan Rose
13c8a75da5 [ParseableInterface] Split up creation of the sub-CompilerInvocation
The goal here is to separate the parts that compute an output file
name from the parts that do the actual compilation, so that we can
test the swiftinterface -> swiftmodule behavior more directly. No
functionality change in this commit; the next will take advantage
of the refactoring.
2018-12-12 19:49:02 -08:00
Joe Groff
89979137fc Push ArchetypeType's API down to subclasses.
And clean up code that conditionally works only with certain kinds of archetype along the way.
2018-12-12 19:45:40 -08:00
Slava Pestov
4f0f11f6bb Merge pull request #21260 from slavapestov/objc-members-transitivity
AST: Rework @objcMembers inheritance to not depend on validation order
2018-12-12 20:39:05 -05:00