Page MenuHomePhabricator

Please use GitHub pull requests for new patches. Phabricator shutdown timeline

galenelias (Galen Elias)
User

Projects

User does not belong to any projects.

User Details

User Since
May 10 2023, 12:34 PM (20 w, 4 d)

Recent Activity

Aug 27 2023

galenelias added inline comments to D158795: [clang-format] Fix AlignArrayOfStructures + Cpp11BracedListStyle=false.
Aug 27 2023, 12:40 PM · Restricted Project, Restricted Project, Restricted Project
galenelias updated the diff for D158795: [clang-format] Fix AlignArrayOfStructures + Cpp11BracedListStyle=false.
Aug 27 2023, 12:38 PM · Restricted Project, Restricted Project, Restricted Project

Aug 26 2023

galenelias updated the diff for D158795: [clang-format] Fix AlignArrayOfStructures + Cpp11BracedListStyle=false.
Aug 26 2023, 10:11 PM · Restricted Project, Restricted Project, Restricted Project
galenelias added inline comments to D158795: [clang-format] Fix AlignArrayOfStructures + Cpp11BracedListStyle=false.
Aug 26 2023, 10:10 PM · Restricted Project, Restricted Project, Restricted Project

Aug 24 2023

galenelias requested review of D158795: [clang-format] Fix AlignArrayOfStructures + Cpp11BracedListStyle=false.
Aug 24 2023, 4:30 PM · Restricted Project, Restricted Project, Restricted Project

Jul 31 2023

galenelias added inline comments to D156705: [clang-format] Fix braced initializer formatting with templated base class initializer.
Jul 31 2023, 1:57 PM · Restricted Project, Restricted Project, Restricted Project
galenelias updated the diff for D156705: [clang-format] Fix braced initializer formatting with templated base class initializer.
Jul 31 2023, 1:57 PM · Restricted Project, Restricted Project, Restricted Project
galenelias requested review of D156705: [clang-format] Fix braced initializer formatting with templated base class initializer.
Jul 31 2023, 8:49 AM · Restricted Project, Restricted Project, Restricted Project

Jul 27 2023

galenelias added a comment to D150403: [clang-format] Adjust braced list detection (try 2).

This seems to cause a regression. See https://github.com/llvm/llvm-project/issues/64134. @galenelias any idea?

Jul 27 2023, 6:30 PM · Restricted Project, Restricted Project, Restricted Project

Jul 24 2023

galenelias updated the diff for D151761: clang-format: Add AlignConsecutiveShortCaseStatements.

Addresses latest review comments.

Jul 24 2023, 8:09 AM · Restricted Project, Restricted Project, Restricted Project
galenelias added a comment to D151761: clang-format: Add AlignConsecutiveShortCaseStatements.

FWIW, I think we can use a shorter name AlignConsecutiveCaseStatements instead of AlignConsecutiveShortCaseStatements.

Jul 24 2023, 8:08 AM · Restricted Project, Restricted Project, Restricted Project

Jul 21 2023

galenelias added a comment to D151761: clang-format: Add AlignConsecutiveShortCaseStatements.

Thanks for the patience, I'm really looking forward to use this.

But please wait for other opinions.

Jul 21 2023, 7:49 PM · Restricted Project, Restricted Project, Restricted Project

Jul 7 2023

galenelias updated the diff for D151761: clang-format: Add AlignConsecutiveShortCaseStatements.

Addressed outstanding review comments.

Jul 7 2023, 3:50 PM · Restricted Project, Restricted Project, Restricted Project
galenelias added inline comments to D151761: clang-format: Add AlignConsecutiveShortCaseStatements.
Jul 7 2023, 3:49 PM · Restricted Project, Restricted Project, Restricted Project
galenelias updated the diff for D151761: clang-format: Add AlignConsecutiveShortCaseStatements.

This iteration switches away from using AlignConsecutiveStyle and instead uses a new ShortCaseStatementsAlignmentStyle.

Jul 7 2023, 12:26 PM · Restricted Project, Restricted Project, Restricted Project
galenelias added inline comments to D151761: clang-format: Add AlignConsecutiveShortCaseStatements.
Jul 7 2023, 12:23 PM · Restricted Project, Restricted Project, Restricted Project

Jul 5 2023

galenelias updated the diff for D151761: clang-format: Add AlignConsecutiveShortCaseStatements.

