Commit Graph

339 Commits

Author SHA1 Message Date
swift_jenkins
47c0e4c987 Merge remote-tracking branch 'origin/master' into master-next 2020-06-01 11:55:33 -07:00
Alexis Laferrière
21bf781067 Merge pull request #32049 from xymus/spi-unique-imports
[ModuleInterface] Print the SPI attribute only once per group and import
2020-06-01 11:24:21 -07:00
swift_jenkins
305cbfeba3 Merge remote-tracking branch 'origin/master' into master-next 2020-05-28 18:58:45 -07:00
Hamish Knight
439c1481be Assert that an added file loaded without error 2020-05-28 15:19:19 -07:00
Hamish Knight
6477cc68eb [Serialization] Delay adding ModuleFiles until they're loaded
Rather than adding a ModuleFile to a parent module
and then removing it afterwards if it fails to
load, let's wait until we've loaded the file before
deciding to add it to the parent module. This then
allows us to get rid of `ModuleDecl::removeFile`.

In addition, push down the calls to `addFile` into
the callers of `loadAST` in preparation for
`addFile` being replaced with a one-time-only call
to a `setFiles` method.
2020-05-28 12:09:10 -07:00
Hamish Knight
f810cfcc45 [Serialization] Remove treatAsPartialModule parameter
This information can be derived from whether we're
installing the module file into the main module.
2020-05-28 12:09:10 -07:00
Alexis Laferrière
8fefdece2c Use a SetVector when looking up the SPI attributes on imports
Using a SetVector fixes an issue where many source files imported the
same SPI group from the same module, the emitted private textual
interfaces superfluously repeated the `@_spi` attribute on the import.

rdar://problem/63681845
2020-05-27 16:11:12 -07:00
swift_jenkins
4cdb7fa2c8 Merge remote-tracking branch 'origin/master' into master-next 2020-05-19 07:58:16 -07:00
Saleem Abdulrasool
a5646e1351 Serialization: permit the directory layout on non-Apple targets
Permit the directory style `.swiftmodule` on non-Apple targets.  This
allows all platforms to use the directory layout enabling
multi-architecture SDKs.  This not only unifies the layout of the SDK
across the various targets, it also enables Windows to have a single
unified SDK.

The complexity here is due to the compatibility for older layouts.  This
change does not break compatibility on Linux/Android/Windows for the old
style layout.
2020-05-18 08:55:50 -07:00
swift_jenkins
9b6f01b6d9 Merge remote-tracking branch 'origin/master' into master-next 2020-04-30 20:37:34 -07:00
Daniel Sweeney
ea526c6383 Converting ModuleDecl::ImportedModule from std::pair to a dedicated struct. (#31360) 2020-04-30 20:26:03 -07:00
swift_jenkins
c6d56ba570 Merge remote-tracking branch 'origin/master' into master-next 2020-04-30 15:57:39 -07:00
Hamish Knight
b6150b06b3 [Serialization] Remove duplicated IsSIB bit
Store the bit on the ModuleFile, and query it
from the SerializedASTFile.
2020-04-30 14:17:29 -07:00
swift_jenkins
ed20b9c058 Merge remote-tracking branch 'origin/master' into master-next 2020-04-24 23:58:13 -07:00
Doug Gregor
172c0472f6 Merge pull request #28515 from DougGregor/fast-dependency-scanning
Fast dependency scanning for Swift
2020-04-24 23:54:06 -07:00
swift_jenkins
df6fe6509c Merge remote-tracking branch 'origin/master' into master-next 2020-04-24 21:20:17 -07:00
Brent Royal-Gordon
e7bd60494a Revert "[ModuleLoader] Emit a better diagnostic for swiftinterfaces with wrong arch."
This reverts commit 412ee0a922.
2020-04-24 13:45:05 -07:00
Doug Gregor
33cdd61835 Fast dependency scanning for Swift
Implement a new "fast" dependency scanning option,
`-scan-dependencies`, in the Swift frontend that determines all
of the source file and module dependencies for a given set of
Swift sources. It covers four forms of modules:

1) Swift (serialized) module files, by reading the module header
2) Swift interface files, by parsing the source code to find imports
3) Swift source modules, by parsing the source code to find imports
4) Clang modules, using Clang's fast dependency scanning tool

A single `-scan-dependencies` operation maps out the full
dependency graph for the given Swift source files, including all
of the Swift and Clang modules that may need to be built, such
that all of the work can be scheduled up front by the Swift
driver or any other build system that understands this
option. The dependency graph is emitted as JSON, which can be
consumed by these other tools.
2020-04-24 12:58:41 -07:00
swift_jenkins
dae7b2425d Merge remote-tracking branch 'origin/master' into master-next 2020-04-23 19:39:25 -07:00
Nathan Hawes
083e95ca9d Merge pull request #31227 from nathawes/cross-import-tooling-fixes
[IDE][AST] Handle frameworks with traditional overlays where the underlying module declares cross imports in sourcekit
2020-04-23 19:28:28 -07:00
Nathan Hawes
b7ac8f87b1 [IDE][AST] Handle frameworks with traditional overlays where the underlying module declares cross imports in sourcekit.
We weren't handling this case, so their generated interfaces / doc info
wouldn't include symbols from the cross-import overlays, and we wouldn't
map the underscored cross-import overlay name back to the declaring
framework's name in cusor-info, completion results or when indexing.

Resolves rdar://problem/62138551
2020-04-23 13:03:59 -07:00
swift_jenkins
01ac52612f Merge remote-tracking branch 'origin/master' into master-next 2020-04-23 07:59:46 -07:00
Varun Gandhi
9c1615c761 Merge pull request #31196 from varungandhi-apple/vg-remove-arm64e-fallback
Remove fallback for arm64e -> arm64.
2020-04-23 07:57:55 -07:00
Varun Gandhi
412ee0a922 [ModuleLoader] Emit a better diagnostic for swiftinterfaces with wrong arch.
Before this change, we would emit the warning only for swiftmodules; however,
it may be the case that only a swiftinterface (of a different arch) is present
but no swiftmodule is present.

Fixes rdar://problem/50905075.
2020-04-22 23:58:54 -07:00
Varun Gandhi
c4134ca452 [ModuleInterface] Remove fallback behavior for arm64e -> arm64.
Addresses rdar://problem/61407215.
2020-04-22 23:58:33 -07:00
swift_jenkins
e44d529e6b Merge remote-tracking branch 'origin/master' into master-next 2020-04-20 08:37:18 -07:00
Max Desiatov
5a2b42d054 [NFC] Fix typo in SerializedModuleLoader.cpp 2020-04-20 14:27:02 +01:00
swift_jenkins
340839a81d Merge remote-tracking branch 'origin/master' into master-next 2020-03-27 12:19:29 -07:00
Hamish Knight
6f212634c8 Add getOperatorDecls to FileUnit and ModuleDecl
Query the SourceLookupCache for the operator decls,
and use ModuleDecl::getOperatorDecls for both
frontend stats and to clean up some code
completion logic.

