Commit Graph

1129 Commits

Author SHA1 Message Date
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
3a214d99f6 Frontend: add an argument to disable implicitly built Swift modules 2020-06-02 16:51:45 -07:00
Hamish Knight
d26f4148a9 [CodeCompletion] Replace main module instead of file
Rather than replacing the code completion file
on the `CompilerInstance` whenever we do a cached
top-level completion, let's set a new main module
instead.

This allows us to properly update the
`LoadedModules` map, and allows the retrieval of
the code completion file to be turned into a
request.
2020-06-02 14:25:28 -07:00
Hamish Knight
1bc028ece3 Merge pull request #32091 from hamishknight/standard-error 2020-06-02 14:17:05 -07:00
Hamish Knight
e60c7fe547 Add request to query primary files
Remove the `PrimarySourceFiles` vector from the
frontend and replace it with a request on
ModuleDecl that retrieves the primary files for
the main module.

This is in preparation for having
`CompilerInstance::getMainModule` automatically
populate the main module with files when queried.
2020-06-02 09:10:35 -07:00
Varun Gandhi
caf38b6224 [NFC] Remove redundant includes for llvm/ADT/MapVector.h. 2020-05-31 13:07:45 -07:00
Varun Gandhi
ea92df04e1 [NFC] Remove redundant includes for <vector>. 2020-05-31 13:05:02 -07:00
Hamish Knight
ab6c15f4b3 [Frontend] Bail early if the stdlib is missing
Rather than trying to continue the compilation
with an empty main module, let's bail out early if
we expect an implicit stdlib import and fail to
load in the stdlib.
2020-05-29 16:13:42 -07:00
swift_jenkins
0b2d4f6963 Merge remote-tracking branch 'origin/master' into master-next 2020-05-27 20:38:47 -07:00
Owen Voorhees
e40e86fc94 Merge pull request #32017 from owenv/diag-style-opt
[Diagnostics] Add -diagnostic-style=(llvm|swift) to control printed output
2020-05-27 20:22:23 -07:00
swift_jenkins
69b940a8d3 Merge remote-tracking branch 'origin/master' into master-next 2020-05-22 20:58:53 -07:00
Robert Widmann
4eb5689115 Merge pull request #31960 from CodaFi/your-references-are-off-the-chain
Delete ReferencedNameTracker
2020-05-22 20:44:37 -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
Robert Widmann
acbf927b0e [NFC] Delete ReferencedNameTracker 2020-05-21 18:54:14 -07:00
Owen Voorhees
c4e67e29ed [Diagnostics] Add -diagnostic-style=(llvm|swift) to control printed output
This default formatting style remains the same "LLVM style". "Swift style"
is what was previously enabled via -enable-experimental-diagnostic-formatting
2020-05-20 19:34:15 -05: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
swift_jenkins
4f45260171 Merge remote-tracking branch 'origin/master' into master-next 2020-05-12 21:38:40 -07:00
Xi Ge
554ecf655d Merge pull request #31720 from nkcsgexi/refactor-sub-astcontext-delegate
ModuleInterface: refactor compiler instance configuration to a standalone delegate class. NFC
2020-05-12 21:23:26 -07:00
swift_jenkins
5fb066ec8a Merge remote-tracking branch 'origin/master' into master-next 2020-05-12 18:19:24 -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
Robert Widmann
4ff5b90a8b [NFC] Fold performParseOnly into performSemaUpTo 2020-05-11 23:58:27 -07:00
Arnold Schwaighofer
e12698d7a0 Merge remote-tracking branch 'origin/master' into master-next 2020-05-08 07:22:20 -07:00
Hamish Knight
98d3a81ede Merge pull request #31609 from hamishknight/ill-sil-you-in-later 2020-05-07 18:02:52 -07:00
swift_jenkins
b89b233b2e Merge remote-tracking branch 'origin/master' into master-next 2020-05-07 14:19:21 -07:00
Hamish Knight
72bb47ee90 [Frontend] Remove InputFileKind::SwiftREPL 2020-05-07 11:00:02 -07:00
Hamish Knight
70abfd3252 [Frontend] Remove TheSILModule
Now that SIL parsing is handled lazily, the
CompilerInstance no longer needs to hang onto a
SILModule.
2020-05-06 20:11:49 -07:00
swift_jenkins
4f38d3e06a Merge remote-tracking branch 'origin/master' into master-next 2020-05-05 13:57:12 -07:00
Xi Ge
3cb8d8e814 DependencyScanner: inherit ASTContext options when configuring a sub compiler instance for interface scanner. NFC 2020-05-05 11:29:12 -07:00
Xi Ge
9bc036c050 DependencyScanner: honor additional compiler flags in interfaces files when collecting imports
Additional flags in interface files may change parsing behavior like #if
statements. We should use a fresh ASTContext with these additional
flags when parsing interface files to collect imports.

