-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Debug] Fix regex type names in DebugDescriptionMacro #71379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kastiglione
merged 1 commit into
main
from
dl/Debug-Fix-regex-type-names-in-DebugDescriptionMacro
Feb 5, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// REQUIRES: swift_swift_parser | ||
|
||
// RUN: %empty-directory(%t) | ||
// RUN: %target-swift-frontend %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -enable-experimental-feature SymbolLinkageMarkers -plugin-path %swift-plugin-dir -dump-macro-expansions > %t/expansions-dump.txt 2>&1 | ||
// RUN: %FileCheck %s < %t/expansions-dump.txt | ||
|
||
struct MyStruct {} | ||
|
||
@_DebugDescription | ||
extension MyStruct { | ||
var debugDescription: String { "thirty" } | ||
} | ||
// CHECK: #if os(Linux) | ||
// CHECK: @_section(".lldbsummaries") | ||
// CHECK: #elseif os(Windows) | ||
// CHECK: @_section(".lldbsummaries") | ||
// CHECK: #else | ||
// CHECK: @_section("__DATA_CONST,__lldbsummaries") | ||
// CHECK: #endif | ||
// CHECK: @_used | ||
// CHECK: static let _lldb_summary = ( | ||
// CHECK: /* version */ 1 as UInt8, | ||
// CHECK: /* record size */ 34 as UInt8, | ||
// CHECK: /* "^main[.]MyStruct(<.+>)?$" */ 25 as UInt8, 94 as UInt8, 109 as UInt8, 97 as UInt8, 105 as UInt8, 110 as UInt8, 91 as UInt8, 46 as UInt8, 93 as UInt8, 77 as UInt8, 121 as UInt8, 83 as UInt8, 116 as UInt8, 114 as UInt8, 117 as UInt8, 99 as UInt8, 116 as UInt8, 40 as UInt8, 60 as UInt8, 46 as UInt8, 43 as UInt8, 62 as UInt8, 41 as UInt8, 63 as UInt8, 36 as UInt8, 0 as UInt8, | ||
// CHECK: /* "thirty" */ 7 as UInt8, 116 as UInt8, 104 as UInt8, 105 as UInt8, 114 as UInt8, 116 as UInt8, 121 as UInt8, 0 as UInt8 | ||
// CHECK: ) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So a
.
inside of a character enumeration[]
does not match any character?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, character classes match their contents literally (generally speaking, there could be some exceptions I am unaware of). This works for other metacharacters too, ex
[+]
,[$]
, etc.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This kind of usage is used as an alternative to backslash escaping.