In addition, this commit switches getPrecedenceGroups
over to querying SourceLookupCache.
2020-03-27 09:44:55 -07:00
swift_jenkins
e4ce785e76 Merge remote-tracking branch 'origin/master' into master-next 2020-03-27 06:42:06 -07:00
Dan Zheng
28315487dc [AutoDiff upstream] Serialize derivative function configurations. (#30672)
Serialize derivative function configurations per module.

`@differentiable` and `@derivative` attributes register derivatives for
`AbstractFunctionDecl`s for a particular "derivative function configuration":
parameter indices and dervative generic signature.

To find `@derivative` functions registered in other Swift modules, derivative
function configurations must be serialized per module. When configurations for
a `AbstractFunctionDecl` are requested, all configurations from imported
modules are deserialized. This module serialization technique has precedent: it
is used for protocol conformances (e.g. extension declarations for a nominal
type) and Obj-C members for a class type.

Add `AbstractFunctionDecl::getDerivativeFunctionConfigurations` entry point
for accessing derivative function configurations.

In the differentiation transform: use
`AbstractFunctionDecl::getDerivativeFunctionConfigurations` to implement
`findMinimalDerivativeConfiguration` for canonical derivative function
configuration lookup, replacing `getMinimalASTDifferentiableAttr`.

Resolves TF-1100.
2020-03-27 06:40:27 -07:00
swift_jenkins
4ccdfa27aa Merge remote-tracking branch 'origin/master' into master-next 2020-03-23 12:20:10 -07:00
Hamish Knight
cc9c851856 Add direct operator lookup requests
Introduce DirectOperatorLookupRequest &
DirectPrecedenceGroupLookupRequest that lookup
operator and precedence groups within a given
file or module without looking through imports.

These will eventually be used as the basis for the
new operator lookup implementation, but for now
just use them when querying lookup results from
serialized module files.
2020-03-23 09:17:58 -07:00
Hamish Knight
a502246f34 [AST] Add OperatorFixity
Use this instead of DeclKind in a few places.
2020-03-23 09:17:58 -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
Fred Riss
259d78a350 Adapt to llvm.org StringRef API change 2020-03-13 19:08:22 +01:00
Adrian Prantl
41f76322d2 Adapt to upstream header file reshuffling 2020-03-12 10:23:47 -07:00
Shoaib Meenai
8b8650770e Include Host.h for getProcessTriple
https://github.com/llvm/llvm-project/commit/213aea4c5836 means this
header doesn't get implicitly transitively included anymore, so we have
to include it explicitly.
2020-03-11 23:36:59 -07:00
Rintaro Ishizaki
a7cb72fe55 Merge remote-tracking branch 'origin/master' into master-next
Conflicts:
	stdlib/public/Reflection/TypeRefBuilder.cpp
2020-03-10 12:46:49 -07:00
Kuba Mracek
84c4864911 [arm64e] Add Swift compiler support for arm64e pointer authentication 2020-02-27 16:10:31 -08:00
swift_jenkins
f96c54317d Merge remote-tracking branch 'origin/master' into master-next 2020-02-21 13:59:21 -08:00
Alexis Laferrière
880b8663b9 [Serialization] Fix crash in reporting missing implementationOnly modules
The diagnostic function crashed as it did not take into account the
DebuggerSupport options as the site reporting the missing dependency did.
In this context, missing implementation-only imported dependencies are
ignored only if DebuggerSupport is set.
2020-02-21 10:25:18 -08:00
swift_jenkins
5806fd0f63 Merge remote-tracking branch 'origin/master' into master-next 2020-02-19 16:19:27 -08:00
Alexis Laferrière
0e7029dfb5 Use "SPI group" for the name used in an @_spi attribute 2020-02-19 14:18:11 -08:00
Alexis Laferrière
501f458879 [AST] Intro service lookupImportedSPIs to find direct SPI imports of a module 2020-02-19 14:17:14 -08:00
swift_jenkins
a2e41771fc Merge remote-tracking branch 'origin/master' into master-next 2020-02-19 09:19:25 -08:00
Brent Royal-Gordon
e248f82773 Add support for loading cross-import files 2020-02-18 11:06:12 -08:00
swift_jenkins
9fb3b6ac0e Merge remote-tracking branch 'origin/master' into master-next 2020-02-12 08:37:17 -08:00
Robert Widmann
86ea1912c4 Merge remote-tracking branch 'upstream/master' into HEAD 2020-02-11 23:03:59 -08:00
Ashley Garland
7190073a85 Serialize symbol graphs for extended modules separately
When a module extends a type from another module, serialize those symbols into
separated files dedicated to those extended modules. This makes it easier to
ingest and categorize those symbols under the extended module if desired.

rdar://58941718
2020-02-11 13:23:16 -08:00