Skip to content

[lldb] Update Swift String summary formatter for new bridged case #9720

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lldb/source/Plugins/Language/Swift/SwiftFormatters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ static bool makeStringGutsSummary(
│ Immortal, Small ║ 1 │ASCII│ 1 │ 0 │
├─────────────────────╫─────┼─────┼─────┼─────┤
│ Immortal, Large ║ 1 │ 0 │ 0 │ 0 │
├─────────────────────╫─────┼─────┼─────┼─────┤
│ Immortal, Bridged ║ 1 │ 1 │ 0 │ 0 │
╞═════════════════════╬═════╪═════╪═════╪═════╡
│ Native ║ 0 │ 0 │ 0 │ 0 │
├─────────────────────╫─────┼─────┼─────┼─────┤
Expand Down Expand Up @@ -373,7 +375,7 @@ static bool makeStringGutsSummary(
if ((discriminator & 0b0111'0000) == 0)
return error("unexpected discriminator");

if ((discriminator & 0b1110'0000) == 0b0100'0000) { // 010xxxxx: Bridged
if ((discriminator & 0b0110'0000) == 0b0100'0000) { // x10xxxxx: Bridged
TypeSystemClangSP clang_ts_sp =
ScratchTypeSystemClang::GetForTarget(process->GetTarget());
if (!clang_ts_sp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ def test_swift_bridged_string_variables(self):
s4 = self.frame().FindVariable("s4")
s5 = self.frame().FindVariable("s5")
s6 = self.frame().FindVariable("s6")
s7 = self.frame().FindVariable("s7")

lldbutil.check_variable(self, s1, summary='"Hello world"')
lldbutil.check_variable(self, s2, summary='"ΞΕΛΛΘ"')
lldbutil.check_variable(self, s3, summary='"Hello world"')
lldbutil.check_variable(self, s4, summary='"ΞΕΛΛΘ"')
lldbutil.check_variable(self, s5, use_dynamic=True, summary='"abc"')
lldbutil.check_variable(self, s6, summary='"abc"')
lldbutil.check_variable(self, s7, summary='"kCFRunLoopDefaultMode"')

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func main()
let s4 = s2 as NSString
let s5 = "abc" as NSString
let s6 = String(s5)
let s7 = CFRunLoopMode.defaultMode!.rawValue as String
print(s1) // Set breakpoint here
withExtendedLifetime((s2, s3, s4, s5, s6)) {}
}
Expand Down