rdar://62612027
2020-05-04 22:18:11 -07:00
swift_jenkins
2fb0e14746 Merge remote-tracking branch 'origin/master' into master-next 2020-04-29 21:48:41 -07:00
Hamish Knight
f34964bc8e [Frontend] NFC: Remove a mutable SILOptions accessor
We shouldn't expose the ability to mutate the
SILOptions through the CompilerInstance.
2020-04-29 18:58:47 -07:00
swift_jenkins
9a852c7116 Merge remote-tracking branch 'origin/master' into master-next 2020-04-28 19:58:43 -07:00
Hamish Knight
9fe475fa47 [Frontend] Inline parseAndCheckTypesUpTo
`performSemaUpTo` will only shrink from here, so
go ahead and inline `parseAndCheckTypesUpTo` into
it already.
2020-04-28 14:44:18 -07:00
Hamish Knight
b78f47490a Move AST transforms out of the Frontend
Move the playground and debugger transforms out
of the Frontend and into `performTypeChecking`, as
we'd want them to be applied if
`performTypeChecking` was called lazily.
2020-04-28 14:44:17 -07:00
swift_jenkins
ed20b9c058 Merge remote-tracking branch 'origin/master' into master-next 2020-04-24 23:58:13 -07:00
Doug Gregor
71e7d6a913 [Dependency scanning] Add implicit Swift and SwiftOnoneSupport dependencies 2020-04-24 12:58:45 -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
e3ad06767c Merge remote-tracking branch 'origin/master' into master-next 2020-04-21 19:38:11 -07:00
Hamish Knight
057ca60371 [Frontend] Inline recordPrimarySourceFile
And remove an unnecessary call to
`recordPrimaryInputBuffer`.
2020-04-20 19:48:37 -07:00
Hamish Knight
a6b3236cd1 [Frontend] Remove parseAndTypeCheckMainFileUpTo
Now that we no longer interleave parsing and
type-checking for SIL, the main file doesn't need
to be handled separately. We can now parse it
along with the rest of the input files and
type-check it along with the rest of the primaries.

This commit also updates `performParseOnly` to
match the order in which the files are now parsed.
2020-04-20 19:48:37 -07:00
swift_jenkins
f5510bf1a4 Merge remote-tracking branch 'origin/master' into master-next 2020-04-20 16:57:12 -07:00
Hamish Knight
7f8a0e8a6c Requestify implicit imports
Add ModuleImplicitImportsRequest, which computes
the modules that should be implicitly imported by
each file of a given module. Use this request in
import resolution to add all the necessary
implicit imports.

The request computes the implicit imports by
consulting the ImplicitImportInfo, which ModuleDecl
can now be created with. This allows us to remove
uses of `SourceFile::addImports` in favor of
adding modules needed to be implicitly imported to
the ImplicitImportInfo.
2020-04-20 13:20:35 -07:00
Hamish Knight
453667f659 [Frontend] Validate ImplicitImportModuleNames early
Check whether the user has provided a valid
identifier when parsing the options. Also make
ImplicitImportModuleNames a private member of
FrontendOptions to prevent mutation after being
parsed.
2020-04-20 13:20:35 -07:00
swift_jenkins
c2672fe6e9 Merge remote-tracking branch 'origin/master' into master-next 2020-04-19 23:58:17 -07:00
Robert Widmann
37f016b802 [NFC] Formalize isModuleExternallyConsumed
Yank this parameter and document the historical scope creep of this value.
2020-04-19 21:46:59 -07:00
Robert Widmann
7fb81eabee [Gardening] Const-qualify CompilerInstance::getInvocation() 2020-04-19 21:45:32 -07:00
swift_jenkins
d7fa85ff14 Merge remote-tracking branch 'origin/master' into master-next 2020-04-10 09:20:49 -07:00