Commit Graph

18240 Commits

Author SHA1 Message Date
Jordan Rose
886475b51a Make SILInstructionResultArray::begin() and end() inlinable (#18612)
These are trivial functions and should be inlined away; the only
tricky bit is they need to be defined after the iterator type.
This gives a slight speedup of stdlib compilation time (about 5%
of the time spent generating the swiftmodule).
2018-08-10 10:25:31 -07:00
Rintaro Ishizaki
254be25f4d Merge pull request #18564 from rintaro/ide-completion-contextanalysis
[CodeCompletion] Improve context type analysis
2018-08-10 10:53:44 +09:00
Argyrios Kyrtzidis
a6fd08226e Merge pull request #18616 from akyrtzi/input-complete-invalid-interpolation
[parser] Make corrections for the isInputIncomplete() functionality
2018-08-09 18:46:21 -07:00
Argyrios Kyrtzidis
82be1a5d47 [parser] Make sure the isInputIncomplete() function works as expected when there is an empty string interpolation segment
Previously it was erroneously treating such invalid interpolation segment as 'incomplete',
even though additional user input, will not 'complete' it.

rdar://28498239
2018-08-09 17:03:44 -07:00
Michael Gottesman
d61dad97f7 Merge pull request #18599 from jrose-apple/FABulous
[SIL] Clarify ownership in FunctionAnalysisBase w/ std::unique_ptr
2018-08-09 16:28:34 -07:00
Jordan Rose
1543f15081 [AST] Remove stale comment from TypeAliasDecl::setUnderlyingType (#18601)
This is used on all paths now.
2018-08-09 15:45:49 -07:00
Jordan Rose
793b335d0e [SIL] Clarify ownership in FunctionAnalysisBase w/ std::unique_ptr
I also thought I was fixing a performance issue by changing
invalidateFunction not to /insert/ new entries into the map, but
I guess those entries were present in practice. So this is just
a cleanup to make ownership easier.
2018-08-09 12:40:10 -07:00
Jordan Rose
0e10f89964 Preserve default argument text through serialization (#18579)
This allows us to dump it in the generated interface, though it's
still not syntax-highlighted. This is necessary for textual module
interfaces, but it's also just a longstanding request for Xcode's
"Generated Interface" / "Jump to Definition" feature.

rdar://problem/18675831
2018-08-09 11:06:22 -07:00
Huon Wilson
b7e513759c Merge pull request #18586 from huonw/tbd-abi-version
[TBDGen] Swift ABI Version can be a constant, not a magic number.
2018-08-10 00:18:01 +10:00
Huon Wilson
8c5ff31b21 Merge pull request #18588 from huonw/fixit-missing-if
[Parse] Fixit for inserting 'if' for 'else ... {' all on one line.
2018-08-09 23:04:19 +10:00
Rintaro Ishizaki
de6e280cf3 [CodeCompletion] Always activate CodeCompletionExpr
There's no reason not to activate them.
2018-08-09 19:16:09 +09:00
Huon Wilson
75934be398 [Parse] Fixit for inserting 'if' for 'else ... {' all on one line.
Fixes rdar://problem/33023297.
2018-08-09 20:08:11 +10:00
Huon Wilson
507d3625bc [Parse] Factor out "find instance of token on current line" logic. NFC. 2018-08-09 16:37:32 +10:00
Huon Wilson
942320f8ac [TBDGen] Swift ABI Version can be a constant, not a magic number. 2018-08-09 15:24:22 +10:00
John McCall
d30aa32001 Merge pull request #18581 from rjmccall/opaque-accessors-cleanup
Various cleanups for opaque accessors
2018-08-09 01:10:50 -04:00
John McCall
ebed6afd59 Make it easy to iterate over all the opaque accessors of a declaration. 2018-08-08 22:44:47 -04:00
John McCall
5f3eaa8feb Fix a couple of oversights relating to modify coroutines. 2018-08-08 19:11:03 -04:00
Xi Ge
1310ffc83f migrator: remove Swift 3 specific migration pass. (#18580) 2018-08-08 16:00:38 -07:00
Jordan Rose
9ebbf2fbaf [Serialization] Remove PARAMETERLIST_ELT node (#18570)
Way back in 6afe77d597 Chris removed the 'Parameter' type that tracked
extra information about parameters, collapsing it into ParamDecl and
making ParameterList "an overblown array of ParamDecl*'s". Do the same
thing for Serialization: push the few fields tracked in
PARAMETERLIST_ELT records down into PARAM_DECL, and then simplify the
PARAMETERLIST record to directly reference its parameters.

No functionality change.
2018-08-08 14:15:47 -07:00
Slava Pestov
4e21a7ae77 AST: Remove TupleType::hasParenSema()
No longer needed after previous cleanups; just fold it into its
sole remaining call site.
2018-08-08 10:18:52 -07:00
Slava Pestov
3ef0991826 AST: Remove TypeBase::getWithoutImmediateLabel()
Again, it appears that looking through one-element tuples is
no longer a thing we need to do.
2018-08-08 10:18:52 -07:00
Slava Pestov
b581c63e6b AST: Remove TypeBase::getRValueObjectType()
This would look through one-element tuples, which is no longer necessary.
2018-08-08 10:18:52 -07:00
Slava Pestov
583d8bac39 AST: TypeBase::getRValueInstanceType() no longer looks through one-element tuples
One-element tuples are not really a thing anymore, and if one pops up
unexpectedly, let's not just ignore it.
2018-08-08 10:18:52 -07:00
Pavel Yaskevich
65e67034f8 Merge pull request #18550 from xedin/improve-conformance-req-diags
[Diagnostics] Improve missing conformance diagnostics by using affect…
2018-08-08 00:36:40 -07:00
Pavel Yaskevich
ba085e5bdc [Diagnostics] Improve missing conformance diagnostics for sub-types and members
If generic parameter associated with missing conformance comes
from different context diagnose the problem as "referencing" a
specific declaration from affected type.
2018-08-07 18:55:43 -07:00
Pavel Yaskevich
ad171e05cc [Diagnostics] Improve missing conformance diagnostics by using affected declaration
Instead of simply pointing out which type had conformance failures,
let's use affected declaration instead, which makes diagnostics much
richer e.g.

```
'List<[S], S.Id>' requires that 'S.Id' conform to 'Hashable'
```

versus

```
initializer 'init(_🆔)' requires that 'E' conform to 'Hashable' [with 'E' = 'S.Id']
```

Since latter message uses information about declaration, it can also
point to it in the source. That makes is much easier to understand when
problem is related to overloaded (function) declarations.
2018-08-07 12:59:53 -07:00
Michael Gottesman
32b039b0a5 Merge pull request #18531 from gottesmm/pr-d4c98beee1c8e18e4807120c5f65bfc23808b419
[sil-opt] Only notify the pass manager of newly added functions in SI…
2018-08-07 12:05:52 -07:00
Jordan Rose
d9e47650d5 Add a new SourceFileKind and InputFileKind for textual interfaces
And test this by tweaking the rules to allow functions without
definitions, like SIL files.
2018-08-07 08:55:07 -07:00
Jordan Rose
061204c704 Remove "IFK_" prefix from enum class InputFileKind
I suspect this was converted from a non-scoped enum in the past.
No functionality change.
2018-08-07 08:54:31 -07:00
Jordan Rose
fc9ea1e329 Add Lexer::IsHashbangAllowed, drop SourceManager::getHashbangBufferID (#18534)
Having this be a single buffer hardcoded in the SourceManager and set
by all clients is silly. SourceFiles with the 'Main' kind are allowed
to have hashbang lines (`#!`), other files are not. And anyone
manually setting up a Lexer can decide for themselves.

No intended behavioral change.
2018-08-07 08:25:05 -07:00
David Ungar
f74b7e5178 Merge pull request #18489 from davidungar/rdar-42314665-fix-batch-mode-truncation-bug
[Batch Mode] Rdar 42314665 fix batch mode truncation bug
2018-08-06 22:04:36 -07:00
Doug Gregor
8f36061f25 Merge pull request #18530 from DougGregor/protocol-decl-based-resolution
[Name lookup] Use decl-based name lookup for protocol-related queries
2018-08-06 20:44:59 -07:00
swift-ci
8d1d873406 Merge pull request #18532 from dcci/deadreflectme 2018-08-06 20:15:43 -07:00
Huon Wilson
bfa4c73872 Merge pull request #18385 from huonw/tbd-property-initializer
Add @_hasInitialValue to reliably mark variables with initialisers, and use it in TBDGen for StoredPropertyInitializer symbols
2018-08-07 13:13:34 +10:00
Doug Gregor
88d2feb44b Merge pull request #18528 from DougGregor/irgen-objc-refcount
[IRGen] Use a more precise computation for the kind of reference count.
2018-08-06 19:25:48 -07:00
Davide Italiano
fdf2ba19ac [ReflectionContext] Remove dead code. NFCI.
This is untested, and unused. I originally planned to use it
in the debugger, but I changed my mind.
2018-08-06 18:45:06 -07:00
Michael Gottesman
f35a2a3cf8 [sil-opt] Only notify the pass manager of newly added functions in SILOptFunctionBuilder.
To do so this commit does a few different things:

1. I changed SILOptFunctionBuilder to notify the pass manager's logging
functionality when new functions are added to the module and to notify analyses
as well. NOTE: This on purpose does not put the new function on the pass manager
worklist since we do not want to by mistake introduce a large amount of
re-optimizations. Such a thing should be explicit.

2. I eliminated SILModuleTransform::notifyAddFunction. This just performed the
operations from 1. Now that SILOptFunctionBuilder performs this operation for
us, it is not needed.

3. I changed SILFunctionTransform::notifyAddFunction to just add the function to
the passmanager worklist. It does not need to notify the pass manager's logging
or analyses that a new function was added to the module since
SILOptFunctionBuilder now performs that operation. Given its reduced
functionality, I changed the name to addFunctionToPassManagerWorklist(...). The
name is a little long/verbose, but this is a feature since one should think
before getting the pass manager to rerun transforms on a function. Also, giving
it a longer name calls out the operation in the code visually, giving this
operation more prominance when reading code. NOTE: I did the rename using
Xcode's refactoring functionality!

rdar://42301529
2018-08-06 18:27:24 -07:00
Michael Gottesman
4d35d5e7c7 Merge pull request #18525 from gottesmm/pr-cc80d72aed9cc61947b24e6ae65da90e8473e53b
[sil] Mark all members of SILFunctionBuilder private and make composi…
2018-08-06 18:26:24 -07:00
David Ungar
7e19f7829b consumerAndRangeForLocation -> subconsumerForLocation 2018-08-06 18:00:17 -07:00
Davide Italiano
72df014a84 Merge pull request #18447 from sparkasaurusRex/codeview-linetables
Reduce breaks in CodeView linetables
2018-08-06 17:08:56 -07:00
Doug Gregor
4d39506c4a [IRGen] Use a more precise computation for the kind of reference count.
TypeBase::usesNativeReferenceCounting() was doing a lot of work to
find the class that a type refers to, then determine whether it
would use the native reference-counting scheme. Its primary caller
in IRGen would use an overly-conservative approximation to decide
between the “Objective-C” and “unknown” cases, which resulted in
uses of “unknown” reference counting for some obviously-ObjC cases
(e.g., values of “NSObject”).

Moreover, the approximation would try to call into the type checker
(because it relied unnecessarily on the superclass *type* of a class
declaration), causing an assertion.

Fixes rdar://problem/42828798.
2018-08-06 17:04:47 -07:00
Huon Wilson
7753383223 [AST] Add @_hasInitialValue to var/lets that have initializers.
The information about whether a variable/property is initialized is lost in the
public interface, but is, unfortunately, required because it results in a symbol
for the initializer (if a class/struct `init` is inlined, it will call
initializers for properties that it doesn't initialize itself). This is
important to preserve for TBD file generation.

Using an attribute rather than just a bit on the VarDecl means this fits into
the scheme for module interfaces: textual/valid Swift.
2018-08-07 09:54:35 +10:00
Mark Lacey
df923d9660 Merge pull request #18522 from rudkx/disable-perf-hacks
[ConstraintSystem] Add an option to disable the constraint solver per…
2018-08-06 15:42:20 -07:00
Michael Gottesman
ac96aba069 [sil] Mark all members of SILFunctionBuilder private and make composition classes friend clases.
This is the final step towards making sure no one can use a SILFunctionBuilder
except through composition classes.

rdar://42301529
2018-08-06 15:11:50 -07:00
Michael Gottesman
f500f007f8 [sil] Add a template parameter to TypeSubstCloner so that subclasses can inject a SILFunctionBuilder composition class.
This works around a potential circular dependence issue where TypeSubstCloner
needs access to SILOptFunctionBuilder but is in libswiftSIL.

rdar://42301529
2018-08-06 13:40:25 -07:00
Mark Lacey
3c9cb97c86 [ConstraintSystem] Add an option to disable the constraint solver perf hacks.
This is helpful in experimenting with constraint solver changes that
might help us remove some of these unsound options. It's not ever mean
to be enabled, but if we're able to remove the things guarded by the
option we can eventually remove the option.
2018-08-06 11:48:19 -07:00
swift-ci
71f0248b0a Merge remote-tracking branch 'origin/master' into master-next 2018-08-06 11:07:55 -07:00
Doug Gregor
6556926cba [AST] Switch ProtocolDecl::requiresClass() over to decl-based resolution.
Resolving whether a protocol is class-bound only requires declaration-based
resolution (not the full type checker), so switch over to those APIs.
2018-08-06 10:07:16 -07:00
Michael Gottesman
b8cb40b950 Merge pull request #18517 from gottesmm/pr-69d1270fb634f67dfbb02afed012bb5cada0dcc1
[passmanager] Change the optimizer to use SILOptFunctionBuilder.
2018-08-06 09:54:01 -07:00
Doug Gregor
971a6e3cd3 [Name lookup] Use decl-based name lookup for the conformance lookup table.
Add API to get all of the nominal types directly referenced from the
inheritance clause of a given declaration. Use that to find the protocols
to enter into the conformance lookup table based on a given declaration,
without going through the type checker [*].

[*] Except for unqualified lookup still needing to use the type checker.
2018-08-06 09:15:57 -07:00