Commit Graph

900 Commits

Author SHA1 Message Date
swift-ci
9fd863f81e Merge remote-tracking branch 'origin/main' into rebranch 2024-10-08 10:50:24 -07:00
Steven Wu
b326c55d82 [CAS] Full support for make-style dependencies file caching hit
Fully support make-style `.d` dependencies file output by making
following improvements:
* All correct dependency file render when cache hit for a different
  output file location. The dependency file should list the correct
  output path, not the stale output path for the initial compilation
* When enable a path prefix mapper to canonicalize the path, the
  dependency file should render the input file correctly as the input
  file path on disk.

rdar://132250067
2024-09-30 15:53:18 -07:00
swift-ci
a0097bde91 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-21 11:14:00 -07:00
Saleem Abdulrasool
6443619126 Remove swift-indent tool
This removes the implementation of the `swift-indent` tool, its
associated documentation, and utilities. This tool was never completed
and has much better alternatives with `swift-format` which is more
flexible and actually maintained.
2024-09-19 11:21:59 -07:00
swift-ci
5039a2d86c Merge remote-tracking branch 'origin/main' into rebranch 2024-09-18 10:55:29 -07:00
Doug Gregor
49aa0e966f Ensure that SourceFiles always have a backing buffer in the SourceManager
The "buffer ID" in a SourceFile, which is used to find the source file's
contents in the SourceManager, has always been optional. However, the
effectively every SourceFile actually does have a buffer ID, and the
vast majority of accesses to this information dereference the optional
without checking.

Update the handful of call sites that provided `nullopt` as the buffer
ID to provide a proper buffer instead. These were mostly unit tests
and testing programs, with a few places that passed a never-empty
optional through to the SourceFile constructor.

Then, remove optionality from the representation and accessors. It is
now the case that every SourceFile has a buffer ID, simplying a bunch
of code.
2024-09-16 21:46:42 -07:00
swift-ci
f624072420 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-29 03:33:30 -07:00
Hamish Knight
1cb0f8fdd5 [AST] Rename isPrivateStdlibDecl -> isPrivateSystemDecl
This better reflects what we're actually checking
here.
2024-08-28 18:31:51 +01:00
swift-ci
0dc0132511 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-27 08:54:50 -07:00
Allan Shortlidge
b52241e381 Frontend: For whole module compiles, omit filelists from stack dumps.
For batch compile jobs, it's helpful to see which files are considered primary
and that was the original reason why filelist contents were printed in compiler
crash stack dumps. However, for whole module compile jobs, the contents of the
filelist is uninteresting (it's just all the files in the module) and can be
hundreds or thousands of lines long so it often causes important information to
be trimmed from stack dumps received in reproducers.
2024-08-26 16:42:23 -07:00
swift-ci
f3ac36bf77 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-12 23:13:53 -07:00
Allan Shortlidge
9062271185 SILGen: Skip SIL verification and optimization if errors were emitted.
In lazy typechecking mode, errors in the program may only be discovered during
SILGen, which can leave the SIL in a bad state for subsequent stages of
compilation. If errors were detected, skip SIL verification and optimization to
prevent knock-on failures.

Partially reverts https://github.com/swiftlang/swift/pull/75428, which included
a more targeted fix for one of the possible knock-on effects of bad SIL coming
out of SILGen.

Resolves rdar://132107752.
2024-08-12 15:34:59 -07:00
swift-ci
2bf8a521eb Merge remote-tracking branch 'origin/main' into rebranch 2024-08-07 09:53:42 -07:00
Ben Langmuir
1f00ffe42c Revert "[immediate] Load Foundation early enough for bridging" 2024-08-06 16:10:42 -07:00
swift-ci
ef054444fd Merge remote-tracking branch 'origin/main' into rebranch 2024-08-02 01:03:44 -07:00
Ben Langmuir
8a824d70a0 [immediate] Load Foundation early enough for bridging
Foundation needs to be loaded early in the process for Swift's runtime
to properly initialize bridging support; otherwise it may cause issues
like unrecognized selectors. When scripting, load Foundation early in
performFrontend before any swift code runs.

rdar://129528115
2024-08-01 15:02:13 -07:00
Ben Barham
2715d0e9d6 Merge branch 'main' into 20240710-main-to-rebranch
Conflicts:
  - `test/Interop/Cxx/class/method/methods-this-and-indirect-return-irgen-itanium.swift`
    previously fixed on rebranch, now fixed on main (slightly differently).
2024-07-10 20:42:09 -07:00
Shubham Sandeep Rastogi
d443fdd501 Merge pull request #74202 from rastogishubham/MCCASReplay
Add replay support for MCCAS in Swift.
2024-07-10 15:21:51 -07:00
Shubham Sandeep Rastogi
8dabf58993 Add support for MCCAS in replay logic for swift
This patch adds support for MCCAS when a cache hit is encountered when
trying to replay a compilation, and uses the MCCAS serialization code
to materialize the object file that is the main output of the
compilation.
2024-07-10 10:19:10 -07:00
Shubham Sandeep Rastogi
31baf4fb54 Store MCCAS ObjectRef as CASOutputBackend's main output.
This patch stores the MCCAS ObjectRef as the main output of the
CASOutputBackend when MCCAS is enabled.
2024-07-09 13:38:11 -07:00
swift-ci
4fb3c4e0d2 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-28 00:35:37 -07:00
Allan Shortlidge
470baff865 Driver: Remove swift-api-extract.
Now that API descriptions are emitted during module build jobs when
`-emit-api-descriptor-path` is specified and the build system has been updated
to pass that flag when the output is needed, the `swift-api-extract` frontend
alias is no longer used. Delete it and the tests that were specific to invoking
`swift-api-extract`.

Resolves rdar://116537394.
2024-06-27 17:05:32 -07:00
Ben Barham
b7954411ec Merge remote-tracking branch 'origin/main' into manually-merge-main-to-rebranch
Conflicts:
  - `include/swift/AST/PluginRegistry.h`
2024-06-27 14:56:11 -07:00
Steven Wu
5056e79942 Merge pull request #74128 from cachemeifyoucan/eng/PR-129015959
[Caching] Teach libSwiftScan to replay all diagnostics kinds
2024-06-26 11:27:56 -07:00
Xi Ge
736ccef626 Merge remote-tracking branch 'apple/main' into rebranch 2024-06-20 15:16:55 -07:00
Tim Kientzle
1098054291 Merge branch 'main' into tbkka-assertions2 2024-06-18 17:52:00 -07:00
Steven Wu
e239ee87b0 [NFC] Rewrite and restructure diagnostics handling in FrontendTool
Extract the logics for emitting diagnostics, especially the parseable
output message, from FrontendTools so it is easier to reason.
2024-06-17 13:31:54 -07:00
swift-ci
fe6c2897e8 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-14 09:14:03 -07:00
Artem Chikin
8a18179b29 [Parseable Output] Make Emit-Module tasks indicate their name accordingly, instead of 'compile' 2024-06-13 12:09:59 -07:00
Tim Kientzle
1d961ba22d Add #include "swift/Basic/Assertions.h" to a lot of source files
Although I don't plan to bring over new assertions wholesale
into the current qualification branch, it's entirely possible
that various minor changes in main will use the new assertions;
having this basic support in the release branch will simplify that.
(This is why I'm adding the includes as a separate pass from
rewriting the individual assertions)
2024-06-05 19:37:30 -07:00
Ben Barham
acd0efa67f Migrate to common OptTable macros
`OptTable` was a source of consistent churn due to new arguments to the
`OPTION` macro. LLVM 3f092f37b7362447cbb13f5502dae4bdd5762afd extracted
the handling of the common option parts (eg. an ID and an info) out into
separate macros to reduce this - use those here (since unsurprisingly,
more arguments were added).
2024-04-08 08:58:58 -07:00
Artem Chikin
a38071ec05 [Explicit Module Build] Do not serialize binary .swiftmodule dependencies when building explicit interface dependencies
The build-system (swift-driver) is then responsible for validating all inputs to each module and re-scheduling affected modules.
2024-03-21 15:48:11 -07:00
Steven Wu
782a421de2 [Caching] Do not serialize module deps when caching
There is no need to serialize module deps when caching is on because the
entire build command has already capture the entire dependency tree.
There is no need to encode the has for all dependencies and try to
validate them.

rdar://122914546
2024-03-19 13:35:52 -07:00
Kavon Farvardin
149c052ec5 use new noncopyable types infrastructure
The infrastructure underpinning the new feature NoncopyableGenerics is
mature enough to be used.
2024-03-14 23:10:44 -07:00
Becca Royal-Gordon
fd9ae4c8ac Merge pull request #72023 from beccadax/lazy-objc-workaround
Add workaround flag for lazy import-as-member
2024-03-05 16:12:32 -08:00
Becca Royal-Gordon
1a97803c8c Add flag for dumping ClangImporter lookup tables
ClangImporter’s SwiftLookupTables map Swift names to their corresponding Clang declarations. These tables are built into a module’s clang .pcm file and missing or inaccurate entries can cause name lookup to fail to find an imported declaration.

Swift has always included a helper function that would dump these tables, and swift-ide-test has a command-line switch that would invoke it, but these tools are clumsy to use in many debugging scenarios. Add a frontend flag that dumps the tables at the end of the frontend job, making it a lot easier to get at this information in the context of a specific compilation.
2024-02-29 17:51:00 -08:00
Erik Eckstein
3488cd364f SIL: remove instruction leaks checking
It's not thread safe and can cause false alarms in case multiple modules exist in different threads. E.g. when building swiftmodules from interfaces.
The leaking check is not important anymore because the builder APIs enforce that instructions are not leaking.
I.e. it's not possible to create an instruction without inserting it into a basic block. Also, it's not possible to remove an instruction from a block without deleting it.

rdar://122169263
2024-02-22 14:09:11 +01:00
Ben Barham
ef8825bfe6 Migrate llvm::Optional to std::optional
LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
2024-02-21 11:20:06 -08:00
Steven Wu
ebc90ffc0a [Caching] Use subInvocation to verify interface
The interface verification needs to read some command-line from the
interface file so it needs to be built inside sub-invocation.

rdar://122423965
2024-02-11 14:08:09 -08:00
Steven Wu
3986937e03 [Caching][NFC] Restructure CASOption in swift. NFC
Clean up how CASOptions are kept and passed inside swift to make the
code more readable. Also avoid a copy of CAS configuration in
ClangImporter.
2024-02-11 14:08:09 -08:00
Artem Chikin
55cc29f4cd [Explicit Module Build] Execute module interface verification in a sub-invocation context
Otherwise, with `-explicit-interface-module-build` they do not read out/inherit compiler flags written in the interface itself.

Resolves rdar://122418125
2024-02-07 08:46:25 -08:00
Steven Wu
b4e5e78bce [SupplementaryOutputs][NFC] Simplify boilerplate output checks.
Reduce some boilerplate code to check if supplementary outputs exist.
2024-02-01 13:43:40 -08:00
Artem Chikin
e04512f55c Merge pull request #71161 from artemcm/IncrementalExplicitHeaderFixes
[Explicit Module Builds] Register Clang module dependencies' input `.h` files with the dependency tracker
2024-01-26 13:24:37 -08:00
Artem Chikin
5fdb695d6d [Explicit Module Builds] Register Clang module dependencies' input .h files with the dependency tracker
Prior to emission of `.d` and `.swiftdeps` outputs. In implicit builds such dependencies are registered during the construction of the corresponding Clang module by the ClangImporter's built-in Compiler Instance. In explicit builds, since we load pre-built PCMs directly, we do not get to do so. So instead, manually register all `.h` inputs of Clang module dependnecies.

Resolves rdar://121354886
2024-01-25 15:41:19 -08:00
Kavon Farvardin
483b569bc8 [NCGenerics] trigger module mismatch
A swiftmodule can only be correctly ingested by a compiler
that has a matching state of using or not-using
NoncopyableGenerics.

The reason for this is fundamental: the absence of a Copyable
conformance in the swiftmodule indicates that a type is
noncopyable. Thus, if a compiler with NoncopyableGenerics
reads a swiftmodule that was not compiled with that feature,
it will think every type in that module is noncopyable.

Similarly, if a compiler with NoncopyableGenerics produces a
swiftmodule, there will be Copyable requirements on each
generic parameter that the compiler without the feature will
become confused about.

The solution here is to trigger a module mismatch, so that
the compiler re-generates the swiftmodule file using the
swiftinterface, which has been kept compatible with the compiler
regardless of whether the feature is enabled.
2024-01-23 22:42:37 -08:00
Rintaro Ishizaki
a61ed80813 [Macros] Track macro dependency separately in module trace
Macro plugins are not normal Swift modules, track them differently.
Add "swiftmacros" field to the JSON file.

rdar://118013482
2024-01-19 12:56:02 -08:00
Zoe Carver
f7f5070454 Merge pull request #70734 from zoecarver/cross-module-everything 2024-01-06 10:28:11 -05:00
Rintaro Ishizaki
f7e35cb835 [AST] Requestify local type declarations
Instead of recording local type declarations while parsing, make a
request to collect them from the AST. This reduces the side effect of
parsing.
2024-01-05 13:26:55 -08:00
zoecarver
64fa0a35db [opt] Add new -enable-cmo-everything flag to enable serializing all sil, match serialization behavior of Embedded Swift. 2024-01-05 13:06:20 -05:00
Stefan Gränitz
ec8cbd4cf9 [Frontend] In performFrontend() drop self-assignment of IRGenOpts.DWARFVersion (NFC) 2023-12-01 16:48:18 +01:00