Commit Graph

1554 Commits

Author SHA1 Message Date
Arnold Schwaighofer
fc766a39d3 Fix some more tests 2023-06-29 16:16:56 -07:00
Felipe de Azevedo Piovezan
e8fdd2a6f3 [DebugInfo] Fix hardcoded integer width in test
These widths are target dependent and irrelevant for the test.
2023-06-28 13:42:15 -04:00
Felipe de Azevedo Piovezan
640a00623d [DebugInfo][NFC] Update test to not check width of integer argument
This is irrelevant for the test itself and may change depending on target.
2023-06-22 14:19:11 -04:00
Felipe de Azevedo Piovezan
4500aadd18 [DebugInfo][NFC] Update test to not check width of alloca integer argument
For the size argument of an alloca, some targets use a i32 bit integer, some use
a 64 bit integer; the updated test was hard-coding i64, which caused it to fail
in other targets. This is irrelevant for what the test is doing, so we remove
that.
2023-06-22 07:00:14 -04:00
Adrian Prantl
c2f164d7ac Merge pull request #66692 from adrian-prantl/110841130
SILDebugScopes: Don't ignore ConditionalClauseInitializerScope.
2023-06-17 10:31:56 -07:00
Adrian Prantl
329e42849a Compute VarDeclScopeMap up front.
The previous lazy discovery did not always work because sometimes a debug_value
is emitted before the first SIL instruction in the variable's scope.

rdar://110841130
2023-06-16 14:32:30 -07:00
Felipe de Azevedo Piovezan
1ed9df0a0c [DebugInfo] Update tests to use opaque ptrs 2023-06-16 15:05:44 -04:00
Adrian Prantl
874ba0868b SILDebugScopes: Don't ignore ConditionalClauseInitializerScope.
ConditionalClauseInitializerScope often create redundant scopes, however, they
are needed to correctly represent the scopes in an expression such as:

  if case .something(let foo), let foo = foo.

This patch changes SILGen to lower them 1:1 from ASTScopes.

rdar://110841130
2023-06-16 07:52:15 -07:00
swift-ci
14f71614e5 Merge pull request #66682 from adrian-prantl/109173022
Replace hardcoded special names with call into getUserfacingName()
2023-06-15 18:43:01 -07:00
Adrian Prantl
229ad8ba84 Replace hardcoded special names with call into getUserfacingName()
This fixes an assertion failure when encountering previously unhandled special names.

rdar://110841130
2023-06-15 13:24:59 -07:00
Arnold Schwaighofer
0d4dec1acb Attempt to fix debug info under opaque pointers
Based on https://github.com/apple/swift/pull/66409

With the observation that the pre-opaque world was using bitcast as an
indication that the storage type and the type of the variable were
different. We can recover this information from the storage type of the
alloca and the storage type of the type info.
2023-06-14 10:49:50 -07:00
Arnold Schwaighofer
c1a93e0bde Move tests over to use the %use_no_opaque_pointers option 2023-06-14 10:49:48 -07:00
Adrian Prantl
7092e50e05 Merge pull request #66479 from adrian-prantl/110329894
Avoid emitting variable debug info for closure captures.  … @adrian-prantl
2023-06-09 09:21:31 -07:00
Adrian Prantl
3a97766bb3 Avoid emitting variable debug info for closure captures.
Variable debug info is triggered by pattern bindings, however, inside a closure
capture list, this should be avoided by setting the appropriate flag in the
initializer object.

rdar://110329894
2023-06-08 16:33:14 -07:00
Nate Chandler
6e7952b4ad [IRGen] Mask off metadata pack passed to DebugInfo
When a metadata pack is heap allocated, the pointer's LSB is set.
But lldb is expecting a real pointer.  So mask it off.

Companion PR has a test: https://github.com/apple/llvm-project/pull/6961

rdar://110195273
2023-06-03 07:30:09 -07:00
Adrian Prantl
958a1577b5 Ensure calls to getters have a source location.
Calls to getters are implicit because the compiler inserts them on a property
access, but the location is useful in backtraces so it should be preserved.

