Commit Graph

1782 Commits

Author SHA1 Message Date
Emil Pedersen
26cb1394f0 Fix salvage integer literal test on 32 bits
rdar://127255781
2024-04-29 15:40:31 -07:00
Adrian Prantl
82a26a59d8 Emit line table entries for closure setup instructions.
Currently the Swift compiler makes these instructions with SILLocations marked
as autgenerated. While this allows for somewhat smoother stepping in some cases,
it can also make some debugging tasks harder due to missing source location
information, for example, when attributing memory allocations.

This patch makes these locations available again, based on that a debug info
consumer could consider filtering them out by recognizing that a source location
is on the opening `{` of a closure, but inside the scope of the function the
closure is defined in.

rdar://127095833
2024-04-29 12:51:28 -07:00
Emil Pedersen
16c57aefcd [DebugInfo] Salvage integer literals 2024-04-26 16:31:16 -07:00
Emil Pedersen
84dae7c37a [DebugInfo] Add support for constant debug values 2024-04-26 16:31:16 -07:00
Emil Pedersen
8ad3066011 [DebugInfo] Fix implicit deref on arithmetic expressions 2024-04-26 16:31:16 -07:00
Emil Pedersen
c2c16f53dd [DebugInfo] Fix undef debug values being removed 2024-04-26 16:31:16 -07:00
Emil Pedersen
450db6e530 [DebugInfo] Add special cases for copy forwarding 2024-04-24 18:23:39 -07:00
Emil Pedersen
523a769e34 [DebugInfo] [Mem2Reg] Move debug info promotion to salvageDebugInfo 2024-04-23 13:12:21 -07:00
Adrian Prantl
15fd443be6 Merge pull request #73090 from augusto2112/mangling-abi-name-deb
Respect the module ABI name when mangling for the debugger
2024-04-18 09:56:00 +02:00
Augusto Noronha
01bd68e8a2 Respect the module ABI name when mangling for the debugger
The mangled name produced for the debugger should match the one emitted
in reflection metadata, otherwise LLDB will not be able to lookup types
when the module is compiled with the -module-abi-name flag.

rdar://125848324
2024-04-17 13:56:18 -07:00
Emil Pedersen
a9d89e5f17 [DebugInfo] Fix dead-store-elim test for 32 bits
rdar://126620071
2024-04-17 11:01:30 -07:00
Adrian Prantl
6357d12cfc Merge pull request #73009 from Snowy1803/debuginfo-small-fixes
[Debuginfo] Small fixes
2024-04-17 00:03:53 +02:00
Emil Pedersen
4a543c8d45 [DebugInfo] Salvage Debug Info in Swift Function Passes
Salvage Debug Info was only being called for simplifications, and not
for function passes written in Swift. Salvage Debug Info is now called
for both cases.
2024-04-16 10:54:48 -07:00
Emil Pedersen
3136d2eac4 [DebugInfo] [IRGen] Use instruction column number for variables
The source location for the variable should be the value in VarInfo if set,
otherwise it should use the location of the instruction. Both ways should
be consistent, and as we use column number if VarInfo is set, we have to do
it if isnt, too.
2024-04-16 10:28:02 -07:00
Artem Chikin
01d891ad99 Merge pull request #72834 from artemcm/UpstreamVisionOS
Introduce visionOS Platform
2024-04-15 09:33:49 -07:00
Artem Chikin
1f14158a1d Introduce VisionOS Platform
This change introduces a new compilation target platform to the Swift compiler - visionOS.

- Changes to the compiler build infrastrucuture to support building compiler-adjacent artifacts and test suites for the new target.
- Addition of the new platform kind definition.
- Support for the new platform in language constructs such as compile-time availability annotations or runtime OS version queries.
- Utilities to read out Darwin platform SDK info containing platform mapping data.
- Utilities to support re-mapping availability annotations from iOS to visionOS (e.g. 'updateIntroducedPlatformForFallback', 'updateDeprecatedPlatformForFallback', 'updateObsoletedPlatformForFallback').
- Additional tests exercising platform-specific availability handling and availability re-mapping fallback code-path.
- Changes to existing test suite to accomodate the new platform.
2024-04-10 09:38:02 -07:00
Meghana Gupta
7fbfa59ad4 Merge pull request #72922 from meg-gupta/moredisable
Disable and fix some failing tests in CI
2024-04-09 23:57:15 -07:00
Kuba (Brecka) Mracek
f9ed12d781 Merge pull request #72716 from kubamracek/embedded-build-macos-as-14
[embedded] Build the macOS Embedded Stdlib with a recent deployment target
2024-04-09 19:11:08 -07:00
Meghana Gupta
9e79964dd4 Disable DebugInfo tests on watchos 2024-04-09 11:00:29 -07:00
Emil Pedersen
512ac6cc31 Merge pull request #72860 from Snowy1803/salvage-debug-info-tuple
[DebugInfo] Salvage debug info for tuples
2024-04-05 20:16:24 -07:00
Emil Pedersen
1e7dc51cd6 [DebugInfo] Add salvageDebugInfo support for tuples 2024-04-05 15:34:36 -07:00
Emil Pedersen
efa09088ac Revert "[DebugInfo][SIL] Introduce the 'implicit' attribute for debug variable"
This reverts commit e63632fda8.

rdar://125939953
2024-04-04 17:23:32 -07:00
Emil Pedersen
e8ce02e0a3 [DebugInfo] Salvage debug info for allocations in SILSROA 2024-04-02 11:34:23 -07:00
Kuba Mracek
eebb48469a [embedded] Adjust tests for the embedded stdlib deployment target bump 2024-03-29 21:17:29 -07:00
Emil Pedersen
4c8beefff4 [DebugInfo] Salvage debug info for stores removed by DeadObject-Elim
rdar://124283055
2024-03-26 10:02:34 -07:00
Alex Lorenz
8484c61f19 [debuginfo][codeview] avoid using line zero artificial location for traps when emitting codeview
This fixes an issue where the debug locations for Swift traps were dropped in the produced PDB files, as they were pointing to line 0

I validated this on a sample project using WinDbgx, which can now correctly trap on the same line in multiple places
2024-03-25 13:35:24 -07:00
Augusto Noronha
0e2c41cb8b Merge pull request #72338 from augusto2112/deb-specialized-types
[DebugInfo] Generate debug info for specialized types
2024-03-19 10:43:10 -07:00
Augusto Noronha
ae5e341db4 [DebugInfo] Generate debug info for specialized types
Specialized types are generic types, or types whose parent is
specialized.

IRGenDebugInfo was previously mistankenly emitting debug info for
nominal specialized types as if they regular nominal types, which caused
problems as that code path does not handle references to generic
parameters.
2024-03-18 15:43:38 -07:00
Adrian Prantl
e3197e971f Merge pull request #72200 from adrian-prantl/124233848
Root the virtual <compiler-generated> file in the root directory.
2024-03-13 14:38:11 -07:00
Emil Pedersen
2ebae40261 Merge pull request #72270 from Snowy1803/fix-empty-tuple-fragments-crash
[DebugInfo] Fix crash on empty tuple fragments
2024-03-13 09:51:47 -07:00
Emil Pedersen
ffb8ece8e0 [DebugInfo] Fix crash on empty tuple fragments
rdar://124408249
2024-03-12 17:38:00 -07:00
Adrian Prantl
aab0cb09cc Root the virtual <compiler-generated> file in the root directory.
Using CWD gives a false sense of accuracy.

rdar://124233848
2024-03-12 16:57:04 -07:00
Emil Pedersen
82743ba467 Merge pull request #72260 from Snowy1803/fix-tuple-fragments-test-32bits
[DebugInfo] Fix sroa_mem2reg_tuple test on 32 bits targets
2024-03-12 16:31:35 -07:00
Alexis Laferrière
0543ff8f82 Tests: disable DebugInfo tests on armv7k 2024-03-12 11:20:48 -07:00
Emil Pedersen
ae09860eb4 [DebugInfo] Fix sroa_mem2reg_tuple test on 32 bits targets 2024-03-12 11:01:33 -07:00
Nate Chandler
a54a8ddaa3 [SIL] Key consume addr checking off var_decl attr.
Previously, the lexical attribute on allock_stack instructions was used.
This doesn't work for values without lexical lifetimes which are
consumed, e.g. stdlib CoW types.  Here, the new var_decl attribute on
alloc_stack is keyed off of instead.  This flag encodes exactly that a
value corresponds to a source-level VarDecl, which is the condition
under which checking needs to run.
2024-03-09 05:29:01 -08:00
Adrian Prantl
654df59161 Detect methods by their scope rather than their representation.
In the end this condition exists to avoid a BitCode Verifyer check that operates
off the scope, so looking for that directly is more future-proof.

rdar://123334375
2024-03-08 13:29:44 -08:00
Emil Pedersen
35e346fd8d Add support for op_tuple_fragment in SIL DIExpression and SIL SROA
rdar://124034536
2024-03-04 15:46:02 -08:00
Augusto Noronha
76853717c2 Merge pull request #71939 from augusto2112/fix-specify-of-2
[DebugInfo] Fix bound generic types debug info generation
2024-03-01 16:40:31 -08:00
Augusto Noronha
9178c4a346 Merge pull request #71962 from augusto2112/embedded-flag
[DebugInfo] Emit embedded swift into DW_AT_APPLE_flags
2024-03-01 15:12:39 -08:00
Adrian Prantl
8a25294f50 Merge pull request #71965 from augusto2112/fix-lto-decl
[DebugInfo] Emit witness and objc method declarations in debug info
2024-03-01 09:26:02 -08:00
Augusto Noronha
0b8abda060 [DebugInfo] Emit embedded swift into DW_AT_APPLE_flags
To properly initialize the compiler instance on LLDB when debugging
embedded Swift programs, emit "-enable-embedded-swift" into the
DW_AT_APPLE_flags attribute of the compile unit.
2024-02-29 16:37:13 -08:00
Felipe de Azevedo Piovezan
665ada403e [DebugInfo] Simplify test for DynamicSelfLocation
We only want to check that there is no "!dbg" until the next line, we can
accomplish this by checking-same on the end-of-line regex marker.
2024-02-29 14:27:38 -08:00
Augusto Noronha
53d1844396 [DebugInfo] Emit witness and objc method declarations in debug info
When emitting a method definition in debug info, the compiler should
also emit the method's declaration, because LLVM LTO can't unify type
definitions when a child DIE is a full subprogram definition. This is
already the behavior for standard methods, this patch implements the
same behavior for witness and objc methods as well.

rdar://123334375
2024-02-29 10:13:10 -08:00
Emil Pedersen
49ee148a2d [DebugInfo] Add support for chained fragments in salvageDebugInfo 2024-02-28 14:41:19 -08:00
Emil Pedersen
0faa055c11 [DebugInfo] Add debug info support for recursive SIL SROA
This removes the restriction that only one fragment is allowed at
the end of a SIL DIExpression.

rdar://100046900
2024-02-28 12:48:17 -08:00
Augusto Noronha
10d263b388 [DebugInfo] Fix bound generic types debug info generation
When generating full debug info for generic types, emit the
specification type as an opaque struct with the collection of
substituted generic parameters.
2024-02-27 17:49:27 -08:00
Felipe de Azevedo Piovezan
76252f8846 Merge pull request #71888 from felipepiovezan/felipe/dynamic_self_loc
[DebugInfo] Fix dynamic self debug loc
2024-02-26 21:57:08 -08:00
Felipe de Azevedo Piovezan
07d58959a2 [DebugInfo] Fix dynamic self debug loc
The instructions related to producing DynamicSelf metadata are always placed at
the start of the function. This creates an issue: which debug location should be
used in order to preserve a sane line table? The current implementation just
uses w/e debug location is present in the new insertion point, which could, for
example, be a debug_declare whose location is not suitable for these purposes.

This patch addresses the issue by removing the debug location of instructions
associated with producing DynamicSelfMetadata.

rdar://120408665
2024-02-26 15:15:37 -08:00
Emil Pedersen
299cf2972e [test] Add missing colons for FileCheck 2024-02-26 13:31:04 -08:00