[PATCH] D107961: [clang-format] Distinguish K&R C function definition and attribute

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 16 00:45:32 PDT 2021


MyDeveloperDay added a comment.

Nit: There is something niggling in the back of my mind that this is too much logic here to be in parseStructuralElement that sort of suggests to me that this isn't the correct place to handle this.

I don't really see any other structural element being handled like this and I'm a little concerned that we could end up in this code for more than just function declarations as parseStructuralElement is called from all over the place.

There seems to be no reference to TT_FunctionOrDecalartionName or TT_StartOfName which I would normally consider to be indicators of a function. I think ultimately you are trying to identify a function which doesn't have type information as actually being a function

so I sort of feel it should be in isFunctionDeclarationName, did you consider that at any point? or is the problem about trying to add the newline after.

What made you decide it should always have a new line and what about indentation? I see alot of code on github like this?

int main(argc, argv)
	int argc;
	char **argv;
int main (argc, argv)
int argc;
char *argv[];
int main(argc, argv) int argc;
char** argv;
int main(argc, argv)int argc; char* argv [];
Aren't we now going to unify them around a single style?

https://github.com/search?l=C&p=99&q=%22int+main%28argc%2C+argv%29%22&type=Code


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107961/new/

https://reviews.llvm.org/D107961



More information about the cfe-commits mailing list