Commit Graph

1186 Commits

Author SHA1 Message Date
Steven Wu
359c37eba7 [EmitPCH] Do not cache PCH in memory during emit-pch action
When pch are explicitly created, there is no need to cached produced pch
in memory since pch is only going to be consumed by a later process.
2023-05-16 16:38:54 -07:00
Steven Wu
371e3c9352 [CAS] Teach swift-frontend to replay result from cache 2023-05-15 13:42:15 -07:00
Rintaro Ishizaki
a551c01d6a [Macros] Track plugin dependencies
* Factor out ASTContext plugin loading to newly introduced 'PluginLoader'
* Insert 'DependencyTracker' to 'PluginLoader'
* Add dependencies right before loading the plugins

rdar://104938481
2023-04-25 10:50:32 -07:00
Steven Wu
c7d66b8845 Teach swift to compute cache key for compiler outputs
Teach swift how to serialize its input into CAS to create a cache key
for compiler outputs. To compute the cache key for the output, it first
needs to compute a base-key for the compiler invocation. The base key is
computed from: swift compiler version and the command-line arguments for
the invocation.

Each compiler output from swift will gets its own key. The key for the
output is computed from: the base key for the compiler invocation + the
primary input for the output + the output type.
2023-04-24 13:55:38 -07:00
Steven Wu
09b8af86fb Virtualize swift compiler outputs (#63206)
Using a virutal output backend to capture all the outputs from
swift-frontend invocation. This allows redirecting and/or mirroring
compiler outputs to multiple location using different OutputBackend.

As an example usage for the virtual outputs, teach swift compiler to
check its output determinism by running the compiler invocation
twice and compare the hash of all its outputs.

Virtual output will be used to enable caching in the future.
2023-04-05 23:34:37 +08:00
Saleem Abdulrasool
c8f88175d8 IRGen: attribute correct linkage to Windows DSO handle
Partially address the incorrect handling for the `#dsohandle` on
Windows.

We were previously emitting a local definition for this external
constant, and worse yet, not marking the definition for COMDAT.  It is
unclear what definition would win ultimately (implementation defined),
as we had a definition as well as the linker synthesized value. We can
change the SIL linkage for this type to `DefaultForDeclaration` which
will give it `available_externally` and default visibility and storage
which is closer to what we desire.  However, because we do not track the
LLVM variables and apply heuristics for lowering the
`SILGlobalVariable`, we would attribute it with imported DLL Storage.
This would then cause us to fail at link time (amusingly enough link.exe
will report a LNK1000).  Special case the variable and track that we are
targeting a windows environment in the `UniversalLinkageInfo` so that we
do not special case this on other platforms.

This also has the nice side effect of allowing us to remove the special
case in the TBD handling.

Fixes: #64741
2023-04-02 10:08:16 -07:00
Rintaro Ishizaki
59f744c36a [Macros] Track loaded plugin paths in each ASTContext
PluginRegistry is now shared between multiple ASTContext. ASTContext
should track its loaded plugin library paths separately.
2023-03-27 16:55:34 -07:00
Alexis Laferrière
205a2edf38 [Sema] Intro set of import filters for general use
Calling getImportedModules requires to list the desired kind of imports.
With the new kind of imports this has become cumbersome. Let's simplify
it by offering common sets of imports. Advanced call sites can still
list the desired imports explicitly.
2023-03-17 16:05:44 -07:00
Richard Wei
c6139f2f78 [Macros] Emit loaded module trace for plugins loaded from search paths
When loading plugins from `-plugin-path`, use the global `PluginRegistry` to keep a record of what's loaded. Emit these dependencies to the loaded module trace.
2023-03-06 02:19:56 -08:00
Alexis Laferrière
6980cf211b [Serialization] Intro package-only module wide information and serialize it 2023-03-03 11:43:20 -08:00
Alexis Laferrière
4330921806 [Sema] Remove ImportFilterKind::SPIAccessControl
That filter wasn't needed in practice, we can remove it.
2023-03-03 11:42:59 -08:00
Ben Barham
8ce26c779e [Frontend] Remove reference to uninitialized ASTContext
Certain actions do not initialize `ASTContext`, eg.
`TypecheckModuleFromInterface`. But `performAction` was always grabbing
a `ASTContext&`. With `_GLIBCXX_ASSERTIONS` and
`_LIBCPP_ENABLE_ASSERTIONS` now enabled in an asserts build, this hits
an assert in `unique_ptr::operator*` that checks for a null deref.
2023-02-15 10:13:51 -08:00
Richard Wei
4480d89536 [Macros] Emit plugin dependencies to loaded module trace. (#63367)
Emit plugins loaded with `-load-plugin-library` to loaded module trace.

Resolves rdar://102212316.
2023-02-03 09:16:14 +08:00
Doug Gregor
db60d60eb7 Merge pull request #63318 from DougGregor/emit-macro-expansion-buffers-for-diags
[Macros] Emit macro expansion buffers for diagnostics.
2023-01-31 11:40:44 -08:00
Doug Gregor
8871129896 [Macros] Add frontend flag to dump macro expansions for diagnostics.
Add frontend flag `-emit-macro-expansion-files diagnostics` to emit any
macro expansion buffers referenced by diagnostics into files in a
temporary directory. This makes debugging type-checking failures in
macro expansions far easier, because you can see them after the
compiler process has exited.
2023-01-30 18:05:53 -08:00
zoecarver
306df1887d Revert "[cxx-interop] Fix crash when indexing with C++ interop enabled."
This reverts commit 883a9abf53.
2023-01-28 16:26:07 -08:00
Doug Gregor
aa969c7ccb [Module trace] Eliminate use of report_fatal_error in non-assertions builds
This code path can have its invariants broken by catastrophic build
failures and needs to not crash.
2022-12-22 09:47:47 -08:00
Alexis Laferrière
010973c276 [Frontend|NFC] Rename ModuleInterfaceOptions::PrintPrivateInterfaceContent 2022-12-08 15:10:03 -08:00
Nuri Amari
cd4b9a6416 Add support for textual imports to -emit-objc-header
Currently headers produced with `-emit-objc-header` /
`-emit-objc-header-path` produce headers that include modular imports.
If the consumer wishes to operate without modules enabled, these headers
cannot be used. This patch introduces a new flag
(`-emit-clang-header-nonmodular-includes`) that when enabled
attempts to argument each modular import included in such a header with
a set of equivalent textual imports.
2022-12-03 13:07:39 -08:00
Evan Wilde
7c0c89546f Revert "Add support for textual imports to -emit-objc-header" 2022-12-02 15:02:19 -08:00
Nuri Amari
91fd5f80e0 Merge pull request #60971 from NuriAmari/textual-imports 2022-11-29 18:24:19 -08:00
Erik Eckstein
ab1b343dad use new llvm::Optional API
`getValue` -> `value`
`getValueOr` -> `value_or`
`hasValue` -> `has_value`
`map` -> `transform`

The old API will be deprecated in the rebranch.
To avoid merge conflicts, use the new API already in the main branch.

rdar://102362022
2022-11-21 19:44:24 +01:00
Nuri Amari
89a01dddfb Add support for textual imports to -emit-objc-header
Currently headers produced with `-emit-objc-header` /
`-emit-objc-header-path` produce headers that include modular imports.
If the consumer wishes to operate without modules enabled, these headers
cannot be used. This patch introduces a new flag
(`-emit-clang-header-nonmodular-includes`) that when enabled
attempts to argument each modular import included in such a header with
a set of equivalent textual imports.
2022-11-19 12:05:09 -08:00
Robert Widmann
37e7052c68 Remove -emit-syntax and -verify-syntax-tree 2022-11-16 15:07:48 -08:00
Robert Widmann
4c162b2aeb Delete libSyntax 2022-11-16 14:52:28 -08:00
Alexis Laferrière
47b29b68db Merge pull request #61649 from xymus/index-swiftinterfaces
[Index] Force indexing of system modules to read only from swiftinterfaces
2022-10-31 14:18:45 -07:00
Alexis Laferrière
83cd432785 [Frontend] Intro global control to force loading from swiftinterface
Intro ASTContext::setIgnoreAdjacentModules to change module loading to
accept load only resilient modules from their swiftinterfaces, ignoring
the adjacent module and any silencing swiftinterfaces errors.
2022-10-31 10:58:54 -07:00
Allan Shortlidge
d663c11df7 IDE: Move compiler invocation utils to break cycle with Frontend.
Move compiler invocation utilities up into the IDETool library which is designed to be dependent on the Frontend and FrontendTool libraries.
2022-10-29 17:51:53 -07:00
Allan Shortlidge
41269e6895 TBDGen: Merge TBDGen library into IRGen.
The relationship between the code in these two libraries was fundamentally circular, indicating that they should not have been split. With other changes that I'm making to remove circular dependencies from the CMake build graph I eventually uncovered that these two libraries were required to link each other circularly, but that had been hidden by other cycles in the build graph previously.
2022-10-27 11:28:02 -07:00
Allan Shortlidge
57ebca8fcc CMake: Break some dependency cycles between compiler libraries.
- Remove cycle between swiftIRGen and swiftTBGen.
- Remove cycle between swiftSIL and swiftSerialization.
- Remove cycle between swiftFrontendTool and swiftIDE.
2022-10-26 15:13:26 -07:00
Anthony Latsis
18156d1177 Merge pull request #61347 from AnthonyLatsis/migrate-compiler-to-gh-issues
Gardening: Migrate compiler sources to GitHub issues
2022-09-30 10:48:52 +03:00
Anthony Latsis
2843e0c871 Gardening: Migrate compiler sources to GitHub issues 2022-09-29 23:58:55 +03:00
Alex Lorenz
c193a63fd4 [interop][SwiftToCxx] add -enable-experimental-cxx-interop-in-clang-header flag that lets you enable reverse interop only 2022-09-27 11:26:21 -07:00
Artem Chikin
aee45799b8 Invoke Explicit Interface Build when '-explicit-interface-module-build' is specified on a '-compile-module-from-interface' frontend action, using the CompilerInstance instantiated directly from the command-line in order to build the module. 2022-08-16 08:36:58 -07:00
Artem Chikin
7fd2a29fb7 Refactor 'ModuleInterfaceBuilder' to separate CompilerInstance setup logic from compilation logic (moved to ExplicitModuleInterfaceBuilder). 2022-08-16 08:36:55 -07:00
swift-ci
e6fb394cb5 Merge remote-tracking branch 'origin/main' into rebranch 2022-08-02 06:56:37 -07:00
Artem Chikin
6e7f3076b8 Add rudimentary emission of compile-time-known default-initialized property values of specific conformances. 2022-08-01 11:06:59 -07:00
swift-ci
b99996dbbd Merge remote-tracking branch 'origin/main' into rebranch 2022-07-21 13:37:34 -07:00
Artem Chikin
b1fee939f1 Add supplementary output path handling for extracted compile-time-known values 2022-07-19 16:24:26 -07:00
swift-ci
2487c19575 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-11 20:34:04 -07:00
Tony Allevato
4d16c43d21 Add -index-include-locals flag.
When this flag is passed, index store data emitted during a build
will also contain definitions/references for local symbols.
2022-07-11 14:08:07 -07:00
swift-ci
aab8da997e Merge remote-tracking branch 'origin/main' into rebranch 2022-06-29 16:34:49 -07:00
Allan Shortlidge
3308e4b38c NFC: Fix a few warnings emitted when building swift-frontend. 2022-06-29 12:09:42 -07:00
swift-ci
1ec185309f Merge remote-tracking branch 'origin/main' into rebranch 2022-06-24 00:14:42 -07:00
Erik Eckstein
ca291fb147 SIL: store IRGenOptions in SILModule
SIL optimization passes can use the IRGen options to do target specific optimizations.
2022-06-23 22:16:42 +02:00
swift-ci
7cb90dc351 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-10 15:33:41 -07:00
Arnold Schwaighofer
821ba47079 IRGen: Add a frontend option to force single LLVM module emission in multithreaded mode
This allows to experiment with single module LLVM emission without
having to change drivers that expect multiple output files.

rdar://94744623
2022-06-10 09:46:07 -07:00
swift-ci
3597ca75f0 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-09 02:52:39 -07:00
Alastair Houghton
a9fe9716da Merge pull request #59287 from al45tair/eng/PR-90776105-2
[Build][Runtime] Add a new threading library.
2022-06-09 02:41:53 -07:00
swift-ci
797e0acecf Merge remote-tracking branch 'origin/main' into rebranch 2022-06-07 11:13:30 -07:00