Commit Graph

1186 Commits

Author SHA1 Message Date
Artem Chikin
f9d6c6a619 [Dependency Scanner] Refactor ModuleDependencies to represent binary-only Swift modules explicitly
This matches the behavior of the current client (`swift-driver`) and reduces ambiguity in how the nodes in the graph are to be treated. Swift dependencies with a textual interface, for example, must be built into a binary module by clients. Swift dependencies without a textual interface, with only a binary module, are to be used directly, without any up-to-date checks.

Note, this is distinct from Swift dependencies that have a textual interface, for which we also detect potential pre-build binary module candidates. Those are still reported in the `details` field of textual Swift dependencies as `prebuiltModuleCandidates`.
2020-10-12 09:56:03 -07:00
Brent Royal-Gordon
d02b34cccc [NFC] Add conveniences to clean up import code 2020-10-09 18:59:19 -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
Brent Royal-Gordon
b440ab7331 [NFC] Move several types/functions to Import.h
To help consolidate our various types describing imports, this commit moves the following types and methods to Import.h:

* ImplicitImports
* ImplicitStdlibKind
* ImplicitImportInfo
* ModuleDecl::ImportedModule
* ModuleDecl::OrderImportedModules (as ImportedModule::Order)
* ModuleDecl::removeDuplicateImports() (as ImportedModule::removeDuplicates())
* SourceFile::ImportFlags
* SourceFile::ImportOptions
* SourceFile::ImportedModuleDesc

This commit is large and intentionally kept mechanical—nothing interesting to see here.
2020-10-09 18:57:07 -07:00
John McCall
0fb407943f [NFC] Rename swift_runtime_unreachable to swift_unreachable and make it use LLVM's support when available. 2020-10-03 02:54:56 -04:00
Robert Widmann
e646ef2cbe Add incrementalExternalDepend as an Incremental NodeKind 2020-09-25 01:16:01 -06:00
Robert Widmann
044f85ad9c Add ModuleDepGraphFactory
This completes the missing piece from #34073 and means the frontend may now serialize moduledecl-based dependencies.
2020-09-24 23:27:11 -06:00
Robert Widmann
76cd4bf160 [NFC] Differential Incremental External Dependencies in DependencyTracker
Also perform the plumbing necessary to convince the rest of the compiler that they're just ordinary external dependencies. In particular, we will still emit these depenencies into .d files, and code completion will still index them.
2020-09-24 23:25:47 -06:00
Robert Widmann
3c2b376aa2 [NFC] Refactor Reference Dependency Emission
Invert the responsibility of the entrypoint so that FrontendTool is directing the actual serialization work. The entrypoint now solely exists to construct a dependency graph.

While I'm here, prepare the way for serializing dependency graphs for modules by optimistically modeling a ModuleOrSourceFile input.
2020-09-24 20:07:02 -06:00
Mishal Shah
956b7a931c Merge pull request #34041 from apple/shahmishal/update-branch-doc
Update doc and links to support new main branch
2020-09-23 22:48:03 -07:00
Varun Gandhi
734b8a2533 Merge pull request #33986 from varungandhi-apple/vg-import-filter-cleanup
[NFC] Clarify import filtering logic and naming.
2020-09-23 18:23:11 -07:00
Varun Gandhi
d3369f7711 [NFC] Rename ImportFilterKind cases to be clearer. 2020-09-23 12:50:20 -07:00
Mishal Shah
40024718ac Update doc and links to support new main branch 2020-09-22 23:53:29 -07:00
Artem Chikin
d5449bf55f [Dependency Scanner] Add import-prescan handling to batch scanning 2020-09-22 11:32:09 -07:00
Artem Chikin
e0dbba569b [Dependency Scanner] Add option to execute an import prescan
With this option enabled, the dependency scanner gathers all import statements in source files of the main module (non-transitive) and outputs a list of imported modules.
This will be used by build systems and the swift-driver as a way to avoid redundant re-scanning in incremental contexts.
2020-09-22 11:04:31 -07:00
Robert Widmann
3287c4b271 [NFC] Refactor Main File Computation 2020-09-11 22:28:59 -06:00
Robert Widmann
c5a6cd6abe [NFC] Refactor getPrimaryOrMainSourceFile 2020-09-11 22:28:58 -06:00
Robert Widmann
a8766cce5b [NFC] Refactor InputFile's Accessors 2020-09-11 22:28:58 -06:00
Robert Widmann
8b725d8713 [NFC] Inline inputFileKindCanHaveTBDValidated 2020-09-11 21:24:26 -06:00
Robert Widmann
618b0b9eb6 Add doesActionPerformEndOfPipelineActions
For now, force the clang-based actions to skip the end of the pipeline. This restores the previous behavior of the frontend, but may not be desirable in the long run. For example, one may want to dump clang stats after running an -emit-pch job, but that is impossible without forcing the end of the pipeline to be more tolerant of ObjCHeader/modulemap-only inputs.

rdar://68587228
2020-09-11 13:57:28 -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
Brent Royal-Gordon
cff4ddf13a [NFC] Adopt new ImportPath types and terminology
# Conflicts:
#	lib/IDE/CodeCompletion.cpp
2020-09-10 19:07:49 -07:00
Robert Widmann
98765132c9 [Gardening] Document a Strange Sort 2020-09-09 10:39:22 -06:00
Max Desiatov
9685179e5f Merge pull request #33324 from kateinoigakukun/katei/swift-module-summary/frontend
[Frontend] Set up output file .swiftmodule.summary
2020-09-07 07:19:33 +01:00
Xi Ge
e107182f1a Merge remote-tracking branch 'apple/master' into master-rebranch 2020-09-02 18:36:37 -07:00
Xi Ge
ed5edb89f5 Merge pull request #33756 from nkcsgexi/module-loader-opts
ModuleLoader: remove several walk-arounds for not having a persistent ClangImporterOptions available. NFC
2020-09-02 18:20:35 -07: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
Varun Gandhi
4350a96303 Merge pull request #33640 from varungandhi-apple/vg-fix-module-trace-cycle
[ModuleTrace] Handle cycle detection edge case in module trace emission (ep2).
2020-09-02 11:59:52 -07:00
Varun Gandhi
3e7f33971c [ModuleTrace] Handle cycle detection edge case in module trace emission (ep2).
Fixes rdar://67704000.
2020-09-01 14:23:14 -07:00
Nathan Hawes
9da1d89520 Manually merge remote-tracking branch 'upstream/master' into HEAD
Conflicts:
	lib/AST/ExtInfo.cpp
2020-08-31 10:50:54 -07:00
Robert Widmann
4c56c95674 Define doesActionRequireInputs 2020-08-27 16:17:20 -07:00
Robert Widmann
fe7444ffa3 Add doesActionRequireSwiftStandardLibrary 2020-08-27 16:17:20 -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
Yuta Saito
43fb346b67 [Frontend] Set up output file .swiftmodule.summary
This patch focus on teaching frontend and driver to emit this file.
The actual serialization and deserialization implementation will come
later.
2020-08-27 00:41:16 +09:00
swift_jenkins
258b72273c Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-24 21:36:02 -07:00
Brent Royal-Gordon
8fbd449501 Merge pull request #33114 from brentdax/check-your-interfaces-at-the-door
Verify that just-emitted module interfaces parse and typecheck
2020-08-24 20:33:58 -07:00
Nathan Hawes
280d4c995a Merge remote-tracking branch 'upstream/master' into HEAD 2020-08-21 22:23:58 -07:00
Xi Ge
f3045ff9c2 DependenciesScanner: teach batch scanning mode to configure scanner using specified additional arguments
To help solving rdar://67079780, this change allows swift-driver to configure scanner using additional
arguments passed down via the batch input JSON file for each module under scanning.
2020-08-21 12:06:14 -07:00
swift_jenkins
21c2e0ebac Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-20 20:54:07 -07:00
Xi Ge
5a1f38bf41 Merge pull request #33569 from nkcsgexi/batch-scanning-protocol
DependenciesScanner: implement protocol for batch module dependencies scan
2020-08-20 20:06:40 -07:00
swift_jenkins
ac8122598c Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-20 18:35:29 -07:00
Varun Gandhi
260125e7ae [ModuleTrace] Early exit if a Clang module imports itself.
Fixes rdar://67435472.
2020-08-20 14:53:06 -07:00
Xi Ge
6a6b1f832d DependenciesScanner: differentiate Swift and Clang module more explicitly in batch scan input 2020-08-20 14:40:54 -07:00
Xi Ge
29e655bac0 DependenciesScanner: implement protocol for batch module dependencies scan
This scanning mode allows swift-driver to query module dependencies in a batch
and in a more granular way. In short term, it could help solve a problem that
clang module dependencies may vary if target triple changes. In a longer term,
we could break a holistic dependencies graph into smaller pieces for better caching
and reusing.

This change doesn't include the implementation of using the specified scanner
arguments to set up Clang dependencies scanner. It will come in later commits.
2020-08-20 14:06:47 -07:00
swift_jenkins
28cce4af82 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-18 10:54:41 -07:00
Xi Ge
9988911232 Frontend: add a new action -scan-clang-dependencies to scan a PCM's dependencies
For the issue mentioned in rdar://67079780, swift-driver needs to run clang dependencies
scanner multiple times with different target triples for a Swift target. This patch adds
a new scanning action to generate the JSON file for a given clang module to accommodate
this requirement.

Resolves: rdar://problem/67269210
2020-08-17 22:02:32 -07:00
swift_jenkins
9ab003bcf9 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-14 15:14:01 -07:00
Hamish Knight
c3dd066d52 Merge pull request #33456 from hamishknight/symlink 2020-08-14 11:18:02 -07:00
Nathan Hawes
f0c8b8e571 Manually merge remote-tracking branch 'upstream/master' into HEAD
Conflicts:
	include/swift/AST/PrettyStackTrace.h
2020-08-14 11:06:27 -07:00
Artem Chikin
70441d1906 Merge pull request #33430 from artemcm/ExplicitFrameworkBuild
[Explicit Module Builds] Distinguish whether an explicit module is a framework.
2020-08-14 09:11:11 -07:00