Commit Graph

318 Commits

Author SHA1 Message Date
Artem Chikin
7dd220f5ef Merge pull request #32754 from artemcm/CanImportExplicitly
[Explicit Module Builds] Add canImport functionality to the ExplicitSwiftModuleLoader
2020-07-09 16:06:40 -07:00
Artem Chikin
f361b250de [Explicit Module Builds] Add canImport functionality to the ExplicitSwiftModuleLoader
It needs to check against the provided ExplicitModuleMap instead of looking into search paths.
2020-07-08 10:11:49 -07:00
swift_jenkins
d883300bc1 Merge remote-tracking branch 'origin/master' into master-next 2020-07-01 17:59:25 -07:00
Xi Ge
84dd4db0b1 Dependencies Scanner: report compiled Swift module paths if they are available
For the explicit module mode, swift-driver uses -compile-module-from-interface to
generate modules from interfaces found by the dependency scanner. However, we don't
need to build the binary module if up-to-date modules are available, either adjacent
to the interface file or in the prebuilt module cache directory. This patch teaches
dependencies scanner to report these ready-to-use binary modules.
2020-07-01 11:54:15 -07:00
Xi Ge
d2bf4473ae Revert "ModuleLoader: refactor computePrebuiltModulePath to facilitate dependencies scanner's invocation, NFC" 2020-07-01 09:53:58 -07:00
swift_jenkins
465eae8559 Merge remote-tracking branch 'origin/master' into master-next 2020-06-30 08:58:09 -07:00
Hamish Knight
7bc5440d17 [Frontend] Internalize createDependencyTracker
Expand the FrontendOptions to allow the enabling
of the dependency tracker for non-system
dependencies, and switch the previous clients of
`createDependencyTracker` over to using this
option. This ensures that the dependency tracker
is now set only during `CompilerInstance::setup`.
2020-06-29 15:26:26 -07:00
swift_jenkins
ea868c665f Merge remote-tracking branch 'origin/master' into master-next 2020-06-26 18:19:05 -07:00
Xi Ge
0816167abd Merge pull request #32564 from nkcsgexi/scanner-report-prebuilt-module
ModuleLoader: refactor computePrebuiltModulePath to facilitate dependencies scanner's invocation, NFC
2020-06-26 18:04:10 -07:00
Xi Ge
a5369475ab ModuleLoader: refactor computePrebuiltModulePath to facilitate dependencies scanner's invocation, NFC 2020-06-26 15:01:19 -07:00
Xi Ge
fb99e840cc ExplicitModuleLoader: use a temporary source manager for loading the explicit module map, NFC
We don't need the buffer for the explicit module map to be persistent in the ASTContext.
2020-06-26 14:44:20 -07:00
swift_jenkins
bbf76203eb Merge remote-tracking branch 'origin/master' into master-next 2020-06-23 09:54:53 -07:00
Xi Ge
05de54f635 ExplicitModules: use key names conforming to Swift naming convention in explicit Swift module maps. NFC 2020-06-22 22:22:05 -07:00
swift_jenkins
436280fdc1 Merge remote-tracking branch 'origin/master' into master-next 2020-06-19 12:58:12 -07:00
Xi Ge
0fd75b4eb9 ExplictModuleLoader: don't fail while no explicit Swift module map is specified
We will eventually move the protocol entirely to using a JSON file for
explicit Swift modules. Before we finish migrating, we should be forgiving
about using the legacy -swift-module-file argument.
2020-06-19 10:23:43 -07:00
swift_jenkins
6ba08d58c3 Merge remote-tracking branch 'origin/master' into master-next 2020-06-18 16:00:01 -07:00
Xi Ge
23ef061b14 ExplictModuleLoader: update acceptable JSON format to be more Codable friendly
Explicit Swift module map will be constructed from the swift-driver side using
the Codable protocol. We should change the format to facilitate that.
2020-06-18 10:44:36 -07:00
David Zarzycki
c0c976355c Adapt a swift/master change to master-next (StringRef vs std::string) 2020-06-18 06:14:00 -04:00
swift_jenkins
82453cf560 Merge remote-tracking branch 'origin/master' into master-next 2020-06-17 18:19:18 -07:00
Xi Ge
ec9cd91c1b ExplicitModuleLoader: take a JSON file that specifies details of explicit Swift modules
Instead of taking paths of Swift module files from front-end command line
arguments, we should take a JSON file specifying details of explicit modules.
The advantages is (1) .swiftdoc and .swiftsourceinfo can be associated
with a .swiftmodule file, and (2) module names are explicitly used as
keys in the JSON input so we don't need to eagerly deserialize a .swiftmodule
file to collect the module name.
2020-06-17 14:02:50 -07:00
swift_jenkins
caf00aebd6 Merge remote-tracking branch 'origin/master' into master-next 2020-06-17 11:29:28 -07:00
Alexis Laferrière
1c8ad2f615 Merge pull request #32423 from xymus/module-loading-order
[ModuleInterface] Prefer the swiftmodule in the SDK over the prebuilt-cache
2020-06-17 11:27:29 -07:00
Alexis Laferrière
b4f2e63df8 [ModuleInterface] Prefer the swiftmodule in the SDK over the prebuilt-cache
Fix the search order for module interfaces to respect the documented
behavior:

