Commit Graph

1931 Commits

Author SHA1 Message Date
Steven Wu
109566fb81 [Caching] Switch clang-include-tree to be default for clang modules
Switch to use clang-include-tree by default for clang module
building/caching when using a CAS. This is the default mode for clang
module and has less issues than CAS file system based implementation.
2023-11-10 11:43:32 -08:00
Ellie Shin
e5ca8e5c0b Allow loading package interface if in same package.
Add a new flag to enable package interface loading.
Use the last value of package-name in case of dupes.
Rename PrintInterfaceContentMode as InterfaceMode.
Update diagnostics.
Test package interface loading with various scenarios.
Test duplicate package-name.
2023-11-09 18:44:06 -08:00
Ellie Shin
aba3b6c24e Introduce a package interface.
It has an extension .package.swiftinterface and contains package decls
as well as SPIs and public/inlinable decls. When a module is loaded
from interface, it now looks up the package-name in the interface
and checks if the importer is in the same package. If so, it uses
that package interface found to load the module. If not, uses the existing
logic to load modules.

Resolves rdar://104617854
2023-11-08 14:56:20 -08:00
Kuba Mracek
2936a33680 [embedded] Wrap SwiftCompilerSources initialization state into swiftModulesInitialized API 2023-11-07 10:00:53 -08:00
Kuba Mracek
f0dd174df3 [embedded] Require SwiftCompilerSources to use embedded Swift 2023-11-07 10:00:53 -08:00
Max Ovtsin
b0105e112d Introduce -application-extension-library (#63769)
The current implementation of `-application-extension` has a problem that affects the generation of ObjC headers for regular Swift modules.

The primary purpose of `-application-extension` is to prevent the use of unavailable APIs in app extensions. However, it has an impact on the generation of -Swift.h headers and exposes Swift's internal declarations to ObjC. This behavior is appropriate for mixed modules that are not consumed externally, such as app extensions, but it fails to address the situation when a module is not an extension itself but is consumed by the extension (c90cd11).

To resolve this issue while maintaining the desired behavior, we can introduce a new flag for this particular use-case.
2023-11-03 08:24:19 -07:00
Richard Howell
3d8e4b9102 Merge pull request #68847 from rmaz/filecompdirpassthrough
Pass through file-compilation-dir to the ClangImporter.
2023-10-30 07:12:02 -07:00
Doug Gregor
40e07cf900 [Typed throws] IR generation and runtime support for function type metadata
Extend function type metadata with an entry for the thrown error type,
so that thrown error types are represented at runtime as well. Note
that this required the introduction of "extended" function type
flags into function type metadata, because we would have used the last
bit. Do so, and define one extended flag bit as representing typed
throws.

Add `swift_getExtendedFunctionTypeMetadata` to the runtime to build
function types that have the extended flags and a thrown error type.
Teach IR generation to call this function to form the metadata, when
appropriate.

Introduce all of the runtime mangling/demangling support needed for
thrown error types.
2023-10-29 09:12:32 -07:00
Adrian Prantl
5d978b44ca Revert "Revert "Make the DWARF version emitted by the Swift compiler configurable."" 2023-10-26 12:29:18 -07:00
Richard Howell
198d2ff2ca Pass through file-compilation-dir to the ClangImporter.
This change passes through the -file-compilation-dir flag to the
ClangImporter instance as -ffile-compilation-dir. When used in
conjunction with https://github.com/llvm/llvm-project/pull/67744
this will allow for setting the compilation directory of pcm
files using the -file-compilation-dir flag.
2023-10-26 08:38:22 -07:00
Adrian Prantl
2a32ca5944 Revert "Make the DWARF version emitted by the Swift compiler configurable." 2023-10-25 13:28:28 -07:00
Adrian Prantl
a26bbb0baf Make the DWARF version emitted by the Swift compiler configurable.
Previously it was hardcoded to version 4 on all platforms.
This patch introduces a driver and frontend option -dwarf-version to configure it if needed.
2023-10-24 12:30:16 -07:00
Evan Wilde
312bd47f4c Merge remote-tracking branch 'main' into 'rebranch' 2023-10-16 23:00:12 -07:00
Steven Wu
278eba5d26 Merge pull request #68946 from cachemeifyoucan/eng/PR-cache-key-rework
[Caching] Change swift cache key computation
2023-10-16 10:03:12 -07:00
Steven Wu
6c3097657a [Caching] Change swift cache key computation
Update swift cache key computation mechanism from one cache key per
output, to one cache key per primary input file (for all outputs that
associated with that input).

The new schema allows fewer cache lookups while still preserving most of
the flexibility for batch mode and incremental mode.
2023-10-13 09:15:22 -07:00
swift-ci
d967b1878a Merge remote-tracking branch 'origin/main' into rebranch 2023-10-10 20:08:25 -07:00
Allan Shortlidge
f131c8a3f5 Frontend: Introduce -experimental-skip-non-exportable-decls.
Rename -experimental-serialize-external-decls only to
-experimental-skip-non-exportable-decls in preparation for the flag being used
to influence more than just serialization.

Resolves rdar://116771543
2023-10-10 16:07:04 -07:00
swift-ci
d253b717d2 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-07 19:35:15 -07:00
Kuba (Brecka) Mracek
c59c79318b Merge pull request #68928 from kubamracek/embedded-concurrency
[embedded] Initial Swift Concurrency for embedded Swift
2023-10-07 19:33:54 -07:00
swift-ci
745d48ad03 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-07 09:34:00 -07:00
Arnold Schwaighofer
e4fbde8063 Merge pull request #68996 from aschwaighofer/objective_c_protocol_symbolic_ref
Add support for objective c protocol symbolic references
2023-10-07 09:18:33 -07:00
Kuba Mracek
5d8c55eacb [embedded] Initial Swift Concurrency for embedded Swift 2023-10-06 20:04:03 -07:00
swift-ci
f07b1aefb2 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-06 09:16:41 -07:00
Artem Chikin
bde05b3eeb Merge pull request #69000 from artemcm/FineGrainedAutolinkControls
Fine-grained autolinking control
2023-10-06 09:13:37 -07:00
Arnold Schwaighofer
894095a5f2 Add a flag to enable/disable usage of objective c protocol symbolic references 2023-10-06 08:43:00 -07:00
Artem Chikin
57e4f244d1 Fine-grained autolinking control
This change adds the following options to allow for greater control over the compiler's autolinking directive use:
- '-disable-autolink-library': equivalent to an existing '-disable-autolink-framework', this option takes a library name as input and ensures the compiler does not produce an autolink directive '-l<library-name>'.
- '-disable-autolink-frameworks': a boolean disable flag which turns off insertion of autolinking directives for all imported frameworks (of the type '-framework <framework-name>')
- '-disable-all-autolinking': a boolean disable flag which turns off insertion of *any* autolinking directives.

Resolves rdar://100859983
2023-10-05 15:12:48 -07:00
Evan Wilde
0453158f8e Merge remote-tracking branch 'main' into rebranch
Conflict in CAS options when
`std::vector<std::string> CacheReplayPrefixMap;` was added.

Conflicts:
  include/swift/Frontend/FrontendOptions.h

Resolution: Take both
2023-10-04 14:28:43 -07:00
Steven Wu
c8bc08107c Merge pull request #68684 from cachemeifyoucan/eng/PR-path-remapping
[CompilerCaching] Path Remapping for canonicalization
2023-10-04 12:57:27 -07:00
swift-ci
75ce2f5734 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-03 07:13:54 -07:00
Kuba (Brecka) Mracek
0d2f98a368 Merge pull request #68912 from kubamracek/embedded-closures-heap
[embedded] Support closures with captures and promoting locals to refcounted heap objects
2023-10-03 07:00:46 -07:00
swift-ci
8b0b25f404 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-02 13:33:12 -07:00
Artem Chikin
08533c94ec Always disable requiring Foundation for '@objc' when building/typechecking interfaces 2023-10-02 10:42:00 -07:00
Kuba Mracek
c6d0e4f76f [embedded] Support closures with captures and promoting locals to refcounted heap objects 2023-10-02 09:45:45 -07:00
swift-ci
2e9555437f Merge remote-tracking branch 'origin/main' into rebranch 2023-09-29 20:19:54 -07:00
Alexis Laferrière
e820854784 Merge pull request #68831 from xymus/report-superfluously-public-imports
Sema: warn on imports that are too public and remark source of entities in API
2023-09-29 20:15:56 -07:00
Alexis Laferrière
c15a576a1c [Sema] Introduce remarks about the source of each decl in API
Using `-Rmodule-api-import` the compiler prints a remark about the
import bringing in every decl used in public function signatures or
inlinable code. It also remarks on the source of conformances where they
are used and the source of typealias underlying types.
2023-09-28 13:00:04 -07:00
swift-ci
2e6b1cd2f7 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-28 07:13:53 -07:00
Kuba Mracek
8b1aca9ff5 [embedded] Only run the late DeadFunctionElimination if embedded mode is on 2023-09-26 22:55:53 -07:00
Steven Wu
7b89afbb6e [DepScan] Teach dependency scanner to remap path for canonicalization
Allow DependencyScanner to canonicalize path using a prefix map. When
option `-scanner-prefix-map` option is used, dependency scanner will
remap all the input paths in following:
* all the paths in the CAS file system or clang include tree
* all the paths related to input on the command-line returned by scanner

This allows all the input paths to be canonicalized so cache key can be
computed reguardless of the exact on disk path.

The sourceFile field is not remapped so build system can track the exact
file as on the local file system.
2023-09-26 12:36:43 -07:00
swift-ci
5ff7257ec3 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-25 22:10:35 -07:00
swift-ci
f14b426802 Merge pull request #68568 from apple/embedded-wmo-via-primaryfiles
[embedded] Detect WMO via .hasPrimaryInputs() instead of -wmo flag presence
2023-09-25 21:55:07 -07:00
swift-ci
daeae9870d Merge remote-tracking branch 'origin/main' into rebranch 2023-09-25 21:51:57 -07:00
Kuba Mracek
d2f8530391 [embedded] Detect WMO via .hasPrimaryInputs() instead of -wmo flag presense 2023-09-25 17:22:10 -07:00
Allan Shortlidge
50fdfbf7b4 Sema: Support multiple -debug-forbid-typecheck-prefix arguments.
An existing test (Frontend/skip-function-bodies.swift) was designed under the
assumption that multiple `-debug-forbid-typecheck-prefix` arguments were
already supported, and as a result the test was not actually asserting what it
was written to assert.
2023-09-25 16:43:11 -07:00
swift-ci
fc3a226c60 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-24 16:13:49 -07:00
Kuba (Brecka) Mracek
f88c919636 Merge pull request #68727 from kubamracek/embedded-serialize-everything2
[embedded] Make CMO's 'serialize everything' mode even more aggressive and allow serialization of private and shared functions
2023-09-24 15:57:17 -07:00
swift-ci
72e3d66404 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-23 15:35:20 -07:00
Kuba Mracek
770dcd1614 [embedded] Make CMO's 'serialize everything' mode even more aggressive and allow serialization of private and shared functions 2023-09-23 13:38:41 -07:00
swift-ci
a1910384fb Merge remote-tracking branch 'origin/main' into rebranch 2023-09-23 13:38:10 -07:00
eeckstein
2a039b412c Revert "[embedded] Make CMO's 'serialize everything' mode even more aggressive and allow serialization of private and shared functions" 2023-09-23 19:13:04 +02:00