Commit Graph

44935 Commits

Author SHA1 Message Date
Doug Gregor
052d4c196c [Type checker] Pull the null check into swift::isSIMDOperator(). 2018-12-11 16:39:10 -08:00
Doug Gregor
88d34a1c7c [Constraint solver] De-priority SIMD operators.
The new SIMD proposal introduced a number of new operators, the presence of
which causes more "expression too complex" failures. Route around the
problem by de-prioritizing those operators, visiting them only if no
other operator could be chosen. This should limit the type checker
performance cost of said operators to only those expressions that need
them OR that already failed to type-check.

Fixes rdar://problem/46541800.
2018-12-11 16:34:37 -08:00
Saleem Abdulrasool
71c11b748e Merge pull request #21158 from compnerd/windows-enum
IRGen: address TODO for COMDATing
2018-12-09 15:36:46 -08:00
Slava Pestov
639ea2c6d5 Merge pull request #21155 from slavapestov/single-tuple-argument-again
Runtime: Fix metatype to mangling of function with single tuple-typed argument
2018-12-09 11:02:03 -05:00
Saleem Abdulrasool
f067cb7250 IRGen: address TODO for COMDATing
Enable COMDATing in `createFunction`.  This is particularly important
for the emission of the GetEnumTagSinglePayload.  The function emission
is marked as linkonce ODR but does not get COMDAT'ed currently, breaking
emission on PE/COFF targets like Windows.
2018-12-08 22:48:56 -08:00
Slava Pestov
929bf610e0 Runtime: Fix demangling of function with single tuple-typed argument
While declaration mangling now does the right thing for parameter lists,
the function type mangling unfortunately still models the parameter list
as a single tuple node.

Change the runtime's behavior to match the AST mangler, which wraps
a single tuple-typed parameter in a tuple node, so that we can produce
different mangling trees for function types taking multiple arguments
versus a single tuple argument.
2018-12-08 23:57:21 -05:00
Slava Pestov
1210bb68a4 SIL: SILFunctionTypes don't allow generic signatures where all parameters are concrete 2018-12-08 22:21:12 -05:00
Slava Pestov
11b1ce2ee7 SILGen: Drop generic signature from witness thunk if all parameters are concrete
SIL functions for AST declarations do this, and the SIL verifier enforces
this, so let's do it for witness thunks too, fixing a devirtualizer
crash.

Fixes <rdar://problem/46571799>.
2018-12-08 22:21:12 -05:00
Saleem Abdulrasool
0da756e1df build: use target_link_libraries for DWARImporter
Use `target_link_libraries` for the linked libraries like the other host
libraries.  This is setup for migrating the host libraries and
executables to the LLVM build infrastructure and matches what the rest
of the host tools and libraries do.
2018-12-08 11:09:09 -08:00
Slava Pestov
e34d67340a Merge pull request #21134 from slavapestov/circular-conformance-check-fail
Sema: Fix failure to emit a diagnostic when a protocol witness is being validated already
2018-12-07 22:54:41 -05:00
Slava Pestov
06c2e980cb Merge pull request #21133 from slavapestov/lazy-implicit-inits
Lazy synthesis of implicit constructors in non-primary files
2018-12-07 22:45:40 -05:00
Joe Groff
b2ceb4b753 Merge pull request #21102 from jckarter/unconditional-cast-source-loc-abi
Runtime: Provide ABI space for source location info in unconditional casts.
2018-12-07 19:04:59 -08:00
Slava Pestov
8c653332ef Sema: Fix failure to emit a diagnostic when a protocol witness is being validated already
Validating a declaration can trigger conformance checking. If the conformance checker
comes across the same declaration as a candidate witness, it would fail to emit a
diagnostic. As a result we would then go onto SILGen, which would crash while emitting
a witness table with a missing entry.

Fixes <rdar://problem/45151902>.
2018-12-07 20:44:59 -05:00
Slava Pestov
a55283d704 Sema: Lazy synthesis of implicit constructors in non-primary files 2018-12-07 20:39:27 -05:00
Slava Pestov
6c012b2aec AST: Remove some unnecessary LazyResolver * parameters from ASTContext methods 2018-12-07 20:39:27 -05:00
Slava Pestov
aa747dcd81 Remove property behaviors 2018-12-07 20:38:33 -05:00
Slava Pestov
e160b85f8f Merge pull request #21117 from slavapestov/accessor-synthesis-cleanup
Accessor synthesis cleanup (NFC)
2018-12-07 19:53:26 -05:00
Harlan Haskins
c829506aca Merge pull request #21033 from harlanhaskins/trouble-at-the-roller-rink
[Sema] Diagnose internal(set) from @inlinable functions
2018-12-07 15:33:18 -08:00
Slava Pestov
a76012dc72 Sema: Tiny cleanup for createImplicitConstructor() 2018-12-07 17:11:30 -05:00
Slava Pestov
a6f6dc01bc Sema: Fix order dependency between lazy getter body synthesis and capture computation
If we computed captures before completing a lazy getter body, we would fail to
consider the 'self' capture properly. Instead make it resilient to such ordering
issues by checking in capture computation if the lazy property has a getter yet
or not.
2018-12-07 17:10:15 -05:00
Slava Pestov
ac53f89ffb Sema: Use a more specific type for ClosuresWithUncomputedCaptures 2018-12-07 17:10:08 -05:00
Slava Pestov
809a6dc3ed Sema: Remove dead code for 'lazy' properties that's no longer used 2018-12-07 17:10:08 -05:00
Slava Pestov
7aed494bf3 Sema: Move accessor synthesis to the callback mechanism
Also change some TypeChecker usages to ASTContext.
2018-12-07 17:10:08 -05:00
Slava Pestov
6d1b866cc1 AST: Fix FuncDecl::getSourceRange() to do the right thing for accessors with synthesized bodies 2018-12-07 17:10:08 -05:00
Slava Pestov
6f243d4ab3 AST: Plumb a 'context' parameter through to AbstractFunctionBody's body synthesizer 2018-12-07 17:10:08 -05:00
Harlan Haskins
1abeeb8b92 [Sema] Diagnose internal(set) from @inlinable functions
This patch mainly consolidates the functions used to check accessors vs.
other decls, and makes sure we check setter access as well as regular
decl access.

rdar://45217648
2018-12-07 12:46:19 -08:00
Harlan Haskins
d30a3da32a [Sema] Non-requirement protocol members should inherit @usableFromInline
Previously, members of protocols that were not protocol requirements,
like accessors and typealiases, did not inherit @usableFromInline from
the parent protocol. Change this so they do.
2018-12-07 12:45:32 -08:00
Argyrios Kyrtzidis
d235fdc582 Merge pull request #21116 from akyrtzi/break-dependency-cycles
[AST] Break dependency cycles of swiftAST against swiftSema and swiftClangImporter
2018-12-07 12:06:07 -08:00
swift-ci
fab121ea97 Merge pull request #21123 from dcci/inoutagain 2018-12-07 10:25:32 -08:00
Argyrios Kyrtzidis
7653ccea54 [AST] minor nitpick in ProtocolConformance.cpp: the 'getASTContext().getClangModuleLoader()' call seems redundant 2018-12-07 10:24:33 -08:00
Argyrios Kyrtzidis
fd3e79b27c [AST] In NameLookup.cpp avoid wrapping functions in namespaces 2018-12-07 09:45:40 -08:00
Doug Gregor
adf4efe7ac Merge pull request #21107 from DougGregor/relative-objc-class-by-name
[IRGen] Don't emit relative references to Objective-C class references.
2018-12-07 09:17:11 -08:00
Davide Italiano
56e3da97cd Revert "[TypeRecontruction] Remove handling of InOutTypes."
This reverts commit 751550be1a.
2018-12-07 09:13:09 -08:00
eeckstein
6f6748174b Merge pull request #21069 from eeckstein/fix-box-mangling
Mangling: mangle box field types as they are.
2018-12-07 08:17:03 -08:00
Slava Pestov
94b167db75 Merge pull request #21112 from slavapestov/on-demand-accessor-fix
Force SILGen emission of on-demand synthesized accessors
2018-12-07 02:04:10 -05:00
Argyrios Kyrtzidis
9405f1eb09 [AST] Break dependency cycle between swiftAST and swiftClangImporter
NormalProtocolConformance::isRetroactive() introduces dependency on swiftClangImporter by calling ClangModuleUnit::getAdapterModule().
Do some refactoring to break the cycle.
2018-12-06 22:54:33 -08:00
Argyrios Kyrtzidis
75ab0a5f36 [AST] Break dependency cycle between swiftAST and swiftSema
AST/LookupVisibleDecls.cpp has a dependency on swiftSema by having doGlobalExtensionLookup call into swift::isExtensionApplied,
and doGlobalExtensionLookup is ultimately used by the other global functions in that file.
Break the cycle by moving the file into the swiftSema library.
2018-12-06 22:52:38 -08:00
Slava Pestov
683c5909f8 Merge pull request #21109 from slavapestov/small-nits
Fix a couple of small nits
2018-12-07 00:20:08 -05:00
Slava Pestov
77215ef5b7 Sema: Force SILGen emission of on-demand synthesized accessors
When an on-demand accessor is synthesized while checking a conformance,
make sure it ends up in the 'external declarations' list so that SILGen
can emit it.

