Commit Graph

20516 Commits

Author SHA1 Message Date
Slava Pestov
1c17ccfd3c AST: Add TypeBase::isNoEscape() 2019-04-09 15:02:14 -04:00
Slava Pestov
e214156abf Sema: Remove escaping capture diagnostics
I'm about to replace all of this with a SIL pass.
2019-04-09 15:02:14 -04:00
Erik Eckstein
bee1d94003 SIL: fix a crash when constructing a debug location in mandatory inlining
There was one case which was not handled and that's inlining of a compiler intrinsic.
In this case there is a different location type on the function call.

rdar://problem/49651421
2019-04-09 10:46:40 -07:00
Saleem Abdulrasool
1fa75525ee Merge pull request #23875 from compnerd/slides-are-fun
Remove slide calculation
2019-04-09 10:39:19 -07:00
Jordan Rose
d96aebd147 [AST] Mark two more dump() methods as LLVM_ATTRIBUTE_USED (#23873)
...so that they don't get dead-code-stripped and become unusable from
the debugger.
2019-04-08 19:55:16 -07:00
Saleem Abdulrasool
f13031f61d Reflection: remove unnecessary offset for MachO
Don't bother passing the slide for the MachO image as it is always 0.
2019-04-08 18:52:48 -07:00
Saleem Abdulrasool
f2986035ad Reflection: remove unnecessary offset for ELF
Don't bother passing the slide for the ELF image as it is always 0.
2019-04-08 18:52:48 -07:00
Saleem Abdulrasool
5b2e95d01f Reflection: remove unnecessary offset for COFF
Don't bother passing the slide for the COFF image as it is always 0.
2019-04-08 18:52:48 -07:00
Gogul Balakrishnan
1fa3846224 Add more hooks for overriding name lookup in the DebuggerClient (#23031) 2019-04-08 15:19:31 -07:00
Harlan Haskins
149367e5d5 [ParseableInterfaces] Short-circuit module loading
Previously, the ParseableInterfaceModuleLoader relied on the assumption
that, if it returned `errc::not_supported`, it would fall through the
search paths and then move on to the SerializedModuleLoader. This did
not anticipate the possibility of a valid .swiftinterface coming later
in the search paths, which can cause issues for the standard library
which is in the resource-dir and should always be loaded from there.

Instead, make the module loading explicitly short-circuit when seeing
`errc::not_supported`, and document it.

Also add some more logging throughout `discoverLoadableModule` so we can
more easily catch issues like this in the future.

Fixes rdar://49479386
2019-04-08 10:07:11 -07:00
Jordan Rose
a9b0a6661a Implementation-only import checking for types used in decls
Based on the existing access checker for types used in decls. There's
a common skeleton here but we can't seem to get it out, so for now
add a third DeclVisitor to this file. On the plus side, checking this
alongside access is an easy way to make sure everything gets checked.

Part of rdar://problem/48991061
2019-04-05 20:10:10 -07:00
Jordan Rose
6c0538988d Access checking: Separate TypeDecl-finding from access scope checking
...for planned reuse in implementation-only import logic.
No intended functionality change.
2019-04-05 20:10:10 -07:00
John McCall
6ef5fb57f0 Merge pull request #23702 from rjmccall/implementation-only-diagnostics
[WIP] implementation-only import checking
2019-04-05 22:07:45 -04:00
David Ungar
cf5d81c889 Merge pull request #23735 from davidungar/tracking-primary
[Batch mode] Cope with bugs that cause error  suppression.
2019-04-05 17:45:20 -07:00
John McCall
ae6561c32c Checks for implementation-only imports in @inlinable code.
Part of rdar://48991061
2019-04-05 16:30:25 -04:00
Arnold Schwaighofer
e50af98cc4 Merge pull request #23790 from aschwaighofer/dynamic_replacement_final
Allow final on dynamic members
2019-04-05 10:09:39 -07:00
Arnold Schwaighofer
90fe435f25 Don't constrain to swift-version 5 2019-04-05 07:09:57 -07:00
Pavel Yaskevich
16b65018b4 Merge pull request #23436 from xedin/keypath-dynamic-lookup
[SE-0252][TypeChecker] Keypath Dynamic Member Lookup
2019-04-05 00:10:53 -07:00
David Ungar
c8cd0f3bc0 Move location lookup to RAII object. 2019-04-04 22:41:53 -07:00
David Ungar
240b573966 WIP 2019-04-04 21:55:25 -07:00
David Ungar
bb131fb4b4 Expand parameter description. 2019-04-04 16:37:38 -07:00
Michael Gottesman
b6c3ca0cd8 Merge pull request #23801 from gottesmm/pr-56c61430037696146352efbfcedf418a94036015
[silgenpattern] Fix two ASAN errors.
2019-04-04 16:34:22 -07:00
David Ungar
9d99eb7f83 Fix typo 2019-04-04 16:22:39 -07:00
Michael Gottesman
564b4fc11a [silgenpattern] Fix some stack-use-after-free errors caused by iterating over an Optional<ArrayRef<T>>.
Specifically the bad pattern was:

```
   for (auto *vd : *caseStmt->getCaseBodyVariables()) { ... }
```

The problem is that the optional is not lifetime extended over the for loop. To
work around this, I changed the API of CaseStmt's getCaseBodyVariable methods to
never return the inner Optional<MutableArrayRef<T>>. Now we have the following 3
methods (ignoring const differences):

1. CaseStmt::hasCaseBodyVariables().

2. CaseStmt::getCaseBodyVariables(). Asserts if the case body variable array was
   never specified.

3. CaseStmt::getCaseBodyVariablesOrEmptyArray(). Returns either the case body
   variables array or an empty array if we were never given any case body
   variable array.

This should prevent anyone else in the future from hitting this type of bug.

radar://49609717
2019-04-04 13:34:36 -07:00
swift-ci
8fc305c03e Merge pull request #23779 from adrian-prantl/48827784 2019-04-04 11:09:11 -07:00
Saleem Abdulrasool
c3ee5ae5ae Merge pull request #23769 from compnerd/you-will-be-assimilated
Reflection: load the builtin section on Windows
2019-04-04 09:09:31 -07:00
Michael Gottesman
7b0d8455ca [ast][silgen] Wire up the case body var decls and use them in SILGenPattern emission to fix the evil fallthrough bug.
rdar://47467128
2019-04-03 23:51:06 -07:00
Azoy
7c75836d77 context cleanup part 1 2019-04-03 20:50:58 -05:00
David Ungar
d0330523d0 suppress non-primary errors if there is no responsible primary 2019-04-03 16:19:45 -07:00
Adrian Prantl
4a23512068 Add an option to disable DWARF skeleton CU breadcrumbs for Clang
module imports. This is useful when building redistributable static
archives, since any pointers into the CLang module cache won't be
portable.

When using this option the Clang type fallback path in LLDB will be
less useful since DWARF type information from those modules will not
be available unless another object file compiled without the option
imported the same modules.

rdar://problem/48827784
2019-04-03 15:45:11 -07:00
Michael Gottesman
ed94b13d3f [ast] Add a helper method for checking if a pattern contains a var decl and adopt it. 2019-04-03 13:38:03 -07:00
Michael Gottesman
8311f2b050 [ast] Add helpers for grabbing various case stmt corresponding var decls to a specific case stmt var decl. 2019-04-03 13:38:03 -07:00
David Ungar
44daa88ebd Format 2019-04-03 12:53:31 -07:00
David Ungar
9cc3a4a9d8 Rename defaultDiagnosticLoc to bufferIndirectlyCausingDiagnostic. 2019-04-03 12:52:49 -07:00
David Ungar
fd63a1ea73 Change strategy for non-primaries
No more vacuous subconsumers. Output into active primary or everywhere.
2019-04-03 11:38:58 -07:00
Saleem Abdulrasool
8bf851064a Reflection: load the builtin section on Windows
This loads the builtin section metadata on Windows which is needed for
the tests.
2019-04-03 11:18:50 -07:00
David Ungar
7ac4592419 Rm ForAnyKind 2019-04-03 11:01:57 -07:00
Saleem Abdulrasool
6fcd874d37 Merge pull request #23633 from alexshap/make_reflection_work_on_linux_and_windows
[Reflection] Fix several issues for COFF and ELF
2019-04-03 08:24:07 -07:00
Nathan Hawes
58d622d796 [ParseableInterface] Don't serialize resource directory deps and stop adding cached modules to the dependency tracker
This patch modifies ParseableInterfaceBuilder::CollectDepsForSerialization to
avoid serializing dependencies from the runtime resource path into the
swiftmodules generated from .swiftinterface files. This means the module cache
should now be relocatable across machines.

It also modifies ParseableInterfaceModuleLoader to never add any dependencies
from the module cache and prebuilt cache to the dependency tracker (in addition
to the existing behaviour of not serializing them in the generated
swiftmodules). As a result, CollectDepsForSerialization no longer checks if the
dependencies it is given come from the cache as they are provided by the
dependency tracker. It now asserts that's the case instead.
2019-04-03 06:35:11 -07:00
Nathan Hawes
58d0ee0888 [ParseableInterface] Distinguish SDK and non-SDK dependencies
This allows the SDK to be relocated without automatically resulting in a
rebuild.

Based on an old patch from Jordan Rose.
2019-04-03 06:35:11 -07:00
Nathan Hawes
f683373116 [ParseableInterface] Respect -track-system-dependencies with -build-module-from-parseable-interface
Updates the subinvocation that builds the parseable interface to respect the
-track-system-dependencies flag of the top-level invocation if present, by
including system dependencies in the produced .swiftmodule.
2019-04-03 06:34:29 -07:00
Slava Pestov
c023e0f35e Merge pull request #23734 from slavapestov/subscript-default-arguments
Subscript default arguments
2019-04-03 08:10:45 -04:00
David Ungar
b112f73780 Typos 2019-04-02 22:52:14 -07:00
David Ungar
0baa668920 Format 2019-04-02 22:28:38 -07:00
David Ungar
c139c5909a Pass defaultDiagnosticLoc to handleDiagnostic, not currentPrimaryInput. 2019-04-02 22:27:55 -07:00
David Ungar
3b8b903807 Refactor handleDiagnostic 2019-04-02 21:41:40 -07:00
Alexander Shaposhnikov
33fa33ff0d [Reflection] Fix several issues for COFF and ELF
Previously when ReflectionContext was parsing the image of a binary
(for ELF or COFF) it was making some incorrect assumptions about the location
of sections in the memory of a remote process. In particular, it was using the offsets
rather than the virtual addresses and it was incorrectly calculating the references (relative pointers)
inside the metadata. In this diff we address these issues and adjust swift-reflection-dump
(used in tests) to emulate the runtime behavior more closely.
This diff has been extensively tested, the reflection tests are green on OSX and Linux,
on Windows it fixes 2 new tests:
    Reflection/typeref_decoding.swift
    stdlib/ReflectionHashing.swift
So now (with some minor fixes to the lit testsing infrastructure) the following reflection
tests pass:
    Reflection/box_descriptors.sil
    Reflection/capture_descriptors.sil
    Reflection/typeref_decoding.swift
    stdlib/ReflectionHashing.swift
2019-04-02 21:22:56 -07:00
swift-ci
3f28159d6b Merge pull request #23748 from gottesmm/pr-f44e277b4644313c441523f68d8c2928247e1e26 2019-04-02 17:41:39 -07:00
Slava Pestov
6bb36b5c01 Sema: Subscript default arguments
Fixes <https://bugs.swift.org/browse/SR-6118>.
2019-04-02 20:37:01 -04:00
Slava Pestov
8292cbe3b3 AST: Remove 'default argument resilience expansion'
This was a Swift 3 mode holdover.
2019-04-02 20:37:01 -04:00