-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
[clang-format] Incorrectly identifies empty function as bracedList #58251
Comments
@llvm/issue-subscribers-bug |
@llvm/issue-subscribers-clang-format |
While working on a fix for #58217 (namely https://reviews.llvm.org/D135466) we identified that |
Also see #57305 (comment). Not exactly a duplicate but the same underlying bug, i'm assuming |
The more I look at this the more I think this is harder than we first think, simply assuming this auto i = decltype(x) {}; to this auto i = decltype(x) {} which would be a compile error So we'd really need yet more semantic (or derived semantic) information about what makes {}; a function body. The unwrappered parser when we are determining the block type is before the annotator which identified the ')' as a TypeDeclarationParen, but this would be useful information to have. I wonder if there is something we can do after the function name has been identified as At present we get this.. Expected & Input void a() {}
void a() {};
void a() { return a;}
void a() { return a;}; Clang-Format current output void a() {}
void a(){};
void a() { return a; }
void a() { return a; }; |
I definitely couldn't fix it. I concluded that determining if a function declaration is being dealt with (i.e. |
feel free to have a go. |
Also fixed some existing test cases. Fixed llvm#57305. Fixed llvm#58251.
Also fixed some existing test cases. Fixed llvm#57305. Fixed llvm#58251.
Also fixed some existing test cases. Fixed llvm#57305. Fixed llvm#58251.
Because clang-format cannot determine
{}
as an empty function is leaves out a space between the)
and the{
as it doesn't identify the{
as aTT_FunctionLBrace
Add an issue for tracking a potential change to fix that.
The text was updated successfully, but these errors were encountered: