[clang] [clang-format] Fix a regression in annotating struct braces (PR #92352)

2024-05-15 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/92352 Fixes #92350. >From d6f338d050bba640e90da983cac34111cdbf56c2 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Wed, 15 May 2024 22:38:29 -0700 Subject: [PATCH] [clang-format] Fix a regression in annotating struct bra

[clang] [clang-format] Don't always break before << between string literals (PR #92214)

2024-05-16 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/92214 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix a regression in annotating struct braces (PR #92352)

2024-05-16 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/92352 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix a regression in annotating goto labels (PR #92494)

2024-05-16 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/92494 Fixes #92300. >From 530b15d68c66b0f1414329a8e190b27c2e6bf106 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 16 May 2024 20:49:17 -0700 Subject: [PATCH] [clang-format] Fix a regression in annotating goto label

[clang] [clang-format] Fix a regression in annotating goto labels (PR #92494)

2024-05-16 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/92494 >From d9f113101028c68465e8befe7db1d4c206daa535 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 16 May 2024 20:49:17 -0700 Subject: [PATCH] [clang-format] Fix a bug in formatting goto labels in macros Fixes #92

[clang] [clang-format] Fix a bug in formatting goto labels in macros (PR #92494)

2024-05-16 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/92494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] 2d5e488 - [clang-format][NFC] Clean up SortIncludesTest.cpp

2024-05-19 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-05-19T15:19:05-07:00 New Revision: 2d5e488c98225108aebfe4aa4acfe6ec1f234a37 URL: https://github.com/llvm/llvm-project/commit/2d5e488c98225108aebfe4aa4acfe6ec1f234a37 DIFF: https://github.com/llvm/llvm-project/commit/2d5e488c98225108aebfe4aa4acfe6ec1f234a37.diff LOG:

[clang] 1c58208 - [clang-format][NFC] Remove redundnat llvm::, clang::, etc.

2024-05-20 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-05-20T20:32:18-07:00 New Revision: 1c58208d899285318c89e069268145c85ec33368 URL: https://github.com/llvm/llvm-project/commit/1c58208d899285318c89e069268145c85ec33368 DIFF: https://github.com/llvm/llvm-project/commit/1c58208d899285318c89e069268145c85ec33368.diff LOG:

[clang] [clang-format] Add space after a word token (PR #92741)

2024-05-21 Thread Owen Pan via cfe-commits
owenca wrote: > Since I am by no means an expert on Clang, a few questions arose > > * As Clang formats the code correctly (no code changes necessary) when > instead of `xor` a different function name e.g. `xooor` is used, I wonder why > `xor` is tokenized as Unary operator in the first place

[clang] [clang-format] Add space after a word token (PR #92741)

2024-05-21 Thread Owen Pan via cfe-commits
@@ -5280,7 +5280,8 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line, // handled. if (Left.is(tok::amp) && Right.is(tok::r_square)) return Style.SpacesInSquareBrackets; -return Style.SpaceAfterLogicalNot && Left.is(tok::exclaim); +retu

[clang] [clang-format] Fix a bug in formatting goto labels in macros (PR #92494)

2024-05-21 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/92494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Correctly annotate C++ alternative operators in C (PR #92880)

2024-05-21 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/92880 PR #90161 uncovered a bug that annotates C++ xor as UnaryOperator if followed by a binary operator. This patch fixes that and all other C++ alternative operator keywords when followed by a binary operator in C.

[clang] [clang-format] Correctly annotate C++ alternative operators in C (PR #92880)

2024-05-21 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/92880 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add space after a word token (PR #92741)

2024-05-21 Thread Owen Pan via cfe-commits
owenca wrote: See #92880. https://github.com/llvm/llvm-project/pull/92741 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-22 Thread Owen Pan via cfe-commits
@@ -1358,6 +1358,8 @@ class AnnotatingParser { Line.First->startsSequence(tok::kw_export, Keywords.kw_module) || Line.First->startsSequence(tok::kw_export, Keywords.kw_import)) { Tok->setType(TT_ModulePartitionColon); + } else if (Line.First->is

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-22 Thread Owen Pan via cfe-commits
@@ -1489,11 +1489,25 @@ TEST_F(TokenAnnotatorTest, RequiresDoesNotChangeParsingOfTheRest) { TEST_F(TokenAnnotatorTest, UnderstandsAsm) { auto Tokens = annotate("__asm{\n" "a:\n" - "};"); - ASSERT_EQ(Tokens.size(), 7u) << Toke

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-22 Thread Owen Pan via cfe-commits
@@ -1489,11 +1489,25 @@ TEST_F(TokenAnnotatorTest, RequiresDoesNotChangeParsingOfTheRest) { TEST_F(TokenAnnotatorTest, UnderstandsAsm) { auto Tokens = annotate("__asm{\n" "a:\n" - "};"); - ASSERT_EQ(Tokens.size(), 7u) << Toke

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-23 Thread Owen Pan via cfe-commits
@@ -1488,12 +1488,91 @@ TEST_F(TokenAnnotatorTest, RequiresDoesNotChangeParsingOfTheRest) { TEST_F(TokenAnnotatorTest, UnderstandsAsm) { auto Tokens = annotate("__asm{\n" - "a:\n" - "};"); - ASSERT_EQ(Tokens.size(), 7u) << To

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-23 Thread Owen Pan via cfe-commits
@@ -1426,12 +1428,9 @@ class AnnotatingParser { // the colon are passed as macro arguments. Tok->setType(TT_ObjCMethodExpr); } else if (Contexts.back().ContextKind == tok::l_paren && - !Line.InPragmaDirective) { -if (Style.isTableGe

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-23 Thread Owen Pan via cfe-commits
@@ -1488,12 +1488,91 @@ TEST_F(TokenAnnotatorTest, RequiresDoesNotChangeParsingOfTheRest) { TEST_F(TokenAnnotatorTest, UnderstandsAsm) { auto Tokens = annotate("__asm{\n" - "a:\n" - "};"); - ASSERT_EQ(Tokens.size(), 7u) << To

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-23 Thread Owen Pan via cfe-commits
@@ -1488,12 +1488,91 @@ TEST_F(TokenAnnotatorTest, RequiresDoesNotChangeParsingOfTheRest) { TEST_F(TokenAnnotatorTest, UnderstandsAsm) { auto Tokens = annotate("__asm{\n" - "a:\n" - "};"); - ASSERT_EQ(Tokens.size(), 7u) << To

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-23 Thread Owen Pan via cfe-commits
@@ -1488,12 +1488,91 @@ TEST_F(TokenAnnotatorTest, RequiresDoesNotChangeParsingOfTheRest) { TEST_F(TokenAnnotatorTest, UnderstandsAsm) { auto Tokens = annotate("__asm{\n" - "a:\n" - "};"); - ASSERT_EQ(Tokens.size(), 7u) << To

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-24 Thread Owen Pan via cfe-commits
https://github.com/owenca commented: It seems that you used 5 different assembly snippets and repeated each 3-6 times. Instead, we can have something like the following: ``` asm{Snippet 1}; __asm(Snippet 2); __asm__(Snippet 3); asm volatile (Snippet 4); __asm volatile (Snippet 5); ``` Also,

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-24 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/92617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-24 Thread Owen Pan via cfe-commits
@@ -1488,12 +1488,247 @@ TEST_F(TokenAnnotatorTest, RequiresDoesNotChangeParsingOfTheRest) { TEST_F(TokenAnnotatorTest, UnderstandsAsm) { auto Tokens = annotate("__asm{\n" - "a:\n" - "};"); - ASSERT_EQ(Tokens.size(), 7u) << T

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-24 Thread Owen Pan via cfe-commits
@@ -1488,12 +1488,247 @@ TEST_F(TokenAnnotatorTest, RequiresDoesNotChangeParsingOfTheRest) { TEST_F(TokenAnnotatorTest, UnderstandsAsm) { auto Tokens = annotate("__asm{\n" - "a:\n" - "};"); - ASSERT_EQ(Tokens.size(), 7u) << T

[clang] [clang-format] Don't always break before << between string literals (PR #92214)

2024-05-24 Thread Owen Pan via cfe-commits
@@ -10539,6 +10539,17 @@ TEST_F(FormatTest, KeepStringLabelValuePairsOnALine) { " bbb);"); } +TEST_F(FormatTest, WrapBeforeInsertionOperatorbetweenStringLiterals) { + verifyFormat("QStringList() << \"foo\" << \"bar\";");

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-25 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/92617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-25 Thread Owen Pan via cfe-commits
https://github.com/owenca approved this pull request. https://github.com/llvm/llvm-project/pull/92617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-25 Thread Owen Pan via cfe-commits
@@ -1488,12 +1488,81 @@ TEST_F(TokenAnnotatorTest, RequiresDoesNotChangeParsingOfTheRest) { TEST_F(TokenAnnotatorTest, UnderstandsAsm) { auto Tokens = annotate("__asm{\n" - "a:\n" - "};"); - ASSERT_EQ(Tokens.size(), 7u) << To

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-25 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/92617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-25 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/92617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-25 Thread Owen Pan via cfe-commits
@@ -1488,12 +1488,81 @@ TEST_F(TokenAnnotatorTest, RequiresDoesNotChangeParsingOfTheRest) { TEST_F(TokenAnnotatorTest, UnderstandsAsm) { auto Tokens = annotate("__asm{\n" - "a:\n" - "};"); - ASSERT_EQ(Tokens.size(), 7u) << To

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-25 Thread Owen Pan via cfe-commits
https://github.com/owenca approved this pull request. https://github.com/llvm/llvm-project/pull/92617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add LeftWithLastLine to AlignEscapedNewlines option (PR #93402)

2024-05-26 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/93402 Closes #92999. >From fc9097e064e2d64832acc611b2a8d50d332119d6 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 26 May 2024 00:23:35 -0700 Subject: [PATCH] [clang-format] Add LeftWithLastLine to AlignEscapedNewl

[clang] [clang-format] Add SpacesInParensOption for filtering repeated parens (PR #77522)

2024-05-26 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/77522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add SpacesInParensOption for filtering repeated parens (PR #77522)

2024-05-26 Thread Owen Pan via cfe-commits
https://github.com/owenca commented: I think we can simply check if a sequence of two `l_parens` have a matching sequence of two `r_parens` and insert spaces only if `ExceptDoubleParentheses` is false. https://github.com/llvm/llvm-project/pull/77522 ___

[clang] [clang-format] Add SpacesInParensOption for filtering repeated parens (PR #77522)

2024-05-26 Thread Owen Pan via cfe-commits
@@ -17265,6 +17317,268 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) { verifyFormat("size_t idx = (a->foo)(a - 1);", Spaces); verifyFormat("size_t idx = (*foo)(a - 1);", Spaces); verifyFormat("size_t idx = (*(foo))(a - 1);", Spaces); + + // Check ExceptDoubleParenthe

[clang] Code implementing the SpacesInParensOptions.ExceptDoubleParentheses l… (PR #93439)

2024-05-26 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/93439 …ogic >From ac03e1506b5ea0d00038501c4f41d5b30c8fa2b3 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 26 May 2024 22:01:48 -0700 Subject: [PATCH] Code implementing the SpacesInParensOptions.ExceptDoubleParenth

[clang] Code implementing the SpacesInParensOptions.ExceptDoubleParentheses l… (PR #93439)

2024-05-26 Thread Owen Pan via cfe-commits
https://github.com/owenca converted_to_draft https://github.com/llvm/llvm-project/pull/93439 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add SpacesInParensOption for filtering repeated parens (PR #77522)

2024-05-26 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/77522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix a misannotation of PointerOrReference (PR #101291)

2024-08-01 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/101291 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Handle parenthesized list in RemoveParentheses (PR #100852)

2024-08-02 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/100852 >From f06f3ab5e59217348e72179c9581be338efa8789 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 26 Jul 2024 19:17:33 -0700 Subject: [PATCH] [clang-format] Handle parenthesized list in RemoveParentheses Also, r

[clang] [clang-format] Handle parenthesized list in RemoveParentheses (PR #100852)

2024-08-03 Thread Owen Pan via cfe-commits
https://github.com/owenca demilestoned https://github.com/llvm/llvm-project/pull/100852 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] d86a995 - [clang-format][doc] Fix a typo.

2024-08-04 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-08-04T21:14:52-07:00 New Revision: d86a995ab78905cd055f8a93812c3b94cf042499 URL: https://github.com/llvm/llvm-project/commit/d86a995ab78905cd055f8a93812c3b94cf042499 DIFF: https://github.com/llvm/llvm-project/commit/d86a995ab78905cd055f8a93812c3b94cf042499.diff LOG:

[clang] [clang-format] Add BreakBinaryOperations configuration (PR #95013)

2024-08-04 Thread Owen Pan via cfe-commits
@@ -146,6 +147,33 @@ static bool startsNextParameter(const FormatToken &Current, Style.BreakInheritanceList != FormatStyle::BILS_BeforeComma)); } +// Returns \c true if \c Token in an alignable binary operator +static bool isAlignableBinaryOperator(const FormatToken

[clang] [clang-format] Add BreakBinaryOperations configuration (PR #95013)

2024-08-04 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/95013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add BreakBinaryOperations configuration (PR #95013)

2024-08-04 Thread Owen Pan via cfe-commits
https://github.com/owenca commented: This patch also fixes #58014 and #57280, so you can include them in the commit message. https://github.com/llvm/llvm-project/pull/95013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org

[clang] [clang-format] Add BreakBinaryOperations configuration (PR #95013)

2024-08-04 Thread Owen Pan via cfe-commits
@@ -27630,6 +27630,245 @@ TEST_F(FormatTest, SpaceBetweenKeywordAndLiteral) { verifyFormat("return sizeof \"5\";"); } +TEST_F(FormatTest, BreakBinaryOperations) { + auto Style = getLLVMStyleWithColumns(60); + // Logical operations + verifyFormat("if (condition1 && conditi

[clang] [clang-format] Add BreakBinaryOperations configuration (PR #95013)

2024-08-04 Thread Owen Pan via cfe-commits
@@ -2231,6 +2231,41 @@ struct FormatStyle { /// \version 3.7 bool BreakBeforeTernaryOperators; + /// Different ways to break binary operations. + enum BreakBinaryOperationsStyle : int8_t { +/// Don't break binary operations +/// \code +///aaa + * ccc

[clang] [clang-format] Add BreakBinaryOperations configuration (PR #95013)

2024-08-04 Thread Owen Pan via cfe-commits
@@ -2231,6 +2231,41 @@ struct FormatStyle { /// \version 3.7 bool BreakBeforeTernaryOperators; + /// Different ways to break binary operations. + enum BreakBinaryOperationsStyle : int8_t { +/// Don't break binary operations +/// \code +///aaa + * ccc

[clang] [clang-format] Add BreakBinaryOperations configuration (PR #95013)

2024-08-04 Thread Owen Pan via cfe-commits
@@ -2231,6 +2231,41 @@ struct FormatStyle { /// \version 3.7 bool BreakBeforeTernaryOperators; + /// Different ways to break binary operations. + enum BreakBinaryOperationsStyle : int8_t { +/// Don't break binary operations +/// \code +///aaa + * ccc

[clang] [clang-format] Add BreakBinaryOperations configuration (PR #95013)

2024-08-04 Thread Owen Pan via cfe-commits
@@ -27630,6 +27630,245 @@ TEST_F(FormatTest, SpaceBetweenKeywordAndLiteral) { verifyFormat("return sizeof \"5\";"); } +TEST_F(FormatTest, BreakBinaryOperations) { + auto Style = getLLVMStyleWithColumns(60); + // Logical operations + verifyFormat("if (condition1 && conditi

[clang] [clang-format] Add BreakBinaryOperations configuration (PR #95013)

2024-08-04 Thread Owen Pan via cfe-commits
@@ -27630,6 +27630,245 @@ TEST_F(FormatTest, SpaceBetweenKeywordAndLiteral) { verifyFormat("return sizeof \"5\";"); } +TEST_F(FormatTest, BreakBinaryOperations) { + auto Style = getLLVMStyleWithColumns(60); + // Logical operations owenca wrote: ```suggest

[clang] [clang-format] Add BreakBinaryOperations configuration (PR #95013)

2024-08-04 Thread Owen Pan via cfe-commits
@@ -146,6 +147,33 @@ static bool startsNextParameter(const FormatToken &Current, Style.BreakInheritanceList != FormatStyle::BILS_BeforeComma)); } +// Returns \c true if \c Token in an alignable binary operator +static bool isAlignableBinaryOperator(const FormatToken

[clang] [clang-format] Add BreakBinaryOperations configuration (PR #95013)

2024-08-04 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/95013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add BreakBinaryOperations configuration (PR #95013)

2024-08-05 Thread Owen Pan via cfe-commits
https://github.com/owenca approved this pull request. https://github.com/llvm/llvm-project/pull/95013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-05 Thread Owen Pan via cfe-commits
owenca wrote: We should rename the option and its values to e.g. `BreakParameters` and `Never`/`OnePerLine`/`Always`. See also https://github.com/llvm/llvm-project/pull/95013#discussion_r1703578003. https://github.com/llvm/llvm-project/pull/101882 __

[clang] [clang-format] Fix a bug in annotating CastRParen (PR #102261)

2024-08-06 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/102261 Fixes #102102. >From b72a629d16d5bc3ce800a562fd41ba2dfd1fe1eb Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 6 Aug 2024 18:10:20 -0700 Subject: [PATCH] [clang-format] Fix a bug in annotating CastRParen Fixe

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-07 Thread Owen Pan via cfe-commits
owenca wrote: > When you say rename, do you mean deprecate `BinPackParameters` like in these > changes > [6739bb5](https://github.com/llvm/llvm-project/commit/6739bb5006bc28e2bdbdb2326eb2c957546634aa) > but using `BreakParameters` and `Never`/`OnePerLine`/`Always` for the names? Yes, deprecat

[clang] [clang-format] Fix a bug in annotating CastRParen (PR #102261)

2024-08-07 Thread Owen Pan via cfe-commits
https://github.com/owenca milestoned https://github.com/llvm/llvm-project/pull/102261 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix a bug in annotating CastRParen (PR #102261)

2024-08-07 Thread Owen Pan via cfe-commits
owenca wrote: > I'm sorry I'm not familiar with LLVM release cycle, but is it too late for > this to make it into the `release/19.x` branch? It's not too late, but in general we backport bug fixes only if the bugs are labeled as `invalid-code-generation`, `crash-on-valid`, or `regression`. In

[clang] [clang-format] Fix a bug in annotating CastRParen (PR #102261)

2024-08-07 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/102261 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] 7cd441f - [clang][NFC] Wrap TYPE_SWITCH in "do while (0)" in the interpreter

2022-01-24 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2022-01-24T09:05:27-08:00 New Revision: 7cd441ff537e00c743236658bfbcfc16c30ce031 URL: https://github.com/llvm/llvm-project/commit/7cd441ff537e00c743236658bfbcfc16c30ce031 DIFF: https://github.com/llvm/llvm-project/commit/7cd441ff537e00c743236658bfbcfc16c30ce031.diff LOG:

[clang] 163c13f - [clang-format] Fix formatting of the code that follows C# Lambda Expressions

2021-12-17 Thread Owen Pan via cfe-commits
Author: Peter Stys Date: 2021-12-17T10:42:15-08:00 New Revision: 163c13fed9f68c31a14b3d2409b994909f0600bb URL: https://github.com/llvm/llvm-project/commit/163c13fed9f68c31a14b3d2409b994909f0600bb DIFF: https://github.com/llvm/llvm-project/commit/163c13fed9f68c31a14b3d2409b994909f0600bb.diff LO

[clang] 212e6c9 - [doc] Fix regex in ClangFormatStyleOptions for IncludeCategories

2021-12-17 Thread Owen Pan via cfe-commits
Author: Joshua Huels Date: 2021-12-17T18:46:12-08:00 New Revision: 212e6c99776f393e0af368ca2086eb8bae2ee1ed URL: https://github.com/llvm/llvm-project/commit/212e6c99776f393e0af368ca2086eb8bae2ee1ed DIFF: https://github.com/llvm/llvm-project/commit/212e6c99776f393e0af368ca2086eb8bae2ee1ed.diff

[clang] b9f6e09 - [clang-format][NFC] Handle wrapping after => in mustBreakBefore()

2021-12-21 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2021-12-21T16:42:52-08:00 New Revision: b9f6e09b850acf2ade04f22fa423e7cc0f075e62 URL: https://github.com/llvm/llvm-project/commit/b9f6e09b850acf2ade04f22fa423e7cc0f075e62 DIFF: https://github.com/llvm/llvm-project/commit/b9f6e09b850acf2ade04f22fa423e7cc0f075e62.diff LOG:

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-16 Thread Owen Pan via cfe-commits
owenca wrote: There's a compiler warning: ``` In file included from /Users/Owen/llvm-project/clang/lib/Format/AffectedRangeManager.cpp:16: /Users/Owen/llvm-project/clang/lib/Format/FormatToken.h:1982:13: warning: unused function 'startsNextParameter' [-Wunused-function] 1982 | static bool star

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
@@ -8925,6 +8925,97 @@ TEST_F(FormatTest, FormatsOneParameterPerLineIfNecessary) { NoBinPacking); } +TEST_F(FormatTest, FormatsDeclarationBreakAlways) { + FormatStyle BreakAlways = getGoogleStyle(); + BreakAlways.BinPackParameters = FormatStyle::BPPS_OnePerLine; + ve

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
@@ -5475,6 +5475,14 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line, return true; } + // Ignores the first parameter as this will be handled separately by + // BreakFunctionDefinitionParameters or AlignAfterOpenBracket. + if (FormatStyle::BPPS_OnePe

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
@@ -1192,20 +1192,36 @@ struct FormatStyle { /// \version 3.7 bool BinPackArguments; - /// If ``false``, a function declaration's or function definition's - /// parameters will either all be on the same line or will have one line each. - /// \code - /// true: - ///

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
@@ -8925,6 +8925,97 @@ TEST_F(FormatTest, FormatsOneParameterPerLineIfNecessary) { NoBinPacking); } +TEST_F(FormatTest, FormatsDeclarationBreakAlways) { + FormatStyle BreakAlways = getGoogleStyle(); + BreakAlways.BinPackParameters = FormatStyle::BPPS_OnePerLine; -

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
@@ -128,25 +128,6 @@ static bool startsSegmentOfBuilderTypeCall(const FormatToken &Tok) { return Tok.isMemberAccess() && Tok.Previous && Tok.Previous->closesScope(); } -// Returns \c true if \c Current starts a new parameter. -static bool startsNextParameter(const FormatTok

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
@@ -8244,7 +8244,7 @@ TEST_F(FormatTest, BreakConstructorInitializersAfterColon) { "a(aa, aa,\n" " aa) {}", OnePerLine); - OnePerLine.BinPackParameters =

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
@@ -8925,6 +8925,97 @@ TEST_F(FormatTest, FormatsOneParameterPerLineIfNecessary) { NoBinPacking); } +TEST_F(FormatTest, FormatsDeclarationBreakAlways) { + FormatStyle BreakAlways = getGoogleStyle(); + BreakAlways.BinPackParameters = FormatStyle::BPPS_OnePerLine; + ve

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
@@ -8925,6 +8925,97 @@ TEST_F(FormatTest, FormatsOneParameterPerLineIfNecessary) { NoBinPacking); } +TEST_F(FormatTest, FormatsDeclarationBreakAlways) { + FormatStyle BreakAlways = getGoogleStyle(); + BreakAlways.BinPackParameters = FormatStyle::BPPS_OnePerLine; + ve

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
@@ -1850,7 +1863,7 @@ FormatStyle getMozillaStyle() { MozillaStyle.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_TopLevel; MozillaStyle.BinPackArguments = false; - MozillaStyle.BinPackParameters = false; + MozillaStyle.BinPackParameters = FormatStyle::BP

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
@@ -8925,6 +8925,97 @@ TEST_F(FormatTest, FormatsOneParameterPerLineIfNecessary) { NoBinPacking); } +TEST_F(FormatTest, FormatsDeclarationBreakAlways) { + FormatStyle BreakAlways = getGoogleStyle(); + BreakAlways.BinPackParameters = FormatStyle::BPPS_OnePerLine; + ve

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
@@ -7954,7 +7954,7 @@ TEST_F(FormatTest, AllowAllArgumentsOnNextLine) { } // This parameter should not affect declarations. - Style.BinPackParameters = false; + Style.BinPackParameters = FormatStyle::BPPS_Never; owenca wrote: Ditto. https://github.com/

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
@@ -8925,6 +8925,97 @@ TEST_F(FormatTest, FormatsOneParameterPerLineIfNecessary) { NoBinPacking); } +TEST_F(FormatTest, FormatsDeclarationBreakAlways) { + FormatStyle BreakAlways = getGoogleStyle(); + BreakAlways.BinPackParameters = FormatStyle::BPPS_OnePerLine; + ve

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
@@ -7694,7 +7694,7 @@ TEST_F(FormatTest, ConstructorInitializers) { ": a(aa, aa,\n" "aa) {}", OnePerLine); - OnePerLine.BinPackParameters = false; + On

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
@@ -2338,7 +2338,7 @@ TEST_F(FormatTest, FormatsForLoop) { "for (const Foo &baz = in.value(); !baz.at_end(); ++baz) {\n}"); FormatStyle NoBinPacking = getLLVMStyle(); - NoBinPacking.BinPackParameters = false; + NoBinPacking.BinPackParameters = FormatStyle::BPPS_Never

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
@@ -362,6 +362,26 @@ TEST_F(FormatTestComments, KeepsParameterWithTrailingCommentsOnTheirOwnLine) { format("aa((,\n" "), //\n" ", b);")); + + FormatStyle BreakAlways = getLLVMStyle(); + BreakAlways

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
@@ -7165,7 +7165,7 @@ TEST_F(FormatTest, LineBreakingInBinaryExpressions) { "}"); FormatStyle OnePerLine = getLLVMStyle(); - OnePerLine.BinPackParameters = false; + OnePerLine.BinPackParameters = FormatStyle::BPPS_Never; owenca wrote: Ditto

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
owenca wrote: > > Whilst I can understand BinPackParameters being deprecated, as its one of > > the original options I do worry a little about just how much impact such a > > deprecation might have... it needs to be completely seemless because there > > is ALOT of documentation references to i

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
@@ -1978,6 +1978,25 @@ inline bool continuesLineComment(const FormatToken &FormatTok, FormatTok.OriginalColumn >= MinContinueColumn; } +// Returns \c true if \c Current starts a new parameter. +static bool startsNextParameter(const FormatToken &Current, -

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
@@ -128,25 +128,6 @@ static bool startsSegmentOfBuilderTypeCall(const FormatToken &Tok) { return Tok.isMemberAccess() && Tok.Previous && Tok.Previous->closesScope(); } -// Returns \c true if \c Current starts a new parameter. -static bool startsNextParameter(const FormatTok

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
@@ -1192,20 +1192,36 @@ struct FormatStyle { /// \version 3.7 bool BinPackArguments; - /// If ``false``, a function declaration's or function definition's - /// parameters will either all be on the same line or will have one line each. - /// \code - /// true: - ///

[clang] [clang-format] Change GNU style language standard to LS_Latest (PR #104669)

2024-08-17 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/104669 Fixes #104655. >From d7c7c0da69864067999ecd9b1621fdbb85d4d365 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 17 Aug 2024 02:32:19 -0700 Subject: [PATCH] [clang-format] Change GNU style language standard to

[clang] [clang-format] Change GNU style language standard to LS_Latest (PR #104669)

2024-08-17 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/104669 >From d7c7c0da69864067999ecd9b1621fdbb85d4d365 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 17 Aug 2024 02:32:19 -0700 Subject: [PATCH 1/2] [clang-format] Change GNU style language standard to LS_Latest F

[clang] [clang-format] Change BinPackParameters to an enum to add a BreakAlways (PR #101882)

2024-08-17 Thread Owen Pan via cfe-commits
@@ -1192,20 +1192,36 @@ struct FormatStyle { /// \version 3.7 bool BinPackArguments; - /// If ``false``, a function declaration's or function definition's - /// parameters will either all be on the same line or will have one line each. - /// \code - /// true: - ///

[clang] [clang-format] Change GNU style language standard to LS_Latest (PR #104669)

2024-08-18 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/104669 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Change BinPackParameters to enum and add AlwaysOnePerLine (PR #101882)

2024-08-20 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/101882 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Change BinPackParameters to enum and add AlwaysOnePerLine (PR #101882)

2024-08-20 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/101882 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Change BinPackParameters to enum and add AlwaysOnePerLine (PR #101882)

2024-08-20 Thread Owen Pan via cfe-commits
@@ -5475,6 +5475,14 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line, return true; } + // Ignores the first parameter as this will be handled separately by + // BreakFunctionDefinitionParameters or AlignAfterOpenBracket. + if (FormatStyle::BPPS_Alway

[clang] [clang-format] Change BinPackParameters to enum and add AlwaysOnePerLine (PR #101882)

2024-08-20 Thread Owen Pan via cfe-commits
@@ -134,6 +134,19 @@ template <> struct ScalarEnumerationTraits { } }; +template <> +struct ScalarEnumerationTraits { + static void enumeration(IO &IO, FormatStyle::BinPackParametersStyle &Value) { +IO.enumCase(Value, "OnePerLine", FormatStyle::BPPS_OnePerLine); +I

[clang] [clang-format] Change BinPackParameters to enum and add AlwaysOnePerLine (PR #101882)

2024-08-20 Thread Owen Pan via cfe-commits
@@ -8925,6 +8925,97 @@ TEST_F(FormatTest, FormatsOneParameterPerLineIfNecessary) { NoBinPacking); } +TEST_F(FormatTest, FormatsDeclarationBreakAlways) { + FormatStyle BreakAlways = getGoogleStyle(); + BreakAlways.BinPackParameters = FormatStyle::BPPS_AlwaysOnePerLine;

[clang] [clang-format] Change BinPackParameters to enum and add AlwaysOnePerLine (PR #101882)

2024-08-20 Thread Owen Pan via cfe-commits
@@ -403,13 +416,25 @@ TEST_F(FormatTestComments, UnderstandsBlockComments) { verifyFormat("f(/* aa = */\n" " );"); - FormatStyle NoBinPacking = getLLVMStyle(); - NoBinPacking.BinPackParamet

[clang] [clang-format] Change BinPackParameters to enum and add AlwaysOnePerLine (PR #101882)

2024-08-20 Thread Owen Pan via cfe-commits
@@ -1192,20 +1192,36 @@ struct FormatStyle { /// \version 3.7 bool BinPackArguments; - /// If ``false``, a function declaration's or function definition's - /// parameters will either all be on the same line or will have one line each. - /// \code - /// true: - ///

[clang] [clang-format] Change BinPackParameters to enum and add AlwaysOnePerLine (PR #101882)

2024-08-20 Thread Owen Pan via cfe-commits
@@ -436,6 +435,19 @@ TEST(ConfigParseTest, ParsesConfiguration) { CHECK_PARSE("BreakBeforeInheritanceComma: true", BreakInheritanceList, FormatStyle::BILS_BeforeComma); + Style.BinPackParameters = FormatStyle::BPPS_BinPack; + CHECK_PARSE("BinPackParameters: O

<    10   11   12   13   14   15   16   17   18   19   >