[clang] [clang-format] Fix mismatched break in BlockIndent (PR #124998)

2025-01-30 Thread Owen Pan via cfe-commits
@@ -9608,6 +9608,10 @@ TEST_F(FormatTest, AlignsAfterOpenBracket) { "\"a aaa a aaa a\"\n" ");", Style); + verifyFormat("aaa(\n" + "&b

[clang] [clang-format] Fix mismatched break in BlockIndent (PR #124998)

2025-01-30 Thread Owen Pan via cfe-commits
https://github.com/owenca approved this pull request. https://github.com/llvm/llvm-project/pull/124998 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add ClassHeadName to help annotating StartOfName (PR #124891)

2025-01-30 Thread Owen Pan via cfe-commits
@@ -1146,6 +1175,8 @@ TEST_F(TokenAnnotatorTest, UnderstandsRequiresClausesAndConcepts) { EXPECT_TOKEN(Tokens[31], tok::greater, TT_TemplateCloser); EXPECT_EQ(Tokens[31]->FakeRParens, 1u); EXPECT_TRUE(Tokens[31]->ClosesRequiresClause); + // FIXME: + // EXPECT_TOKEN(Tok

[clang] [clang-format] Add ClassHeadName to help annotating StartOfName (PR #124891)

2025-01-30 Thread Owen Pan via cfe-commits
@@ -1146,6 +1175,8 @@ TEST_F(TokenAnnotatorTest, UnderstandsRequiresClausesAndConcepts) { EXPECT_TOKEN(Tokens[31], tok::greater, TT_TemplateCloser); EXPECT_EQ(Tokens[31]->FakeRParens, 1u); EXPECT_TRUE(Tokens[31]->ClosesRequiresClause); + // FIXME: + // EXPECT_TOKEN(Tok

[clang] [clang-format] Add ClassHeadName to help annotating StartOfName (PR #124891)

2025-01-30 Thread Owen Pan via cfe-commits
@@ -3458,6 +3509,9 @@ TEST_F(TokenAnnotatorTest, BraceKind) { Tokens = annotate("a = class Foo extends goog.a {};", getGoogleStyle(FormatStyle::LK_JavaScript)); ASSERT_EQ(Tokens.size(), 12u) << Tokens; + EXPECT_TOKEN(Tokens[3], tok::identifier, TT_Class

[clang] [clang-format] Add ClassHeadName to help annotating StartOfName (PR #124891)

2025-01-30 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/124891 >From 04fd96533a48b0f6fdbacb6c9947740bf4c58992 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 28 Jan 2025 23:16:10 -0800 Subject: [PATCH] [clang-format] Add ClassHeadName to help annotating StartOfName Fixe

[clang] [clang-format] Fix mismatched break in BlockIndent (PR #124998)

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

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-05 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,254 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-05 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,254 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-05 Thread Owen Pan via cfe-commits
@@ -304,6 +304,10 @@ bool ContinuationIndenter::canBreak(const LineState &State) { Current.closesBlockOrBlockTypeList(Style))) { return false; } + if (Style.BreakBeforeTemplateCloser && Current.is(TT_TemplateCloser) && + !Current

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-04 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,328 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-04 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,328 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-04 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,328 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-04 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,328 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-04 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,328 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2025-02-04 Thread Owen Pan via cfe-commits
owenca wrote: What about changing it to an option (e.g. `BinPackBracedListThreshold`) with a default value of about 20? If the number of elements in the list is more than the threshold, they will be bin packed even if `BinPackArguments` is set to false. https://github.com/llvm/llvm-project/pu

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-04 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,328 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-04 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,328 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] Hanlde qualified type name for `QualifierAlignment` (PR #125327)

2025-02-04 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/125327 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-04 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,328 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-04 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,328 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-04 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,328 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-04 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,328 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-04 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,328 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-04 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,328 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-04 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,328 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-04 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,328 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-04 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,328 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-04 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,328 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-04 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,328 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] Add BreakBeforeTemplateCloser option (PR #118046)

2025-02-06 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/118046 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add BreakBeforeTemplateCloser option (PR #118046)

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

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-05 Thread Owen Pan via cfe-commits
@@ -11224,6 +11224,254 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getLLVMStyle(); + // Begin with tests covering the case where there is no constraint on the + // col

[clang] [clang-format] Add BreakBeforeTemplateCloser option (PR #118046)

2025-02-05 Thread Owen Pan via cfe-commits
@@ -2252,6 +2252,33 @@ struct FormatStyle { /// \version 16 BreakBeforeInlineASMColonStyle BreakBeforeInlineASMColon; + /// If ``true``, a line break will be placed before the ``>`` in a block + /// indented template declaration. owenca wrote: ```sugges

[clang] [clang-format] Add BreakBeforeTemplateCloser option (PR #118046)

2025-02-06 Thread Owen Pan via cfe-commits
https://github.com/owenca approved this pull request. https://github.com/llvm/llvm-project/pull/118046 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Handle C-style cast of member function pointer type (PR #126340)

2025-02-07 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/126340 Fixes #125012. >From a0e44456a4fa1f5ef1168ac0e399b7113252bf96 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 7 Feb 2025 19:53:17 -0800 Subject: [PATCH] [clang-format] Handle C-style cast of member function p

[clang] [clang-format] Improve function pointer CastRParen detection. (PR #126019)

2025-02-07 Thread Owen Pan via cfe-commits
owenca wrote: See #126340. https://github.com/llvm/llvm-project/pull/126019 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add BinPackLongBracedList style option (PR #112482)

2025-02-07 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/112482 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add BinPackLongBracedList style option (PR #112482)

2025-02-07 Thread Owen Pan via cfe-commits
https://github.com/owenca approved this pull request. https://github.com/llvm/llvm-project/pull/112482 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add BinPackLongBracedList style option (PR #112482)

2025-02-07 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/112482 >From 8282f754ae40b64a88e2d22a6cb21e7028da8371 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 15 Oct 2024 23:55:49 -0600 Subject: [PATCH 1/8] [clang-format] add BinPackLongBracedList style option The use

[clang] [clang-format] Add BinPackLongBracedList style option (PR #112482)

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

[clang] [clang-format] Handle C-style cast of member function pointer type (PR #126340)

2025-02-09 Thread Owen Pan via cfe-commits
https://github.com/owenca milestoned https://github.com/llvm/llvm-project/pull/126340 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Handle C-style cast of member function pointer type (PR #126340)

2025-02-09 Thread Owen Pan via cfe-commits
owenca wrote: /cherry-pick 8d373ceaec1f1b27c9e682cfaf71aae19ea48d98 https://github.com/llvm/llvm-project/pull/126340 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-02-09 Thread Owen Pan via cfe-commits
owenca wrote: > > Diagnostic output should go to stderr, but the informational output of > > git-clang-format is sent to stdout instead. > > What does that mean? The printing of null-terminated paths on stdout is > pretty standard on unix utilities. What's "diagnostic" and "informational"? Di

[clang] [clang-format] Handle C-style cast of member function pointer type (PR #126340)

2025-02-09 Thread Owen Pan via cfe-commits
owenca wrote: You mean 20.x? https://github.com/llvm/llvm-project/pull/126340 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2025-02-07 Thread Owen Pan via cfe-commits
@@ -14185,6 +14185,32 @@ TEST_F(FormatTest, LayoutCxx11BraceInitializers) { "ff, g, hh, ii, jj, kk,\n" "};", NoBinPacking); + NoBinPacking.BinPackLongBracedLists = false; owenca wrote: ```suggestion NoBinPacki

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2025-02-07 Thread Owen Pan via cfe-commits
@@ -14185,6 +14185,32 @@ TEST_F(FormatTest, LayoutCxx11BraceInitializers) { "ff, g, hh, ii, jj, kk,\n" "};", NoBinPacking); + NoBinPacking.BinPackLongBracedLists = false; + verifyFormat("const Aa a = {\n" +

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2025-02-07 Thread Owen Pan via cfe-commits
@@ -1212,6 +1212,22 @@ struct FormatStyle { /// \version 3.7 bool BinPackArguments; + /// If ``BinPackLongBracedLists`` is ``true`` it overrides + /// ``BinPackArguments`` if there are 20 or more items in a braced + /// initializer list. + /// \code + ///BinPackLo

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2025-02-07 Thread Owen Pan via cfe-commits
@@ -14185,6 +14185,32 @@ TEST_F(FormatTest, LayoutCxx11BraceInitializers) { "ff, g, hh, ii, jj, kk,\n" "};", NoBinPacking); + NoBinPacking.BinPackLongBracedLists = false; + verifyFormat("const Aa a = {\n" +

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2025-02-07 Thread Owen Pan via cfe-commits
@@ -2520,6 +2536,9 @@ struct FormatStyle { /// (e.g. a type or variable name), clang-format formats as if the ``{}`` were /// the parentheses of a function call with that name. If there is no name, /// a zero-length name is assumed. + /// + /// ``BinPackArguments`` may

[clang] [clang-format] Improve function pointer CastRParen detection. (PR #126019)

2025-02-07 Thread Owen Pan via cfe-commits
@@ -874,6 +874,11 @@ TEST_F(TokenAnnotatorTest, UnderstandsCasts) { EXPECT_TOKEN(Tokens[14], tok::r_paren, TT_CastRParen); EXPECT_TOKEN(Tokens[15], tok::amp, TT_UnaryOperator); + Tokens = annotate("func((foo(bar::*)(void))&a);"); owenca wrote: So `foo` i

[clang] [clang-format] Improve function pointer CastRParen detection. (PR #126019)

2025-02-07 Thread Owen Pan via cfe-commits
owenca wrote: The root cause is that the l_paren after the return type is not annotated. That's why the space between them is missing. https://github.com/llvm/llvm-project/pull/126019 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lis

[clang] [clang-format] Handle C-style cast of member function pointer type (PR #126340)

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

[clang] [clang-format] Support BraceWrapping.AfterNamespace with AllowShortNamespacesOnASingleLine (PR #123010)

2025-02-08 Thread Owen Pan via cfe-commits
@@ -28430,6 +28430,36 @@ TEST_F(FormatTest, ShortNamespacesOption) { "}}} // namespace foo::bar::baz", "namespace foo { namespace bar { namespace baz { class qux; } } }", Style); + Style.FixNamespaceComments = false; + + Style.BreakBeforeBraces = FormatStyle

[clang] [clang-format] Support BraceWrapping.AfterNamespace with AllowShortNamespacesOnASingleLine (PR #123010)

2025-02-08 Thread Owen Pan via cfe-commits
@@ -367,8 +367,12 @@ class LineJoiner { if (Style.AllowShortNamespacesOnASingleLine && TheLine->First->is(tok::kw_namespace) && -TheLine->Last->is(tok::l_brace)) { - const auto result = tryMergeNamespace(I, E, Limit); +((Style.BraceWrapping.Aft

[clang] [clang-format] Support BraceWrapping.AfterNamespace with AllowShortNamespacesOnASingleLine (PR #123010)

2025-02-08 Thread Owen Pan via cfe-commits
@@ -28430,6 +28430,36 @@ TEST_F(FormatTest, ShortNamespacesOption) { "}}} // namespace foo::bar::baz", "namespace foo { namespace bar { namespace baz { class qux; } } }", Style); + Style.FixNamespaceComments = false; + + Style.BreakBeforeBraces = FormatStyle

[clang] [clang-format] Support BraceWrapping.AfterNamespace with AllowShortNamespacesOnASingleLine (PR #123010)

2025-02-08 Thread Owen Pan via cfe-commits
@@ -28430,6 +28430,36 @@ TEST_F(FormatTest, ShortNamespacesOption) { "}}} // namespace foo::bar::baz", "namespace foo { namespace bar { namespace baz { class qux; } } }", Style); + Style.FixNamespaceComments = false; + + Style.BreakBeforeBraces = FormatStyle

[clang] [clang-format] Support BraceWrapping.AfterNamespace with AllowShortNamespacesOnASingleLine (PR #123010)

2025-02-08 Thread Owen Pan via cfe-commits
@@ -628,28 +632,36 @@ class LineJoiner { unsigned tryMergeNamespace(ArrayRef::const_iterator I, ArrayRef::const_iterator E, - unsigned Limit) { + unsigned Limit, bool OpenBraceWrapped) { ---

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-02-09 Thread Owen Pan via cfe-commits
owenca wrote: > > It seems that `git-clang-format` was not designed for its output to be > > consumed by another utility as it prints everything to `stdout` instead of > > `stderr`. Adding an option like`--print0` (especially just for `--staged`) > > looks odd to me. > > No, the approach of p

[clang] [clang-format] Improve function pointer CastRParen detection. (PR #126019)

2025-02-06 Thread Owen Pan via cfe-commits
@@ -874,6 +874,11 @@ TEST_F(TokenAnnotatorTest, UnderstandsCasts) { EXPECT_TOKEN(Tokens[14], tok::r_paren, TT_CastRParen); EXPECT_TOKEN(Tokens[15], tok::amp, TT_UnaryOperator); + Tokens = annotate("func((foo(bar::*)(void))&a);"); owenca wrote: What's `fo

[clang] [clang-format] Hanlde qualified type name for `QualifierAlignment` (PR #125327)

2025-02-02 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/125327 >From af3d964d74634f0dd9f7216572c1d852b7a549dc Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 31 Jan 2025 18:32:33 -0800 Subject: [PATCH 1/2] [clang-format] Hanlde qualified type names Fixes #125178. --- cl

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-02 Thread Owen Pan via cfe-commits
@@ -11220,6 +11220,333 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getGoogleStyle(FormatStyle::LK_Cpp); + // Begin with tests covering the case where there is no constr

[clang] [clang-format] Hanlde qualified type name for `QualifierAlignment` (PR #125327)

2025-02-01 Thread Owen Pan via cfe-commits
owenca wrote: Same reason we almost never handle them, just like we (almost?) never handle the possibility of templated qualified names of arbitrary nesting levels (e.g. `A1::A2 … An`) and of comments before _every_ token. We can always tweak the code if and when we need to handle these rare c

[clang] [clang-format] Hanlde qualified type name for `QualifierAlignment` (PR #125327)

2025-02-02 Thread Owen Pan via cfe-commits
owenca wrote: > Seems to also work for top-level types (`::int_64_t constexpr x{123};` works > correctly) It didn't work either. https://github.com/llvm/llvm-project/pull/125327 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.

[clang] [clang-format] Hanlde qualified type name for `QualifierAlignment` (PR #125327)

2025-02-02 Thread Owen Pan via cfe-commits
owenca wrote: > > Seems to also work for top-level types (`::int_64_t constexpr x{123};` > > works correctly) but breaks for fully qualified types (`::std::int64_t > > constexpr x{123};` becomes `::constexpr std::int64_t x{123};`) > > Yeah, I intentionally didn't want to use a loop for names l

[clang] [clang-format] Fix a crash on parsing requires clause (PR #125021)

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

[clang] [clang-format] Fix annotation of class name after requires clause (PR #125019)

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

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-02-02 Thread Owen Pan via cfe-commits
owenca wrote: > > From #123921, it seems that you only want the new option to work with > > `--staged`, but should it also work with other options that may print a > > list of filenames? > > I don't know; I only use `git clang-format` as in #123921 and I am not > familiar with all its uses. I

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-02-02 Thread Owen Pan via cfe-commits
@@ -11220,6 +11220,333 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getGoogleStyle(FormatStyle::LK_Cpp); + // Begin with tests covering the case where there is no constr

[clang] [clang-format] Hanlde qualified type name for `QualifierAlignment` (PR #125327)

2025-02-02 Thread Owen Pan via cfe-commits
@@ -412,6 +414,15 @@ const FormatToken *LeftRightQualifierAlignmentFixer::analyzeLeft( // The case `const long long volatile int` -> `const volatile long long int` // The case `long volatile long int const` -> `const volatile long long int` if (TypeToken->isTypeName(Lang

[clang] [clang-format] Hanlde qualified type name for `QualifierAlignment` (PR #125327)

2025-02-02 Thread Owen Pan via cfe-commits
@@ -412,6 +414,15 @@ const FormatToken *LeftRightQualifierAlignmentFixer::analyzeLeft( // The case `const long long volatile int` -> `const volatile long long int` // The case `long volatile long int const` -> `const volatile long long int` if (TypeToken->isTypeName(Lang

[clang] [clang-format] Fix a bug in annotating ClassHeadName (PR #125326)

2025-02-01 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/125326 ___ 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 ClassHeadName (PR #125326)

2025-01-31 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/125326 None >From d2a9862cb4f88ebb92f0d5266ffd80aec51b8f04 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 31 Jan 2025 18:19:37 -0800 Subject: [PATCH] [clang-format] Fix a bug in annotating ClassHeadName --- clang

[clang] [clang-format] Hanlde qualified type names (PR #125327)

2025-01-31 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/125327 Fixes #125178. >From af3d964d74634f0dd9f7216572c1d852b7a549dc Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 31 Jan 2025 18:32:33 -0800 Subject: [PATCH] [clang-format] Hanlde qualified type names Fixes #125

[clang] [clang-format] Hanlde qualified type name for `QualifierAlignment` (PR #125327)

2025-01-31 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/125327 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] 280609c - [clang-format][NFC] Minor improvement to FormatToken::isTypeName()

2025-01-31 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2025-01-31T18:52:53-08:00 New Revision: 280609c215e4a684cad215ea5be913293de0d255 URL: https://github.com/llvm/llvm-project/commit/280609c215e4a684cad215ea5be913293de0d255 DIFF: https://github.com/llvm/llvm-project/commit/280609c215e4a684cad215ea5be913293de0d255.diff LOG:

[clang] [clang-format] Hanlde qualified type name for `QualifierAlignment` (PR #125327)

2025-01-31 Thread Owen Pan via cfe-commits
owenca wrote: > Seems to also work for top-level types (`::int_64_t constexpr x{123};` works > correctly) but breaks for fully qualified types (`::std::int64_t constexpr > x{123};` becomes `::constexpr std::int64_t x{123};`) Yeah, I intentionally didn't want to use a loop for names like `A1::A

[clang] [clang-format] Fix idempotent format of hash in macro body (PR #118513)

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

[clang] [clang-format] Reorder TokenAnnotator::canBreakBefore (PR #119044)

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

[clang] [clang-format] Reorder TokenAnnotator::canBreakBefore (PR #119044)

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

[clang] [clang-format] Reorder TokenAnnotator::canBreakBefore (PR #119044)

2024-12-09 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/119044 >From c5bf1fc70df08ef94cc32a47d1bdce69c92c2abf Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Fri, 6 Dec 2024 16:52:35 -0700 Subject: [PATCH 1/2] [clang-format] Reorder TokenAnnotator::canBreakBefore Move the

[clang] [clang-format] Reorder TokenAnnotator::canBreakBefore (PR #119044)

2024-12-09 Thread Owen Pan via cfe-commits
@@ -6105,6 +6105,35 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line, return false; } + // We can break before an r_brace if there was a corresponding break after + // the l_brace, which is tracked by BreakBeforeClosingBrace, or if we are + // in a

[clang] [clang-format] Fix idempotent format of hash in macro body (PR #118513)

2024-12-09 Thread Owen Pan via cfe-commits
owenca wrote: Ping @mydeveloperday @HazardyKnusperkeks https://github.com/llvm/llvm-project/pull/118513 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add --strip-trailing-cr to diff in docs_updated.test (PR #119666)

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

[clang] [clang-format] Add --strip-trailing-cr to diff in docs_updated.test (PR #119666)

2024-12-11 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/119666 Also clean up dump_format_style.py and dump_format_help.py. >From 6105a4ba95e7458623e2bf7363f0d454c3bd1b9a Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Wed, 11 Dec 2024 23:14:29 -0800 Subject: [PATCH] [clang-fo

[clang] 8c681a9 - [clang-format][NFC] Add a TypeScript test case

2024-12-14 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-12-14T19:42:43-08:00 New Revision: 8c681a929b8684f5a4ad2ebd4e3e4f20036a9595 URL: https://github.com/llvm/llvm-project/commit/8c681a929b8684f5a4ad2ebd4e3e4f20036a9595 DIFF: https://github.com/llvm/llvm-project/commit/8c681a929b8684f5a4ad2ebd4e3e4f20036a9595.diff LOG:

[clang] [clang-format] Fix crashes when the macro expansion is empty (PR #119428)

2024-12-15 Thread Owen Pan via cfe-commits
owenca wrote: You should add unit tests in `clang/unittests/Format/`. https://github.com/llvm/llvm-project/pull/119428 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [AIX] fix unsupported diff flag on AIX (-strip-trailing-cr) (PR #120276)

2024-12-17 Thread Owen Pan via cfe-commits
@@ -19,3 +22,8 @@ config.suffixes = [ ".td", ".test" ] + +# AIX 'diff' command doesn't support --strip-trailing-cr, but the internal +# python implementation does, so use that for cross platform compatibility +if platform.system() == "AIX": +config.test_format = lit

[clang] [clang-format] Detect nesting in template strings (PR #119989)

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

[clang] [clang-format] Don't change breaking before CtorInitializerColon (PR #119522)

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

[clang] fe26853 - [clang-format] Fix a crash caused by commit f03bf8c45f43

2024-12-18 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-12-18T19:41:50-08:00 New Revision: fe2685303b215182b1acc5b6fb8be30c24bd6e8e URL: https://github.com/llvm/llvm-project/commit/fe2685303b215182b1acc5b6fb8be30c24bd6e8e DIFF: https://github.com/llvm/llvm-project/commit/fe2685303b215182b1acc5b6fb8be30c24bd6e8e.diff LOG:

[clang] [clang-format] Fix crashes when the macro expansion is empty (PR #119428)

2024-12-18 Thread Owen Pan via cfe-commits
@@ -217,6 +217,19 @@ TEST_F(MacroCallReconstructorTest, Identifier) { EXPECT_THAT(std::move(Unexp).takeResult(), matchesLine(line(U.consume("X"; } +TEST_F(MacroCallReconstructorTest, EmptyExpansion) { + auto Macros = createExpander({"A(x)=y"}); owenca

[clang] Add configuration option PenaltyBreakBeforeMemberAccess (PR #118409)

2024-12-19 Thread Owen Pan via cfe-commits
https://github.com/owenca commented: Please rebase and run `ninja clang-format-style`. https://github.com/llvm/llvm-project/pull/118409 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add --strip-trailing-cr to diff in docs_updated.test (PR #119666)

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

[clang] ea44647 - [clang-format] Write in text mode with LF in dump_format_[help|style].py

2024-12-12 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-12-12T23:22:26-08:00 New Revision: ea44647a0b49de826191eeb6e05020262b5a81e9 URL: https://github.com/llvm/llvm-project/commit/ea44647a0b49de826191eeb6e05020262b5a81e9 DIFF: https://github.com/llvm/llvm-project/commit/ea44647a0b49de826191eeb6e05020262b5a81e9.diff LOG:

[clang] [clang-format] Add --strip-trailing-cr to diff in docs_updated.test (PR #119666)

2024-12-12 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/119666 >From 8ee6f99cd55cb8d30340e6e89e70c60b54c07aab Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 12 Dec 2024 23:27:23 -0800 Subject: [PATCH] [clang-format] Add --strip-trailing-cr to diff in docs_updated.test

[clang] [clang-format] Add --strip-trailing-cr to diff in docs_updated.test (PR #119666)

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

[clang] [clang-format] Add --strip-trailing-cr to diff in docs_updated.test (PR #119666)

2024-12-12 Thread Owen Pan via cfe-commits
owenca wrote: > Is the cleanup just running `black`? Would be better committed separately in > my opinion. See ea44647a0b49de826191eeb6e05020262b5a81e9. https://github.com/llvm/llvm-project/pull/119666 ___ cfe-commits mailing list cfe-commits@lists.l

[clang] [clang-format] Fix a bug in annotating arrows after init braces (PR #119958)

2024-12-14 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/119958 Fixes #59066. >From 393e153c8ce6ec713ad9653f5f37eacc72b17b39 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 14 Dec 2024 00:33:35 -0800 Subject: [PATCH] [clang-format] Fix a bug in annotating arrows after ini

[clang] [clang-format] Detect nesting in template strings (PR #119989)

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

<    15   16   17   18   19   20   21   22   23   24   >