================ @@ -1429,6 +1429,37 @@ TEST_F(FormatTestComments, CommentsInStaticInitializers) { " 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // comment\n" " 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // comment\n" " 0x00, 0x00, 0x00, 0x00}; // comment"); + + // The usual 'open brace with trailing comment' behaviour is to forcibly + // break the trailing comment onto onto a new line - + FormatStyle Style = getLLVMStyle(); + Style.AlignAfterOpenBracket = FormatStyle::BAS_BlockIndent; + StringRef Input = "int a[2][2] = {\n" + " { // a\n" + " 0, // x\n" + " 1,\n" + " },\n" + " {\n" + " 2,\n" + " 3, // y\n" + " }\n" + "};"; + verifyFormat("int a[2][2] = {\n" + " {\n" + " // a\n" + " 0, // x\n" + " 1,\n" + " },\n" + " {\n" + " 2,\n" + " 3, // y\n" + " }\n" + "};", + Input, Style); + // But, especially for nested, multi-dimensional initialization, allowing + // open braces with trailing comments can be desirable - ---------------- mydeveloperday wrote:
extraneous - normally we end with a period (.) https://github.com/llvm/llvm-project/pull/89956 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits