Commit Graph

58361 Commits

Author SHA1 Message Date
Xi Ge
e50096fe22 Merge pull request #30080 from nkcsgexi/ObjCCategoryDecl-canonical
ClangImporter: import non-canonical ObjCCategoryDecl after recent clang changes
2020-02-26 15:49:12 -08:00
Michael Gottesman
d1b41e9ac4 [ownership] Add an extra run of TempRValueOpt before Semantic ARC Opts.
There is a natural synergy in between the two passes since TempRValueOpt often
times eliminates temporaries that prevent Semantic ARC Opts from removing ARC
traffic.

NOTE: The reason why I am adding an extra run rather than moving the
TempRValueOpt that runs slightly after SemanticARCOpts on non-ownership SIL is
that the run afterwards is able to run on non-ossa code from the stdlib/etc and
eliminate copies that way. With time once we transition to always serializing in
OSSA form, we will be able to get rid of that second run.
2020-02-26 15:24:07 -08:00
Joe Groff
808d33d016 IRGen: Don't cache accesses to fixed class metadata.
The only initialization these class objects need is ObjC realization, which can be done
fast with `objc_opt_self` on recent Apple OSes. The cache check just adds code size and
dirties memory.
2020-02-26 15:10:18 -08:00
Rintaro Ishizaki
c3c5fbc5a2 Merge pull request #30004 from rintaro/ide-completion-genericreq-rdar58580482
[CodeCompletion] Re-implement generic requirement completion
2020-02-26 14:53:00 -08:00
Xi Ge
3fe4b89dbf ClangImporter: import non-canonical ObjCCategoryDecl after recent clang changes
Recent clang side change merges ObjCCategoryDecl with the same name. All re-declarations
of a category points to the first category as the canonical one. This patch keeps these
non-canonical redeclarations as separate extensions in Swift.

rdar://problem/59744309
2020-02-26 13:41:09 -08:00
Joe Groff
0fb4ea1ec3 Merge pull request #30003 from NobodyNada/master
[SILOptimizer] Generalize optimization of static key paths, take 2
2020-02-26 12:13:43 -08:00
Suyash Srijan
d7bba7f193 [Typechecker] Use getCalledValue() rather than using DeclRefExpr to get the function decl when checking ignored expressions (#30077) 2020-02-26 19:49:58 +00:00
Rintaro Ishizaki
fc28f909b8 [CodeCompletion] Tweak canBeUsedAsRequirementFirstType() 2020-02-26 10:58:01 -08:00
Doug Gregor
031f5a4888 Merge pull request #30065 from DougGregor/function-builders-if-case-fixes
[Constraint system] Cleanups for function builders support for if let/if case let
2020-02-26 10:38:15 -08:00
Pavel Yaskevich
e70ef60ad5 Merge pull request #30067 from xedin/rdar-59741308
[ConstraintSystem] Don't attempt bindings for closure parameters/resu…
2020-02-26 10:03:58 -08:00
Rintaro Ishizaki
0dd0092e9e [CodeCompletion] Only suggest generic params in where for non-protocol
nominal types
2020-02-26 09:57:18 -08:00
Rintaro Ishizaki
ea6886114a [CodeCompletion] Generalize generic requirement completion
Align completion logics for all 'where' clauses.
2020-02-26 09:57:18 -08:00
Rintaro Ishizaki
e5cdbb7fab [CodeCompletion] completeGenericRequirement to use the decl context
instead of the parsed type name for the extension.
Preparation for generalize this to other 'where' clause (e.g. functions)
2020-02-26 09:57:17 -08:00
Rintaro Ishizaki
5cf88a15cf [CodeCompletion] Rename GenericParam kind to GenericRequiremnt
NFC
2020-02-26 09:57:17 -08:00
Rintaro Ishizaki
ea947987e9 [CodeCompletion] Associated types after where on a protocol extesnion
rdar://problem/58580482
2020-02-26 09:57:17 -08:00
Arnold Schwaighofer
6c482d977b Merge pull request #30075 from aschwaighofer/irgen_reinstate_jit_workaround
IRGen: Reinstate JIT workaround removed in PR #28704
2020-02-26 09:54:21 -08:00
Rintaro Ishizaki
75c36615e4 Merge pull request #29048 from rintaro/ide-completion-fasttoplevel-rdar58378157
[CodeCompletion] Fast completion for top-level code in single file script
2020-02-26 09:49:18 -08:00
Arnold Schwaighofer
cae695e81b SILGen: Fix dynamic replacement before original function
Creating a @_dynamicReplacement function requires the creation of a
reference to the original function. We need to call SILGenModule's
getFunction to satisfy all the assertions in place.

rdar://59774606
2020-02-26 09:47:36 -08:00
Erik Eckstein
43e8b07e3f GlobalOpt: improvements for constant folding global variables
* Simplified the logic for creating static initializers and constant folding for global variables: instead of creating a getter function, directly inline the constant value into the use-sites.
* Wired up the constant folder in GlobalOpt, so that a chains for global variables can be propagated, e.g.

  let a = 1
  let b = a + 10
  let c = b + 5

* Fixed a problem where we didn't create a static initializer if a global is not used in the same module. E.g. a public let variable.
* Simplified the code in general.

rdar://problem/31515927
2020-02-26 17:35:05 +01:00
Arnold Schwaighofer
335be17562 IRGen: Reinstate JIT workaround removed in PR #28704
The usage of private vars that seemingly are accessed accross object
files confuses the JIT.

rdar://59782487
2020-02-26 08:00:05 -08:00
Michael Gottesman
54e2d97bca [temp-rvalue-opt] Update temp-rvalue-opt for OSSA.
The pass is already setup for OSSA, so I just enabled it for ownership and
converted its tests over. Eventually, I am going to be able to add support for
eliminating alloc_stack that have a loadabel value and whose lifetime are ended
via a load [take]. But that will be in a forthcoming commit.
2020-02-25 23:29:37 -08:00
Doug Gregor
c58e0aa169 [Constraint system] Make sure we set expression types on StmtCondition. 2020-02-25 22:43:21 -08:00
Michael Gottesman
5e9d720a28 Move TempRValueOpt from CopyForwarding.cpp -> TempRValueElimination.cpp.
The pass is standalone from CopyForwarding and is big enough to stand on its
own.

This changes is NFC beyond clang-format + xcode rename.
2020-02-25 21:12:16 -08:00
Holly Borla
3a361c7f02 [Attr] Implement printing the typeEraser attribute. 2020-02-25 19:53:25 -08:00
Holly Borla
3032dbd210 [Serialization] Implement serialization/deserialization for the typeEraser
attribute.
2020-02-25 19:53:25 -08:00
Holly Borla
96d7434fd0 [Sema] Implement type erasure for dynamic replacement when the
dynamically replaceable function returns an opaque type.
2020-02-25 19:53:25 -08:00
swift-ci
281da6b451 Merge pull request #30066 from gottesmm/pr-1130ca3a3a3a8cf94b05b9bb79cdecefe4a48833 2020-02-25 19:42:32 -08:00
Slava Pestov
d823be96a2 Merge pull request #30061 from slavapestov/property-wrapper-backing-init-constrained-extension
SILGen: Fix substitution map when calling property wrapper backing initializer
2020-02-25 22:11:45 -05:00
Slava Pestov
2ca7134f7d Merge pull request #30053 from slavapestov/keypath-component-resilient-stored-generic
SILGen: Work around for stored property keypath components not supporting generic resilient classes
2020-02-25 22:10:51 -05:00
Slava Pestov
2cfc2fa567 Merge pull request #30054 from slavapestov/vtable-thunk-generic-subclass-non-generic-base-class
Fix vtable thunk emission with a generic subclass of a non-generic base class
2020-02-25 22:10:03 -05:00
Ravi Kandhadai
482c82cee5 Merge pull request #30060 from ravikandhadai/oslog-dynamic-precision
[os log][stdlib/private] Enable precision and alignment values to be dynamic.
2020-02-25 19:08:19 -08:00
Pavel Yaskevich
0e88bd6890 [ConstraintSystem] Don't attempt bindings for closure parameters/result until body is opened
Let's delay attempting any bindings for type variables representing
parameters or result type of the closure until the body is "opened"
because it's impossible to infer a full set of bindings until all
constraints related to a closure have been generated.

Resolves: rdar://problem/59741308
2020-02-25 17:42:37 -08:00
Michael Gottesman
258f9bed8e [semantic-arc] Update begin_borrow elimination for guaranteed phi args.
Now, guaranteed phi args can also consume begin_borrow. This means our simple
analysis here is not sufficient. I am going to add support for this in a
forthcoming commit.

Optimizations are still not creating guaranteed phi arguments, so no breakage
can result.
2020-02-25 17:16:54 -08:00
Pavel Yaskevich
9ae68133ff Merge pull request #30040 from xedin/sr-11743
[ConstraintSystem] Look through l-value while checking whether dynami…
2020-02-25 17:09:45 -08:00
Hamish Knight
63e4ec6bdd Merge pull request #30038 from hamishknight/plenty-of-scope-for-requestification
Requestify scoped import validation
2020-02-25 16:40:00 -08:00
Doug Gregor
8482516412 [Constraint system] Properly deal with "as" patterns.
Teach pattern matching involving "as" patterns to work properly in
function builders. The code almost handled this, but prematurely
prechecking expressions in patterns broke it.
2020-02-25 16:29:07 -08:00
Doug Gregor
cc8db01ba9 Merge pull request #30045 from DougGregor/function-builders-if-let
[Constraint system] Support if let / if case in function builders.
2020-02-25 16:24:09 -08:00
swift-ci
1100144233 Merge pull request #30056 from gottesmm/pr-ff10022369984ebf7c3eea59bda1dda7eff169cb 2020-02-25 16:19:05 -08:00
Rintaro Ishizaki
0a0cde92a4 [CodeCompletion] Fast completion for top-level code in single file script
e.g. Playground.
A single file script is like a single function body; the interface of
the file does not affect any other files.
So when a completion happens in a single file script, re-parse the whole
file. But we are still be able to reuse imported modules.

rdar://problem/58378157
2020-02-25 15:56:28 -08:00
Xi Ge
baa83f53d7 Merge pull request #30048 from nkcsgexi/disable-lock-file-interface-for-test
Front-end: add an option to not lock interface file when building module
2020-02-25 15:46:38 -08:00
Slava Pestov
4b9c82de5b SILGen: Fix substitution map when calling property wrapper backing initializer
If we're emitting a designated constructor inside a constrained extension,
we have to use the correct substitution map for calling the property wrapper
backing initializer.

Factor out the computation of this substitution map and use it consistently.

Fixes <rdar://problem/59245068>.
2020-02-25 18:18:54 -05:00
Ravi Kandhadai
7c9ddca1d4 [os log][stdlib/private] Enable precision and alignment values to be dynamic.
The format specifier constructed by the os log implementation uses '*' for
width and precision, and passes those values to the os_log ABIs as additional
arguments of the message. (The precision/alignment arguments have the
type: count).

Update tests to handle this change.
2020-02-25 15:11:48 -08:00
swift-ci
2ffeb3608c Merge pull request #30051 from gottesmm/pr-7908b92ced8c329c27b870832c793311a91089b0 2020-02-25 14:23:54 -08:00
Michael Gottesman
15bd35017d [ownership] Move semantic arc opts from Mandatory -> Transforms. 2020-02-25 14:16:43 -08:00
Francis Visoiu Mistrih
e7b2850f52 [SIL][Remarks] Use camelCase for fields, arguments, and variables 2020-02-25 14:09:10 -08:00
Doug Gregor
6ad4b252ef [Constraint system] Address review comments on if patterns in function builders 2020-02-25 14:06:05 -08:00
Slava Pestov
2a865a06b6 SILGen: Fix crash when emitting vtable thunk for a generic subclass of non-generic base class
Fixes <rdar://problem/59669591>.
2020-02-25 16:56:04 -05:00
Slava Pestov
f6e7c11bb6 AST: Slim down ASTContext::getOverrideGenericSignature()
We don't actually have to store the superclass type or the interface
type to be unique enough; just the derived class declaration alone
is sufficient.
2020-02-25 16:55:39 -05:00
Doug Gregor
141f3e7f07 [Constraint system] Expand SolutionApplicationTarget to StmtConditions.
Handle StmtCondition as part of SolutionApplicationTarget, so we can
generate constraints from it and rewrite directly as part of a solution,
rather than open-coding the operation in the function builder transform.
2020-02-25 13:47:26 -08:00
Slava Pestov
59cc7d7512 AST: Tighten up preconditions for getOverrideGenericSignature() 2020-02-25 16:41:28 -05:00