Skip to content

[lldb/formatter] Format single valued OptionSets w/o brackets #1728

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
merged 7 commits into from
Sep 3, 2020
Merged

[lldb/formatter] Format single valued OptionSets w/o brackets #1728

merged 7 commits into from
Sep 3, 2020

Conversation

kastiglione
Copy link

@kastiglione kastiglione commented Sep 1, 2020

Special case formatting of single valued option sets to print the case name without square brackets.

For example, instead producing [.yellow], the output will be .yellow.

rdar://54106278

@adrian-prantl
Copy link

Nice!

@adrian-prantl
Copy link

My understanding is that swiftlang/swift#33731 is imminent, so we might want to hold off on actually merging this until the rebranch is complete. (Fingers crossed that it will actually happen soon).

@medismailben
Copy link

Special case formatting of single valued option sets to print the case name without square brackets.

For example, instead producing [.yellow], the output will be .yellow.

It's a good practice to add the bug tracking number in your commit/PR so people can get more context/history of what you're working on 🙂

@kastiglione
Copy link
Author

@medismailben thanks, done.

@adrian-prantl
Copy link

My understanding is that swiftlang/swift#33731 is imminent, so we might want to hold off on actually merging this until the rebranch is complete. (Fingers crossed that it will actually happen soon).

Even better: Since your change doesn't need anything in master-rebranch, you can just do it in swift/master and swift/master-next — and it will be picked up by the rebranch automatically.

@kastiglione kastiglione changed the base branch from swift/master-rebranch to apple/master September 1, 2020 23:39
@kastiglione kastiglione changed the base branch from apple/master to swift/master September 1, 2020 23:39
@kastiglione
Copy link
Author

I've retargeted this PR to swift/master.

@adrian-prantl adrian-prantl self-requested a review September 2, 2020 19:23
@@ -167,6 +167,12 @@ bool lldb_private::formatters::swift::SwiftOptionSetSummaryProvider::

for (auto val_name : *m_cases) {
llvm::APInt case_value = val_name.first;
// Print single valued sets without using enclosing brackets.
if (case_value == value) {
ss << '.' << val_name.second;

Choose a reason for hiding this comment

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

might be nice to also make this change on line 184 and 187 in a follow-up commit.

@adrian-prantl
Copy link

Thanks!

@adrian-prantl
Copy link

@swift-ci test

@kastiglione
Copy link
Author

I realized my added test cases needed matching expression tests. I've pushed an update, can you kick off a new test?

@adrian-prantl
Copy link

@swift-ci test

@adrian-prantl
Copy link

Is there also a matching PR for master-next?

@kastiglione
Copy link
Author

I haven't created one, sounds like I should, I will.

@kastiglione
Copy link
Author

master-next: #1735

@adrian-prantl adrian-prantl merged commit a5de9f5 into swiftlang:swift/master Sep 3, 2020
@kastiglione kastiglione deleted the dl/lldb-formatter-Format-single-valued-OptionSets-w-o-brackets branch September 3, 2020 15:57
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.

4 participants