Commit Graph

24822 Commits

Author SHA1 Message Date
Ben Langmuir
f6662a8c9a Merge pull request #30437 from benlangmuir/more-stringref
Update for llvm StringRef string conversion
2020-03-17 08:48:57 -07:00
Dmitri Gribenko
841eeb05b0 Merge pull request #30403 from MForster/forster/string-fixes
Cherry-pick StringRef->std::string conversion fixes into `master`
2020-03-17 12:09:36 +01:00
Robert Widmann
ecb58a12d7 Merge pull request #30439 from CodaFi/swift-is-an-untyped-languge-now-i-dont-make-the-rules
[NFC] Break TypeChecker Down Into a Namespace
2020-03-16 21:17:45 -07:00
Robert Widmann
70b6bbcb13 Remove swift::createTypeChecker
Replace it with the "legacy semantic queries" bit. The remaining client
of this bit is SourceKit, which appears to require this bit be set
conditionally so certain semantic property wrapper requests return
a sentinel value.

We should migrate these requests to a syntactic interface as soon as
possible.

rdar://60516325
2020-03-16 19:20:22 -07:00
Robert Widmann
14c073ba0b Remove friend references to TypeChecker
TypeChecker has no friends
2020-03-16 19:19:02 -07:00
Robert Widmann
4be0e4a2bd Strip Forward-Declararations of TypeChecker 2020-03-16 19:19:02 -07:00
Robert Widmann
c3c490efb0 Remove the ability to reference instances of TypeChecker 2020-03-16 19:19:02 -07:00
Robert Widmann
52c808648f Move the defined functions list onto SourceFile 2020-03-16 19:19:01 -07:00
Robert Widmann
52f4aba784 IRGen Requests
Implement the IRGen Request infrastructure and provide the first
request: generating IR from a given SourceFile.
2020-03-16 18:00:33 -07:00
Ben Langmuir
cb7b64a3fe Update for llvm StringRef string conversion
rdar://60514063
2020-03-16 16:07:48 -07:00
Michael Gottesman
7ac7620c78 Merge pull request #30425 from gottesmm/pr-a62f3926b9e0b421c35408e66cf592f84295cd24
[ownership] Treat open_existential_box as an interior pointer producting instruction.
2020-03-16 14:06:15 -07:00
Robert Widmann
3f7c89ae9c Correct diagnostic for plain member constraints
This used to print as just a plain space.

Resolves rdar://60030114
2020-03-16 11:22:18 -07:00
eeckstein
b5c0b6de9d Merge pull request #30381 from eeckstein/lazy_properties
Improve optimization of lazy properties.
2020-03-16 08:32:19 +01:00
Michael Gottesman
f3df836652 [ownership] Treat open_existential_box as an interior pointer producting instruction.
This means that it can only have a guaranteed object as an operandand that we
validate that all uses of the result address of open_existential_box occur only
within the lifetime of said object's borrow scope.
2020-03-15 23:21:45 -07:00
Anthony Latsis
d688710fb3 [Diag] Move invalid where clause on top-level decl diagnostic to Sema 2020-03-15 13:38:49 +03:00
Andrew Trick
ca686a58ec Merge pull request #30414 from atrick/fix-escape-unreachable
Fix EscapeAnalysis verification assert at unreachable blocks
2020-03-14 17:53:09 -07:00
Andrew Trick
bebbe370e8 Fix EscapeAnalysis verification assert at unreachable blocks
If EscapeAnalysis verification runs on unreachable code, it asserts
with "Missing escape connection graph mapping" because the connection
graph builder only runs on reachable blocks.

Add a ReachableBlocks utility and use it during verification.

