owenpan added a comment. In D107961#2946183 <https://reviews.llvm.org/D107961#2946183>, @MyDeveloperDay wrote:
> 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. The `IsTopLevel` and `Style.isCpp()` checks should cut it down a lot, and we are already doing this with `tryToParseJSFunction()` anyway. > 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. The latter although I did consider handling it in `isFunctionDeclarationName()` with the help of `TT_StartOfName` and `TT_FunctionOrDeclarationName`. In the end, I came to the conclusion that we must break the line in the unwrapped-line parser. > 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 I only break the line. The indentation would be lost even if we didn't break it. For example: int main(argc, argv) int argc; char *argv[]; would be formatted to: int main(argc, argv) int argc; char *argv[]; which is worse than: int main(argc, argv) int argc; char *argv[]; Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D107961/new/ https://reviews.llvm.org/D107961 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits