Commit Graph

945 Commits

Author SHA1 Message Date
Doug Gregor
c4527dc47d Merge pull request #84580 from DougGregor/static-build-configure 2025-09-30 20:47:04 -07:00
Doug Gregor
ae8f9d8234 Add -print-static-build-config to print a static build conformance
Introduce the ability to form a `StaticBuildConfiguration` from
language options. Add a frontend option `-print-static-build-config`
to then print that static build configuration as JSON in a manner that
can be decoded into a `StaticBuildConfiguration`.

Most of the change here is in sinking the bridged ASTContext queries
of language options into a new BridgedLangOptions. The printing of the
static build configuration only has a LangOptions (not an ASTContext),
so this refactoring is required for printing.
2025-09-29 18:42:14 -07:00
Erik Eckstein
a322fd9209 Serialization: remove the IS_OSSA flag from the module file header 2025-09-26 08:01:08 +02:00
Erik Eckstein
2f124cf564 Remove the -enable-ossa-modules option.
OSSA modules are enabled by default.
The compiler still accepts this option but it has no effect.
2025-09-26 08:01:08 +02:00
Anthony Latsis
ea5d89d0d0 tools: Set Swift bug report message in some executable targets
If these programs crash, we want them to print the Swift bug report
message, not the default LLVM one, which leads to
https://github.com/llvm/llvm-project/issues.

While here, hoist the setting of the bug report message to the
START_PROGRAM macro so that we don't forget to set it in the future.
2025-09-19 12:05:31 +01:00
Richard Howell
0b829bfab1 Add error messages for Swift module map parser
Parser errors with large Swift module map files can be hard to diagnose.
Refactor the parser to return an llvm::Error so clearer diagnostics can
be passed to the user.
2025-09-05 13:53:26 -07:00
Steven Wu
b18e865b0a [Caching] Fix typecheck swiftinterface with prefix map
SwiftVerifyEmittedModuleInterface job is configured to be built within
the SubInvocation and it needs to inherit the caching replay prefix map
in order to load macro plugin library correctly.

rdar://158692095
2025-08-19 10:28:20 -07:00
Allan Shortlidge
5d3d93478a Frontend: Inherit compiler debugging options during module interface actions.
When building a module interface for the -typecheck-module-from-interface or
-compile-module-from-interface actions, inherit and honor compiler debugging
options and emit debugging output at the end of the interface build.
2025-08-12 15:48:42 -07:00
Allan Shortlidge
901e8becb2 Frontend: Make getPrimaryOrMainSourceFile() a utility on CompilerInstance. 2025-08-12 10:18:33 -07:00
Allan Shortlidge
512cf21148 Frontend: Make -dump-availability-scopes an option instead of a mode.
Allowing it to be specified in conjunction with any frontend mode makes it a
more flexible debugging tool.
2025-08-12 10:18:33 -07:00
Alex Hoppen
2d2adfb017 Merge pull request #82947 from ahoppen/compress-index
[Index] Add an option to compress the record and unit files
2025-08-07 21:12:39 +02:00
Anthony Latsis
fec049e5e4 Address llvm::PointerUnion::{is,get} deprecations
These were deprecated in
https://github.com/llvm/llvm-project/pull/122623.
2025-07-29 18:37:48 +01:00
Steven Wu
a24c34252f [SwiftCaching] Create standalone reproducer from swift caching build
Add a new option `-gen-reproducer` that when swift caching is used,
create a standalone reproducer that can be used to reproduce the
`swift-frontend` invocation.
2025-07-21 14:16:48 -07:00
Alex Hoppen
ed3b64af2c [Index] Add an option to compress the record and unit files
Companion of https://github.com/swiftlang/llvm-project/pull/10977.
2025-07-10 15:23:51 +02:00
Arnold Schwaighofer
b30bd40b83 Add code to create llvm::RemarkStreamer objects for all the LLVMModules in WMO mode
rdar://154403078
2025-07-01 07:19:33 -07:00
Pavel Yaskevich
18703d64d6 [Frontend] Rework -emit-supported-features mode into -emit-supported-arguments
The "featues" part was never actually implemented and Swift Driver
is replying on information about arguments, so instead of removing
this mode, let's scope it down to "arguments" to be deprecated in
the future.
2025-04-17 12:33:23 -07:00
Pavel Yaskevich
55bd906906 [Frontend] Add -print-supported-features option
This is a replacement for `-emit-supported-features` that prints
all of the upcoming/experimental features supported by the compiler
with some additional meta information in JSON format to stdout.
2025-04-16 16:34:47 -07:00
Saleem Abdulrasool
a5e6a7f6d9 Merge pull request #78793 from hjyamauchi/emit-reference-dependencies
An attempt to reduce file accesses during the .swiftdeps file generat…
2025-03-29 17:53:55 -07:00
Steven Wu
4115be5e18 [FrontendTool] Use a null diagconsumer for verify instance
Use a null diagnostic consumer in the deterministic verify instance. The
constraint system will skip work if there are no consumer in the
diagnostic engine. Use a null consumer to make sure the same amount of
work is done for two runs.
2025-03-21 13:11:14 -07:00
Tony Allevato
7c258f2057 Merge pull request #79485 from allevato/index-swiftinterface
[Frontend] Support `-index-store-path` for explicit module interface compilation.
2025-02-21 12:55:49 -08:00
Tony Allevato
5fd985256c [Frontend] Support -index-store-path for explicit module interface compilation. 2025-02-19 12:42:48 -05:00
Saleem Abdulrasool
6dc18c0854 Merge pull request #79334 from compnerd/configuration
FrontendTool: print the compiler configuration
2025-02-13 16:20:40 -08:00
Saleem Abdulrasool
2ba2d1bceb FrontendTool: print the compiler configuration
This adds the compiler configuration to the output similar to clang.
This will allow us to identify the compiler build type, e.g.

```
Swift version 6.2-dev (LLVM 47665e034aa6f27, Swift 2b3e5dac59b8632)
Target: x86_64-unknown-windows-msvc
Build config: +unoptimized,+assertions,+expensive-checks,+asan,+hwasan,+msan,+ubsan
```
2025-02-12 14:06:58 -08:00
Rintaro Ishizaki
71b24665fa [ASTDumper] Dump DeclContext
* Include `DeclContext` of the node where possible
* Add 'default-with-decl-contexts' dump style that dumps the dect context
  hierarchy in addition to the AST
* Support `-dump-parse` with `-dump-ast-format json`
2025-02-12 10:53:33 -08:00
Allan Shortlidge
d00e102fd1 Frontend: Remove the -skip-import-in-public-interface flag.
This flag is unsafe since the compiler does not verify that the resulting
public interface will compile with the module import removed. The modern
alternative to this flag is `@_spiOnly import`. Since the flag is no longer
used by any projects it should be removed.

Resolves rdar://134351088.
2025-02-09 18:52:10 -08:00
Tony Allevato
c5f0200680 Merge pull request #79059 from allevato/json-ast-followups
[ASTDumper] Some followups from the initial JSON PR and macro dumping improvements.
2025-02-04 01:13:46 -05:00
Tony Allevato
0d9467e688 Hoist ASTDumpMemberLoading choice up to the frontend call sites. 2025-02-03 11:37:47 -05:00
Meghana Gupta
6f9167c29e Serialize after high level passes for -emit-sib 2025-01-30 17:10:04 -08:00
Tony Allevato
3804110db8 Change parseIfNeeded to an enum to control member loading behavior. 2025-01-30 09:10:15 -05:00
Artem Chikin
41e471288a [Dependency Scanning] Deprecate/Remove batch scanning capability
Batch dependency scanning was added as a mechanism to support multiple compilation contexts within a single module dependency graph.
The Swift compiler and the Explicitly-built modules model has long since abandoned this approach and this code has long been stale. It is time to remove it and its associated C API.
2025-01-28 15:30:39 -08:00
Hiroshi Yamauchi
30d298a70c An attempt to reduce file accesses during the .swiftdeps file generation. 2025-01-22 13:57:47 -08:00
Tony Allevato
a57fb4dfa9 [AST] Add minimal JSON support to ASTDumper.
This only takes the existing AST information and writes it as JSON
instead of S-expressions. Since many of these fields are stringified,
they're not ideal for the kind of analysis clients of the JSON format
would want to do. A future commit will update these values to use a
more structured representation.
2025-01-22 14:26:13 -05:00
Steven Wu
627c64f391 [Caching][NFC] Unify the two cache replay code path
There were two cache replay code exists, one for cache replay from
swift-frontend, the other for replay using C API from libSwiftScan. It
is easy to forget to update one copy when new specialized cache replay
logic is added for some output kinds. Now unify the replay logics to a
single location to avoid confusion. This is a rewrite of the existing
logic and NFCI.
2024-12-19 14:10:46 -08:00
Xi Ge
c868515fae FineModuleTracing: only collect fine-grained tracing for those source files that compiler promises to type check.
rdar://141065994
2024-12-10 16:56:16 -08:00
Xi Ge
4a5d041932 FineModuleTrace: reposition the currently ObjC message specific trace files to be a more general purposed file for tracing fine-grained dependencies. NFC 2024-11-20 12:41:21 -08:00
Allan Shortlidge
239720897a AST: Rename TypeRefinementContext to AvailabilityScope. 2024-11-12 11:34:25 -08:00
Michael Gottesman
4763251427 [sil] Add the ability for the frontend to dump LoweredSIL before IRGen.
This is something that I have wanted to add for a while and have never had the
need to. I need it now to fix a bug in the bots where I am forced to use IRGen
output to test ThunkLowering which causes platform level differences to show up
in the FileCheck output. With this, I can just emit the actual lowered SIL
output and just test it at that level. There are other cases like this where we
are unable to test lowered SIL so we use IRGen creating this brittleness.
Hopefully this stops this problem from showing up in the future.

rdar://138845396
2024-11-01 03:16:55 -07:00
Ben Barham
f59b2f19e6 Merge branch 'main' into 2024-rebranch-to-main 2024-10-28 13:03:35 -07:00
Xi Ge
7bf010777e Frontend: when emitting loaded module trace file, also emit a JSON file tracking Objc method calls issued from the source code. 2024-10-24 17:19:21 -07:00
swift-ci
138625f758 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-18 10:41:34 -07:00
Tony Allevato
bd4cfee965 Merge pull request #76872 from allevato/swift-synthesize-interface-tool
Add a new driver tool/mode to print the synthesized Swift interface for a module.
2024-10-18 13:26:22 -04:00
Tony Allevato
2cfcdd8ed1 Add a new driver tool/mode to print the synthesized Swift interface for a module.
This mode is similar to `swift-symbolgraph-extract`; it takes a subset of compiler
flags to configure the invocation for module loading, as well as a module name
whose contents should be extracted. It does not take any other input files. The
output is a single text file specified by `-o` (or `stdout` if not specified).

While the most common use case for this would be viewing the synthesized Swift
interface for a Clang module, since the implementation simply calls
`swift::ide::printModuleInterface` under the hood, it's usable for any module
that Swift can import. Thus, it could also be used to view a synthesized textual
representation of, say, a compiled `.swiftmodule`.

One could imagine that in the future, we might add more flags to
`swift-synthesize-interface` to modify various `PrintOptions` used when
generating the output, if we think those would be useful.
2024-10-10 15:30:41 -04:00
swift-ci
ec2edb72f0 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-09 14:44:21 -07:00
Tony Allevato
a3961c826d Merge pull request #76933 from allevato/unique-ptr-hardening
[Frontend] Fix a small `unique_ptr` array access.
2024-10-09 17:32:42 -04:00
Tony Allevato
bdf40184ab [Frontend] Fix a small unique_ptr array access.
When the size of the array accessed here is zero, retrieving the
address of the zero-th element here is undefined. When the frontend
is linked against a libc++ that has the `unique_ptr` hardening in
[this commit](18df9d23ea)
enabled, it traps here.

Instead, simply call `.get()` to retrieve the address of the
array, which works even when it is a zero-byte allocation.
2024-10-09 13:54:43 -04:00
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