Fixes <rdar://problem/46503121>, and part of <rdar://problem/46186045>.
2018-12-06 23:58:46 -05:00
Slava Pestov
8503de4d66 Sema: Synthesize function bodies before type checking external declarations 2018-12-06 23:32:50 -05:00
swift-ci
f98b617398 Merge pull request #21108 from dcci/inouttypereco 2018-12-06 20:30:15 -08:00
Pavel Yaskevich
306355110f Merge pull request #21091 from xedin/rdar-45771997
[ConstraintSystem] Handle `InOut` base introduced by diagnostic re-ty…
2018-12-06 19:23:36 -08:00
Jordan Rose
9536d40718 Merge pull request #21094 from jrose-apple/a-module-by-any-other-name
[ParseableInterface] Pass down the module name and import source loc
2018-12-06 18:44:01 -08:00
Slava Pestov
0bcb2fbebd SILOptimizer: Remove a dead function 2018-12-06 21:34:49 -05:00
Davide Italiano
751550be1a [TypeRecontruction] Remove handling of InOutTypes. 2018-12-06 17:31:43 -08:00
Davide Italiano
3909b98d87 Merge pull request #21095 from dcci/di-inouttypes
[DebugInfo] Stop handling InOut types, they'll be gone soon.
2018-12-06 17:12:07 -08:00
Doug Gregor
e981834a73 [IRGen] Stop forcing Objective-C class references to be file-local.
Now that we're never relatively addressing an Objective-C class reference,
stop emitting them as file-local (by eliminating the \01l_ prefix). This
is both a minor optimization and also a way to ensure that things will
break more consistently if a problem remains.
2018-12-06 17:05:52 -08:00
Doug Gregor
50b5044abb [IRGen] Don't emit relative references to Objective-C class references.
Objective-C class references (which show up in the __objc_classrefs
section) are always coalesced by the linker. When we relatively
address them (which occurs in protocol conformance records), the
linker may compute the relative offset *before* coalescing, leading to
an incorrect result. The net effect is a protocol conformance record
that applies to the wrong Objective-C class, causing all sorts of
runtime mayhem.

Switch relatively-addressed Objective-C classes over to using the
Objective-C runtime name of the class. It's a less efficient encoding
(since we need to go through objc_lookUpClass), but it avoids the
linker bug.

Fixes rdar://problem/46428085 by working around the linker bug.
2018-12-06 17:05:52 -08:00
Pavel Yaskevich
694c89c090 [ConstraintSystem] Handle InOut base introduced by diagnostic re-typecheck
While trying to lookup member reference on some base type, handle
base being an `InOutType`, which could be a result of previous
sub-expression re-typechecks made by diagnostics.

Resolves: rdar://problem/45771997
2018-12-06 16:02:28 -08:00
Harlan Haskins
2e50a431b1 Merge pull request #20986 from harlanhaskins/clogged-pipes
[SILOptimizer] Stop optimization after serialization if only emitting a module
2018-12-06 15:49:11 -08:00