Commit Graph

58361 Commits

Author SHA1 Message Date
Brent Royal-Gordon
a7a5e340aa Improve diagnostic for broken module interfaces
Currently, when a swiftinterface file fails to load, we emit the specific diagnostics for the failures, followed by a generic “failed to load module ‘Foo’” message. This PR improves that final diagnostic, particularly when the cause may be that the interface was emitted by a newer compiler using backwards-incompatible syntax.
2020-03-13 20:31:55 -07:00
Pavel Yaskevich
2dd74706c9 Merge pull request #30411 from xedin/diags-to-use-solution-instead-of-cs
[Diagnostics] Switch `FailureDiagnostic` to use a solution
2020-03-13 20:20:58 -07:00
Meghana Gupta
8e800e49bf Recommit #29812 with fixes (#30342) 2020-03-13 19:34:16 -07:00
lhames
afc8762a54 Merge pull request #30406 from lhames/fix-imm-static-inits
[Immediate] Fix static constructor/destructor calls in RunImmediately.
2020-03-13 18:08:42 -07:00
HassanElDesouky
ceb3f3842f [SR-12309] Add more tests 2020-03-14 03:06:10 +02:00
Pavel Yaskevich
7800a04de3 [Diagnostics] Adjust "missing arguments" diagnostic to store parameter indices directly
This helps to avoid allocating new type variables (which shouldn't be done regardless)
to store parameter indices when `missing arguments` diagnostic is used by other diagnostics.
2020-03-13 16:55:37 -07:00
Xi Ge
21b9e80848 Merge pull request #30405 from nkcsgexi/omit-resilient-witness-table-tbd
TBDGen: omit witness table symbol for imported resilient protocols
2020-03-13 16:36:55 -07:00
HassanElDesouky
8195cce1d3 [SR-12309] Cannot force unwrap 'nil' 2020-03-14 01:28:28 +02:00
swift-ci
a7470db556 Merge pull request #30404 from adrian-prantl/51645582 2020-03-13 15:39:13 -07:00
Pavel Yaskevich
3ab8710329 [Diagnostics] Cleanup use of constraint system by ConstraintFix/FailureDiagnostic 2020-03-13 15:02:10 -07:00
Andrew Trick
0395920668 Merge pull request #30369 from atrick/fix-verify-exclusivity
Fix MemBehavior calls to getAccessedAddress to avoid an assert.
2020-03-13 14:55:47 -07:00
Lang Hames
2c083d8d2b [Immediate] Fix static constructor/destructor calls in RunImmediately.
Removes a redundant call to LLJIT::runConstructors and adds a call to
LLJIT::runDestructors.
2020-03-13 14:44:32 -07:00
Ben Langmuir
dbbe45e256 Merge pull request #30389 from benlangmuir/index-caf
[index] Add implicit callAsFunction reference to index
2020-03-13 14:44:26 -07:00
Xi Ge
1fc0799e8b TBDGen: omit witness table symbol for imported resilient protocols
For imported resilient protocols, we cannot directly emit witness table
symbol when a local type conforms to them because initializing these
protocols are required.

rdar://60429448
2020-03-13 13:46:50 -07:00
Adrian Prantl
56309f6b49 Debug Info: Store the SDK in the DICompileUnit.
This an intermediate step for PR44213
(https://bugs.llvm.org/show_bug.cgi?id=44213).

This stores the SDK *name* in the debug info, to make it possible to
`-fdebug-prefix-map`-replace the sysroot with a recognizable string and allowing
the debugger to find a fitting SDK relative to itself, not the machine the
executable was compiled on.

rdar://problem/51645582
2020-03-13 13:25:39 -07:00
John McCall
05f92f1d01 Merge pull request #30396 from rjmccall/key-is-code-key
More descriptive names and comments; NFC
2020-03-13 15:47:35 -04:00
Pavel Yaskevich
52cf60122b [Diagnostics] Switch isMisplacedMissingArgument to use a solution 2020-03-13 12:46:38 -07:00
Pavel Yaskevich
0fc9d1b84a [Diagnostics] Move getFunctionArgApplyInfo to Solution
Instead of relying on constraint system having solution applied
let's pass a solution directly to `getFunctionArgApplyInfo`.
2020-03-13 12:46:25 -07:00
Michael Forster
345a9147ec Explicit SmallString->std::string conversion.
This is only needed temporarily until commit d7049213 from upstream
LLVM hits the swift/master branch.
2020-03-13 19:16:49 +01:00
Alex Langford
e92599fa63 Follow-up change to PR30186
`std::string(...)` -> `.str()`
2020-03-13 19:08:22 +01:00
Alex Langford
b957facaef More explicit StringRef to std::string conversions 2020-03-13 19:08:22 +01:00
Fred Riss
259d78a350 Adapt to llvm.org StringRef API change 2020-03-13 19:08:22 +01:00
Pavel Yaskevich
af4afe3fbc [Diagnostics] Switch FailureDiagnostic to use a solution
Make diagnostics stateless by providing them with a solution
instead of applying a solution back to constraint system and
using constraint system. Latter doesn't work well when there
is an ambiguity and multiple solutions are available instead
of one.
2020-03-13 10:37:23 -07:00
AG
710799dd09 Merge pull request #30393 from bitjammer/acgarland/rdar-59262057-ssge-maccatalyst
[SymbolGraph] Add macCatalyst compatibility
2020-03-13 09:35:39 -07:00
Andrew Trick
7145a80fa2 Fix MemBehavior calls to getAccessedAddress to avoid an assert.
Fixes <rdar://60046018> assert: (v->getType().isAddress())
in getAccessedAddress.

MemBehavior compares known memory accesses with some arbitrary value,
which may not be an address. However, we should not call utilities
that work on accessed addresses with an arbitrary value.

This assert is a result of very recent changes to gradually make
memory access utilities more type safe and introduce the concept of a
canonical accessed address. In the future, we may even have a wrapper
type for such a thing. In the SIL optimizer, there are several
different notions of what constitutes the base of a memory
access. Mismatches can lead to subtle bugs.
2020-03-13 09:30:48 -07:00
Nathan Hawes
fcf95eae16 Merge pull request #30187 from nathawes/indentation
[SourceKit/CodeFormat] Re-work and improve the indentation implementation
2020-03-13 08:01:29 -07:00
Erik Eckstein
b51284fae3 CSE: optimize calls of lazy property getters
If such a call is dominated by another call to the same getter, it is replaced by a direct load of the property - assuming that it is already computed.

rdar://problem/34715412
2020-03-13 11:01:59 +01:00
Erik Eckstein
2de425665c PerformanceInliner: prevent inlining of lazy property getters
Lazy property getters are usually non tivial functions (otherwise the user would not implement it as lazy property).
Inlining such getters would most likely not benefit other optimizations because the top-level switch_enum cannot be constant folded in most cases.
Also, not inlining lazy property getters enables optimizing them in CSE.
2020-03-13 09:49:56 +01:00
Erik Eckstein
ae93e60072 SIL: add a lazy_property_getter flag to SILFunction
It is set on getter-functions for lazy properties.
2020-03-13 09:49:55 +01:00
Brent Royal-Gordon
0be8357dcc Merge pull request #29950 from brentdax/less-crossover
Make cross-importing faster
2020-03-13 01:45:02 -07:00
Ravi Kandhadai
c315bff573 Merge pull request #30386 from ravikandhadai/handle-in-guaranteed-captures
[OSLogOptimization] Fix folding of symbolic closures to handle @in_guaranteed captures
2020-03-12 20:48:18 -07:00
Rintaro Ishizaki
52d336705b Merge pull request #30383 from rintaro/ide-completion-callarg
[CodeCompletion] Call argument label with value placeholder
2020-03-12 19:43:53 -07:00
John McCall
2d25b6603e More descriptive names and comments; NFC. 2020-03-12 22:03:42 -04:00
swift-ci
3982bb4af7 Merge pull request #28612 from owenv/terminal_md_viewer 2020-03-12 18:55:45 -07:00
Brent Royal-Gordon
b65a9c6db1 [NFC] Doc and style fixes for #filePath implementation
This addresses some late-breaking review comments left by @hamishknight on apple/swift#29412.
2020-03-12 18:12:09 -07:00
Rintaro Ishizaki
9225cfce3d [CodeCompletion] Type annotation for call argument completions 2020-03-12 17:46:25 -07:00
Ben Langmuir
3eff694bad [index] Add implicit callAsFunction reference to index
* Reference is marked "explicit", which may be unexpected - the reason
is that the *call* is explicit, so we want to find it with e.g. rename,
or looking up callers, even though the identifier callAsFunction is
implicit. This matches the behaviour of initializers.

* The source location is the same as the base name (e.g. in `add3(5)`,
it would be at `add3`), which matches the behaviour of initializers.

rdar://problem/60327632
2020-03-12 15:04:52 -07:00
swift-ci
7b81701a44 Merge pull request #30387 from gribozavr/computeNominalType 2020-03-12 14:57:51 -07:00
Dmitri Gribenko
5873b04323 Renamed a variable to be more descriptive in computeNominalType() 2020-03-12 21:03:37 +01:00
Ravi Kandhadai
e3a8a96469 [OSLogOptimization] Fix the symbolic closure folding code to only create
new closures when all captures of the symbolic closure, including address-typed
captures, are symbolic constants. For other closures, they must have been
autoclosures passed to the log call and therefore they need not be duplicated
but reused as such.

This eliminates the need to copy_value the non-constant captured values of
closures. Instead the closure itself is copied as a whole.

Fixes <rdar://problem/60344043>
2020-03-12 12:42:43 -07:00
Alexis Laferrière
884222e083 [Serialization] Bump swiftmodule version number
rdar://problem/60350100
2020-03-12 12:04:34 -07:00
Rintaro Ishizaki
f8147f72d9 [CodeCompletion] Call argument label with value placeholder
When a completion happens at a call argument position, insert
'label: <#T##TypeName#>' instead of just 'label: '.

rdar://problem/60379654
2020-03-12 11:48:15 -07:00
Pavel Yaskevich
1fc0ea6b0e [CSFix] Allow diagnose to accept a solution to diagnose
Instead of always applying solution back to constraint system
before diagnostics, let's pass solution directly to `ConstaintFix::diagnose`
method to be used by `FailureDiagnostic` which paves a way for
stateless diagnostics.
2020-03-12 11:41:36 -07:00
Shoaib Meenai
e506e4ac02 Merge pull request #30375 from smeenai/master
Update for LLVM changes
2020-03-12 11:16:06 -07:00
Ashley Garland
8f96f67581 [SymbolGraph] Add macCatalyst compatibility
- Add `setDefaultPrebuiltCacheIfNecessary` a `CompilerInvocation` method
- Call that while setting up the invocation in `swift-symbolgraph-extract`
- Add `Fsystem` argument to add iOSSupport directory to the search paths
- Add `resource-dir` argument for local builds

rdar://59262057
2020-03-12 10:51:11 -07:00
Pavel Yaskevich
7c1df6ad51 [ConstraintSystem] Remove getType(Expr*) accessor from Solution
It's obsolete and has been superseded by `getType(TypedNode)`.
2020-03-12 10:28:18 -07:00
Pavel Yaskevich
126065821a Merge pull request #30348 from omochi/fix-arg-reorder
[ConstraintSystem] Fix bug of argument reordering in matchCallArguments
2020-03-12 09:29:11 -07:00
Joe Groff
719002b08e Merge pull request #30365 from jckarter/substitution-map-mismatches
Create an inherited conformance in SubstitutionMap::lookupConformance when needed.
2020-03-12 08:39:44 -07:00
Dmitri Gribenko
be80642fe8 Removed a catch-all default implementation of ASTVisitor::visitTypeRepr
Other AST nodes don't have such functionality now, and it was removed
from them previously. Not having a default implementation means that
users of ASTVisitor have to either explicitly write a catch-all default,
or handle all cases. Making this decision consciously is a good
practice.
2020-03-12 11:29:11 +01:00
Dmitri Gribenko
a058d990e1 Added dumping for SILBoxTypeRepr 2020-03-12 11:29:11 +01:00