Commit Graph

10 Commits

Author SHA1 Message Date
Allan Shortlidge
5257747b1b Macros: Implement expansion(of:providingMembersOf:conformingTo:in:) on MemberMacros.
Resolves a warning about using a deprecated default implementation.
2024-10-16 16:35:54 -07:00
Dave Lee
b3c59aceda [Debug] Escape LLDB syntax in debugDescription (#75306)
When using `@DebugDescription`, only allow use of [LLDB Summary 
Strings](https://lldb.llvm.org/use/variable.html#summary-strings) syntax from 
`lldbDescription` properties. When `@DebugDescription` is applied to existing 
`debugDescription` properties, escape any `$`, as the output of `debugDescription` is 
never interpreted by LLDB.

Depends on #75305
2024-07-30 10:58:49 -07:00
Dave Lee
abe697ff72 [Debug] Rename DebugDescription fallback property to lldbDescription (#75305)
From feedback, replace the name `_debugDescription`, which was confusing because of the 
underscore, with `lldbDescription`. This new name also indicates that this property may 
contain [LLDB Summary Strings](https://lldb.llvm.org/use/variable.html#summary-strings).
2024-07-29 11:10:43 -07:00
Dave Lee
e0129799fa [Debug] Add user friendly diagnostic when @DebugDescription is atached to a generic (#75307)
Emit a user friendly diagnostic when `@DebugDescription` is attached to a generic 
definition.
2024-07-25 10:06:47 -07:00
Dave Lee
fc23eef2d2 Disable macro on windows (#71685)
On windows (PECOFF), the `static let` properties produced by `DebugDescriptionMacro` 
are not constants, and as a result the `@_section` macro cannot be applied. The error 
message is:

> global variable must be a compile-time constant to use `@_section` attribute

Until this issue is addressed, DebugDescriptionMacro is disabled for windows targets.
2024-02-19 15:01:11 -08:00
Dave Lee
63e42a4f36 Switch to __TEXT segment (#71639)
The data emitted by `DebugDescriptionMacro` is constant. For that reason, it was placed 
in `__DATA_CONST`. However, this causes a problem with the linker, which emits an error 
 if the `__DATA_CONST` segment is _not_ marked `SG_READ_ONLY`.

After discussion, it was pointed out that if the constant data has no fixups, then it 
can and should be in the the `__TEXT` segment. The `__DATA_CONST` segment is for data 
that is essentially constant but contains dyld fixups.
2024-02-16 07:49:40 -08:00
Dave Lee
3a43e7d689 [Debug] Fix regex type names in DebugDescriptionMacro (#71379)
Fixes the way `DebugDescriptionMacro` produces a regex type name.

The problem was use of backslash escapes that weren't sufficiently escaped. They needed 
to be double escaped. To avoid this trap, the regexes now use `[.]` to match a dot, 
instead of the more conventional `\.` syntax.
2024-02-05 10:49:01 -08:00
Dave Lee
67677742b0 [Debug] Remove temp workaround in DebugDescriptionMacro (#70746)
This workaround is no longer needed, as of https://github.com/apple/swift/pull/70435.
2024-01-07 16:59:08 -08:00
Dave Lee
96faeb5177 [Debug] Accept _debugDescription in DebugDescriptionMacro (#70728)
Some data types cannot modify their `description` or `debugDescription` properties, as 
modification to those properties could result in breakage to their users. To support 
these conditions, `DebugDescriptionMacro` should support and prioritize an independent 
property (one that that is not being reused).

This change adds support for `_debugDescription`. The macro will now prioritize the 
description properties in this order:

1. `_debugDescription`
2. `debugDescription`
3. `debugDescription`

rdar://120498021
2024-01-05 15:16:01 -08:00
Dave Lee
ad585b3195 [Debug] Add _DebugDescription macro (#69626)
Implementation of the DebugDescription macro pitched on the forums: 
https://forums.swift.org/t/pitch-debug-description-macro/67711. In this initial commit, 
the macro is named `_DebugDescription` to indicate it's internal use at this time, 
pending Swift Evolution.

rdar://115180949
2023-12-08 15:19:16 -08:00