llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[clang-format] Missing option for C++20 `export` blocks

Open ifarbod opened this issue 3 months ago • 6 comments

It'd be nice to have an option for export blocks' brace placements:

BraceWrapping:
  AfterExportBlock:  true

Currently, all export blocks are formatted like this:

export {
  // ...
}

ifarbod avatar Aug 17 '26 17:08 ifarbod

@llvm/issue-subscribers-clang-format

Author: iFarbod (ifarbod)

It'd be nice to have an option for export blocks' brace placements:
BraceWrapping:
  AfterExportBlock:  true

Currently, all export blocks are formatted like this:

export {
  // ...
}

Should be fairly simple. Do you want to give it a try?

HazardyKnusperkeks avatar Aug 17 '26 20:08 HazardyKnusperkeks

Hi!

This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:

  1. Check that no other contributor is working on this issue. If someone is assigned to the issue or claimed to be working on it, ping the person. After one week without a response, the assignee may be changed.
  2. Leave a comment indicating that you are working on the issue, or just create a pull request after following the steps below. Mention this issue in the description of the pull request.
  3. Fix the issue locally. Be aware that LLVM's AI policy forbids the use of AI tools to fix good first issues since it squanders a learning opportunity. Using LLMs to search and learn is permitted, since the goal is learning.
  4. Run the test suite locally. Remember that the subdirectories under test/ create fine-grained testing targets, so you can e.g. use make check-clang-ast to only run Clang's AST tests.
  5. Create a Git commit.
  6. Run git clang-format HEAD~1 to format your changes.
  7. Open a pull request to the upstream repository on GitHub. Detailed instructions can be found in GitHub's documentation. Mention this issue in the description of the pull request.

If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below.

@llvm/issue-subscribers-good-first-issue

Author: iFarbod (ifarbod)

It'd be nice to have an option for export blocks' brace placements:
BraceWrapping:
  AfterExportBlock:  true

Currently, all export blocks are formatted like this:

export {
  // ...
}

Hi @HazardyKnusperkeks, I would like to work on this. will research the implementation details and submit a PR soon.

AhmedKamel10 avatar Aug 17 '26 20:08 AhmedKamel10

I've submitted a pull request to address this: #216892

AhmedKamel10 avatar Aug 18 '26 00:08 AhmedKamel10