1. Local cache
2. Next to the .swiftinterface
3. Prebuilt cache

Fixing the order of the last two allows the XcodeDefault compiler to
prioritize swiftmodule files with SPI information.

rdar://problem/64097455
2020-06-17 08:36:08 -07:00
swift_jenkins
20ba5d3171 Merge remote-tracking branch 'origin/master' into master-next 2020-06-16 21:38:08 -07:00
Robert Widmann
260b6a1e2f Merge pull request #32409 from CodaFi/fixing-a-whole-where-the-rain-gets-in
Build Module Interfaces in WMO
2020-06-16 21:18:49 -07:00
swift_jenkins
90dd9dbae8 Merge remote-tracking branch 'origin/master' into master-next 2020-06-16 14:18:53 -07:00
Robert Widmann
0ca2399cab Build Module Interfaces in WMO
Building in incremental mode incurs the overhead associated with the
incremental dependency tracking infrastructure. Considering we're
throwing away all of this stuff anyways, let's just build in WMO to
avoid that.
2020-06-16 11:48:56 -07:00
Xi Ge
b6a8af599e DependenciesScanner: move -fapinotes-swift-version to extra PCM arguments
Swift interface files may specify the effective language version to use. When building
a PCM loadable for these textual interface files, we should respect the language
version. This patch moves -fapinotes-swift-version from the generic PCM
commands to the extra PCM arguments owned by each loading Swift module.
2020-06-16 11:38:28 -07:00
Xi Ge
00872ba53e DependencyScanner: add a new extraPcmArgs field for each Swift module
Building each Swift module explicitly requires dependency PCMs to be built
with the exactly same deployment target version. This means we may need to
build a Clang module multiple times with different target triples.

This patch removes the -target arguments from the reported PCM build
arguments and inserts extraPcmArgs fields to each Swift module.
swift-driver can combine the generic PCM arguments with these extra arguments
to get the command suitable for building a PCM specifically for
that loading Swift module.
2020-06-16 09:42:59 -07:00
David Zarzycki
4be1192904 Keep master-next building and tested 2020-06-09 06:05:05 -04:00
Karoy Lorentey
57ea964f2c Merge commit '3eb82c183662945687f48e11c09828f551b34858' into master-next
# Conflicts:
#	include/swift/Frontend/FrontendInputsAndOutputs.h
2020-06-08 16:58:37 -07:00
Karoy Lorentey
68351d2110 Revert "Merge remote-tracking branch 'origin/master-next'"
This reverts commit 1c9b0908e6, reversing
changes made to 3eb82c1836.
2020-06-08 16:48:38 -07:00
Karoy Lorentey
1c9b0908e6 Merge remote-tracking branch 'origin/master-next'
# Conflicts:
#	include/swift/Frontend/FrontendInputsAndOutputs.h
2020-06-08 16:43:40 -07:00
Xi Ge
bd782be654 Front-end: add a new module loader that loads explicitly built Swift modules
To support -disable-implicit-swift-modules, the explicitly built modules
are passed down as compiler arguments. We need this new module loader to
handle these modules.

This patch also stops ModuleInterfaceLoader from building module from interface
when -disable-implicit-swift-modules is set.
2020-06-03 18:59:18 -07:00
Xi Ge
0d74428575 Front-end: use separate flag for -swift-module-file instead of EQ 2020-06-02 16:51:45 -07:00
Xi Ge
01c18d01c1 Frontend: move ExplicitSwiftModules into SearchPathOptions, NFC 2020-06-02 16:51:45 -07:00
Xi Ge
38b3d81905 ModuleInterface: pass-down explicit Swift module paths when building module from interface 2020-06-02 16:51:45 -07:00
Xi Ge
28b0b22a42 ModuleInterface: refactor several configuration values into an Option struct 2020-06-02 16:51:45 -07:00
Xi Ge
1ae70a5b26 DependenciesScanner: avoid reporting output file path because build system should specify it 2020-06-02 16:51:45 -07:00
Xi Ge
3a214d99f6 Frontend: add an argument to disable implicitly built Swift modules 2020-06-02 16:51:45 -07:00
swift_jenkins
68af9d595b Merge remote-tracking branch 'origin/master' into master-next 2020-05-22 20:18:30 -07:00
Xi Ge
38c0452d65 DependenciesScanner: report command-line arguments for building pcm explicitly 2020-05-22 07:50:08 -07:00
Erik Eckstein
82a006be26 Merge remote-tracking branch 'origin/master' into master-next 2020-05-16 10:26:27 +02:00
Xi Ge
7d08a24161 ModuleInterface: reconstruct command-line arguments for building Swift module from interface explicitly 2020-05-15 10:49:45 -07:00
Arnold Schwaighofer
622fee54a7 Another std::string StringRef assignment. 2020-05-13 07:35:11 -07:00
Xi Ge
3952fd5bf7 ModuleInterface: refactor compiler instance configuration to a standalone delegate class. NFC
Module interface builder used to maintain a separate compiler instance for
building Swift modules. The configuration of this compiler instance is also
useful for dependencies scanner because it needs to emit front-end compiler invocation
for building Swift modules explicitly.

This patch refactor the configuration out to a delegate class, and the
delegate class is also used by the dependency scanner.
2020-05-12 16:19:27 -07:00
Fred Riss
259d78a350 Adapt to llvm.org StringRef API change 2020-03-13 19:08:22 +01:00
Xi Ge
8c2a041822 Front-end: add an option to not lock interface file when building module
This could help fix a flaky test.

Related to: rdar://58578342
2020-02-25 12:13:14 -08:00
Alexis Laferrière
ffa0bda67e [Frontend] Use the private module interface when available 2020-02-19 14:17:14 -08:00
Brent Royal-Gordon
e4c1de675a [NFC-ish] Simplify module loader filename handling (#29295)
* Remove dead ModuleSourceInfoFilename parameters

These were never actually used; we might find a way to bring them back later.

* Introduce SerializedModuleBaseName

This is intended to replace the _n_ filename parameters that tend to get passed around in the SerializedModuleLoader classes.

* Manipulate currPath in SerializedModuleLoader less often

* Don’t pass raw paths around SerializedModuleLoader

Only pass base names.

* Regularize module file opening functions
2020-01-21 13:02:20 -08:00