GSOC 2021 : Improvements to clang-format and clang-tidy to format code according to haiku coding guidelines | Haiku Project

I am Saloni B.Tech.(3rd year), Computer Science and Engineering(CSE) student of Guru Nanak Dev Engineering College, India. I have been selected for Google Summer of Code 2021 to work with Haiku on the project Improvements to clang-format and clang-tidy to format code according to haiku coding guidelines. My mentors are Preetpal Kaur and Adrien Destugues.


This is a companion discussion topic for the original entry at https://www.haiku-os.org/blog/saloni/2021-05-20_gsoc_2021__improvements_to_clang-format_and_clang-tidy_to_format_code_according_to_haiku_coding_guidelines/
10 Likes

Congrats! I have just reviewed some of your work and would like to offer a few tips:

  • You should rebase your code to my latest (6+ months old though) haiku-format as most of the work you have been doing had already been done there. (See #18, #21, and #22.)

  • Do not add Haiku-specific style options like I initially did here. Instead, see the much simpler approach I later took.

  • Take a look at some of my previous work for clang-format to get a feeling for how to fix bugs in, and add features to, clang-format. Pay attention to the test cases added to the test suite as it’s very easy to trigger a regression.

Good luck!

2 Likes

Hi!

We know of your work but some of it was removed from the current branch because it was not working correctly. For example the code to remove unneeded braces on single-statement if/else would sometime remove braces on multi-statement ones. That’s why it has been replaced by a different implementation that was extracted from a work in progress change in llvm bugtracker (and I think we can use the final version of that when it will be merged on llvm side)

For example the code to remove unneeded braces on single-statement if/else would sometime remove braces on multi-statement ones.

I already removed it in this commit last year based on feedback from korli and then you. See the rationale here.

I also addressed all other issues (except #17) reported by you in subsequent commits. So as of late last year, there were no open issues (other than #17) that warranted further investigation.

That’s why it has been replaced by a different implementation that was extracted from a work in progress change in llvm bugtracker (and I think we can use the final version of that when it will be merged on llvm side)

Are you talking about ⚙ D95168 [clang-format] Add InsertBraces option? But it’s kind of the opposite of removing redundant braces. Anyway, beware that it didn’t get landed after all because it failed when tested against a large code base.