[clang] [clang-format]: Split alignment of declarations around assignment (PR #69340)

2023-11-09 Thread Owen Pan via cfe-commits
https://github.com/owenca commented: See https://github.com/llvm/llvm-project/issues/66857#issuecomment-1793022188. Can you make this a suboption, e.g. `AlignFunctionPointers`? We can add another (e.g. `AlignConstructorsDestructors`) for ctors and dtors in the future. https://github.com/llvm/l

[clang] [clang-format] Handle variable declarations in BreakAfterAttributes (PR #71755)

2023-11-09 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/71755 >From 17921d5a1d74017128691428815ede53ac1a4d67 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Wed, 8 Nov 2023 17:55:56 -0800 Subject: [PATCH 1/2] [clang-format] Handle variable declarations in BreakAfterAttributes

[clang] [clang-format] Handle variable declarations in BreakAfterAttributes (PR #71755)

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

[clang] a0710e1 - Revert "[clang-format] Handle variable declarations in BreakAfterAttributes (#71755)"

2023-11-09 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2023-11-09T23:34:06-08:00 New Revision: a0710e162dac8eb845588779deb39f2b35e5cb88 URL: https://github.com/llvm/llvm-project/commit/a0710e162dac8eb845588779deb39f2b35e5cb88 DIFF: https://github.com/llvm/llvm-project/commit/a0710e162dac8eb845588779deb39f2b35e5cb88.diff LOG:

[clang] cc75e52 - [clang-format][NFC] Refactor isPointerOrReference

2023-11-10 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2023-11-10T01:23:05-08:00 New Revision: cc75e520162ef651977d3f6d11b0d0b92dd2be07 URL: https://github.com/llvm/llvm-project/commit/cc75e520162ef651977d3f6d11b0d0b92dd2be07 DIFF: https://github.com/llvm/llvm-project/commit/cc75e520162ef651977d3f6d11b0d0b92dd2be07.diff LOG:

[clang] f7bbb58 - Reland "[clang-format] Handle variable declarations in BreakAfterAttributes (#71755)"

2023-11-10 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2023-11-10T01:53:43-08:00 New Revision: f7bbb58690910a8320b0927525dfba19df69a910 URL: https://github.com/llvm/llvm-project/commit/f7bbb58690910a8320b0927525dfba19df69a910 DIFF: https://github.com/llvm/llvm-project/commit/f7bbb58690910a8320b0927525dfba19df69a910.diff LOG:

[clang] 86ef9d3 - Revert "[clang-format] Handle variable declarations in BreakAfterAttributes (#71755)"

2023-11-10 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2023-11-10T02:03:35-08:00 New Revision: 86ef9d36519f72c06741335ce0a445ab73eb4cfb URL: https://github.com/llvm/llvm-project/commit/86ef9d36519f72c06741335ce0a445ab73eb4cfb DIFF: https://github.com/llvm/llvm-project/commit/86ef9d36519f72c06741335ce0a445ab73eb4cfb.diff LOG:

[clang] [clang-format] Handle variable declarations in BreakAfterAttributes (PR #71755)

2023-11-10 Thread Owen Pan via cfe-commits
owenca wrote: @Meinersbur thanks for the info! https://github.com/llvm/llvm-project/pull/71755 ___ 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] Handle variable declarations in BreakAfterAttributes (PR #71935)

2023-11-10 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/71935 Also fixed a bug in `isStartOfName()` and cleaned up some old test cases. Fixed #71563. This is a rework of #71755. >From 17921d5a1d74017128691428815ede53ac1a4d67 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: W

[llvm] [clang-tools-extra] [clang] [clang-format] Handle variable declarations in BreakAfterAttributes (PR #71935)

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

[clang] [clang-format] Handle control statements in BreakAfterAttributes (PR #71995)

2023-11-10 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/71995 This patch doesn't work for do-while loops. Fixed #64474. >From b67ea36d180e700cc6b0661e8f2390eda515c566 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 10 Nov 2023 00:21:58 -0800 Subject: [PATCH] [clang-form

[clang] [clang-format][NFC] Simplify parseBracedList() (PR #72010)

2023-11-10 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/72010 None >From f3f303d80a40b9ce8a13721cfa108b4094b8b2c3 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 10 Nov 2023 17:34:06 -0800 Subject: [PATCH] [clang-format][NFC] Simplify parseBracedList() --- clang/lib/Fo

[clang] [clang-format] Handle control statements in BreakAfterAttributes (PR #71995)

2023-11-11 Thread Owen Pan via cfe-commits
@@ -1432,34 +1432,82 @@ struct FormatStyle { /// const int i; /// [[gnu::const]] [[maybe_unused]] /// int j; +/// /// [[nodiscard]] /// inline int f(); /// [[gnu::const]] [[nodiscard]] /// int g(); +/// +/// [[likely]]

[clang] [clang-format] Handle control statements in BreakAfterAttributes (PR #71995)

2023-11-11 Thread Owen Pan via cfe-commits
@@ -2049,8 +2049,10 @@ the configuration (without a prefix: ``Auto``). .. _BreakAfterAttributes: **BreakAfterAttributes** (``AttributeBreakingStyle``) :versionbadge:`clang-format 16` :ref:`¶ ` - Break after a group of C++11 attributes before a variable/function - (including

[clang] [clang-format] Handle control statements in BreakAfterAttributes (PR #71995)

2023-11-11 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/71995 >From b67ea36d180e700cc6b0661e8f2390eda515c566 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 10 Nov 2023 00:21:58 -0800 Subject: [PATCH 1/2] [clang-format] Handle control statements in BreakAfterAttributes

[clang] [clang-format] Remove special handling of comments after brace/paren (PR #71672)

2023-11-11 Thread Owen Pan via cfe-commits
@@ -802,7 +802,10 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, Previous.isNot(TT_ObjCMethodExpr) && Previous.isNot(TT_RequiresClause) && !(Current.MacroParent && Previous.MacroParent) && (Current.isNot(TT_LineComment) ||

[clang] [clang-format][NFC] Simplify parseBracedList() (PR #72010)

2023-11-11 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/72010 >From f3f303d80a40b9ce8a13721cfa108b4094b8b2c3 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 10 Nov 2023 17:34:06 -0800 Subject: [PATCH 1/2] [clang-format][NFC] Simplify parseBracedList() --- clang/lib/Form

[clang] [clang-format] Handle control statements in BreakAfterAttributes (PR #71995)

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

[clang] [clang-format][NFC] Simplify parseBracedList() (PR #72010)

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

[clang] 265ed68 - [clang-format] Fix a JavaScript import order bug

2023-10-25 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2023-10-25T17:06:53-07:00 New Revision: 265ed6819409a9d76f112a601d48b971904921c8 URL: https://github.com/llvm/llvm-project/commit/265ed6819409a9d76f112a601d48b971904921c8 DIFF: https://github.com/llvm/llvm-project/commit/265ed6819409a9d76f112a601d48b971904921c8.diff LOG:

[clang] e3ecdf7 - [clang-format][NFC] Remove some extraneous newlines at end of test cases

2023-10-26 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2023-10-26T13:37:23-07:00 New Revision: e3ecdf7d3b7ec8fa2c3c594ff39b20788e75eaf2 URL: https://github.com/llvm/llvm-project/commit/e3ecdf7d3b7ec8fa2c3c594ff39b20788e75eaf2 DIFF: https://github.com/llvm/llvm-project/commit/e3ecdf7d3b7ec8fa2c3c594ff39b20788e75eaf2.diff LOG:

[clang] [clang-format] Change LLVM style to BreakAfterAttributes == ABS_Leave (PR #70360)

2023-10-26 Thread Owen Pan via cfe-commits
owenca wrote: This would change the default for every other predefined style, which might be ok if there's no mention of breaking after C++11 attributes in those styles. https://github.com/llvm/llvm-project/pull/70360 ___ cfe-commits mailing list cfe-

[clang] 88934a8 - [clang-format][NFC] Remove extraneous newlines in some unit test files

2023-10-26 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2023-10-26T21:43:27-07:00 New Revision: 88934a82dced0116227e4ad9af8896d8fa0943b8 URL: https://github.com/llvm/llvm-project/commit/88934a82dced0116227e4ad9af8896d8fa0943b8 DIFF: https://github.com/llvm/llvm-project/commit/88934a82dced0116227e4ad9af8896d8fa0943b8.diff LOG:

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

2023-10-27 Thread Owen Pan via cfe-commits
owenca wrote: IMO, the new behavior is consistent with the [documentation](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#columnlimit) for `ColumnLimt: 0`. https://github.com/llvm/llvm-project/pull/69871 ___ cfe-commits mailing list cfe-com

[clang] 6c3bc91 - [clang-format][NFC] Remove more extraneous newlines in unit tests

2023-10-27 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2023-10-27T02:22:36-07:00 New Revision: 6c3bc910588f962e49470098ccc3b13c29cae493 URL: https://github.com/llvm/llvm-project/commit/6c3bc910588f962e49470098ccc3b13c29cae493 DIFF: https://github.com/llvm/llvm-project/commit/6c3bc910588f962e49470098ccc3b13c29cae493.diff LOG:

[clang] [clang-format] Change LLVM style to BreakAfterAttributes == ABS_Leave (PR #70360)

2023-10-27 Thread Owen Pan via cfe-commits
owenca wrote: > [Google](https://google.github.io/styleguide/cppguide.html) is the only one > mentioning attributes: > > > Attributes, and macros that expand to attributes, appear at the very > > beginning of the function declaration or definition, before the return type: > > ```c++ > > ABSL_

[clang] [clang-format] Change LLVM style to BreakAfterAttributes == ABS_Leave (PR #70360)

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

[clang] [clang-format] Change LLVM style to BreakAfterAttributes == ABS_Leave (PR #70360)

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

[clang] [clang-format] Change LLVM style to BreakAfterAttributes == ABS_Leave (PR #70360)

2023-10-27 Thread Owen Pan via cfe-commits
@@ -794,6 +794,7 @@ clang-format - Add ``AllowBreakBeforeNoexceptSpecifier`` option. - Add ``AllowShortCompoundRequirementOnASingleLine`` option. +- Change ``BreakAfterAttributes`` from ``Never`` to ``Leave`` in LLVM style owenca wrote: Full stop

[clang] [clang-format] Change LLVM style to BreakAfterAttributes == ABS_Leave (PR #70360)

2023-10-27 Thread Owen Pan via cfe-commits
@@ -26179,7 +26179,7 @@ TEST_F(FormatTest, RemoveSemicolon) { TEST_F(FormatTest, BreakAfterAttributes) { FormatStyle Style = getLLVMStyle(); - EXPECT_EQ(Style.BreakAfterAttributes, FormatStyle::ABS_Never); + EXPECT_EQ(Style.BreakAfterAttributes, FormatStyle::ABS_Leave); --

[clang] 9299ace - [clang-format][NFC] Remove extraneous newlines in remaining unit tests

2023-10-27 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2023-10-27T03:42:16-07:00 New Revision: 9299ace0a20d3ea4d921c033a49364ea6f24263e URL: https://github.com/llvm/llvm-project/commit/9299ace0a20d3ea4d921c033a49364ea6f24263e DIFF: https://github.com/llvm/llvm-project/commit/9299ace0a20d3ea4d921c033a49364ea6f24263e.diff LOG:

[clang] [clang-format] Change LLVM style to BreakAfterAttributes == ABS_Leave (PR #70360)

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

[clang] [clang-format]: Split alignment of declarations around assignment (PR #69340)

2023-10-27 Thread Owen Pan via cfe-commits
owenca wrote: > @gedare can you fix the merge conflict on this one? We don't want to merge this yet. See [here](https://github.com/llvm/llvm-project/issues/68079#issuecomment-1776826021). https://github.com/llvm/llvm-project/pull/69340 ___ cfe-commit

[clang] [clang-format]: Split alignment of declarations around assignment (PR #69340)

2023-10-27 Thread Owen Pan via cfe-commits
https://github.com/owenca requested changes to this pull request. Please see [here](https://github.com/llvm/llvm-project/issues/68079#issuecomment-1776826021). https://github.com/llvm/llvm-project/pull/69340 ___ cfe-commits mailing list cfe-commits@li

[clang] [clang-format][NFC] Delete TT_LambdaArrow (PR #70519)

2023-10-27 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/70519 It's one type of TT_TrailingReturnArrow. >From 64d622264f2e3cd3345f741965f450daa00bac5e Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 27 Oct 2023 15:33:40 -0700 Subject: [PATCH] [clang-format][NFC] Delete TT

[clang] [clang-format] Option to ignore PP directives (PR #70338)

2023-10-27 Thread Owen Pan via cfe-commits
https://github.com/owenca requested changes to this pull request. Please refer to the [policy](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#adding-additional-style-options) for adding new options. https://github.com/llvm/llvm-project/pull/70338 _

[clang] [clang-format] Option to ignore PP directives (PR #70338)

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

[clang] [clang-format] Option to ignore PP directives (PR #70338)

2023-10-27 Thread Owen Pan via cfe-commits
owenca wrote: > #67911 is a pull request, not an issue, i'm not sure what you're referring to I think it was a typo. It should be #67991. https://github.com/llvm/llvm-project/pull/70338 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://l

[clang] [clang-format][NFC] Delete TT_LambdaArrow (PR #70519)

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

[clang] [clang-format][NFC] Reduce indent (PR #70583)

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

[clang] [clang-format] Fix annotating annotations after requires clause (PR #70602)

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

[clang] [clang-format] Treat empty for/while loops as short loops (PR #70768)

2023-10-30 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/70768 A for/while loop with only a semicolon as its body should be treated as an empty loop. Fixes #61708. >From 7e6030532f99b4128807631e993609ce40171043 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Mon, 30 Oct 2023

[clang] [clang-format] Treat empty for/while loops as short loops (PR #70768)

2023-10-31 Thread Owen Pan via cfe-commits
@@ -3117,9 +3117,16 @@ void UnwrappedLineParser::parseForOrWhileLoop(bool HasParens) { FormatTok->setFinalizedType(TT_ConditionLParen); parseParens(); } - // Event control. - if (Style.isVerilog()) + + if (Style.isVerilog()) { +// Event control. parseVe

[clang] [clang-format] Treat empty for/while loops as short loops (PR #70768)

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

[clang] Add ability for clang-format-diff to exit with non-0 status (PR #70883)

2023-10-31 Thread Owen Pan via cfe-commits
@@ -185,6 +191,8 @@ def main(): diff_string = "".join(diff) if len(diff_string) > 0: sys.stdout.write(diff_string) +if args.non_zero_exit_code: +sys.exit(1) owenca wrote: ```suggestion

[clang] [clang-format] Treat empty for/while loops as short loops (PR #70768)

2023-11-01 Thread Owen Pan via cfe-commits
@@ -3117,9 +3117,16 @@ void UnwrappedLineParser::parseForOrWhileLoop(bool HasParens) { FormatTok->setFinalizedType(TT_ConditionLParen); parseParens(); } - // Event control. - if (Style.isVerilog()) + + if (Style.isVerilog()) { +// Event control. parseVe

[clang] Add ability for clang-format-diff to exit with non-0 status (PR #70883)

2023-11-01 Thread Owen Pan via cfe-commits
@@ -185,6 +191,8 @@ def main(): diff_string = "".join(diff) if len(diff_string) > 0: sys.stdout.write(diff_string) +if args.non_zero_exit_code: +sys.exit(1) owenca wrote: I was aware o

[clang] [clang-format] Treat empty for/while loops as short loops (PR #70768)

2023-11-01 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/70768 >From 7e6030532f99b4128807631e993609ce40171043 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Mon, 30 Oct 2023 22:50:27 -0700 Subject: [PATCH 1/2] [clang-format] Treat empty for/while loops as short loops A for/wh

[clang] [clang-format] Treat empty for/while loops as short loops (PR #70768)

2023-11-01 Thread Owen Pan via cfe-commits
@@ -3117,9 +3117,16 @@ void UnwrappedLineParser::parseForOrWhileLoop(bool HasParens) { FormatTok->setFinalizedType(TT_ConditionLParen); parseParens(); } - // Event control. - if (Style.isVerilog()) + + if (Style.isVerilog()) { +// Event control. parseVe

[clang] [clang-format] Treat empty for/while loops as short loops (PR #70768)

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

[clang] [clang-format] Treat empty for/while loops as short loops (PR #70768)

2023-11-01 Thread Owen Pan via cfe-commits
@@ -3117,9 +3117,16 @@ void UnwrappedLineParser::parseForOrWhileLoop(bool HasParens) { FormatTok->setFinalizedType(TT_ConditionLParen); parseParens(); } - // Event control. - if (Style.isVerilog()) + + if (Style.isVerilog()) { +// Event control. parseVe

[clang] [clang-format] Treat empty for/while loops as short loops (PR #70768)

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

[clang] [clang-format] Break after string literals with trailing line breaks (PR #76795)

2024-01-05 Thread Owen Pan via cfe-commits
@@ -5151,6 +5151,14 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line, return true; if (Left.IsUnterminatedLiteral) return true; + // FIXME: Breaking after newlines seems useful in general. Turn this into an + // option and recognize more cases like

[clang] [clang-format] Break after string literals with trailing line breaks (PR #76795)

2024-01-05 Thread Owen Pan via cfe-commits
@@ -2499,6 +2499,15 @@ TEST_F(TokenAnnotatorTest, BraceKind) { EXPECT_BRACE_KIND(Tokens[6], BK_Block); } +TEST_F(TokenAnnotatorTest, StreamOperator) { + auto Tokens = annotate("\"foo\\n\" << aux << \"foo\\n\" << \"foo\";"); + ASSERT_EQ(Tokens.size(), 9u) << Tokens; + EXPE

[clang] [clang-format]: Split alignment of declarations around assignment (PR #69340)

2024-01-05 Thread Owen Pan via cfe-commits
owenca wrote: > @owenca this waits for re-review Can you rebase the patch? https://github.com/llvm/llvm-project/pull/69340 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format]: Split alignment of declarations around assignment (PR #69340)

2024-01-06 Thread Owen Pan via cfe-commits
https://github.com/owenca commented: Please also update the release notes. LGTM otherwise. https://github.com/llvm/llvm-project/pull/69340 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

[clang] [clang-format]: Split alignment of declarations around assignment (PR #69340)

2024-01-06 Thread Owen Pan via cfe-commits
@@ -76,40 +76,49 @@ template <> struct MappingTraits { FormatStyle::AlignConsecutiveStyle( {/*Enabled=*/false, /*AcrossEmptyLines=*/false, /*AcrossComments=*/false, /*AlignCompound=*/false, + /*AlignF

[clang] [clang-format]: Split alignment of declarations around assignment (PR #69340)

2024-01-06 Thread Owen Pan via cfe-commits
@@ -76,40 +76,49 @@ template <> struct MappingTraits { FormatStyle::AlignConsecutiveStyle( {/*Enabled=*/false, /*AcrossEmptyLines=*/false, /*AcrossComments=*/false, /*AlignCompound=*/false, + /*AlignF

[clang] [clang-format]: Split alignment of declarations around assignment (PR #69340)

2024-01-06 Thread Owen Pan via cfe-commits
@@ -76,40 +76,49 @@ template <> struct MappingTraits { FormatStyle::AlignConsecutiveStyle( {/*Enabled=*/false, /*AcrossEmptyLines=*/false, /*AcrossComments=*/false, /*AlignCompound=*/false, + /*AlignF

[clang] [clang-format]: Split alignment of declarations around assignment (PR #69340)

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

[clang] [clang-format]: Split alignment of declarations around assignment (PR #69340)

2024-01-06 Thread Owen Pan via cfe-commits
@@ -76,40 +76,49 @@ template <> struct MappingTraits { FormatStyle::AlignConsecutiveStyle( {/*Enabled=*/false, /*AcrossEmptyLines=*/false, /*AcrossComments=*/false, /*AlignCompound=*/false, + /*AlignF

[clang] [clang-format]: Split alignment of declarations around assignment (PR #69340)

2024-01-06 Thread Owen Pan via cfe-commits
@@ -225,6 +225,22 @@ struct FormatStyle { /// bbb = 2; /// \endcode bool AlignCompound; +/// Only for ``AlignConsecutiveDeclarations``. Whether function pointers +/// are aligned. owenca wrote: ```suggestion /// Only for ``AlignConsec

[clang] [clang-format]: Split alignment of declarations around assignment (PR #69340)

2024-01-06 Thread Owen Pan via cfe-commits
@@ -978,7 +978,14 @@ void WhitespaceManager::alignConsecutiveDeclarations() { AlignTokens( Style, - [](Change const &C) { + [&](Change const &C) { +if (Style.AlignConsecutiveDeclarations.AlignFunctionPointers) { + for (FormatToken *Prev = C.T

[clang] [clang-format]: Split alignment of declarations around assignment (PR #69340)

2024-01-06 Thread Owen Pan via cfe-commits
@@ -76,40 +76,49 @@ template <> struct MappingTraits { FormatStyle::AlignConsecutiveStyle( {/*Enabled=*/false, /*AcrossEmptyLines=*/false, /*AcrossComments=*/false, /*AlignCompound=*/false, + /*AlignF

[clang] [clang-tools-extra] [llvm] [mlir] [emacs] Fix Emacs library formatting (PR #76110)

2024-01-06 Thread Owen Pan via cfe-commits
owenca wrote: @darkfeline I'm ok with adding the Version comment in clang/tools/clang-format/clang-format.el, but you may have to explicitly request others to review the rest of the patch. https://github.com/llvm/llvm-project/pull/76110 ___ cfe-commi

[clang] [clang-format] Break after string literals with trailing line breaks (PR #76795)

2024-01-06 Thread Owen Pan via cfe-commits
@@ -2499,6 +2499,15 @@ TEST_F(TokenAnnotatorTest, BraceKind) { EXPECT_BRACE_KIND(Tokens[6], BK_Block); } +TEST_F(TokenAnnotatorTest, StreamOperator) { + auto Tokens = annotate("\"foo\\n\" << aux << \"foo\\n\" << \"foo\";"); + ASSERT_EQ(Tokens.size(), 9u) << Tokens; + EXPE

[clang] [clang-format] Fix crash involving array designators and dangling comma (PR #77045)

2024-01-08 Thread Owen Pan via cfe-commits
@@ -1444,16 +1444,26 @@ WhitespaceManager::CellDescriptions WhitespaceManager::getCells(unsigned Start, } else if (C.Tok->is(tok::comma)) { if (!Cells.empty()) Cells.back().EndIndex = i; -if (C.Tok->getNextNonComment()->isNot(tok::r_brace)) // d

[clang] [clang-format] Break after string literals with trailing line breaks (PR #76795)

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

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

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

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-08 Thread Owen Pan via cfe-commits
owenca wrote: > > can you also add a test to clang/unittests/Format/TokenAnnotatorTest.cpp > > that ensures trailing attribute-like macros receive `StartOfName` > > annotation to make sure we don't regress the signal in the future? > > ok, that opened a whole can of worms. > > ``` > Tokens =

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-08 Thread Owen Pan via cfe-commits
@@ -2209,7 +2209,8 @@ class AnnotatingParser { (!NextNonComment && !Line.InMacroBody) || (NextNonComment && (NextNonComment->isPointerOrReference() || - NextNonComment->isOneOf(tok::identifier, tok::string_literal { + (Line.InPragm

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-08 Thread Owen Pan via cfe-commits
@@ -8498,9 +8498,6 @@ TEST_F(FormatTest, BreaksFunctionDeclarationsWithTrailingTokens) { "__attribute__((unused));"); Style = getGoogleStyle(); - ASSERT_THAT(Style.AttributeMacros, owenca wrote: Please also delete line 10: ``` #include

[clang] [clang-format] Fix crash involving array designators and dangling comma (PR #77045)

2024-01-08 Thread Owen Pan via cfe-commits
@@ -1444,16 +1444,26 @@ WhitespaceManager::CellDescriptions WhitespaceManager::getCells(unsigned Start, } else if (C.Tok->is(tok::comma)) { if (!Cells.empty()) Cells.back().EndIndex = i; -if (C.Tok->getNextNonComment()->isNot(tok::r_brace)) // d

[clang] [clang-format] Don't apply severe penalty if no possible column formats (PR #76675)

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

[clang] [clang-format] Fix crash involving array designators (PR #77045)

2024-01-09 Thread Owen Pan via cfe-commits
@@ -2315,6 +2315,8 @@ bool UnwrappedLineParser::tryToParseLambdaIntroducer() { if (Next->is(tok::greater)) return false; } + if (tok::isLiteral(FormatTok->Tok.getKind())) +return false; owenca wrote: ```suggestion ``` Instead, I would change l

[clang] [clang-format] Fix crash involving array designators (PR #77045)

2024-01-09 Thread Owen Pan via cfe-commits
owenca wrote: Please add an assertion in `WhitespaceManager.h`: ``` --- a/clang/lib/Format/WhitespaceManager.h +++ b/clang/lib/Format/WhitespaceManager.h @@ -282,6 +282,7 @@ private: for (auto PrevIter = Start; PrevIter != End; ++PrevIter) { // If we broke the line the initial spaces

[clang] [ClangFormat] Fix formatting bugs. (PR #76245)

2024-01-09 Thread Owen Pan via cfe-commits
@@ -255,6 +255,41 @@ TEST_F(FormatTestMacroExpansion, Style); } +TEST_F(FormatTestMacroExpansion, CommaAsOperator) { + FormatStyle Style = getGoogleStyle(); + Style.ColumnLimit = 42; owenca wrote: ```suggestion FormatStyle Style =

[clang] [ClangFormat] Fix formatting bugs. (PR #76245)

2024-01-09 Thread Owen Pan via cfe-commits
@@ -255,6 +255,41 @@ TEST_F(FormatTestMacroExpansion, Style); } +TEST_F(FormatTestMacroExpansion, CommaAsOperator) { + FormatStyle Style = getGoogleStyle(); + Style.ColumnLimit = 42; + Style.Macros.push_back("MACRO(a, b, c)=a=(b); if(x) c"); + veri

[clang] [ClangFormat] Fix formatting bugs. (PR #76245)

2024-01-09 Thread Owen Pan via cfe-commits
@@ -255,6 +255,41 @@ TEST_F(FormatTestMacroExpansion, Style); } +TEST_F(FormatTestMacroExpansion, CommaAsOperator) { + FormatStyle Style = getGoogleStyle(); + Style.ColumnLimit = 42; + Style.Macros.push_back("MACRO(a, b, c)=a=(b); if(x) c"); + veri

[clang] [ClangFormat] Fix formatting bugs. (PR #76245)

2024-01-09 Thread Owen Pan via cfe-commits
@@ -255,6 +255,41 @@ TEST_F(FormatTestMacroExpansion, Style); } +TEST_F(FormatTestMacroExpansion, CommaAsOperator) { + FormatStyle Style = getGoogleStyle(); + Style.ColumnLimit = 42; + Style.Macros.push_back("MACRO(a, b, c)=a=(b); if(x) c"); + veri

[clang] [ClangFormat] Fix formatting bugs. (PR #76245)

2024-01-09 Thread Owen Pan via cfe-commits
@@ -255,6 +255,41 @@ TEST_F(FormatTestMacroExpansion, Style); } +TEST_F(FormatTestMacroExpansion, CommaAsOperator) { + FormatStyle Style = getGoogleStyle(); + Style.ColumnLimit = 42; + Style.Macros.push_back("MACRO(a, b, c)=a=(b); if(x) c"); + veri

[clang] [clang-format]: Split alignment of declarations around assignment (PR #69340)

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

[clang] [clang-format]: Split alignment of declarations around assignment (PR #69340)

2024-01-09 Thread Owen Pan via cfe-commits
@@ -1079,6 +1079,7 @@ clang-format - Add ``ObjCPropertyAttributeOrder`` which can be used to sort ObjC property attributes (like ``nonatomic, strong, nullable``). - Add ``.clang-format-ignore`` files. +- Add ``AlignFunctionPointers`` sub-option for ``AlignConsecutiveDeclarat

[clang] [clang-format] Fix crash involving array designators (PR #77045)

2024-01-09 Thread Owen Pan via cfe-commits
@@ -2315,6 +2315,8 @@ bool UnwrappedLineParser::tryToParseLambdaIntroducer() { if (Next->is(tok::greater)) return false; } + if (tok::isLiteral(FormatTok->Tok.getKind())) +return false; owenca wrote: You are right! Then how about the following

[clang] [clang-format] Fix crash involving array designators (PR #77045)

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

[clang] b53628a - Reland "[clang-format] Optimize processing .clang-format-ignore files"

2024-01-09 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-01-09T21:34:21-08:00 New Revision: b53628a52d1947c51e250d6fa4ff5dd12b737aa0 URL: https://github.com/llvm/llvm-project/commit/b53628a52d1947c51e250d6fa4ff5dd12b737aa0 DIFF: https://github.com/llvm/llvm-project/commit/b53628a52d1947c51e250d6fa4ff5dd12b737aa0.diff LOG:

[clang] [clang-format] Optimize processing .clang-format-ignore files (PR #76733)

2024-01-10 Thread Owen Pan via cfe-commits
owenca wrote: Relanded as b53628a52d19. (See [here](https://github.com/llvm/llvm-project/commit/42ec976184acd40436acd7104ad715c60ca3e7ed#commitcomment-136674701)). https://github.com/llvm/llvm-project/pull/76733 ___ cfe-commits mailing list cfe-commit

[clang] c69ec70 - [clang-format][NFC] Don't use clang-format style in config files

2024-01-10 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-01-10T00:58:35-08:00 New Revision: c69ec700adec315b3daa55742f2ef655242fa297 URL: https://github.com/llvm/llvm-project/commit/c69ec700adec315b3daa55742f2ef655242fa297 DIFF: https://github.com/llvm/llvm-project/commit/c69ec700adec315b3daa55742f2ef655242fa297.diff LOG:

[clang] [clang-format] Do not update cursor pos if no includes replacement (PR #77456)

2024-01-10 Thread Owen Pan via cfe-commits
owenca wrote: > The change is done 👍 Is the code formatting check broken? See [here](https://github.com/llvm/llvm-project/pull/76059#issuecomment-1865850011). https://github.com/llvm/llvm-project/pull/77456 ___ cfe-commits mailing list cfe-commits@li

[clang] [ClangFormat] Fix formatting bugs. (PR #76245)

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

[clang] [clang-format] Don't apply severe penalty if no possible column formats (PR #76675)

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

[clang] [clang-format]: Split alignment of declarations around assignment (PR #69340)

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

[clang] [clang-format] Fix crash involving array designators (PR #77045)

2024-01-10 Thread Owen Pan via cfe-commits
owenca wrote: > While I was trying to find a minimal reproducer to the bug, I accidentally > found that this patch fix another crash, and doesn't fix the linked issue. Can you open another pull request to [fix](https://github.com/llvm/llvm-project/pull/77045#discussion_r1442578220) the other

[clang] [clang-format] Fix crash involving array designators (PR #77045)

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

[clang] [clang-format] Handle possible crash in `getCells` (PR #77723)

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

[clang] [clang-format] Don't allow casts in front of ampamp (PR #77704)

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

[clang] [clang-format] Optimize processing .clang-format-ignore files (PR #76733)

2024-01-10 Thread Owen Pan via cfe-commits
owenca wrote: > This still breaks tests on win: http://45.33.8.238/win/88113/step_7.txt I didn't get any email for the failure. Is this a regular LLVM buildbot? If it chokes on `grep -Fx`, can you (or whoever has access to it) install a POSIX-compliant grep? It seems all other Windows buildbot

[clang] [clang-format] Add SpaceInParensOption for __attribute__ keyword (PR #77522)

2024-01-11 Thread Owen Pan via cfe-commits
owenca wrote: > The __attribute((specifier-list)) currently is formatted based on the > SpacesInParensOptions.Other (previously, SpacesInParentheses). This change > allows finer control over addition of spaces between the consecutive parens, > and between the inner parens and the list of attri

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

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

[clang] [clang-format] Handle possible crash in `getCells` (PR #77723)

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

<    1   2   3   4   5   6   7   8   9   10   >