Commit Graph

1174 Commits

Author SHA1 Message Date
Emil Pedersen
4ede40e2f7 [DebugInfo] Remove passing of the unused SizeIsFragmentSize (NFC) 2024-03-07 15:21:44 -08:00
Emil Pedersen
456b5a0ac8 [DebugInfo] Move type size information to CompletedDebugTypeInfo (NFC) 2024-03-07 13:07:43 -08:00
Emil Pedersen
75015b5050 [DebugInfo] Remove accessor for type size in DebugTypeInfo 2024-03-06 17:42:40 -08:00
Emil Pedersen
01c752e6db [DebugInfo] Use LLVM type size instead of an estimate for types 2024-03-06 17:23:26 -08:00
Emil Pedersen
7c9a8769a1 Merge pull request #72072 from Snowy1803/tuple-fragments
Add support for op_tuple_fragment in SIL DIExpression and SIL SROA
2024-03-06 15:20:08 -08:00
Adrian Prantl
b5d83afaba Avoid copy of loop temporary 2024-03-05 12:16:14 -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
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
Adrian Prantl
23e6e54ca1 Merge pull request #71925 from Snowy1803/recursive-sroa
[DebugInfo] Add debug info support for recursive SIL SROA
2024-02-28 20:05:57 -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
Adrian Prantl
1e50be370d Emit original-source-range comment in inline macro expansion files.
rdar://123117522
2024-02-27 15:30:24 -08:00
Ben Barham
1de479d4c1 Remove the last few llvm::Optional
Not sure how I missed these in the previous lot, but actually remove all
this time.
2024-02-23 16:42:30 -08:00
Ben Barham
ef8825bfe6 Migrate llvm::Optional to std::optional
LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
2024-02-21 11:20:06 -08:00
Augusto Noronha
393849290b [DebugInfo] Emit full DWARF info for generic classes and enums 2024-02-20 20:03:14 -08:00
Augusto Noronha
af1d477674 [DebugInfo] Emit a MultiPayloadEnum's spare bits mask in DWARF 2024-02-20 15:38:46 -08:00
Augusto Noronha
dc959a4eb4 Merge pull request #71332 from augusto2112/emit-class-deb
Generate full debug info for special builtins and classes
2024-02-06 17:08:33 -08:00
Kavon Farvardin
ee12fd6655 NCGenerics: reenable round-trip for mangling 2024-02-06 08:15:26 -08:00
Augusto Noronha
3352e7d157 [DebugInfo] Generate full debug info for classes 2024-02-05 16:44:44 -08:00
Augusto Noronha
2084da1163 Emit the special stdlib builtin types into full dwarf metadata 2024-02-02 18:15:31 -08:00
Rick van Voorden
f8ae46b3f3 [inclusive-language] changed sanity to soundness 2024-01-25 18:18:02 -08:00
Hamish Knight
fd97268393 Merge pull request #70983 from hamishknight/another-cleanup
[AST] Remove SerializedLocalDeclContext
2024-01-22 18:49:42 +00:00
Augusto Noronha
1bf6375b78 [DebugInfo] Generate full debug info for generic structs
Generate the full debug info for generic structs. The strategy is to
emit one full entry for the generic type with archetypes, and one
forward declaration per instantiation of the generic type.

For example, given:
```
struct Pair<T, U> {
  let t: T
  let u: U
}
let p1 = Pair<Int, Double>(t: 1, u: 4.2)
let p2 = Pair<String, Bool>(t: "Hello", u: true)
```

DebugInfo will have one entry for Pair<T, U> which includes descriptions
of its fields, one forward declaration of Pair<Int, Double> and one
forward declaration of Pair<String, Bool>. This information is enough
for the algorithms of RemoteMirrors to reconstruct type information for
the fully instantiated types.
2024-01-19 12:35:30 -08:00
Hamish Knight
3f4b45b012 [AST] Remove SerializedLocalDeclContext
It's not clear that its worth keeping this as a
base class for SerializedAbstractClosure and
SerializedTopLevelCodeDecl, most clients are
interested in the concrete kinds, not only whether
the context is serialized.
2024-01-18 12:03:52 +00:00
Doug Gregor
c31d45eda6 [Debug info] Map the thrown error type into context when generating debug info 2024-01-12 10:10:13 -08:00
Tony Allevato
49dbf152e0 Merge pull request #70371 from allevato/c++20-fixes
[C++20] Make `operator==` const.
2023-12-12 08:04:47 -05:00
Tony Allevato
c7e52ca7da [C++20] Make operator== const.
C++20 considers calls to `operator==` ambiguous with calls that have
the arguments reversed if the argument is const but `this` is not.
2023-12-11 09:14:29 -05:00
Doug Gregor
b080b5f3d8 [Typed throws] An ErrorUnion type to the type system
The errorUnion type operation specifies how thrown error types are
combined when multiple errors are thrown in the same context. When
thrown error types can have type variables in them, we sometimes cannot
resolve the errorUnion until the type variables have substitutions. In
such cases, we need to persist the result of errorUnion in the
constraint solver.

