Commit Graph

1186 Commits

Author SHA1 Message Date
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
df86e089c8 Merge pull request #80172 from cachemeifyoucan/eng/PR-147513165
Fix `.swiftdeps` file deterministic issues
2025-03-24 15:15:17 -07:00
Jan Svoboda
0aeba05790 [Frontend] Use new LockFileManager APIs (#80123) 2025-03-24 10:14:24 -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
Xi Ge
eb6933bbed Merge pull request #78337 from nkcsgexi/141850408
FineModuleTracing/CAS: move the computation of whether fine module trace will be emitted to an early stage.
2025-01-02 09:26:45 -08:00
Doug Gregor
d593442cc4 Add module trace information for strict memory safety
Extend the module trace format with a field indicating whether a given
module, or any module it depends on, was compiled with strict memory
safety enabled. This separate output from the compiler can be used as
part of an audit to determine what parts of Swift programs are built
with strict memory safety checking enabled.
2024-12-24 12:27:35 -08:00
Xi Ge
049f381807 FineModuleTracing: being blocklisted in collecting fine trace shouldn't change that the promised file is being emitted 2024-12-20 21:33:24 -08:00
Xi Ge
c8fa52b96d FineModuleTracing/CAS: move the computation of whether fine module trace will be emitted to an early stage.
CAS needs to determine if an output is needed very early (when computing supplementary outputs) in the pipeline so we can do caching and replays.

Resolves: rdar://141850408
2024-12-20 19:09:35 -08: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
c965343f54 Frontend: add a flag to disable fine-grained module tracing 2024-12-13 16:07:15 -08:00
Xi Ge
7f3c9cbeb1 FineModuleTrace: add a blocklist action for skipping fine module tracing 2024-12-13 13:49:38 -08:00
Xi Ge
3f69aed0f8 FineModuleTracing: use requested action type to further gate whether emitting fine-grained module trace is supported.
Emitting fine-grained module tracing files during full compilation should be sufficient for the use case in design. Other
swift-frontend invocations, such as emitting modules, doesn't need fully type-checked AST to perform the action, therefore
requesting/walking the fully typechecked AST to emit those tracing files may introduce performance overhead.
2024-12-10 22:10:25 -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
5deb21d4fe FineModuleTrace: avoid emitting trace file when lazy type checking is enabled.
When lazy type checking is enabled, the generated AST to walk on may contain function bodies that
are not fully type-checked. Walking on these function bodies could expose latent bugs.

Resolves rdar://140818215
2024-12-07 22:13:10 -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
Xi Ge
51a68ecdd1 ModuleObjCTrace/CAS: compute objc trace file paths via the canoical supplementary output paths computation
CAS support in compiler relies on supplementary paths to decide the mapping between input and output files. Therefore, we
have to compute the paths of the module ObjC trace files in this canonical place to have CAS support for
this newly added ObjC message trace files.
2024-11-20 08:52:15 -08:00
Xi Ge
fc1dac7e77 ObjCMessageTracing: append trace file content atomically to a canonical file location provided by the build environment
To simplify post-processing of these collected ObjC message traces, this PR teaches the compiler to atomically append the content of
ObjC message trace to a file location provided by the build environment, instead of emitting multiple files.
2024-11-19 11:57:29 -08:00
Allan Shortlidge
239720897a AST: Rename TypeRefinementContext to AvailabilityScope. 2024-11-12 11:34:25 -08:00
Akira Hatanaka
555c00a731 ModuleTrace: use clang API to emit information in JSON (#77422) 2024-11-07 15:31:55 -08:00
Xi Ge
1116e2882b ModuleTrace: check source file category using SourceFileKind instead of their file extensions. NFC 2024-11-05 08:55:12 -08:00
Xi Ge
94d1333072 ModuleObjCTrace: walk only Swift source files to collect used ObjC method invocations 2024-11-04 18:56:12 -08:00
Xi Ge
3cb5fbd411 ModuleObjCTrace: allow configuring the directory path to where the objc message trace file will be emitted to via an environment variable 2024-11-04 12:51:35 -08:00
Xi Ge
4937282848 Merge pull request #77337 from swiftlang/multi-file-objc-message
ModuleObjcMessageTrace: report ObjC method calls from all source files under compilation
2024-11-02 04:43:24 -07:00
Xi Ge
6e42dfb470 ModuleObjcMessageTrace: also include a field for the current compiler version 2024-11-01 21:35:14 -07: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
Xi Ge
95f2523ef3 ModuleObjcMessageTrace: report ObjC method calls from all source files under compilation 2024-10-31 14:52:09 -07:00
Xi Ge
8d0815e16f ModuleObjcMessageTrace: also report method calls from protocol types 2024-10-30 17:24:10 -07:00
Xi Ge
0d16cbf5d5 Merge pull request #77253 from nkcsgexi/138776708
ModuleObjcMessageTrace: also include the source file name where an ObjcMethod is referenced
2024-10-30 13:47:59 -07:00
Xi Ge
3fc9e273f3 ModuleObjcMessageTrace: use a more generalized directory name. NFC 2024-10-29 13:42:31 -07:00
Xi Ge
58e40166fb ModuleObjcMessageTrace: consolidate all source code file paths to a side table 2024-10-28 18:19:46 -07:00
Xi Ge
84ba789707 ModuleObjcMessageTrace: include target and target variant info and a format version number 2024-10-28 16:52:28 -07:00
Xi Ge
1b025bacc5 ModuleObjcMessageTrace: specify whether the owning context is an interface or category 2024-10-28 16:16:02 -07:00
Xi Ge
b1fa3e65b5 ModuleObjcMessageTrace: indicate whether a method is instance method or class method 2024-10-28 15:58:57 -07:00
Ben Barham
f59b2f19e6 Merge branch 'main' into 2024-rebranch-to-main 2024-10-28 13:03:35 -07:00
Xi Ge
7b32de27c6 ModuleObjcMessageTrace: also include the source file name where an ObjcMethod is referenced. rdar://138776708 2024-10-28 10:47:16 -07:00