-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[stdlib] Clean up debug printing code #18126
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
Conversation
@swift-ci please test |
bd8d32b
to
d48a907
Compare
printedElements += 1 | ||
} | ||
} | ||
|
||
// LLDB uses this function in expressions, and if it is inlined the resulting | ||
// LLVM IR is enormous. As a result, to improve LLDB performance we are not | ||
// making it @inlinable. | ||
public static func stringForPrintObject(_ value: Any) -> String { | ||
var maxItemCounter = Int.max |
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 is... quite a big maximum.
public | ||
func _debuggerTestingCheckExpect(_ checked_value: String, | ||
_ expected_value: String) {} | ||
public func _debuggerTestingCheckExpect(_: String, _: String) { } |
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.
Seems like this global symbol could be eliminated and users could call into the _DebuggerSupport
version directly.
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.
I think the retain count getters below could be moved into _DebuggerSupport
, too, so that stringForPrintObject
isn't the only definition there.
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, I think there's no reason to keep this global.
@swift-ci please test |
@swift-ci please clean test macOS platform |
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.
Nice!
public | ||
func _debuggerTestingCheckExpect(_ checked_value: String, | ||
_ expected_value: String) {} | ||
public func _debuggerTestingCheckExpect(_: String, _: String) { } |
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.
I think the retain count getters below could be moved into _DebuggerSupport
, too, so that stringForPrintObject
isn't the only definition there.
public | ||
func _debuggerTestingCheckExpect(_ checked_value: String, | ||
_ expected_value: String) {} | ||
public func _debuggerTestingCheckExpect(_: String, _: String) { } |
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, I think there's no reason to keep this global.
printedElements += 1 | ||
} | ||
} | ||
|
||
// LLDB uses this function in expressions, and if it is inlined the resulting |
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.
Is this comment stale?
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.
Yep! I'm going to land this, and then will take care of that in a follow-up PR, at the same time as moving those global symbols.
Cool. Thanks for the spring cleaning. |
This code has been largely untouched since the early days and has missed out on a few possible improvements since, especially with optionals. Hopefully a NFC, though it doesn't look like it's got full test coverage.
Also removed all inlineable annotations – it oughtn't be necessary to inline any code if it's for debugging, and there's no public generic code to specialize.