rdar://109123395
2023-05-31 17:41:26 -07:00
Slava Pestov
e9e6a51c82 Unconditionally enable variadic generic types now that SE-0398 has been accepted 2023-05-15 23:32:52 -04:00
Slava Pestov
4318a36be6 Sema: Availability checking for variadic generic types 2023-05-12 22:50:25 -04:00
Adrian Prantl
b74cdf19e8 Derive the SILDebugScope for a variable declaration from its owning ASTScope.
The previous code made the assumption that the ASTScope for a variable
declaration should be the one of the declaration's source location. That is not
necessarily the case, in some cases it should be an ancestor scope. This patch
introduces a map from ValueDecl -> ASTScope that is derived from querying each
ASTScope for its locals, which matches also what happens in name lookup.  This
patch also fixes the nesting of SILDebugScopes created for guard statement
bodies, which are incorrectly nested in the ASTScope hierarchy.

rdar://108940570
2023-05-10 12:29:42 -07:00
Adrian Prantl
a0ec3f45cd Revert "Relax test"
This reverts commit be845f1e42.
2023-05-10 12:13:34 -07:00
Adrian Prantl
fd06d27d43 Merge pull request #65725 from adrian-prantl/107869141
[Serialization] Teach ASTSectionImporter to filter by triple.
2023-05-08 13:03:12 -07:00
Adrian Prantl
a3a43d46c5 [Serialization] Teach ASTSectionImporter to filter by triple.
On macOS it is possible for one application to contain Swift modules compiled
for different triples that are incompatible as far as the Swift compiler is
concerned. Examples include an iOS simulator application hunning on a macOS
host, or a macCatalyst application running on macOS. A debugger might see
.swift_ast sections for all triples at the same time. This patch adds an
interface to let the client provide a triple to filter Swift modules in an
ASTSection.

rdar://107869141
2023-05-08 08:32:00 -07:00
swift-ci
a90fa03d0f Merge pull request #65655 from adrian-prantl/require-asserts
Add REQUIRES: asserts
2023-05-04 15:14:31 -07:00
Adrian Prantl
f1315ab982 Add REQUIRES: asserts 2023-05-04 08:33:29 -07:00
Adrian Prantl
93b6987900 Merge pull request #65607 from adrian-prantl/107491524
Emit debug info for count arguments of variadic generic types.
2023-05-03 08:49:40 -07:00
swift-ci
58eaacbde4 Merge pull request #65595 from adrian-prantl/relax-test
Relax test
2023-05-02 19:24:04 -07:00
Adrian Prantl
85dcd50605 Emit debug info for count arguments of variadic generic types.
rdar://107491524
2023-05-02 17:35:28 -07:00
Slava Pestov
45ab59c4e1 Merge pull request #65558 from slavapestov/sil-function-type-pack-mangling
ASTMangler: Fix mangling of SILFunctionType with @pack conventions
2023-05-02 20:13:27 -04:00
Adrian Prantl
be845f1e42 Relax test 2023-05-02 13:45:56 -07:00
Adrian Prantl
686023861e Merge pull request #65552 from adrian-prantl/108736443
Remove a stateful workaround for Property Wrappers.
2023-05-02 13:43:51 -07:00
Slava Pestov
1c924018d1 ASTMangler: Fix mangling of SILFunctionType with @pack conventions
Fixes rdar://problem/107151125.
2023-05-01 21:56:05 -04:00
Adrian Prantl
dcd881e105 SILDebugScopes: Remove a stateful workaround for Property Wrappers.
In an earlier version of the ASTScope -> SILdebugScope translation a workaround
was put into place that would select the current debug scope if an ASTScope was
marked as ignoreInDebugInfo. Removing this workaround makes the translation more
predictable as it eliminated the dependency on the current SILBuilder state. The
property wrapper tests still pass without this.

This uncovers a situations with let bindings where the SIL instructions are
emitted RHS before LHS, which does violate the di-hole verifier. This is
addressed by relaxing the verifier for now.

rdar://108736443
2023-05-01 17:52:44 -07:00
swift-ci
49e50a5c80 Merge pull request #65483 from adrian-prantl/108576484
Remove an obsolete workaround for error variables.
2023-04-28 17:40:20 -07:00
Adrian Prantl
0668289744 Remove an obsolete workaround for error variables.
This is a revert  of the workaround for creating debug  info for error variables
in b2109ab4db, while leaving the test  added back then in place.  The compiler
is now emitting debug info for the error pattern binding as it's supposed to and
after the  recent migration to  stricter debug  scope generation, there  are now
situations where the  variable added for the workaround and  the correct one are
in conflict.

