[clang] [clang-format] Fix a regression on BAS_AlwaysBreak (PR #107506)

2024-09-05 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/107506 Fixes #107401. >From bd7da6ec9afabd829010db4c33d088590ab68b5a Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 5 Sep 2024 19:44:46 -0700 Subject: [PATCH] [clang-format] Fix a regression on BAS_AlwaysBreak Fix

[clang] [clang-format] Correctly annotate braces in macro definition (PR #107352)

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

[clang] [clang-format] Correctly annotate braces in macro definition (PR #107352)

2024-09-05 Thread Owen Pan via cfe-commits
owenca wrote: /cherry-pick 616a8ce6203d8c7569266bfaf163e74df1f440ad https://github.com/llvm/llvm-project/pull/107352 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Correctly annotate braces in macro definition (PR #107352)

2024-09-06 Thread Owen Pan via cfe-commits
owenca wrote: Done in #107531. https://github.com/llvm/llvm-project/pull/107352 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [llvm] [clang-format] Add support for BasedOnStyle referencing an arbitrary file (PR #107312)

2024-09-06 Thread Owen Pan via cfe-commits
owenca wrote: @jediry, can you open a github issue for this? We probably should continue the discussion on your [RFC](https://discourse.llvm.org/t/rfc-clang-format-option-to-include-another-configuration-file/74891) before getting into the details of the implementation. At the very least, I n

[clang] clang-format: Add "AllowShortNamespacesOnASingleLine" option (PR #105597)

2024-09-06 Thread Owen Pan via cfe-commits
@@ -27981,6 +27981,118 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, ShortNamespacesOption) { + FormatStyle Style = getLLVMStyle(); owenca wrote: ```suggestion auto Style = getLLVMStyle(); ``` https://github.c

[clang] clang-format: Add "AllowShortNamespacesOnASingleLine" option (PR #105597)

2024-09-06 Thread Owen Pan via cfe-commits
https://github.com/owenca commented: The following are missing: - Run `dump_format_style.py`. - Add a `ConfigParseTest` for the new option. How does the new option interact with `CompactNamespaces`? For example: - `AllowShortNamespacesOnASingleLine: true` and `CompactNamespaces: false` ``` names

[clang] clang-format: Add "AllowShortNamespacesOnASingleLine" option (PR #105597)

2024-09-06 Thread Owen Pan via cfe-commits
@@ -27981,6 +27981,118 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, ShortNamespacesOption) { + FormatStyle Style = getLLVMStyle(); + Style.AllowShortNamespacesOnASingleLine = true; + Style.FixNamespaceComments = false; + + //

[clang] clang-format: Add "AllowShortNamespacesOnASingleLine" option (PR #105597)

2024-09-06 Thread Owen Pan via cfe-commits
@@ -27981,6 +27981,118 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, ShortNamespacesOption) { + FormatStyle Style = getLLVMStyle(); + Style.AllowShortNamespacesOnASingleLine = true; + Style.FixNamespaceComments = false; + + //

[clang] clang-format: Add "AllowShortNamespacesOnASingleLine" option (PR #105597)

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

[clang] clang-format: Add "AllowShortNamespacesOnASingleLine" option (PR #105597)

2024-09-06 Thread Owen Pan via cfe-commits
@@ -27981,6 +27981,118 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, ShortNamespacesOption) { + FormatStyle Style = getLLVMStyle(); + Style.AllowShortNamespacesOnASingleLine = true; + Style.FixNamespaceComments = false; + + //

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

2024-09-07 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/107675 Fixes #107568. >From 6deac871ceae8ba3918570a4bdbd8476e014a3a1 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 7 Sep 2024 01:39:34 -0700 Subject: [PATCH] [clang-format] Fix a bug in annotating CastRParen Fixe

[clang] [clang-format] Fix a regression on BAS_AlwaysBreak (PR #107506)

2024-09-07 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/107506 >From bd7da6ec9afabd829010db4c33d088590ab68b5a Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 5 Sep 2024 19:44:46 -0700 Subject: [PATCH 1/2] [clang-format] Fix a regression on BAS_AlwaysBreak Fixes #107401.

[clang] [clang-format] Fix a regression on BAS_AlwaysBreak (PR #107506)

2024-09-07 Thread Owen Pan via cfe-commits
@@ -861,7 +861,7 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, // or // cal( // new SomethingElseee()); - !IsSimpleFunction(Current)) { + Current.isNot(

[clang] [clang-format] Fix a regression on BAS_AlwaysBreak (PR #107506)

2024-09-07 Thread Owen Pan via cfe-commits
owenca wrote: > i've also found 3 more cases that point back to same patch in #107574, in > case you want to address all of them with this change I'd rather make incremental changes. Maybe you or @gedare can give them a try. https://github.com/llvm/llvm-project/pull/107506

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

2024-09-07 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/107675 ___ 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 on BAS_AlwaysBreak (PR #107506)

2024-09-08 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/107506 >From bd7da6ec9afabd829010db4c33d088590ab68b5a Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 5 Sep 2024 19:44:46 -0700 Subject: [PATCH 1/3] [clang-format] Fix a regression on BAS_AlwaysBreak Fixes #107401.

[clang] [clang-format] Fix regressions in BAS_AlwaysBreak (PR #107506)

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

[clang] [clang-format] Fix regressions in BAS_AlwaysBreak (PR #107506)

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

[clang] [clang-format] Add new option: WrapNamespaceBodyWithNewlines (PR #106145)

2024-09-08 Thread Owen Pan via cfe-commits
https://github.com/owenca requested changes to this pull request. Running `FormatTests` failed: ``` [ RUN ] FormatTest.WrapNamespaceBodyWithEmptyLinesNever Assertion failed: (TheLine->MatchingClosingBlockLineIndex > 0), function tryFitMultipleLinesInOne, file UnwrappedLineFormatter.cpp, lin

[clang] [Format] Avoid repeated hash lookups (NFC) (PR #107962)

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

[clang] [Format] Avoid repeated hash lookups (NFC) (PR #107962)

2024-09-10 Thread Owen Pan via cfe-commits
@@ -86,9 +86,7 @@ void ObjCPropertyAttributeOrderFixer::sortPropertyAttributes( Value = Tok->TokenText; } -auto It = SortOrderMap.find(Attribute); -if (It == SortOrderMap.end()) - It = SortOrderMap.insert({Attribute, SortOrderMap.size()}).first; +aut

[clang] [clang-format] Fix a serious bug in `git clang-format -f` (PR #102629)

2024-08-09 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/102629 With the --force (or -f) option, git-clang-format wipes out input files excluded by a .clang-format-ignore file if they have unstaged changes. This patch adds a hidden clang-format option --list-ignored that lis

[clang] [clang-format] Fix a serious bug in `git clang-format -f` (PR #102629)

2024-08-09 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/102629 >From 9b71b289feb75cdc6d67a6ac696ff0ba7969549d Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 9 Aug 2024 08:15:43 -0700 Subject: [PATCH 1/2] [clang-format] Fix a serious bug in `git clang-format -f` With the

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

2024-08-09 Thread Owen Pan via cfe-commits
owenca wrote: > Thanks for the review feedback @owenca @HazardyKnusperkeks Please merge this > PR for me if you feel it is ready as I don't have merge permissions I wonder if anyone can come up with a better name than `OnePerLine`. See https://github.com/llvm/llvm-project/pull/101882#issuecomm

[clang] [clang-format] Fix a serious bug in `git clang-format -f` (PR #102629)

2024-08-09 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/102629 >From 9b71b289feb75cdc6d67a6ac696ff0ba7969549d Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 9 Aug 2024 08:15:43 -0700 Subject: [PATCH 1/3] [clang-format] Fix a serious bug in `git clang-format -f` With the

[clang] [clang-format] Fix a serious bug in `git clang-format -f` (PR #102629)

2024-08-09 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/102629 >From 9b71b289feb75cdc6d67a6ac696ff0ba7969549d Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 9 Aug 2024 08:15:43 -0700 Subject: [PATCH 1/4] [clang-format] Fix a serious bug in `git clang-format -f` With the

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

2024-08-10 Thread Owen Pan via cfe-commits
https://github.com/owenca closed 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] Fix a serious bug in `git clang-format -f` (PR #102629)

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

[clang] [clang-format] Fix a serious bug in `git clang-format -f` (PR #102629)

2024-08-10 Thread Owen Pan via cfe-commits
owenca wrote: /cherry-pick 986bc3d0719af653fecb77e8cfc59f39bec148fd https://github.com/llvm/llvm-project/pull/102629 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix a serious bug in `git clang-format -f` (PR #102629)

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

[clang] [clang-format] Fix a serious bug in `git clang-format -f` (PR #102629)

2024-08-12 Thread Owen Pan via cfe-commits
owenca wrote: You need to use the clang-format built from this patch, which adds the new clang-format `-list-ignored` option. https://github.com/llvm/llvm-project/pull/102629 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.o

[clang] [clang-format] Correctly handle C# attribute on auto property (PR #102921)

2024-08-12 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/102921 Fixes #101487. >From 5fd35e3d2b9775867a259457879fc7030c901724 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Mon, 12 Aug 2024 08:24:12 -0700 Subject: [PATCH] [clang-format] Correctly handle C# attribute on auto p

[clang] [clang-format] Correctly handle C# attribute on auto property (PR #102921)

2024-08-12 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/102921 ___ 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 braces enclosing stringification (PR #102998)

2024-08-12 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/102998 Fixes #102937. >From bd4a32c90f6148d27b010a5a1497c0f447144d9a Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Mon, 12 Aug 2024 20:58:04 -0700 Subject: [PATCH] [clang-format] Fix annotation of braces enclosing str

[clang] [clang-format] Fix annotation of braces enclosing stringification (PR #102998)

2024-08-12 Thread Owen Pan via cfe-commits
https://github.com/owenca milestoned https://github.com/llvm/llvm-project/pull/102998 ___ 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 braces enclosing stringification (PR #102998)

2024-08-13 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/102998 ___ 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 braces enclosing stringification (PR #102998)

2024-08-13 Thread Owen Pan via cfe-commits
owenca wrote: /cherry-pick ee2359968fa307ef45254c816e14df33374168cd https://github.com/llvm/llvm-project/pull/102998 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)

2024-08-14 Thread Owen Pan via cfe-commits
@@ -497,6 +497,16 @@ template <> struct MappingTraits { } }; +template <> struct ScalarEnumerationTraits { + static void enumeration(IO &IO, FormatStyle::ReflowCommentsStyle &Value) { +IO.enumCase(Value, "Never", FormatStyle::RCS_Never); +IO.enumCase(Value, "Indent

[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)

2024-08-14 Thread Owen Pan via cfe-commits
@@ -3750,24 +3750,43 @@ struct FormatStyle { ReferenceAlignmentStyle ReferenceAlignment; // clang-format off - /// If ``true``, clang-format will attempt to re-flow comments. That is it - /// will touch a comment and *reflow* long comments into new lines, trying to - //

[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)

2024-08-14 Thread Owen Pan via cfe-commits
@@ -4588,11 +4588,11 @@ bool UnwrappedLineParser::isOnNewLine(const FormatToken &FormatTok) { // Checks if \p FormatTok is a line comment that continues the line comment // section on \p Line. -static bool -continuesLineCommentSection(const FormatToken &FormatTok, -

[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)

2024-08-14 Thread Owen Pan via cfe-commits
@@ -4588,11 +4588,11 @@ bool UnwrappedLineParser::isOnNewLine(const FormatToken &FormatTok) { // Checks if \p FormatTok is a line comment that continues the line comment // section on \p Line. -static bool -continuesLineCommentSection(const FormatToken &FormatTok, -

[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)

2024-08-14 Thread Owen Pan via cfe-commits
@@ -855,7 +859,8 @@ bool BreakableBlockComment::mayReflow( StringRef IndentContent = Content[LineIndex]; if (Lines[LineIndex].ltrim(Blanks).starts_with("*")) IndentContent = Lines[LineIndex].ltrim(Blanks).substr(1); - return LineIndex > 0 && !CommentPragmasRegex.match(

[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)

2024-08-14 Thread Owen Pan via cfe-commits
@@ -420,8 +420,10 @@ BreakableComment::getSplit(unsigned LineIndex, unsigned TailOffset, unsigned ColumnLimit, unsigned ContentStartColumn, const llvm::Regex &CommentPragmasRegex) const { // Don't break lines matching the

[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)

2024-08-14 Thread Owen Pan via cfe-commits
@@ -493,9 +493,36 @@ TEST_F(FormatTestComments, AlignsBlockComments) { TEST_F(FormatTestComments, CommentReflowingCanBeTurnedOff) { FormatStyle Style = getLLVMStyleWithColumns(20); - Style.ReflowComments = false; - verifyFormat("// a aa aa", Style);

[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)

2024-08-14 Thread Owen Pan via cfe-commits
@@ -1160,7 +1165,8 @@ bool BreakableLineCommentSection::mayReflow( // // text that protrudes // //into text with different indent // We do reflow in that case in block comments. - return LineIndex > 0 && !CommentPragmasRegex.match(IndentContent) && + return LineInde

[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)

2024-08-14 Thread Owen Pan via cfe-commits
@@ -608,8 +610,10 @@ BreakableToken::Split BreakableBlockComment::getSplit( unsigned LineIndex, unsigned TailOffset, unsigned ColumnLimit, unsigned ContentStartColumn, const llvm::Regex &CommentPragmasRegex) const { // Don't break lines matching the comment pragmas r

[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)

2024-08-14 Thread Owen Pan via cfe-commits
@@ -4778,8 +4778,8 @@ void UnwrappedLineParser::distributeComments( if (HasTrailAlignedWithNextToken && i == StartOfTrailAlignedWithNextToken) { FormatTok->ContinuesLineCommentSection = false; } else { - FormatTok->ContinuesLineCommentSection = - co

[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)

2024-08-14 Thread Owen Pan via cfe-commits
@@ -3750,24 +3750,43 @@ struct FormatStyle { ReferenceAlignmentStyle ReferenceAlignment; // clang-format off - /// If ``true``, clang-format will attempt to re-flow comments. That is it - /// will touch a comment and *reflow* long comments into new lines, trying to - //

[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)

2024-08-14 Thread Owen Pan via cfe-commits
@@ -493,9 +493,36 @@ TEST_F(FormatTestComments, AlignsBlockComments) { TEST_F(FormatTestComments, CommentReflowingCanBeTurnedOff) { FormatStyle Style = getLLVMStyleWithColumns(20); - Style.ReflowComments = false; - verifyFormat("// a aa aa", Style);

[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)

2024-08-14 Thread Owen Pan via cfe-commits
@@ -4704,8 +4704,8 @@ void UnwrappedLineParser::flushComments(bool NewlineBeforeNext) { // // FIXME: Consider putting separate line comment sections as children to the // unwrapped line instead. -Tok->ContinuesLineCommentSection = -continuesLineComment

[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)

2024-08-14 Thread Owen Pan via cfe-commits
@@ -493,9 +493,36 @@ TEST_F(FormatTestComments, AlignsBlockComments) { TEST_F(FormatTestComments, CommentReflowingCanBeTurnedOff) { FormatStyle Style = getLLVMStyleWithColumns(20); - Style.ReflowComments = false; - verifyFormat("// a aa aa", Style);

[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)

2024-08-14 Thread Owen Pan via cfe-commits
@@ -5272,22 +5272,46 @@ the configuration (without a prefix: ``Auto``). .. _ReflowComments: -**ReflowComments** (``Boolean``) :versionbadge:`clang-format 3.8` :ref:`¶ ` - If ``true``, clang-format will attempt to re-flow comments. That is it - will touch a comment and *ref

[clang] [clang-format] modified goto bool to enum (PR #65140)

2024-08-15 Thread Owen Pan via cfe-commits
owenca wrote: > Can we have a rule that a PR that reaches 6 months or 1 year without activity > we close with a comment of " Yep. IMO six months of no response _from the author_ is sufficient to close the PR. However, if we can't find a reviewer for the PR (e.g. #78904), we should leave it op

[clang] [clang-format] add an option to insert a space only for non-code block empty braces, not for empty parentheses (PR #93634)

2024-08-15 Thread Owen Pan via cfe-commits
@@ -4493,13 +4493,11 @@ struct FormatStyle { bool SpaceBeforeRangeBasedForLoopColon; /// If ``true``, spaces will be inserted into ``{}``. - /// \code - ///true:false: - ///void f() { } vs. void f() {} - ///

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

2024-08-15 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 its use o

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

2024-08-15 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? >

[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)

2024-08-15 Thread Owen Pan via cfe-commits
@@ -5272,22 +5272,46 @@ the configuration (without a prefix: ``Auto``). .. _ReflowComments: -**ReflowComments** (``Boolean``) :versionbadge:`clang-format 3.8` :ref:`¶ ` - If ``true``, clang-format will attempt to re-flow comments. That is it - will touch a comment and *ref

[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)

2024-08-15 Thread Owen Pan via cfe-commits
https://github.com/owenca approved this pull request. https://github.com/llvm/llvm-project/pull/96804 ___ 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 BK_BracedInit (PR #87450)

2024-04-04 Thread Owen Pan via cfe-commits
https://github.com/owenca dismissed https://github.com/llvm/llvm-project/pull/87450 ___ 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 BK_BracedInit (PR #87450)

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

[clang] [polly] [clang-format] Correctly annotate block braces of empty ctors/dtors (PR #82097)

2024-04-04 Thread Owen Pan via cfe-commits
owenca wrote: /cherry-pick 8de230093f58 https://github.com/llvm/llvm-project/pull/82097 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] 7702023 - [clang-format][NFC] Rename `kind` to `Kind`

2024-04-05 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-04-05T22:17:50-07:00 New Revision: 770202343ebce1f2bc0745c78e298e251f204bee URL: https://github.com/llvm/llvm-project/commit/770202343ebce1f2bc0745c78e298e251f204bee DIFF: https://github.com/llvm/llvm-project/commit/770202343ebce1f2bc0745c78e298e251f204bee.diff LOG:

[clang] [clang-format][NFC] Add getNextNonComment() to FormatTokenSource (PR #87868)

2024-04-05 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/87868 None >From 5c614fec2b54c146841a9ef3089dee1a63f72543 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 5 Apr 2024 22:45:47 -0700 Subject: [PATCH] [clang-format][NFC] Add getNextNonComment() to FormatTokenSource

[clang] [clang-format][NFC] Add getNextNonComment() to FormatTokenSource (PR #87868)

2024-04-06 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/87868 >From 5c614fec2b54c146841a9ef3089dee1a63f72543 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 5 Apr 2024 22:45:47 -0700 Subject: [PATCH 1/2] [clang-format][NFC] Add getNextNonComment() to FormatTokenSource -

[clang] 684f27d - [clang-format][NFC] Use `is` instead of `getType() ==`

2024-04-06 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-04-06T01:51:45-07:00 New Revision: 684f27d37a6f1faf546a71bcb784b48c7fc8b7e0 URL: https://github.com/llvm/llvm-project/commit/684f27d37a6f1faf546a71bcb784b48c7fc8b7e0 DIFF: https://github.com/llvm/llvm-project/commit/684f27d37a6f1faf546a71bcb784b48c7fc8b7e0.diff LOG:

[clang] [clang-format][NFC] Add getNextNonComment() to FormatTokenSource (PR #87868)

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

[clang] [clang-format] Added unittest of TableGen formatting w.r.t. block type calculation. (PR #87924)

2024-04-07 Thread Owen Pan via cfe-commits
@@ -290,6 +290,16 @@ TEST_F(FormatTestTableGen, MultiClass) { "}\n"); } +TEST_F(FormatTestTableGen, MultiClassesWithPasteOperator) { + // This is a sensitive example for the handling of the paste operators in + // brace type calculation. + verifyFormat("multi

[clang] [polly] [clang-format] Correctly annotate braces in macros (PR #87953)

2024-04-07 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/87953 Also fix unit tests and reformat polly. Fixes #86550. >From 6d0c7e5602a227b1b7310be46553aa689e6a93e7 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 7 Apr 2024 17:27:21 -0700 Subject: [PATCH] [clang-format] C

[clang] [polly] [clang-format] Correctly annotate braces in macros (PR #87953)

2024-04-07 Thread Owen Pan via cfe-commits
@@ -538,16 +538,6 @@ void UnwrappedLineParser::calculateBraceTypes(bool ExpectClassBody) { if (Style.Language == FormatStyle::LK_Proto) { ProbablyBracedList = NextTok->isOneOf(tok::comma, tok::r_square); } else { - // Skip NextTok over prepro

[clang] [polly] [clang-format] Correctly annotate braces in macros (PR #87953)

2024-04-07 Thread Owen Pan via cfe-commits
owenca wrote: The polly formatting failure should be ignored as CI is using clang-format 18.1.1 instead of the version built from this patch. https://github.com/llvm/llvm-project/pull/87953 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http

[clang] [polly] [clang-format] Correctly annotate braces in macros (PR #87953)

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

[clang] [clang-format] Remove trailing newlines in TableGen formatting test. (PR #87983)

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

[clang] [clang-format] instanceof is a keyword only in Java/JavaScript (PR #88085)

2024-04-08 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/88085 Fixes #87907. >From 0daef6caaac5d3779cda0d4cbbf9cd2514662b92 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Mon, 8 Apr 2024 20:29:26 -0700 Subject: [PATCH] [clang-format] instanceof is a keyword only in Java/Java

[clang] 5c056b3 - [clang-format] Clean up unit tests from commit 13be0d4a34c4

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

[clang] [polly] [clang-format] Correctly annotate braces in macros (PR #87953)

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

[clang] [clang-format] instanceof is a keyword only in Java/JavaScript (PR #88085)

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

[clang] [clang-format] Don't merge a short block for SBS_Never (PR #88238)

2024-04-10 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/88238 Also fix unit tests. Fixes #87484. >From 4122a4f0e189afa7aff1010f0061b4f4d2b2a627 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Wed, 10 Apr 2024 00:03:21 -0700 Subject: [PATCH] [clang-format] Don't merge a short

[clang] [clang-format] Don't merge a short block for SBS_Never (PR #88238)

2024-04-10 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/88238 >From 4122a4f0e189afa7aff1010f0061b4f4d2b2a627 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Wed, 10 Apr 2024 00:03:21 -0700 Subject: [PATCH 1/2] [clang-format] Don't merge a short block for SBS_Never Also fix un

[clang] [clang-format] Don't merge a short block for SBS_Never (PR #88238)

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

[clang-tools-extra] [clangd] Fix test case due to clang-format bug fix (PR #88352)

2024-04-10 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/88352 See commit 51f1681424f1. >From 3ecf27d15646345f43703f5a361bd9766307ebf4 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Wed, 10 Apr 2024 21:22:05 -0700 Subject: [PATCH] [clangd] Fix test case due to clang-format bu

[clang-tools-extra] [clangd] Fix test case due to clang-format bug fix (PR #88352)

2024-04-10 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/88352 >From a070f07c16ddacc1aaf7591a1f7c129bf6abc90a Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Wed, 10 Apr 2024 21:22:05 -0700 Subject: [PATCH] [clangd] Fix test case due to clang-format bug fix See commit 51f16814

[clang-tools-extra] [clangd] Fix test case due to clang-format bug fix (PR #88352)

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

[clang-tools-extra] [clangd] Fix test case due to clang-format bug fix (PR #88352)

2024-04-10 Thread Owen Pan via cfe-commits
owenca wrote: @HighCommander4 Thanks! https://github.com/llvm/llvm-project/pull/88352 ___ 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 ContinuationIndenter (PR #88414)

2024-04-11 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/88414 Commit d06b92391513 caused a regression that breaks after a block comment adjacent to a function paramter that follows. Fixes #86573. >From 2ec43f6dc1fafed9d7fc324eeacfa07133af3abd Mon Sep 17 00:00:00 2001 From:

[clang] [clang-format] Fix a regression in ContinuationIndenter (PR #88414)

2024-04-11 Thread Owen Pan via cfe-commits
https://github.com/owenca milestoned https://github.com/llvm/llvm-project/pull/88414 ___ 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 ContinuationIndenter (PR #88414)

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

[clang] [clang-format] Don't break between string literal operands of << (PR #69871)

2024-04-13 Thread Owen Pan via cfe-commits
owenca wrote: > I wish we'd made this removal an option rather than just removing it, what we > are seeing is reasonably formatted json or xml being streamed out is now > poorly written > > ```c++ > osjson << "{\n" ><<" \"name\": \"value\",\n" ><<" \"key\": \"abc\", \n" >

[clang] [clang-format] revert to string << string handling to previous default (PR #88490)

2024-04-14 Thread Owen Pan via cfe-commits
owenca wrote: Please see https://github.com/llvm/llvm-project/issues/88483#issuecomment-2053928993 and Conversation in #69859, which was the first attempt at adding an option for breaking consecutive stream insertion operations. Instead of handling everything specified in https://github.com/

[clang] [clang-format] Don't format comments in SkipMacroDefinitionBody (PR #94425)

2024-06-05 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/94425 ___ 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 `AlignAfterOpenBracket: DontAlign` (PR #94561)

2024-06-05 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/94561 Fixes #94555. >From f5a4cd0df1df390166adb8400e21894a0f2db18f Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Wed, 5 Jun 2024 19:18:19 -0700 Subject: [PATCH] [clang-format] Fix a bug in `AlignAfterOpenBracket: Dont

[clang] [clang-format] remove redundant else statement (PR #94548)

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

[clang] [clang-format][NFC] Remove an else after a return statement (PR #94548)

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

[clang] [clang-format][NFC] Remove an else after a return statement (PR #94548)

2024-06-05 Thread Owen Pan via cfe-commits
owenca wrote: It means "No Functional Change". See [here](https://llvm.org/docs/Lexicon.html#n). https://github.com/llvm/llvm-project/pull/94548 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cf

[clang] [clang-format] Fix a bug in `AlignAfterOpenBracket: DontAlign` (PR #94561)

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

[clang] [clang-format][NFC] Remove an else after a return statement (PR #94548)

2024-06-06 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/94548 ___ 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-06-06 Thread Owen Pan via cfe-commits
https://github.com/owenca closed 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] Fix bad comment indentation before ifdef after braceless if (PR #94776)

2024-06-08 Thread Owen Pan via cfe-commits
https://github.com/owenca commented: What happens if the comment is unindented, with and without an empty line below it? https://github.com/llvm/llvm-project/pull/94776 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[clang] [clang-format] Fix bad comment indentation before ifdef after braceless if (PR #94776)

2024-06-08 Thread Owen Pan via cfe-commits
@@ -4828,7 +4833,10 @@ void UnwrappedLineParser::readToken(int LevelDifference) { PPBranchLevel > 0) { Line->Level += PPBranchLevel; } - flushComments(isOnNewLine(*FormatTok)); + + if (!UnbracedBodyDepth) owenca wrote: Ditto.

[clang] [clang-format] Fix bad comment indentation before ifdef after braceless if (PR #94776)

2024-06-08 Thread Owen Pan via cfe-commits
@@ -796,6 +796,44 @@ TEST_F(FormatTestComments, ParsesCommentsAdjacentToPPDirectives) { format("namespace {}\n /* Test */#define A")); } +TEST_F(FormatTestComments, DeIdentsCommentBeforeIfdefAfterBracelessIf) { + verifyFormat("void f() {\n" +

<    6   7   8   9   10   11   12   13   14   15   >