Introduce the ErrorUnionType to do exactly that, and update the core
errorUnion operation to produce an ErrorUnionType when needed. At
present, this code is inert, because any errorUnion operation today
involves only concrete types. However, inference of thrown errors in
closures will introduce type variables, and depend on this.
2023-12-08 22:30:37 -08:00
Kavon Farvardin
63b3e7624d [NCGenerics] fold InverseType into PCT
We already need to track the inverses separate from the members in a
ProtocolCompositionType, since inverses aren't real types. Thus, the
only purpose being served by InverseType is to be eliminated by
RequirementLowering when it appears in a conformance requirement.

Instead, we introduce separate type InverseRequirement just to keep
track of which inverses we encounter to facilitate cancelling-out
defaults and ensuring that the inverses are respected after running
the RequirementMachine.
2023-12-07 22:14:23 -08:00
Adrian Prantl
8626aeff03 [Debug Info] Store the source code for macro expansions in the debug info
This patch stores the source code of macro in the source field of DIFile, which
can be used together with the DW_LLVM_LNCT_source extension to emit the source
code into DWARF debug info.

rdar://110926109
2023-11-30 14:49:57 -08:00
Adrian Prantl
e4dd71bd87 [IRGenDebugInfo] Cache DIFile pointers instead of file names (NFC)
This is an NFC refactoring that is slightly more efficient and needed for
subsequent commits.
2023-11-29 12:37:06 -08:00
Augusto Noronha
594f51a13e Generate full debug info for enums
Replace the generation of debug info for enums from DW_TAG_union_type
to either DW_TAG_enumeration_type or DW_TAG_variant_part, as these
representation match Swift enums more closely.
2023-11-13 14:31:29 -08:00
Doug Gregor
446dfbff3e Merge pull request #69741 from DougGregor/typed-throws-minor-fixes
Typed throws minor fixes
2023-11-09 10:17:58 -08:00
Doug Gregor
1a2f521aef [Debug info] Make sure we establish a generic scope for the thrown error type 2023-11-08 14:36:50 -08:00
Kuba Mracek
84561f9e69 [embedded] Avoid materializing generic functions for debuginfo purposes in embedded Swift 2023-11-06 15:37:57 -08:00
Kavon Farvardin
29acda5136 Merge pull request #69406 from kavon/noncopyable-generics-pt2
[NoncopyableGenerics] handle `~Copyable` in `where`, `some`, and compositions.
2023-10-28 22:36:22 -07:00
Adrian Prantl
5d978b44ca Revert "Revert "Make the DWARF version emitted by the Swift compiler configurable."" 2023-10-26 12:29:18 -07:00
Adrian Prantl
2a32ca5944 Revert "Make the DWARF version emitted by the Swift compiler configurable." 2023-10-25 13:28:28 -07:00
Allan Shortlidge
d0a4f2633c NFC: Fix unused variable warnings. 2023-10-25 09:42:21 -07:00
Adrian Prantl
d19fe381fa Use LLVM definitions for Swift section names (NFC) 2023-10-24 10:58:40 -07:00
Kavon Farvardin
66712ce6e0 [Sema] introduce InverseType
This type will become the corresponding type that is resolved for an
`InverseTypeRepr`. This kind of type is not expected to appear past type
 checking (currently, not even past requirement lowering!).
2023-10-23 10:37:22 -07:00
Augusto Noronha
75e45bd024 Emit extra inhabitants in debug info for basic types
To support debugging embedded Swift, we will need to store information
that previously we searched in metadata. Extra inhabitants is one of
those.
2023-10-20 16:14:52 -07:00
swift-ci
042e9df19d Merge remote-tracking branch 'origin/main' into rebranch 2023-10-04 18:22:41 -07:00
Richard Howell
1bc715a8a1 Fix ASAN use-after-scope in module-file-home-is-cwd.swift 2023-10-04 12:11:48 -07:00
swift-ci
049f867392 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-03 13:58:47 -07:00
Richard Howell
76dd1f9069 Set clang module directory correctly with fmodule-file-home-is-cwd
When building and importing modules built with
`-fmodule-file-home-is-cwd` we should be setting the debug info
directory to the current working directory. This matches the
behavior in clang: https://reviews.llvm.org/D134911
2023-09-29 08:32:36 -07:00