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
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
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
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
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
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
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:
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:
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
@@ -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
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
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.
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
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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,
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
@@ -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
@@ -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
@@ -10539,6 +10539,17 @@ TEST_F(FormatTest, KeepStringLabelValuePairsOnALine) {
" bbb);");
}
+TEST_F(FormatTest, WrapBeforeInsertionOperatorbetweenStringLiterals) {
+ verifyFormat("QStringList() << \"foo\" << \"bar\";");
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
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
@@ -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
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
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
@@ -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
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
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
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
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
___
@@ -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
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
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
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
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
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
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
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:
@@ -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
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
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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
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
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
__
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
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
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
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
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
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:
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
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
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:
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
@@ -8925,6 +8925,97 @@ TEST_F(FormatTest,
FormatsOneParameterPerLineIfNecessary) {
NoBinPacking);
}
+TEST_F(FormatTest, FormatsDeclarationBreakAlways) {
+ FormatStyle BreakAlways = getGoogleStyle();
+ BreakAlways.BinPackParameters = FormatStyle::BPPS_OnePerLine;
+ ve
@@ -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
@@ -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:
- ///
@@ -8925,6 +8925,97 @@ TEST_F(FormatTest,
FormatsOneParameterPerLineIfNecessary) {
NoBinPacking);
}
+TEST_F(FormatTest, FormatsDeclarationBreakAlways) {
+ FormatStyle BreakAlways = getGoogleStyle();
+ BreakAlways.BinPackParameters = FormatStyle::BPPS_OnePerLine;
-
@@ -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
@@ -8244,7 +8244,7 @@ TEST_F(FormatTest,
BreakConstructorInitializersAfterColon) {
"a(aa, aa,\n"
" aa) {}",
OnePerLine);
- OnePerLine.BinPackParameters =
@@ -8925,6 +8925,97 @@ TEST_F(FormatTest,
FormatsOneParameterPerLineIfNecessary) {
NoBinPacking);
}
+TEST_F(FormatTest, FormatsDeclarationBreakAlways) {
+ FormatStyle BreakAlways = getGoogleStyle();
+ BreakAlways.BinPackParameters = FormatStyle::BPPS_OnePerLine;
+ ve
@@ -8925,6 +8925,97 @@ TEST_F(FormatTest,
FormatsOneParameterPerLineIfNecessary) {
NoBinPacking);
}
+TEST_F(FormatTest, FormatsDeclarationBreakAlways) {
+ FormatStyle BreakAlways = getGoogleStyle();
+ BreakAlways.BinPackParameters = FormatStyle::BPPS_OnePerLine;
+ ve
@@ -1850,7 +1863,7 @@ FormatStyle getMozillaStyle() {
MozillaStyle.AlwaysBreakAfterDefinitionReturnType =
FormatStyle::DRTBS_TopLevel;
MozillaStyle.BinPackArguments = false;
- MozillaStyle.BinPackParameters = false;
+ MozillaStyle.BinPackParameters = FormatStyle::BP
@@ -8925,6 +8925,97 @@ TEST_F(FormatTest,
FormatsOneParameterPerLineIfNecessary) {
NoBinPacking);
}
+TEST_F(FormatTest, FormatsDeclarationBreakAlways) {
+ FormatStyle BreakAlways = getGoogleStyle();
+ BreakAlways.BinPackParameters = FormatStyle::BPPS_OnePerLine;
+ ve
@@ -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/
@@ -8925,6 +8925,97 @@ TEST_F(FormatTest,
FormatsOneParameterPerLineIfNecessary) {
NoBinPacking);
}
+TEST_F(FormatTest, FormatsDeclarationBreakAlways) {
+ FormatStyle BreakAlways = getGoogleStyle();
+ BreakAlways.BinPackParameters = FormatStyle::BPPS_OnePerLine;
+ ve
@@ -7694,7 +7694,7 @@ TEST_F(FormatTest, ConstructorInitializers) {
": a(aa, aa,\n"
"aa) {}",
OnePerLine);
- OnePerLine.BinPackParameters = false;
+ On
@@ -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
@@ -362,6 +362,26 @@ TEST_F(FormatTestComments,
KeepsParameterWithTrailingCommentsOnTheirOwnLine) {
format("aa((,\n"
"), //\n"
", b);"));
+
+ FormatStyle BreakAlways = getLLVMStyle();
+ BreakAlways
@@ -7165,7 +7165,7 @@ TEST_F(FormatTest, LineBreakingInBinaryExpressions) {
"}");
FormatStyle OnePerLine = getLLVMStyle();
- OnePerLine.BinPackParameters = false;
+ OnePerLine.BinPackParameters = FormatStyle::BPPS_Never;
owenca wrote:
Ditto
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
@@ -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,
-
@@ -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
@@ -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:
- ///
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
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
@@ -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:
- ///
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
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
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
@@ -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
@@ -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
@@ -8925,6 +8925,97 @@ TEST_F(FormatTest,
FormatsOneParameterPerLineIfNecessary) {
NoBinPacking);
}
+TEST_F(FormatTest, FormatsDeclarationBreakAlways) {
+ FormatStyle BreakAlways = getGoogleStyle();
+ BreakAlways.BinPackParameters = FormatStyle::BPPS_AlwaysOnePerLine;
@@ -403,13 +416,25 @@ TEST_F(FormatTestComments, UnderstandsBlockComments) {
verifyFormat("f(/* aa = */\n"
" );");
- FormatStyle NoBinPacking = getLLVMStyle();
- NoBinPacking.BinPackParamet
@@ -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:
- ///
@@ -436,6 +435,19 @@ TEST(ConfigParseTest, ParsesConfiguration) {
CHECK_PARSE("BreakBeforeInheritanceComma: true", BreakInheritanceList,
FormatStyle::BILS_BeforeComma);
+ Style.BinPackParameters = FormatStyle::BPPS_BinPack;
+ CHECK_PARSE("BinPackParameters: O
1401 - 1500 of 2500 matches
Mail list logo