Skip to content

Conversation

kastiglione
Copy link
Contributor

@kastiglione kastiglione commented Oct 3, 2025

This is for lldb, where the po command for Swift is implemented in _DebuggerSupport.stringForPrintObject.

Up to now, a Swift struct which conforms to CustomStringConvertible will print both its description, and also recursively print its internals.

This differs from a class, where only the description is printed.

This changes stringForPrintObject to print only the description of value types that conform to CustomStringConvertible (or debugDescription for CustomDebugStringConvertible) – unless the type conforms to CustomReflectable, in which case its children are printed.

This issue was raised for FilePath, which prints excessively verbosely, like so:

(lldb) po FilePath("/tmp")
▿ "/tmp"
  ▿ _storage : "/tmp"
    ▿ nullTerminatedStorage : 5 elements
      ▿ 0 : SystemChar
        - rawValue : 47
      ▿ 1 : SystemChar
        - rawValue : 116
      ▿ 2 : SystemChar
        - rawValue : 109
      ▿ 3 : SystemChar
        - rawValue : 112
      ▿ 4 : SystemChar
        - rawValue : 0

rdar://161919005

@kastiglione kastiglione marked this pull request as ready for review October 4, 2025 20:49
@kastiglione kastiglione requested a review from a team as a code owner October 4, 2025 20:49
@kastiglione
Copy link
Contributor Author

@swift-ci smoke test

kastiglione added a commit to swiftlang/llvm-project that referenced this pull request Oct 5, 2025
In conjunction with swiftlang/swift#84677

rdar://161919005
@kastiglione
Copy link
Contributor Author

swiftlang/llvm-project#11570

@swift-ci smoke test

2 similar comments
@kastiglione
Copy link
Contributor Author

swiftlang/llvm-project#11570

@swift-ci smoke test

@kastiglione
Copy link
Contributor Author

swiftlang/llvm-project#11570

@swift-ci smoke test

@kastiglione
Copy link
Contributor Author

swiftlang/llvm-project#11570

@swift-ci smoke test Linux

@kastiglione
Copy link
Contributor Author

swiftlang/llvm-project#11570

@swift-ci smoke test

@kastiglione kastiglione requested a review from lorentey October 6, 2025 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants