Commit Graph

731 Commits

Author SHA1 Message Date
Becca Royal-Gordon
ccf244b89b Add ability to load access notes 2021-02-09 14:17:33 -08:00
Ashley Garland
69c4fc47cb Add optional -emit-symbol-graph output when emitting modules
rdar://71497047
2021-01-28 09:55:33 -08:00
swift-ci
90eb4fe6af Merge remote-tracking branch 'origin/main' into rebranch 2021-01-15 13:12:33 -08:00
Xi Ge
fcbc2b4d9d Merge pull request #35414 from nkcsgexi/volatile-open-input
Frontend: add an option -bad-file-descriptor-retry-count
2021-01-15 12:58:55 -08:00
Xi Ge
ae9d873009 Frontend: add an option -bad-file-descriptor-retry-count
This option allows the compiler to retry opening an input file if the previous
opening returns an error of bad file descriptor. Swift-driver will set this
argument in certain circumstances to walk-around such error.

rdar://73157185
2021-01-15 10:28:27 -08:00
swift-ci
6841728fb2 Merge remote-tracking branch 'origin/main' into rebranch 2021-01-14 09:32:28 -08:00
Robert Widmann
cc0d919653 Remove Compiled Source 2021-01-13 23:00:16 -08:00
Robert Widmann
2475095021 Remove Ranges File Type 2021-01-13 22:42:17 -08:00
Brent Royal-Gordon
5036a55550 [Frontend] Allow additional files for diagnostic verifier
This change adds a frontend flag, -verify-additional-file, which can be used to pass extra files directly to the diagnostic verifier. These files are not otherwise considered to be Swift source files; they are not compiled or even properly parsed.

This feature can be used to verify diagnostics emitted in non-source files, such as in module interfaces or header files.
2021-01-11 15:59:25 -08:00
swift-ci
7c08a49dc1 Merge remote-tracking branch 'origin/main' into rebranch 2021-01-08 18:32:53 -08:00
Slava Pestov
60644295d3 Merge pull request #35307 from slavapestov/wmo-perf-fix
Frontend: Don't record request references in WMO builds
2021-01-08 21:29:44 -05:00
swift-ci
0988129fe1 Merge remote-tracking branch 'origin/main' into rebranch 2021-01-08 16:12:47 -08:00
Slava Pestov
797813fda4 Frontend: Don't record request references in WMO builds
Part of <rdar://problem/72906325>.
2021-01-07 23:52:55 -05:00
Artem Chikin
7d1d8a4661 [Dependency Scanning] Factor ModuleDependenciesCache out of a CompilerInstance into callers of scanDependencies
It is now the responsibility of the scanDependencies code to instantiate (and share) the cache.
e.g. FrontendTool instantiates a new cache per `-scan-dependencies` invocation, and the DependencyScanningTool keeps one shared cache across its lifetime.
2021-01-07 09:08:20 -08:00
Alexis Laferrière
d79a58fbb4 [Frontend] Fix use of unique pointer to VFS
rdar://72137092
2020-12-09 08:29:37 -08:00
Rintaro Ishizaki
bf5d22257a [Frontend] Opt-in missing file recovery 2020-12-04 15:23:43 -08:00
Rintaro Ishizaki
055dc66d3b [Frontend] Recover missing input file by dummy input buffer.
Also, continue trying opening files even if any of primary files are
missing so that the caller can know all files failed to open.

rdar://problem/33757793
2020-12-04 15:23:29 -08:00
Ben Barham
b0577b0641 Merge pull request #34472 from bnbarham/benb/allow-errors-69815975
[Serialization] Add an option to output modules regardless of errors
2020-11-11 08:30:18 +10:00
Artem Chikin
3e3be76efb Merge pull request #34646 from artemcm/BatchScanShouldShareCache
[Dependency Scanner] Share `ModuleDependenciesCache` as a part of the CompilerInstance
2020-11-10 14:10:11 -08:00
Artem Chikin
10b6b9d47c [Dependency Scanner] Share ModuleDependenciesCache as a part of the CompilerInstance
This will allow individual module scans in batch-scanning mode to share the already-scanned Swift and Clang modules, and avoid instantiating a brand new Clang `DependencyScanningService` for each batch entry.

Performance-improvement anecdote:
A simple experiment which performs a batch scan of all modules involved in planning a build of SwiftPM (using SwiftPM in explicit module build mode), which includes 126 batch entries (scan entry-points), with 21 distinct Swift modules and 27 distinct Clang modules (many Clang modules are scanned multiple times, at different target versions), this modification reduces the total time taken from ~34 seconds to ~6.
2020-11-10 09:26:34 -08:00
Ben Barham
241559dc88 [Serialization] Add an option to output modules regardless of errors
Adds a new frontend option
"-experimental-allow-module-with-compiler-errors". If any compilation
errors occur while generating the .swiftmodule, this mode will skip SIL
entirely and only serialize the (likey invalid) AST.

This existence of this option during generation is serialized into the
resulting .swiftmodule. Errors found in deserialization are only allowed
if it is set.

Primarily intended for IDE requests (eg. indexing and code completion)
to ensure robust cross-module results, despite possible errors.

Resolves rdar://69815975
2020-11-10 14:47:22 +10:00
Doug Gregor
ff14a40f49 [Concurrency] Don't import _Concurrency implicitly when building a module.
Another fix for rdar://71045297.
2020-11-09 11:15:12 -08:00
swift-ci
f82e962262 Merge pull request #34609 from apple/disable-implicit-concur-import 2020-11-06 15:16:45 -08:00
Kavon Farvardin
242e9fe464 add the -disable-implicit-concurrency-module-import hidden flag 2020-11-06 08:54:01 -08:00
Ben Barham
7cee600bcd [SILGen] Add flag to skip typechecking and SIL gen for function bodies
Adds a new flag "-experimental-skip-all-function-bodies" that skips
typechecking and SIL generation for all function bodies (where
possible).

`didSet` functions are still typechecked and have SIL generated as their
body is checked for the `oldValue` parameter, but are not serialized.
Parsing will generally be skipped as well, but this isn't necessarily
the case since other flags (eg. "-verify-syntax-tree") may force delayed
parsing off.
2020-11-06 12:08:19 +10:00
Doug Gregor
13c17aef95 [Concurrency] Only auto-import _Concurrency when auto-importing Swift.
This allows the standard library to build with concurrency enabled.
Fixes rdar://70700689.
2020-10-29 14:57:10 -07:00
John McCall
a8464dcaf1 Implicitly import _Concurrency under -enable-experimental-concurrency 2020-10-22 00:53:15 -04:00
Brent Royal-Gordon
f71923778b Add -testable-import-module frontend flag
This is just like -import-module, but it does an @testable import. Simple, right?

Fixes rdar://66544654.
2020-10-09 18:59:20 -07:00
Brent Royal-Gordon
c13067a0e0 [NFC] Rework ImplicitImportInfo::ModuleNames
Replace with an array of AttributedImport<UnloadedImportedModule> to add flexibility.
2020-10-09 18:58:03 -07:00
Xi Ge
8ccee27db7 ModuleInterface: refactor ModuleInterfaceChecker out of ModuleInterfaceLoader
This refactoring allows us to drop ModuleInterfaceLoader when explicit modules
are enabled. Before this change, the dependencies scanner needs the loader to be
present to access functionalities like collecting prebuilt module candidates.
2020-10-01 10:30:48 -07:00
Robert Widmann
574ee39397 Stage in frontend flags for experimental cross-module incremental builds 2020-09-24 17:11:28 -06:00
Robert Widmann
3287c4b271 [NFC] Refactor Main File Computation 2020-09-11 22:28:59 -06:00
Robert Widmann
a8766cce5b [NFC] Refactor InputFile's Accessors 2020-09-11 22:28:58 -06:00
Robert Widmann
75116e9f86 [NFC] Inline CompilerInstance::setUpForInput 2020-09-11 21:24:26 -06:00
Robert Widmann
c3e33bec7a [NFC] Drop getSourceFileKind 2020-09-11 21:24:26 -06:00
Robert Widmann
d4b2e167ac Model ObjCHeader Inputs
These inputs were previously modeled as Swift files, which would lead to bizarre situations where parts of the pipeline expecting Swift inputs actually wound up parsing Objective-C.
2020-09-11 13:55:48 -06:00
Xi Ge
a4d731ed9f ModuleLoader: remove several walk-arounds for not having a persistent ClangImporterOptions available. NFC 2020-09-02 15:10:50 -07:00
Xi Ge
c403b140e1 ClangImporter: refactor ClangImporterOptions to be ASTContext-owned. NFC
We need ClangImporterOptions to be persistent for several scenarios: (1)
when creating a sub-ASTContext to build Swift modules from interfaces; and
(2) when creating a new Clang instance to invoke Clang dependencies scanner.

This change is NFC.
2020-09-01 14:04:22 -07:00
Robert Widmann
4c7ccf5abe [NFC] Clean Up FrontendTool
Try to impose a simple structure that splits performing actions from the
pre and post-pipeline conditions. Wherever actions would take more than
a simple return, split them into functions. Refine functions that
perform effects to return status codes when they fail. Finally,
delineate functions that need semantic analysis from those that do not.

Overall this should be NFC.
2020-08-27 16:15:44 -07:00
Artem Chikin
99938758f7 Merge pull request #33630 from artemcm/ScannerCanImport
[Explicit Module Builds] Handle #canImport in the dependency scanner by adding scanner "loaders" to the ASTContext.
2020-08-27 11:24:26 -07:00
Artem Chikin
78159c83f7 [Explicit Module Builds] Handle #canImport in the dependency scanner by adding scanner "loaders" to the ASTContext. 2020-08-25 14:20:38 -07:00
Brent Royal-Gordon
9bc787ef5f Add a “typecheck module interface” mode 2020-08-07 16:00:15 -07:00
Varun Gandhi
1ddf4ff790 [Gardening] Use consistent style for referencing notes. 2020-07-25 23:36:17 -07:00
Artem Chikin
140fd73f83 [Explicit Module Builds] Prevent SerializedModuleLoader from running in Explicit Module Build mode.
In order to avoid accidentally implicitly loading modules that are expected but were not provided as explicit inputs.

- Use either SerializedModuleLoader or ExplicitSwiftModuleLoader for loading of partial modules, depending on whether we are in Explicit Module Build or Implicit Module Build mode.
2020-07-22 09:00:40 -07:00
Hamish Knight
241c5d95e3 Merge pull request #32461 from hamishknight/its-all-linked 2020-07-08 11:07:17 -07:00
Hamish Knight
5792a72b95 Always link SIL for partial modules in SILGen
Previously we would only link `.sib` partial
modules in SILGen, with other kinds of serialized
ASTs being linked just before the SILOptimizer if
`-sil-merge-partial-modules` was specified.
However linking them always seems to be the desired
behaviour, so adjust SILGen to link SIL for all
serialized AST inputs.
2020-07-01 23:14:01 -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
David Zarzycki
9e85a396f6 Merge pull request #32630 from HassanElDesouky/LocaleFlagsRE
Reopen [Diag] Create frontend flags for localization
2020-07-01 05:58:50 -04:00
HassanElDesouky
063e92aa53 Create frontend flags for localization 2020-06-30 23:12:40 +02: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