Fixes <rdar://problem/60373501> EscapeAnalysis crashes with CFG with
unreachable blocks
2020-03-14 14:31:41 -07:00
Pavel Yaskevich
5bb2a62b70 Merge pull request #30409 from HassanElDesouky/SR-12309
[CSGen] Force unwrapping 'nil' compiles without warning
2020-03-14 11:41:02 -07:00
Owen Voorhees
592ce68c55 Support the combination of -enable-educational-notes and -enable-experimental-diagnostic-formatting 2020-03-14 09:21:06 -07:00
Brent Royal-Gordon
5b7a13cf69 Merge pull request #30410 from brentdax/futures-end
Improve diagnostic for broken module interfaces
2020-03-14 01:25:58 -07:00
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
Meghana Gupta
8e800e49bf Recommit #29812 with fixes (#30342) 2020-03-13 19:34:16 -07:00
HassanElDesouky
8195cce1d3 [SR-12309] Cannot force unwrap 'nil' 2020-03-14 01:28:28 +02: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
Fred Riss
259d78a350 Adapt to llvm.org StringRef API change 2020-03-13 19:08:22 +01: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
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
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
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
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
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
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
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
Xi Ge
1a32db94cd Merge pull request #30366 from nkcsgexi/59110975
PrintAsObjC: allow users to specify bridging header relative path for printing
2020-03-12 00:30:41 -07:00
Slava Pestov
afa2440f85 Merge pull request #30370 from slavapestov/encapsulate-conformance-descriptor
Runtime: Use accessor method to get TargetWitnessTable::Description
2020-03-12 00:19:24 -04:00
tbkka
ee36c1cc3e RemoteMirror: Project some multi-payload enums (#30357)
* First part of multi-payload enum support

This handles multi-payload enums with fixed
layouts that don't use spare payload bits.
It includes XI calculations that allow us to
handle single-payload enums where the payload
ultimately includes a multi-payload enum
(For example, on 32-bit platforms, String uses
a multi-payload enum, so this now supports single-payload
enums carrying Strings.)
2020-03-11 18:48:39 -07:00
Xi Ge
df0493c288 PrintAsObjC: allow users to specify bridging header relative path for printing
Compatibility header may #import bridging header if specified with -import-underlying-module.
How these two headers are relative to each other is subject to project setting. To accommodate
this, we should allow users to specify bridging header directory for header generating purposes.

rdar://59110975
2020-03-11 17:09:53 -07:00
Slava Pestov
4bc1d03283 Runtime: Use accessor method to get TargetWitnessTable::Description 2020-03-11 19:34:10 -04:00
Joe Groff
d06b839c03 Add -verify-all-substitution-maps frontend flag 2020-03-11 16:19:30 -07:00
Doug Gregor
a3979da1cd Merge pull request #30322 from DougGregor/function-builders-extras
[Function builders] Additional entry points
2020-03-11 16:17:27 -07:00
John McCall
4ee87d4f6d Use the right generic signature when producing a substituted function type from an interface type.
Doing this requires us to re-introduce the concept of the contextual generic signature to SIL type lowering, but hopefully just in a few places.

As the FIXME notes, I found a problem here for substituted function types, but I need to land this first to fix ProcedureKit in the source-compatibility test suite.
2020-03-11 15:25:43 -04:00
Slava Pestov
52fe9ba790 Merge pull request #30346 from slavapestov/fix-abi-header-nit
ABI: Fix return type of TargetGenericRequirementDescriptor::getConformance()
2020-03-11 14:39:42 -04:00
Michael Gottesman
fbdf729da6 Merge pull request #30298 from gottesmm/pr-4e1212f1e4e3640e5037f11164d07e20fcea7324
[inliner] Add a new Inliner that only inlines AlwaysInline functions (but do not put it in the pass pipeline).
2020-03-11 01:38:54 -07:00
Michael Gottesman
1c1fae381d Merge pull request #30341 from gottesmm/pr-91997a0048cde708ab0a33c5e524a8c8f9422956
Recommit #30289 with ASAN fix.
2020-03-11 00:43:38 -07:00
Slava Pestov
c61ead1aa0 ABI: Fix return type of TargetGenericRequirementDescriptor::getConformance() 2020-03-11 00:33:46 -04:00
Nathan Hawes
a368434432 [SourceKit/CodeFormat] Re-work and improve the indentation implementation.
This restructures the indentation logic around producing a single IndentContext
for the line being indented. An IndentContext has:
- a ContextLoc, which points to a source location to indent relative to,
- a Kind, indicating whether we should align with that location exactly, or
  with the start of the content on its containing line, and
- an IndentLevel with the relative number of levels to indent by.

It also improves the handling of:
- chained and nested parens, braces, square brackets and angle brackets, and
  how those interact with the exact alignment of parameters, call arguments,
  and tuple, array and dictionary elements.
- Indenting to the correct level after an incomplete expression, statement or
  decl.

Resolves:
rdar://problem/59135010
rdar://problem/25519439
rdar://problem/50137394
rdar://problem/48410444
rdar://problem/48643521
rdar://problem/42171947
rdar://problem/40130724
rdar://problem/41405163
rdar://problem/39367027
rdar://problem/36332430
rdar://problem/34464828
rdar://problem/33113738
rdar://problem/32314354
rdar://problem/30106520
rdar://problem/29773848
rdar://problem/27301544
rdar://problem/27776466
rdar://problem/27230819
rdar://problem/25490868
rdar://problem/23482354
rdar://problem/20193017
rdar://problem/47117735
rdar://problem/55950781
rdar://problem/55939440
rdar://problem/53247352
rdar://problem/54326612
rdar://problem/53131527
rdar://problem/48399673
rdar://problem/51361639
rdar://problem/58285950
rdar://problem/58286076
rdar://problem/53828204
rdar://problem/58286182
rdar://problem/58504167
rdar://problem/58286327
rdar://problem/53828026
rdar://problem/57623821
rdar://problem/56965360
rdar://problem/54470937
rdar://problem/55580761
rdar://problem/46928002
rdar://problem/35807378
rdar://problem/39397252
rdar://problem/26692035
rdar://problem/33760223
rdar://problem/48934744
rdar://problem/43315903
rdar://problem/24630624
2020-03-10 21:04:21 -07:00