[clang] [clang-format] Fix crashes in AlignArrayOfStructures (PR #72520)

2023-11-17 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/72520 >From efdf321e9447e8b3f1c27ccdf6da842107deb6dd Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 16 Nov 2023 06:36:41 -0800 Subject: [PATCH 1/4] [clang-format] Fix crashes in AlignArrayOfStructures Fixed #55493.

[clang] [clang-format] Fix crashes in AlignArrayOfStructures (PR #72520)

2023-11-17 Thread Owen Pan via cfe-commits
owenca wrote: > > Thanks for trying it on 17.x. We can't backport it then. > > Any idea if there is another workaround or fix that we could do to target > 17.x? 18 is still pretty far off and clang-format for 17 will soon be > included in a lot of downstream tools. Happy to help out fixing it

[clang] [clang-format] Fix crashes in AlignArrayOfStructures (PR #72520)

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

[clang] [clang-format][NFC] Skip alignArrayInitializers() for 1-row matrices (PR #72166)

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

[clang] f603369 - [clang-format][NFC] Remove a redundant isLiteral() call

2023-11-17 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2023-11-17T18:18:49-08:00 New Revision: f6033699646b7650123a273c043a93e5eeaac6d8 URL: https://github.com/llvm/llvm-project/commit/f6033699646b7650123a273c043a93e5eeaac6d8 DIFF: https://github.com/llvm/llvm-project/commit/f6033699646b7650123a273c043a93e5eeaac6d8.diff LOG:

[clang] [clang-format] Correctly annotate braces of empty functions (PR #72733)

2023-11-17 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/72733 Also fixed some existing test cases. Fixed #57305. Fixed #58251. >From 519c21da642026b917c2e51c95cc4347f85163ca Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 17 Nov 2023 17:51:33 -0800 Subject: [PATCH] [cla

[clang] [clang-format] Fix a bug in isStartOfName() on macro definitions (PR #72768)

2023-11-18 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/72768 Fixed #72751. >From 188eeabc89cfc4851ad1943d5ef6bf11bc6cb629 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 18 Nov 2023 16:37:45 -0800 Subject: [PATCH] [clang-format] Fix a bug in isStartOfName() on macro de

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-18 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 macro definitions (PR #70338)

2023-11-18 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] Fix a bug in aligning comments above PPDirective (PR #72791)

2023-11-19 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/72791 Fixed #72785. >From 0aadd3c1e458f1137c4d45bc14dfae7db9b0446f Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 19 Nov 2023 03:41:58 -0800 Subject: [PATCH] [clang-format] Fix a bug in aligning comments above PPD

[clang] [clang-format][NFC] Skip alignArrayInitializers() for 1-row matrices (PR #72166)

2023-11-19 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/72166 ___ 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 aligning comments above PPDirective (PR #72791)

2023-11-19 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/72791 ___ 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 isStartOfName() on macro definitions (PR #72768)

2023-11-19 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/72768 ___ 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 of empty functions (PR #72733)

2023-11-19 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/72733 ___ 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 macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via cfe-commits
https://github.com/owenca commented: Please update ReleaseNotes.rst. 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 macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via cfe-commits
@@ -2443,6 +2443,10 @@ struct FormatStyle { /// \version 13 std::vector IfMacros; + /// Ignore formatting in preprocessor definitions. + /// \version 18 + bool IgnorePPDefinitions; owenca wrote: Please rename it to `SkipMacroDefinition` or similar. ht

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 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 macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via cfe-commits
@@ -1355,6 +1362,10 @@ unsigned UnwrappedLineFormatter::format( bool FixIndentation = (FixBadIndentation || ContinueFormatting) && Indent != TheLine.First->OriginalColumn; bool ShouldFormat = TheLine.Affected || FixIndentation; + +if (Style

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via cfe-commits
@@ -24153,6 +24153,123 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) { verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style); } +TEST_F(FormatTest, IgnorePPDefinitions) { + FormatStyle Style = getLLVMStyle(); owenca wrote: ```suggesti

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via cfe-commits
@@ -2443,6 +2443,10 @@ struct FormatStyle { /// \version 13 std::vector IfMacros; + /// Ignore formatting in preprocessor definitions. owenca wrote: ```suggestion /// Do not format macro definitions. ``` https://github.com/llvm/llvm-project/pull/70338

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via cfe-commits
https://github.com/owenca requested changes to this pull request. 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 macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via cfe-commits
@@ -24153,6 +24153,123 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) { verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style); } +TEST_F(FormatTest, IgnorePPDefinitions) { + FormatStyle Style = getLLVMStyle(); + Style.IgnorePPDefinitions = true; + + v

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via cfe-commits
@@ -24153,6 +24153,123 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) { verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style); } +TEST_F(FormatTest, IgnorePPDefinitions) { + FormatStyle Style = getLLVMStyle(); + Style.IgnorePPDefinitions = true; + + v

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via cfe-commits
@@ -24153,6 +24153,123 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) { verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style); } +TEST_F(FormatTest, IgnorePPDefinitions) { + FormatStyle Style = getLLVMStyle(); + Style.IgnorePPDefinitions = true; + + v

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via cfe-commits
@@ -24153,6 +24153,123 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) { verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style); } +TEST_F(FormatTest, IgnorePPDefinitions) { + FormatStyle Style = getLLVMStyle(); + Style.IgnorePPDefinitions = true; + + v

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 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 macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via cfe-commits
owenca wrote: After giving more thoughts to this, I think what we really want is `SkipMacroDefinitionBody`, which would format the code below: ``` # define A a. b //comment # define A( x , y ) ( ( x ) + ( y ) ) ``` To the following: ``` #define A a. b // comment #define A(x, y)

[clang] [clang-format] Fix a bug in formating `#define A x:` (PR #73220)

2023-11-23 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/73220 Fixed #70789. >From 0a8459053be654313efff8002ff3e171d8cd9d18 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 23 Nov 2023 00:41:41 -0800 Subject: [PATCH] [clang-format] Fix a bug in formating `#define A x:` Fi

[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] Skip PP directives when determining brace kind (PR #69473)

2023-11-02 Thread Owen Pan via cfe-commits
owenca wrote: @rymiel can we merge this? https://github.com/llvm/llvm-project/pull/69473 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Use StringRef::{starts,ends}_with (NFC) (PR #75149)

2023-12-12 Thread Owen Pan via cfe-commits
owenca wrote: Running the in-tree clang-format on the changed files in clang/lib/Format passed, so that part LGTM. https://github.com/llvm/llvm-project/pull/75149 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/m

[clang] [Windows] Add git-clang-format wrapper bat file (PR #69228)

2023-12-12 Thread Owen Pan via cfe-commits
@@ -0,0 +1 @@ +py -3 git-clang-format %* owenca wrote: @llvm-beanz This doesn't seem to work if `git-clang-format` is run from another directory: ``` C:\Users\Owen\llvm-project>clang\tools\clang-format\git-clang-format C:\Users\Owen\llvm-project>py -3 git-clang

[clang] [clang-format] Fix a bug in git-clang-format.bat (PR #75268)

2023-12-12 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/75268 Pass the fully-qualified path name (less the file extension) of git-clang-format.bat to py so that it can be run from anywhere. Fixes #75265. >From 1eb01de0a5bcd20c903348ecccbc559751d97be5 Mon Sep 17 00:00:00 200

[clang] [Windows] Add git-clang-format wrapper bat file (PR #69228)

2023-12-12 Thread Owen Pan via cfe-commits
owenca wrote: See #75268. https://github.com/llvm/llvm-project/pull/69228 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix parsing of `operator<() {}` (PR #75144)

2023-12-12 Thread Owen Pan via cfe-commits
@@ -164,6 +167,12 @@ class AnnotatingParser { TT_OverloadedOperatorLParen))) { return false; } + FormatToken *ClosingParen = nullptr; + if (Previous.Previous->is(tok::kw_operator) && + isFunctionDeclarationName(Style.isCpp(), *Pre

[clang] [clang-format] Fix parsing of `operator<() {}` (PR #75144)

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

[clang] [clang-format] Fix parsing of `operator<() {}` (PR #75144)

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

[clang] [clang-format] Fix parsing of `operator<() {}` (PR #75144)

2023-12-12 Thread Owen Pan via cfe-commits
@@ -11727,6 +11727,13 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) { " void func(type &a) { a & member; }\n" " anotherType &member;\n" "}"); + + Style.ReferenceAlignment = FormatStyle::RAS_Left; + verifyFormat("class Foo {\

[clang] [clang-format] Fix parsing of `operator<() {}` (PR #75144)

2023-12-12 Thread Owen Pan via cfe-commits
@@ -298,6 +298,17 @@ TEST_F(TokenAnnotatorTest, UnderstandsUsesOfStarAndAmp) { ASSERT_EQ(Tokens.size(), 12u) << Tokens; EXPECT_TOKEN(Tokens[2], tok::identifier, TT_TypeName); EXPECT_TOKEN(Tokens[3], tok::star, TT_PointerOrReference); + + Tokens = annotate("class Foo {\n"

[clang] [clang-format] Fix parsing of `operator<() {}` (PR #75144)

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

[clang] [clang-format] Fix parsing of `operator<() {}` (PR #75144)

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

[clang] [clang-format] Fix parsing of `operator<() {}` (PR #75144)

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

[clang] [clang-format] Fix parsing of `operator<() {}` (PR #75144)

2023-12-13 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/75144 ___ 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 git-clang-format.bat (PR #75268)

2023-12-13 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/75268 ___ 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 `IndentExternBlock: NoIndent` (PR #75731)

2023-12-16 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/75731 Fixes #36620. Fixes #75719. >From 9e54c990db8e597a85239b1efea06b597acf6beb Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 16 Dec 2023 22:50:27 -0800 Subject: [PATCH] [clang-format] Fix a bug in `IndentExternB

[clang] [clang-format] Fix a bug in `IndentExternBlock: NoIndent` (PR #75731)

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

[clang] [clang-format] Add an fnmatch-like function for .clang-format-ignore (PR #76021)

2023-12-19 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/76021 This is needed because Windows doesn't have anything equivalent to the POSIX fnmatch() function. >From b53c8b6c6d34857168d868d99c8d7ea7a69621eb Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 19 Dec 2023 23:2

[clang] [clang-format] Fix a bug in formating `#define A x:` (PR #73220)

2023-11-24 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/73220 >From 0a8459053be654313efff8002ff3e171d8cd9d18 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 23 Nov 2023 00:41:41 -0800 Subject: [PATCH 1/2] [clang-format] Fix a bug in formating `#define A x:` Fixed #70789.

[clang] [clang-format] Fix a bug in formating `#define A x:` (PR #73220)

2023-11-24 Thread Owen Pan via cfe-commits
@@ -1171,6 +1171,13 @@ void UnwrappedLineParser::parsePPDefine() { assert((int)Line->PPLevel >= 0); Line->InMacroBody = true; + if (FormatTok->is(tok::identifier) && + Tokens->peekNextToken()->is(tok::colon)) { +nextToken(); +nextToken(); +addUnwrappedLin

[clang] [clang-format] Add BreakConcatenatedStrings option (PR #73432)

2023-11-26 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/73432 Closes #70451. >From def7bbb22cdd9269aa927d8dcf4247c88877503b Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 25 Nov 2023 23:55:11 -0800 Subject: [PATCH] [clang-format] Add BreakConcatenatedStrings option Clo

[clang] [clang-format] Fix a bug in formating `#define A x:` (PR #73220)

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

[clang] 659e401 - [clang-format][NFC] Improve an `if` conditional in the annotator

2023-11-26 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2023-11-26T22:54:44-08:00 New Revision: 659e4017b7371efa8ce97da2d87270c60a93d03d URL: https://github.com/llvm/llvm-project/commit/659e4017b7371efa8ce97da2d87270c60a93d03d DIFF: https://github.com/llvm/llvm-project/commit/659e4017b7371efa8ce97da2d87270c60a93d03d.diff LOG:

[clang] [clang-format] Add BreakConcatenatedStrings option (PR #73432)

2023-11-27 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/73432 >From def7bbb22cdd9269aa927d8dcf4247c88877503b Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 25 Nov 2023 23:55:11 -0800 Subject: [PATCH 1/2] [clang-format] Add BreakConcatenatedStrings option Closes #70451.

[clang] [clang-format] Add BreakAdjacentStringLiterals option (PR #73432)

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

[clang] [clang-format] Add BreakAdjacentStringLiterals option (PR #73432)

2023-11-27 Thread Owen Pan via cfe-commits
@@ -2088,6 +2088,19 @@ struct FormatStyle { /// \version 3.7 bool BreakBeforeTernaryOperators; + /// Break between concatenated string literals in C, C++, and Objective-C. owenca wrote: Fixed. https://github.com/llvm/llvm-project/pull/73432

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-27 Thread Owen Pan via cfe-commits
owenca wrote: > > After giving more thoughts to this, I think what we really want is > > `SkipMacroDefinitionBody`, which would format the code below: > > (...) > > That is, only the body (except comments) of a macro definition is not > > formatted. > > I understand that: > > * we do want to

[clang] [clang-format] Add BreakAdjacentStringLiterals option (PR #73432)

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

[clang] [clang-format][NFC] Add isProto() and rename old one to isProtoBuf() (PR #73582)

2023-11-27 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/73582 None >From f98e8cfa7e4d77ed554a249f65caa88a696f5318 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Mon, 27 Nov 2023 14:35:22 -0800 Subject: [PATCH] [clang-format][NFC] Add isProto() and rename old one to isProtoB

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

2023-11-27 Thread Owen Pan via cfe-commits
owenca wrote: The default value of `BreakAfterAttributes` was changed to `Leave` in #70360. You need to set it to `Never` or `Always` for the example above. https://github.com/llvm/llvm-project/pull/71935 ___ cfe-commits mailing list cfe-commits@lists

[clang] Improve clang-format-diff help output (PR #73491)

2023-11-27 Thread Owen Pan via cfe-commits
owenca wrote: See below. Seems it's already working as expected without this patch. ``` $ clang-format -version clang-format version 17.0.5 $ clang-format-diff.py foo usage: clang-format-diff.py [-h] [-i] [-p NUM] [-regex PATTERN] [-iregex PATTERN] [-sort-includes] [-

[clang] [clang-format][NFC] Extend isProto() to also cover LK_TextProto (PR #73582)

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

[clang] Improve clang-format-diff help output (PR #73491)

2023-11-28 Thread Owen Pan via cfe-commits
owenca wrote: Please open a github issue to show us what you are trying to accomplish and reference the issue number here. https://github.com/llvm/llvm-project/pull/73491 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/c

[clang] Improve clang-format-diff help output (PR #73491)

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

[clang] [clang-format][NFC] Extend isProto() to also cover LK_TextProto (PR #73582)

2023-11-28 Thread Owen Pan via cfe-commits
owenca wrote: This patch makes `isProto()` a convenience function like `isCpp()`, which doesn't prevent us from handling C++ and Objective-C separately when needed. Although `LK_TextProto` is not always formatted like `LK_Proto`, it's frequent enough (about 16 times in the codebase) that we sh

[clang] [clang-format] Finalize children after formatting them (PR #73753)

2023-11-28 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/73753 This would also fix the overlapping replacements below: $ clang-format a( #else #endif ) = []() { )} The new replacement overlaps with an existing replacement. New replacement: : 38:+7:" " Existing replacement:

[clang] [clang-format] Finalize children after formatting them (PR #73753)

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

[clang] [clang-format] Finalize children after formatting them (PR #73753)

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

[clang] [clang-format] Finalize children after formatting them (PR #73753)

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

[clang-tools-extra] [flang] [clang] [compiler-rt] [libcxx] [llvm] [lldb] [libc] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)

2023-11-29 Thread Owen Pan via cfe-commits
@@ -1464,6 +1467,21 @@ class AnnotatingParser { } } + void parseEmbedDirective() { +if (CurrentToken && CurrentToken->is(tok::less)) { + next(); + while (CurrentToken) { +// Mark tokens up to the trailing line comments as implicit string +/

[clang] [clang-format][NFC] Extend isProto() to also cover LK_TextProto (PR #73582)

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

[clang] [clang-format] Finalize children after formatting them (PR #73753)

2023-11-29 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/73753 ___ 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 macro definitions (PR #70338)

2023-11-29 Thread Owen Pan via cfe-commits
@@ -1157,7 +1157,15 @@ void UnwrappedLineParser::parsePPDefine() { // guard processing above, and changes preprocessing nesting. FormatTok->Tok.setKind(tok::identifier); FormatTok->Tok.setIdentifierInfo(Keywords.kw_internal_ident_after_define); - nextToken(); + + if (St

[clang] [clang-format] Don't skip stringizing when determining brace kind (PR #73886)

2023-11-29 Thread Owen Pan via cfe-commits
@@ -496,7 +496,7 @@ void UnwrappedLineParser::calculateBraceTypes(bool ExpectClassBody) { do { NextTok = Tokens->getNextToken(); } while (NextTok->is(tok::comment)); -while (NextTok->is(tok::hash)) { +while (NextTok->is(tok::hash) && !Line->InPPDirective)

[clang] [clang-format] Don't skip stringizing when determining brace kind (PR #73886)

2023-11-29 Thread Owen Pan via cfe-commits
@@ -1851,6 +1851,22 @@ TEST_F(TokenAnnotatorTest, UnderstandsTrailingReturnArrow) { EXPECT_TOKEN(Tokens[13], tok::arrow, TT_Unknown); } +TEST_F(TokenAnnotatorTest, UnderstandHashInMacro) { + auto Tokens = annotate("#define Foo(Bar) \\\n" + " { \\\n

[clang] [clang-format] Don't skip stringizing when determining brace kind (PR #73886)

2023-11-29 Thread Owen Pan via cfe-commits
@@ -1851,6 +1851,22 @@ TEST_F(TokenAnnotatorTest, UnderstandsTrailingReturnArrow) { EXPECT_TOKEN(Tokens[13], tok::arrow, TT_Unknown); } +TEST_F(TokenAnnotatorTest, UnderstandHashInMacro) { + auto Tokens = annotate("#define Foo(Bar) \\\n" + " { \\\n

[clang] [clang-format] Don't skip stringizing when determining brace kind (PR #73886)

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

[clang] [clang-format] Don't skip stringizing when determining brace kind (PR #73886)

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

[clang] 5c60e2c - [clang-format][NFC] Reformat source code with clang-format style

2023-11-30 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2023-11-30T20:19:30-08:00 New Revision: 5c60e2ce78e79c2d15152e08d9e28fcf3a1d4e51 URL: https://github.com/llvm/llvm-project/commit/5c60e2ce78e79c2d15152e08d9e28fcf3a1d4e51 DIFF: https://github.com/llvm/llvm-project/commit/5c60e2ce78e79c2d15152e08d9e28fcf3a1d4e51.diff LOG:

[clang] c45a66e - [clang-format] ObjCPropertyAttributeOrder to sort ObjC property attributes

2023-12-01 Thread Owen Pan via cfe-commits
Author: Jared Grubb Date: 2023-12-01T17:41:30-08:00 New Revision: c45a66ecd4cb8f351298ca987d6086cf02b77bfb URL: https://github.com/llvm/llvm-project/commit/c45a66ecd4cb8f351298ca987d6086cf02b77bfb DIFF: https://github.com/llvm/llvm-project/commit/c45a66ecd4cb8f351298ca987d6086cf02b77bfb.diff L

[clang] [clang-format] Fix a bug in `git-clang-format --binary` (PR #74176)

2023-12-01 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/74176 Fixed #74165. >From 462a93a59b236fd6f6750ed69c8629db12cd32a9 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 1 Dec 2023 18:31:05 -0800 Subject: [PATCH] [clang-format] Fix a bug in `git-clang-format --binary`

[clang] [clang-format] Remove duplicates in @property using std::set (PR #74235)

2023-12-03 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/74235 Re-implement ObjCPropertyAttributeOrder using std::set for sorting and removing duplicates. (We can't use llvm::SmallSet because it's unordered.) >From 7323d9261fe8c876fe3a656a98e186af3dd0b2a0 Mon Sep 17 00:00:00

[clang] [clang-format] Remove duplicates in @property using std::set (PR #74235)

2023-12-03 Thread Owen Pan via cfe-commits
owenca wrote: @jaredgrubb I can't add you to Reviewers. Maybe you can add yourself? https://github.com/llvm/llvm-project/pull/74235 ___ 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 `git-clang-format --binary` (PR #74176)

2023-12-03 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/74176 ___ 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   >