rdar://108576484
2023-04-28 13:03:14 -07:00
Slava Pestov
36e74c1331 ASTMangler: Mangle variadic pack markers before requirements 2023-04-19 18:32:18 -04:00
Holly Borla
e48a9b5aeb [NFC] Remove the VariadicGenerics flag from tests that don't use generic types
with parameter packs.
2023-04-15 17:48:08 -07:00
swift-ci
703222583c Merge pull request #65047 from adrian-prantl/107764966
Ignore profile counter instructions in the dihole verifier.
2023-04-12 21:36:02 -07:00
Augusto Noronha
dbaf5e53f0 Emit cxx interop into DW_AT_APPLE_flags
When compiling with interop enabled, emit the C++ interop compiler flag
into the DW_AT_APPLE_flags, to make it so LLDB can accurately match the
C++ interop mode when initializing its compiler instance.

rdar://97610458
(cherry picked from commit b1dbb0a321)
2023-04-11 10:40:09 -07:00
Adrian Prantl
bccc080888 Fix handling of implicit locations for variables 2023-04-10 18:13:42 -07:00
Adrian Prantl
c877a4a802 Ignore profile counter instructions in the dihole verifier.
rdar://107764966
2023-04-10 14:23:43 -07:00
Adrian Prantl
158772c2ab Rebase SILScope generation on top of ASTScope.
This patch replaces the stateful generation of SILScope information in
SILGenFunction with data derived from the ASTScope hierarchy, which should be
100% in sync with the scopes needed for local variables. The goal is to
eliminate the surprising effects that the stack of cleanup operations can have
on the current state of SILBuilder leading to a fully deterministic (in the
sense of: predictible by a human) association of SILDebugScopes with
SILInstructions. The patch also eliminates the need to many workarounds. There
are still some accomodations for several Sema transformation passes such as
ResultBuilders, which don't correctly update the source locations when moving
around nodes. If these were implemented as macros, this problem would disappear.

This necessary rewrite of the macro scope handling included in this patch also
adds proper support nested macro expansions.

This fixes

rdar://88274783

and either fixes or at least partially addresses the following:

rdar://89252827
rdar://105186946
rdar://105757810
rdar://105997826
rdar://105102288
2023-04-04 15:20:11 -07:00
Adrian Prantl
bbcce343e8 Refactor testcase to be more robust against IR ordering changes
and also make it easier to debug.
2023-03-29 12:51:05 -07:00
Michael Gottesman
4a309575d7 [sil] Rename [moved] flag on debug_value/alloc_stack to moveable_value_debuginfo.
This is in preparation for wiring up debug info support for noncopyable
values. Originally this flag name made sense since it was set when we performed
consume operator checking. Now I am going to use it for noncopyable types as
well. I think the new name uses_moveable_value_debuginfo actually describes what
the flag is supposed to do, tell IRGen that the value may be moved since it
needs to use moveable value debug info emission.
2023-03-19 15:38:42 -07:00
Kavon Farvardin
2c7d9a5047 update tests given move-only types are enabled
the main things still left behind the experimental flag(s) are
- move-only classes (guarded by MoveOnlyClasses feature)
- noimplicitcopy
- the _borrow operator
2023-03-14 18:35:13 -07:00
Adrian Prantl
e6aa779aec Let pack_count helper variables be zero-indexed. 2023-03-06 16:04:18 -08:00
Mishal Shah
aced44a84b Merge pull request #63187 from apple/rebranch
Merge `rebranch` into `main` to support `stable/20221013` llvm-project branch
2023-03-03 11:01:34 -08:00
Mishal Shah
e256b56545 Merge branch 'main' into rebranch 2023-03-02 18:25:09 -08:00
Sophia Poirier
70cffb06f3 [Variadic Generics] type parameter pack syntax change: T... -> each T 2023-03-02 14:42:28 -08:00
Joe Groff
ecceb02e2a Implement consume x operator with the accepted SE-0366 syntax.
Implement it as a contextual operator that only parses as an operator when
followed by an identifier.
2023-03-01 17:37:54 -08:00
Arnold Schwaighofer
1dfc30eb1f Merge remote-tracking branch 'origin/main' into rebranch 2023-02-27 09:18:56 -08:00