I re-wrote the alignment to stop using AlignTokens so that I can now handle all the edge cases that came up. Specifically:

  • Allowing empty case labels (implicit fall through) to not break the alignment, but only if they are sandwiched by short case statements.
  • Don't align the colon of a non-short case label that follows short case labels when using 'AlignCaseColons=true'.
  • Empty case labels will also now push out the alignment of the statements when using AlignCaseColons=false.
Jul 5 2023, 9:24 AM · Restricted Project, Restricted Project, Restricted Project

Jun 12 2023

galenelias added a comment to D151761: clang-format: Add AlignConsecutiveShortCaseStatements.

Well, I guess I didn't put quite enough thought into the AlignCaseColons option. While this solves the empty case label problem, it will also match in non-short case label scenarios such as the following, which doesn't seem desirable:

Jun 12 2023, 9:39 PM · Restricted Project, Restricted Project, Restricted Project
galenelias updated the diff for D151761: clang-format: Add AlignConsecutiveShortCaseStatements.

Ok, I added the ability to align the case label colons. In your original message you mentioned "I'd like to align the colon (and thus the statement behind that)" which implies actually adding the whitespace after the 'case' token itself. Not sure if that would still be your preference in an ideal world, or if I just misinterpreted your request. Aligning the colons themselves is very straightforward.

Jun 12 2023, 4:51 PM · Restricted Project, Restricted Project, Restricted Project

Jun 9 2023

galenelias added a comment to D151761: clang-format: Add AlignConsecutiveShortCaseStatements.

I'd say: align it.

If it was straightforward, I would definitely agree to just align across empty case labels, but unfortunately there is no way to do that while using the generic AlignTokens (since the line with just a case has no token which matches the pattern, but needs to not break the alignment streak). I guess the way to do it generically would be to add some sort of ExcludeLine lambda to allow filtering out lines. Given that I don't think this is a common pattern with these 'Short Case Labels', and it's fairly easy to work around with [[fallthrough]]; my plan is just to leave this as is (and add a test to make the behavior explicit).

Leaving it open (and documenting that) I could get behind, but making it explicit as desired behavior will not get my approval. On the other hand I will not stand in the way, if the others approve.

Jun 9 2023, 2:51 PM · Restricted Project, Restricted Project, Restricted Project

Jun 7 2023

galenelias updated the diff for D151761: clang-format: Add AlignConsecutiveShortCaseStatements.
Jun 7 2023, 10:53 AM · Restricted Project, Restricted Project, Restricted Project
galenelias added a comment to D151761: clang-format: Add AlignConsecutiveShortCaseStatements.

did you consider a case where the case falls through? (i.e. no return)

"case log::info :    return \"info\";\n"
"case log::warning :\n"
"default :           return \"default\";\n"

That's a great point. I didn't really consider this, and currently this particular case won't align the case statements if they have an empty case block, however if you had some tokens (e.g. // fallthrough) it would. It's not immediately clear to me what the expectation would be. I guess to align as if there was an invisible trailing token, but it's a bit awkward if the cases missing a body are the 'long' cases that push out the alignment. Also, I don't think it's possible to use AlignTokens and get this behavior, as there is no token on those lines to align, so it's not straightforward to handle. I guess I'll be curious to see if there is feedback or cases where this behavior is desired, and if so, I can look into adding that functionality later. Since right now it would involve a completely custom AlignTokens clone, my preference would be to just leave this as not supported.

I'd say: align it.

Jun 7 2023, 10:51 AM · Restricted Project, Restricted Project, Restricted Project

Jun 6 2023

galenelias added a comment to D151761: clang-format: Add AlignConsecutiveShortCaseStatements.

did you consider a case where the case falls through? (i.e. no return)

"case log::info :    return \"info\";\n"
"case log::warning :\n"
"default :           return \"default\";\n"
Jun 6 2023, 9:56 AM · Restricted Project, Restricted Project, Restricted Project
galenelias added inline comments to D151761: clang-format: Add AlignConsecutiveShortCaseStatements.
Jun 6 2023, 9:46 AM · Restricted Project, Restricted Project, Restricted Project

Jun 3 2023

galenelias added inline comments to D151761: clang-format: Add AlignConsecutiveShortCaseStatements.
Jun 3 2023, 10:08 AM · Restricted Project, Restricted Project, Restricted Project
galenelias updated the diff for D151761: clang-format: Add AlignConsecutiveShortCaseStatements.

