Skip to content

[clang-format] No space between between ) and { at constructor/destructor when there is a semicolon at the end. #79834

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

Closed
CDAlexanderW opened this issue Jan 29, 2024 · 3 comments · Fixed by #82097
Assignees

Comments

@CDAlexanderW
Copy link

Environment

The tested v18 clang-format executable was built from latest source of 15.01.2024.

Setting in .clang-format is:

Language: Cpp

Problem

No space between between ) and { at constructor/destructor when there is a semicolon at the end. A member function seems to work by adding the space, due to the fix #72733 in version 18.

class A {
  A(){};
  void b() {};
};

When adding something (in that case int i;) into the implementation, it seems to work for the constructor:

class A {
  ~A() { int i; };
  void s() { int i; };
};

It looks like #58251 mentions clang-format "cannot determine {} as an empty function".

For our case maybe a fix of #79833 would also workaround this in case you automatically let the semicolons removed. I don't know if they are related in some way, so I tried to split them into separate issues.

@j2kun
Copy link
Contributor

j2kun commented Apr 1, 2024

Would it be possible to get this cherry-picked into the next patch release of llvm-18? It doesn't appear to have made it into llvm-18.1.2, even though the commit was merged before it was released.

@owenca
Copy link
Contributor

owenca commented Apr 2, 2024

I've added #82097 to the LLVM 18 Release milestone.

@j2kun
Copy link
Contributor

j2kun commented Apr 2, 2024 via email

llvmbot pushed a commit to llvmbot/llvm-project that referenced this issue Apr 5, 2024
tstellar pushed a commit to llvmbot/llvm-project that referenced this issue Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants