Skip to content

[lldb] Add summary formatter for TaskPriority #10205

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

Conversation

kastiglione
Copy link

@kastiglione kastiglione commented Mar 7, 2025

Add a summary formatter for TaskPriority to print values with the names of the constants. See https://developer.apple.com/documentation/swift/taskpriority

Some values have more than one name, ex high and userInitiated are the same value. The definition of TaskPriority defines some some constants in terms of others. This summary formatter uses the seemingly "primary" names. As a result, if a user expects to see userInitiated, they will see high instead. Similarly, they'll see low instead of utility, and medium instead of default.

@kastiglione kastiglione requested a review from a team as a code owner March 7, 2025 21:35
@kastiglione
Copy link
Author

@swift-ci test

@kastiglione
Copy link
Author

A follow up change will change the type of Task's enqueuePriority property to to TaskPriority. This will allow developers to see the semantic name for the priority, instead of a raw value number.

Copy link

@felipepiovezan felipepiovezan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@kastiglione kastiglione merged commit de43ec3 into stable/20240723 Mar 8, 2025
3 checks passed
@kastiglione kastiglione deleted the dl/lldb-Add-summary-formatter-for-TaskPriority branch March 8, 2025 06:00
kastiglione added a commit that referenced this pull request Mar 10, 2025
Changes the type of `enqueuePriority` to `TaskPriority`. This allows Tasks to be displayed using human readable names added in #10205 (`TaskPriority` summary provider).
kastiglione added a commit that referenced this pull request Mar 11, 2025
Add a summary formatter for `TaskPriority` to print values with the names of the constants. See https://developer.apple.com/documentation/swift/taskpriority

Some values have more than one name, ex `high` and `userInitiated` are the same value. The [definition of `TaskPriority`](https://github.com/swiftlang/swift/blob/28f96411c9a1fe9c8768ac48c24a6974973876ff/stdlib/public/Concurrency/Task.swift#L308-L331) defines some some constants in terms of others. This summary formatter uses the seemingly "primary" names. As a result, if a user expects to see `userInitiated`, they will see `high` instead. Similarly, they'll see `low` instead of `utility`, and `medium` instead of `default`.

(cherry-picked from commit de43ec3)
kastiglione added a commit that referenced this pull request Mar 11, 2025
Add a summary formatter for `TaskPriority` to print values with the names of the constants. See https://developer.apple.com/documentation/swift/taskpriority

Some values have more than one name, ex `high` and `userInitiated` are the same value. The [definition of `TaskPriority`](https://github.com/swiftlang/swift/blob/28f96411c9a1fe9c8768ac48c24a6974973876ff/stdlib/public/Concurrency/Task.swift#L308-L331) defines some some constants in terms of others. This summary formatter uses the seemingly "primary" names. As a result, if a user expects to see `userInitiated`, they will see `high` instead. Similarly, they'll see `low` instead of `utility`, and `medium` instead of `default`.

(cherry-picked from commit de43ec3)
kastiglione added a commit that referenced this pull request Mar 11, 2025
Changes the type of `enqueuePriority` to `TaskPriority`. This allows Tasks to be displayed using human readable names added in #10205 (`TaskPriority` summary provider).

(cherry-picked from commit 1c65036)
kastiglione added a commit that referenced this pull request Mar 11, 2025
Changes the type of `enqueuePriority` to `TaskPriority`. This allows Tasks to be displayed using human readable names added in #10205 (`TaskPriority` summary provider).

(cherry-picked from commit 1c65036)
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