Fixup up review comments.

Jun 3 2023, 10:04 AM · Restricted Project, Restricted Project, Restricted Project

Jun 2 2023

galenelias updated the diff for D151761: clang-format: Add AlignConsecutiveShortCaseStatements.
Jun 2 2023, 10:36 PM · Restricted Project, Restricted Project, Restricted Project

May 31 2023

galenelias added inline comments to D151761: clang-format: Add AlignConsecutiveShortCaseStatements.
May 31 2023, 9:44 PM · Restricted Project, Restricted Project, Restricted Project
galenelias added a comment to D151761: clang-format: Add AlignConsecutiveShortCaseStatements.

When I read the title I thought "Yay, some one is doing what I want and don't find the time.", but (for me) sadly you're not.
I'd like to align the colon (and thus the statement behind that). Do you think you can add that option too?

May 31 2023, 3:06 PM · Restricted Project, Restricted Project, Restricted Project

May 30 2023

galenelias requested review of D151761: clang-format: Add AlignConsecutiveShortCaseStatements.
May 30 2023, 4:01 PM · Restricted Project, Restricted Project, Restricted Project

May 22 2023

galenelias updated the diff for D150403: [clang-format] Adjust braced list detection (try 2).

Thanks for the additional review comments. Hopefully everything if fixed.

May 22 2023, 2:06 PM · Restricted Project, Restricted Project, Restricted Project

May 17 2023

galenelias added a comment to D150403: [clang-format] Adjust braced list detection (try 2).

We'll wait a bit, if someone might have a comment. And (at least I) need name and email for the commit.

May 17 2023, 9:45 AM · Restricted Project, Restricted Project, Restricted Project

May 15 2023

galenelias added a comment to D150403: [clang-format] Adjust braced list detection (try 2).

Thanks @HazardyKnusperkeks! I don't have commit access, so will need someone to land this for me.

May 15 2023, 1:50 PM · Restricted Project, Restricted Project, Restricted Project
galenelias added a comment to D150403: [clang-format] Adjust braced list detection (try 2).

Thanks for the review and feedback. Sorry about the unfortunate timing between @sstwcw and my fix - we submitted our fixes less than 24 hours apart. I didn't think there would be another simultaneous fix for this 5 year old bug, so didn't even think to link to the review in the GitHub issue. I will definitely do this for any future contributions.

May 15 2023, 10:11 AM · Restricted Project, Restricted Project, Restricted Project
galenelias updated the diff for D150403: [clang-format] Adjust braced list detection (try 2).

Addressed remaining review feedback.

May 15 2023, 10:06 AM · Restricted Project, Restricted Project, Restricted Project

May 12 2023

galenelias updated the summary of D150403: [clang-format] Adjust braced list detection (try 2).
May 12 2023, 9:02 PM · Restricted Project, Restricted Project, Restricted Project
galenelias added a comment to D150403: [clang-format] Adjust braced list detection (try 2).

@HazardyKnusperkeks, thanks for the feedback. I added the TokenAnnotatorTests from @sstwcw's review. I also updated the design to use a single stack instead of the two parallel stacks.

May 12 2023, 4:04 PM · Restricted Project, Restricted Project, Restricted Project
galenelias updated the diff for D150403: [clang-format] Adjust braced list detection (try 2).
May 12 2023, 4:01 PM · Restricted Project, Restricted Project, Restricted Project
galenelias added a comment to D150452: [clang-format] Recognize nested blocks.

Coincidentally I also sent out a review to fix this issue yesterday, but went with a different approach of trying to scope the ProbablyBracedList logic by just looking at the lbrace previous token.

May 12 2023, 10:59 AM · Restricted Project, Restricted Project, Restricted Project
galenelias updated subscribers of D150403: [clang-format] Adjust braced list detection (try 2).

Looks like @sstwcw also submitted a fix for the same issue, with a bit of a different approach: https://reviews.llvm.org/D150452

May 12 2023, 10:56 AM · Restricted Project, Restricted Project, Restricted Project

May 11 2023

galenelias requested review of D150403: [clang-format] Adjust braced list detection (try 2).
May 11 2023, 3:03 PM · Restricted Project, Restricted Project, Restricted Project