Commit Graph

804 Commits

Author SHA1 Message Date
Artem Chikin
f92abb8c81 Verify that _Concurrency *can* be imported on implicit import.
In case the compiler is used with concurrency features enabled (by-default or otherwise), and an older SDK is used which does not include the `_Concurrency` module, do not load this module implicitly. Instead, emit a diagnostic indicating that no such module is found.

rdar://76967260
2021-04-22 13:46:59 -07:00
QuietMisdreavus
419483863f Revert "[Driver][Frontend] add the symbol graph dir to the supplementary file map" 2021-04-22 12:20:14 -06:00
QuietMisdreavus
170dcd88bc Merge pull request #36863 from apple/QuietMisdreavus/docs-inheritance
[SymbolGraph] Add information about "inherited docs" for synthesized symbols
2021-04-19 19:40:38 -06:00
Doug Gregor
c1328bd83f Merge pull request #36857 from DougGregor/import-concurrency-by-default-take-2
Enable import of the _Concurrency module by default.
2021-04-15 13:12:45 -07:00
Becca (née Brent) Royal-Gordon
6e710b2806 Merge pull request #36594 from beccadax/nonstandard-library
Preload standard library in ModuleInterfaceBuilder
2021-04-15 10:43:28 -07:00
Dario Rexin
01298df2f5 Enable import of _Concurrency by default on Linux 2021-04-13 23:14:06 -07:00
Doug Gregor
ca6b6953a0 Only import _Concurrency implicitly on Darwin and Windows for now. 2021-04-13 23:14:06 -07:00
Doug Gregor
568e943115 Enable import of the _Concurrency module by default. 2021-04-13 23:14:06 -07:00
Victoria Mitchell
f4154d6019 add flag to skip docs on synthesized symbols 2021-04-11 17:40:37 -05:00
Arnold Schwaighofer
9286ece71c Revert "Enable import of the _Concurrency module by default." 2021-04-09 13:20:30 -07:00
Doug Gregor
cc0a74d766 Enable import of the _Concurrency module by default. 2021-04-06 14:08:41 -07:00
Becca Royal-Gordon
1f713074ac [NFC] Fix issues with -verify mode
This commit fixes two weird bugs in -verify mode:

1. SourceLocs from the wrong SourceManager could be passed through a ForwardingDiagnosticConsumer into the DiagnosticVerifier.

2. -verify-additional-file did not error out correctly when the file couldn’t be opened.

No tests, as we only have basic tests for the diagnostic verifier.
2021-03-25 16:02:29 -07:00
Victoria Mitchell
97a4cba250 add the symbol graph dir to the supplementary file map
rdar://75582169
2021-03-24 09:44:23 -05:00
Michael Gottesman
504b5f2058 [ossa][frontend] Separately namespace enable-ossa-modules in the prebuilt module cache so that the flag causes recompilation of imported resilient modules when the flag is enabled.
This will enable users to try out the '-enable-ossa-modules' flag if their
compiler supports it and get OSSA code on all inlinable code that they use. The
idea is that this is a nice way to stage this in and get more testing.

The specific implementation is that the module interface loader:

1. Knows if enable ossa modules is enabled not to search for any compiled
modules. We always rebuild from the interface file on the system.

2. Knows that if enable ossa modules is enabled to mixin a bit into the module
interface loader cache hash to ensure that we consider the specialized ossa
compiled modules to be different than the modules in that cache from the system.

This ensures that when said flag is enabled, the user transparently gets all
their code in OSSA form from transparent libraries.
2021-03-18 13:03:51 -07:00
Doug Gregor
2a28fed34d Allow one to separately specify the ABI name of a module.
Introduce a new compiler flag `-module-abi-name <name>` that uses the
given name as the ABI name for the module (rather than the module's
name in source code). The ABI name impacts name mangling and metadata.
2021-03-12 07:42:07 -08:00
Victoria Mitchell
3e22b20551 don't pop the last path component from -emit-symbol-graph-dir
rdar://74318113
2021-03-08 12:04:17 -07:00
Robert Widmann
28a37a427f Add Real Enable/Disable Flags for Cross-Module Incremental Builds
In the legacy driver, these flags will merely be propagated to the
frontends to indicate that they should disable serialization of
incremental information in swift module files.

In the new driver, these flags control whether the Swift driver performs
an incremental build that is aware of metadata embedded in the module.

Kudos to David for coming up with our new marketing name: Incremental
Imports.

rdar://74363450
2021-03-01 10:15:25 -08:00
Ben Barham
bb9dd3a4aa [Frontend] Allow missing files when allowing compiler errors
As with other compilation errors, we want to generate the swiftmodule
regardless.
2021-02-24 14:13:21 +10:00
AG
a5b804602d Merge pull request #35110 from bitjammer/acgarland/emit-symbol-graph
Add optional -emit-symbol-graph output when emitting modules
2021-02-12 09:00:58 -08:00
Becca Royal-Gordon
8d0040fa2b Improve access note error handling
The LLVM rebranch added an “AllowUnknownKeys” setting to llvm::yaml::Input, which lets us rip out a lot of marginal code and encourages a broader rework of access note error diagnosis:

• Access note warnings and errors are now diagnosed as they’re found during YAML parsing
• They now have proper SourceLocs inside the .accessnotes file
• They’re now tested using -verify-additional-file instead of FileCheck
• A lot of gross duct tape is now gone
2021-02-10 00:29:34 -08:00
Becca Royal-Gordon
01fa74510e [NFC] Clean up access note code
• Rename properties for greater consistency with the YAML file
• Rename AccessNotes -> AccessNotesFile
• Add doc comments
• Miscellaneous comment/style improvements.
2021-02-09 14:17:35 -08:00
Becca Royal-Gordon
bf13139495 Allow unknown keys in access notes
LLVM’s YAML support wants to show a hard error if an unknown string appears in an access note. Instead, emit a remark but load the parts of the access note we do understand to allow for future expansion of access notes.
2021-02-09 14:17:35 -08:00
Becca Royal-Gordon
e42294737f Handle access note I/O and parse errors 2021-02-09 14:17:35 -08:00
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