1177 Commits

Author SHA1 Message Date
Felipe de Azevedo Piovezan
0cff9c7b95 [IRGenDebugInfo] Replace llvm.dbg.coroframe_entry with dbg.declare_value
We had introduced coroframe_entry downstream while the upstream proposal
was discussed. It has since been merged upstream, so this commit changes
the code to use the upstream intrisic, avoiding a binary incompatibility
in the IR w.r.t. upstream.
2025-12-02 17:09:17 +00:00
Adrian Prantl
45547be3f8 [Debug Info] Represent type alias existantials in debug info
Previously debug info made not difference between an existential type and a
protocol type. This caused us to loose typealiases such as

typealias Alias = ProtocolType

in the debug info.

rdar://161134092
2025-11-21 15:17:47 -08:00
Anthony Latsis
dd5ac838e5 AST: Properly disallow isa/cast/dyn_cast on Type
We currently disallow these by deleting them in the `swift` namespace.
This approach has several loopholes, all of which ultimately work
because we happen to define specializations of `simplify_type` for
`swift::Type`:
* `llvm::isa/cast/dyn_cast`. The deleted partial specializations will
  not be selected because they are not defined in the `llvm` namespace.
* The argument is a non-const `Type`. The deleted function templates
  will not be selected because they all accept a `const Type &`, and
  there is a better `Y &Val` partial specialization in LLVM.
* Other casting function templates such as `isa_and_nonull` and
  `cast_if_present` are not deleted.

Eliminate these loopholes by instead triggering a static assertion
failure with a helpful message upon instantiation of `CastInfo` for
`swift::Type`.
2025-11-14 19:02:41 +00:00
Slava Pestov
819738c83e AST: Rename mapTypeIntoContext() => mapTypeIntoEnvironment(), mapTypeOutOfContext() => mapTypeOutOfEnvironment() 2025-11-12 14:48:19 -05:00
Steven Wu
4e0484201d Merge pull request #83621 from cachemeifyoucan/eng/PR-gmodule-with-cas-id-update
Update swift compiler after clang gmodule CAS build update
2025-11-07 10:03:44 -08:00
Slava Pestov
46b41a3ae4 Merge pull request #85288 from slavapestov/narrow-cxx-roundtrip-carveout
IRGen: Only skip round-trip demangler check for types that involve C++ types
2025-11-03 20:17:10 -05:00
Slava Pestov
d4869193c8 IRGen: Only skip round-trip demangler check for types that involve C++ types
Previously this was disabled entirely if C++ interop was
enabled, which is too broad.
2025-11-03 13:59:06 -05:00
Steven Wu
ee09790748 Update swift compiler after clang gmodule CAS build update
Fix swift compiler build and test to work with new clang gmodule build
with CAS, which encodes references to clang PCMs as CASIDs.
2025-10-28 11:35:44 -07:00
Adrian Prantl
cb4efa0839 Add a -debug-module-path frontend option
This new option allows the Driver to pass the path to a compilation
job's own binary swiftmodule artifact to the frontend. The compiler
then stores this path in the debug info, to allow clients like LLDB to
unambiguously know which binary Swift module belongs to which compile
unit.

rdar://163302154
2025-10-23 17:10:50 -07:00
Michael Gottesman
2fa3908e94 [concurrency] Add a new type Builtin.ImplicitActor.
This is currently not wired up to anything. I am going to wire it up in
subsequent commits.

The reason why we are introducing this new Builtin type is to represent that we
are going to start stealing bits from the protocol witness table pointer of the
Optional<any Actor> that this type is bitwise compatible with. The type will
ensure that this value is only used in places where we know that it will be
properly masked out giving us certainty that this value will not be used in any
manner without it first being bit cleared and transformed back to Optional<any
Actor>.
2025-10-16 10:51:13 -07:00
Slava Pestov
b720735879 IRGen: Don't ask for stored properties of resilient types in debug info emission 2025-10-15 13:44:42 -04:00
Tim Kientzle
41f680cb93 Merge pull request #84826 from tbkka/tbkka-revert-revert-floatingpointdescription
Re-land new Floating-poing `debugDescription`
2025-10-12 20:19:12 -07:00
Tim Kientzle
4c0b58096e Make _InlineArray subject to the same optimizations as InlineArray 2025-10-10 14:06:14 -07:00
Adrian Prantl
b8f2d33ded [DebugInfo] Use the human-readable name as name of FwdDecls of unused structs
rdar://162080220
2025-10-06 17:54:57 -07:00
Adrian Prantl
305f0edb20 [DebugInfo] Properly nest types declared in extensions in the debug info
rdar://161923580
2025-10-03 16:12:24 -07:00
Hamish Knight
954b08cae5 [AST] Remove UnresolvedType
We have now removed all uses of this type.
2025-10-03 09:50:42 +01:00
swift-ci
0d2c4ca9be Merge remote-tracking branch 'origin/main' into rebranch 2025-09-15 10:29:21 -07:00
Meghana Gupta
9fe489ce22 Introduce borrow and mutate as new accessor kinds
And handle them in various covered switches
2025-09-09 14:30:26 -07:00
Shubham Sandeep Rastogi
3eb40fc19c Emit llvm.dbg.coroframe_entry instead of llvm.dbg.declare for async code.
For swift async debug info, we create llvm.dbg.declare that contain
locations which may not be a pointer or int. This is fine, because the
CoroSplitter pass fixes up those llvm.dbg.declares later.

However, with a recent change to the LLVM Verifier, there is a check
that asserts if there is a llvm.dbg.declare with a location other than
a pointer or an int.

To workaround the problem, we created a new llvm.dbg.coroframe_entry
intrinsic that doesn't have the same restriction as llvm.dbg.declare.

This patch ensures that in async code, we now emit the new
llvm.dbg.coroframe_entry intrinsic, instead of llvm.dbg.declare
intrinsic

rdar://157299589

rdar://157509307
2025-08-23 20:13:18 -07:00
Shubham Sandeep Rastogi
35ed2080ba Revert "Temporarily disable debug info generation for async functions"
This reverts commit 8d763321c1.
2025-08-22 15:31:47 -07:00
Ben Barham
8d763321c1 Temporarily disable debug info generation for async functions
Temporary workaround for a compiler crash in rebranch:
```
location of #dbg_declare must be a pointer or int
```
2025-08-13 15:36:02 -07:00
Anthony Latsis
1de3e14252 Revert "DebugInfo: Bring back accidentally dropped DIFlagArtificial flag"
This reverts commit 5a456c5c3f.
2025-07-31 11:43:26 +01:00
Anthony Latsis
5a456c5c3f DebugInfo: Bring back accidentally dropped DIFlagArtificial flag
Patches up https://github.com/swiftlang/swift/pull/83283.
2025-07-30 23:28:53 +01:00
swift-ci
3998a187f9 Merge remote-tracking branch 'origin/main' into rebranch 2025-07-30 09:36:41 -07:00
Anthony Latsis
3f841b515c Merge remote-tracking branch 'origin/main' into jepa-rebranch 2025-07-30 14:31:33 +01: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
Shubham Sandeep Rastogi
5b4fdd6e62 Revert "Set the Compilation directory when generating the Skeleton CU"
This reverts commit b286b1c3a5.

Reverted because fix for rdar://131726681 broke rdar://154247270

Reverting and will try to fix properly later
2025-07-24 10:59:11 -07:00
Anthony Latsis
7f8dc07f1c Merge pull request #83283 from swiftlang/jepa-rebranch
DebugInfo: Stop setting `FlagObjectPointer` without being certain tha…
2025-07-24 09:56:59 +01:00
Anthony Latsis
e246f0de59 DebugInfo: Stop setting FlagObjectPointer without being certain that the parameter is self
The stable/21.x branch is not happy with us setting the object pointer
flag here because it now asserts that this flag is set for at most one
function parameter. We should add a dedicated routine for instance
method parameters. For now, stop setting the flag altogether to unblock
the stdlib build on rebranch.
2025-07-24 09:17:00 +01:00
swift-ci
077ba17bee Merge remote-tracking branch 'origin/main' into rebranch 2025-07-23 23:18:26 -07:00
Augusto Noronha
c03831f70d [DebugInfo] Fix infinite recursion when opaque return type is defined
inside function returning it

A stack overflow would happen when the compiler tried emitting debug
info for a function whose opaque return type was declared inside the
function itself. This fixes the issue by emitting a forward declaration
for the function before emitting it.

rdar://150313956
2025-07-23 15:24:34 -07:00
Anthony Latsis
b04d6085f3 IRGen: Address llvm::InsertPosition ctor deprecation
See https://github.com/llvm/llvm-project/pull/102608.
2025-07-21 12:50:39 +01:00
swift-ci
3787a312d7 Merge remote-tracking branch 'origin/main' into rebranch 2025-07-15 17:17:19 -07:00
Allan Shortlidge
910989c2c2 AST: Store parsed version in OriginallyDefinedInAttr instead of canonical.
Canonicalize the version on-demand instead.

NFC, part of rdar://155558161.
2025-07-14 16:04:04 -07:00
swift-ci
7373597cc8 Merge remote-tracking branch 'origin/main' into rebranch 2025-06-30 15:54:31 -07:00
Augusto Noronha
0c20222aea Merge pull request #81700 from augusto2112/revert-debug-info-witness-table
Revert "Merge pull request #79171 from augusto2112/debug-info-witness…
2025-06-30 15:28:15 -07:00
swift-ci
457aa96d07 Merge remote-tracking branch 'origin/main' into rebranch 2025-05-23 14:54:46 -07:00
Shubham Sandeep Rastogi
f91f8c5283 Merge pull request #81563 from rastogishubham/CompDir
Set the Compilation directory when generating the Skeleton CU
2025-05-23 14:39:16 -07:00
Shubham Sandeep Rastogi
b286b1c3a5 Set the Compilation directory when generating the Skeleton CU
When creating a skeleton Compile Unit, the DIFile passed
in, it always uses the include path. This leads to the DW_AT_comp_dir
being wrong, if the -file-compilation-dir option is passed, we need to
use the remapped compilation dir passed in to the DIFile instead.

This patch fixes that problem.
2025-05-22 08:37:10 -07:00
Augusto Noronha
680fbc566f Revert "Merge pull request #79171 from augusto2112/debug-info-witness-table"
This reverts commit c8eba86c3e, reversing
changes made to 98c3993503.
2025-05-22 11:45:37 +09:00
Anthony Latsis
12823706a8 Merge pull request #81667 from AnthonyLatsis/rebranch
[rebranch] DebugInfo: Restore old behavior in call to `llvm::DIBuilder::createOb…
2025-05-21 05:48:46 +01:00
Anthony Latsis
ff64fc79af DebugInfo: Restore old behavior in call to llvm::DIBuilder::createObjectPointerType
Fix my mistake in 66a6df9a44. `false` is
the wrong value for the new `Implicit` parameter because it causes the
`FlagArtificial` flag to not be set as before that change. The flag
itself looks appropriate because the entry is constructed for a built-in
type.
2025-05-21 05:44:06 +01:00
swift-ci
8108f779a5 Merge remote-tracking branch 'origin/main' into rebranch 2025-05-20 17:48:45 -07:00
Augusto Noronha
c8eba86c3e Merge pull request #79171 from augusto2112/debug-info-witness-table
[DebugInfo] Emit debug info for witness tables
2025-05-21 09:23:04 +09:00
swift-ci
fe523c4b0b Merge remote-tracking branch 'origin/main' into rebranch 2025-05-20 02:15:11 -07:00
Hamish Knight
edca7c85ad Adopt ABORT throughout the compiler
Convert a bunch of places where we're dumping to stderr and calling
`abort` over to using `ABORT` such that the message gets printed to
the pretty stack trace. This ensures it gets picked up by
CrashReporter.
2025-05-19 20:55:01 +01:00
Augusto Noronha
66748f71eb [DebugInfo] Emit debug info for witness tables
This change emits debug info for witness tables passed into generic
functions when a generic type is constrained to a protocol. This
information is required for LLDB's generic expression evaluator
to work in such functions.

rdar://104446865
2025-04-30 11:18:19 -07:00
Anthony Latsis
e124bca3e1 IRGen: Adjust uses of llvm::DIBuilder::insertDbgValueIntrinsic (parameter type changed)
Per 1083ec647f16314bcc9af8c4d6b11f50d288bca6 (llvm-project).
2025-04-24 01:52:48 +01:00
Anthony Latsis
4e972c0e75 IRGen: Adjust uses of llvm::BasicBlock::getFirstNonPHIOrDbg (return type changed)
Per 81d18ad86419fc612c7071e888d11aa923eaeb8a (llvm-project).
2025-04-24 01:52:48 +01:00
Anthony Latsis
66a6df9a44 IRGen: Conservatively adjust use of llvm::DIBuilder::createObjectPointerType (parameter added)
Per a5fb2bbb2ad8488482843e2298fbe6f6a1d45bbd (llvm-project).
2025-04-24 01:52:48 +01:00