[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, +

[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, +

[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, +

[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

[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] 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; +

[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 , 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; +

[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 , 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] Fix crash involving array designators and dangling comma (PR #77045)

2024-01-05 Thread Owen Pan via cfe-commits
@@ -1444,7 +1444,8 @@ 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)) //

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

2024-01-05 Thread Owen Pan via cfe-commits
@@ -21084,6 +21084,12 @@ TEST_F(FormatTest, CatchAlignArrayOfStructuresLeftAlignment) { "};", Style); + verifyNoCrash("Foo f[] = {\n" +"[0] = { 1, },\n" +"[1] { 1, },\n" +"};", +Style);

[clang] [clang-format] Add .clang-format-ignore for ignoring files (PR #76327)

2024-01-04 Thread Owen Pan via cfe-commits
owenca wrote: Actually, it's commit 42ec976184ac. Please see [here](https://github.com/llvm/llvm-project/pull/76733#issuecomment-1876707005). https://github.com/llvm/llvm-project/pull/76327 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2024-01-04 Thread Owen Pan via cfe-commits
owenca wrote: It had passed my local tests (x64 Native Tools Command Prompt for VS 2022) and the buildkite win build, so I wonder if it has something to do with the grep in the failed buildbot (only https://lab.llvm.org/buildbot/#/builders/123/builds/23808 so far) as I only used the POSIX

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

2024-01-03 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/76733 ___ 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-03 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/76733 >From 7f8da18dc59706df8f1ee15d22076b4794881579 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Mon, 1 Jan 2024 19:10:30 -0800 Subject: [PATCH 1/2] [clang-format] Optimize processing .clang-format-ignore files

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

2024-01-03 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/76733 ___ 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-02 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/76733 Reuse the patterns governing the previous input file being formatted if the the current input file is from the same directory. >From 7f8da18dc59706df8f1ee15d22076b4794881579 Mon Sep 17 00:00:00 2001 From: Owen

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

2023-12-31 Thread Owen Pan via cfe-commits
@@ -2919,6 +2912,12 @@ class ExpressionParser { void addFakeParenthesis(FormatToken *Start, prec::Level Precedence, FormatToken *End = nullptr) { +// Do not assign fake parenthesis to tokens that are part of an +// unexpanded macro call.

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

2023-12-31 Thread Owen Pan via cfe-commits
@@ -255,6 +255,44 @@ TEST_F(FormatTestMacroExpansion, Style); } +TEST_F(FormatTestMacroExpansion, CommaAsOperator) { + FormatStyle Style = getGoogleStyle(); + Style.Macros.push_back("ASSIGN_OR_RETURN(a, b, c)=a=(b); if(x) c"); +

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

2023-12-31 Thread Owen Pan via cfe-commits
@@ -255,6 +255,44 @@ TEST_F(FormatTestMacroExpansion, Style); } +TEST_F(FormatTestMacroExpansion, CommaAsOperator) { + FormatStyle Style = getGoogleStyle(); + Style.Macros.push_back("ASSIGN_OR_RETURN(a, b, c)=a=(b); if(x) c"); +

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

2023-12-31 Thread Owen Pan via cfe-commits
@@ -416,10 +421,15 @@ struct FormatToken { /// to another one please use overwriteFixedType, or even better remove the /// need to reassign the type. void setFinalizedType(TokenType T) { +if (MacroCtx && MacroCtx->Role == MR_UnexpandedArg) + return; +

[clang] bd3d358 - [clang-format][doc] Add the link to POSIX 2.13

2023-12-30 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2023-12-30T01:32:10-08:00 New Revision: bd3d358ec68f686a280ae628f9074fdff1f10fe9 URL: https://github.com/llvm/llvm-project/commit/bd3d358ec68f686a280ae628f9074fdff1f10fe9 DIFF: https://github.com/llvm/llvm-project/commit/bd3d358ec68f686a280ae628f9074fdff1f10fe9.diff

[clang] fe2e677 - [clang-format][doc] Add .clang-format-ignore to the release notes

2023-12-29 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2023-12-29T23:12:16-08:00 New Revision: fe2e677aa7aebedd316b1a688db8410855a213c1 URL: https://github.com/llvm/llvm-project/commit/fe2e677aa7aebedd316b1a688db8410855a213c1 DIFF: https://github.com/llvm/llvm-project/commit/fe2e677aa7aebedd316b1a688db8410855a213c1.diff

[clang] 3507959 - [clang-format][doc] Fix format errors.

2023-12-29 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2023-12-29T22:52:07-08:00 New Revision: 3507959e441ed9470818e7c6ef16d9bbcfe6a999 URL: https://github.com/llvm/llvm-project/commit/3507959e441ed9470818e7c6ef16d9bbcfe6a999 DIFF: https://github.com/llvm/llvm-project/commit/3507959e441ed9470818e7c6ef16d9bbcfe6a999.diff

[clang] ca8441d - [clang-format][NFC] Fix a typo.

2023-12-29 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2023-12-29T19:47:08-08:00 New Revision: ca8441d6dbd36003288ef412295e7b946a8bb893 URL: https://github.com/llvm/llvm-project/commit/ca8441d6dbd36003288ef412295e7b946a8bb893 DIFF: https://github.com/llvm/llvm-project/commit/ca8441d6dbd36003288ef412295e7b946a8bb893.diff

[clang] [clang-format] Add .clang-format-ignore for ignoring files (PR #76327)

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

[clang] [clang-format] Add .clang-format-ignore for ignoring files (PR #76327)

2023-12-29 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/76327 >From 4afd12db61528b40d842a7fbee9af37c2235822c Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 24 Dec 2023 01:18:55 -0800 Subject: [PATCH 1/9] [clang-format] Add .clang-format.ignore for ignoring files

[clang] [clang-format] Add .clang-format-ignore for ignoring files (PR #76327)

2023-12-29 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/76327 >From 4afd12db61528b40d842a7fbee9af37c2235822c Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 24 Dec 2023 01:18:55 -0800 Subject: [PATCH 1/8] [clang-format] Add .clang-format.ignore for ignoring files

[clang] [clang-format] Add .clang-format-ignore for ignoring files (PR #76327)

2023-12-29 Thread Owen Pan via cfe-commits
@@ -570,6 +571,70 @@ static int dumpConfig(bool IsSTDIN) { return 0; } +// Check whether `FilePath` is ignored according to the nearest +// .clang-format-ignore file based on the rules below: +// - A blank line is skipped. +// - Leading and trailing spaces of a line are

[clang] [clang-format] Add .clang-format-ignore for ignoring files (PR #76327)

2023-12-29 Thread Owen Pan via cfe-commits
@@ -570,6 +571,70 @@ static int dumpConfig(bool IsSTDIN) { return 0; } +// Check whether `FilePath` is ignored according to the nearest +// .clang-format-ignore file based on the rules below: +// - A blank line is skipped. +// - Leading and trailing spaces of a line are

[clang] [clang-format] Fix bad indentation with attribute and templated type (PR #76336)

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

[clang] [clang-format] Fix bad indentation with attribute and templated type (PR #76336)

2023-12-28 Thread Owen Pan via cfe-commits
@@ -26492,6 +26492,10 @@ TEST_F(FormatTest, BreakAfterAttributes) { verifyFormat("[[nodiscard]]\n" "Foo& operator-(Foo&);", Style); + + verifyFormat("[[maybe_unused]]\n" + "foo f;", owenca wrote: ```suggestion

[clang] [clang-format] Fix bad indentation with attribute and templated type (PR #76336)

2023-12-28 Thread Owen Pan via cfe-commits
@@ -26492,6 +26492,10 @@ TEST_F(FormatTest, BreakAfterAttributes) { verifyFormat("[[nodiscard]]\n" "Foo& operator-(Foo&);", Style); + + verifyFormat("[[maybe_unused]]\n" + "foo f;", + Style); owenca

[clang] [clang-format] Add .clang-format-ignore for ignoring files (PR #76327)

2023-12-28 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/76327 >From 4afd12db61528b40d842a7fbee9af37c2235822c Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 24 Dec 2023 01:18:55 -0800 Subject: [PATCH 1/7] [clang-format] Add .clang-format.ignore for ignoring files

[clang] [clang-format] Add .clang-format-ignore for ignoring files (PR #76327)

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

[clang] [clang-format] Add .clang-format.ignore for ignoring files (PR #76327)

2023-12-28 Thread Owen Pan via cfe-commits
@@ -570,6 +571,74 @@ static int dumpConfig(bool IsSTDIN) { return 0; } +// Check whether `FilePath` is ignored according to the nearest +// .clang-format-ignore file based on the rules below: +// - A blank line is skipped. +// - Leading and trailing spaces of a line are

[clang] [clang-format] Add .clang-format.ignore for ignoring files (PR #76327)

2023-12-28 Thread Owen Pan via cfe-commits
@@ -570,6 +571,74 @@ static int dumpConfig(bool IsSTDIN) { return 0; } +// Check whether `FilePath` is ignored according to the nearest +// .clang-format-ignore file based on the rules below: +// - A blank line is skipped. +// - Leading and trailing spaces of a line are

[clang] [clang-format] Add .clang-format.ignore for ignoring files (PR #76327)

2023-12-26 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/76327 >From 4afd12db61528b40d842a7fbee9af37c2235822c Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 24 Dec 2023 01:18:55 -0800 Subject: [PATCH 1/6] [clang-format] Add .clang-format.ignore for ignoring files

[clang] [clang-format] Add .clang-format.ignore for ignoring files (PR #76327)

2023-12-26 Thread Owen Pan via cfe-commits
@@ -570,6 +571,74 @@ static int dumpConfig(bool IsSTDIN) { return 0; } +// Check whether `FilePath` is ignored according to the nearest +// .clang-format-ignore file based on the rules below: +// - A blank line is skipped. +// - Leading and trailing spaces of a line are

[clang] [clang-format] Add .clang-format.ignore for ignoring files (PR #76327)

2023-12-26 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/76327 >From 4afd12db61528b40d842a7fbee9af37c2235822c Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 24 Dec 2023 01:18:55 -0800 Subject: [PATCH 1/5] [clang-format] Add .clang-format.ignore for ignoring files

[clang] [clang-format] Add .clang-format.ignore for ignoring files (PR #76327)

2023-12-26 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/76327 >From 4afd12db61528b40d842a7fbee9af37c2235822c Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 24 Dec 2023 01:18:55 -0800 Subject: [PATCH 1/4] [clang-format] Add .clang-format.ignore for ignoring files

[clang] [clang-format] Add .clang-format.ignore for ignoring files (PR #76327)

2023-12-26 Thread Owen Pan via cfe-commits
@@ -0,0 +1,31 @@ +// RUN: rm -rf %t.dir +// RUN: mkdir -p %t.dir/level1/level2 + +// RUN: cd %t.dir +// RUN: printf "%%s\n" "\*" "level*/*.c*" "*/*2/foo.*" > .clang-format-ignore owenca wrote: ```suggestion // RUN: echo "*" > .clang-format-ignore // RUN: echo

[clang] [clang-format] Add .clang-format.ignore for ignoring files (PR #76327)

2023-12-26 Thread Owen Pan via cfe-commits
@@ -0,0 +1,31 @@ +// RUN: rm -rf %t.dir +// RUN: mkdir -p %t.dir/level1/level2 + +// RUN: cd %t.dir +// RUN: printf "%%s\n" "\*" "level*/*.c*" "*/*2/foo.*" > .clang-format-ignore +// RUN: touch foo.cc +// RUN: clang-format -verbose .clang-format-ignore foo.cc 2> %t.stderr +//

[clang] [clang-format] Add .clang-format.ignore for ignoring files (PR #76327)

2023-12-26 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/76327 >From 4afd12db61528b40d842a7fbee9af37c2235822c Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 24 Dec 2023 01:18:55 -0800 Subject: [PATCH 1/3] [clang-format] Add .clang-format.ignore for ignoring files

[clang] [clang-format] Add .clang-format.ignore for ignoring files (PR #76327)

2023-12-24 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/76327 >From 4afd12db61528b40d842a7fbee9af37c2235822c Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 24 Dec 2023 01:18:55 -0800 Subject: [PATCH 1/2] [clang-format] Add .clang-format.ignore for ignoring files

[clang] [clang-format] Add .clang-format.ignore for ignoring files (PR #76327)

2023-12-24 Thread Owen Pan via cfe-commits
@@ -131,6 +131,24 @@ An easy way to create the ``.clang-format`` file is: Available style options are described in :doc:`ClangFormatStyleOptions`. +You can create ``.clang-format-ignore`` files to make ``clang-format`` ignore +certain files. A ``.clang-format-ignore`` file

[clang] [clang-format] Add .clang-format.ignore for ignoring files (PR #76327)

2023-12-24 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/76327 Closes #52975. >From 4afd12db61528b40d842a7fbee9af37c2235822c Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 24 Dec 2023 01:18:55 -0800 Subject: [PATCH] [clang-format] Add .clang-format.ignore for ignoring

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

2023-12-24 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/76021 ___ 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-23 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/76021 >From 4954f52278ca41652be79318843d3538a2eb1205 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 19 Dec 2023 23:25:57 -0800 Subject: [PATCH 1/3] [clang-format] Add an fnmatch-like function for

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

2023-12-23 Thread Owen Pan via cfe-commits
@@ -0,0 +1,121 @@ +//===--- MatchFilePath.cpp - Match file path with pattern ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [clang-format] Do not break on JS fields like on goto labels (PR #76233)

2023-12-23 Thread Owen Pan via cfe-commits
owenca wrote: > This regressions was introduced in > [70d7ea0](https://github.com/llvm/llvm-project/commit/70d7ea0cebcf363cd0ddcfb76375fb5fada87dd5). > The commit moved some code and correctly picked up an explicit check for not > running on Verilog. However, the moved code also never ran for

[clang] [clang-format] Fix operator overload inconsistency in `BreakAfterAttributes: Always` (PR #74943)

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

[clang] [clang-format] Fix a bug in annotating function declaration names (PR #76206)

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

[clang] [clang-format] Add common attribute macros to Google style (PR #76239)

2023-12-22 Thread Owen Pan via cfe-commits
owenca wrote: > `GUARDED_BY` and `ABSL_GUARDED_BY` are very commoon in Google codebases so it > is reasonable to include them by default to avoid the need for extra > configuration in every Google repository. I don't feel comfortable with this as it might impact users of the Google style

[clang] [clang-format] Fix operator overload inconsistency in `BreakAfterAttributes: Always` (PR #74943)

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

[clang] [clang-format] Fix operator overload inconsistency in `BreakAfterAttributes: Always` (PR #74943)

2023-12-22 Thread Owen Pan via cfe-commits
@@ -26451,6 +26451,20 @@ TEST_F(FormatTest, BreakAfterAttributes) { "{\n" "}", CtorDtorCode, Style); + + Style.BreakBeforeBraces = FormatStyle::BS_Attach; + Style.ReferenceAlignment =

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

2023-12-22 Thread Owen Pan via cfe-commits
owenca wrote: > Are we going to use this specific implementation on all platforms for parity? Yes, similar to [this](https://github.com/owenca/llvm-project/commit/52866dcfe31cf5a43d86b27ec1f0420077034780#diff-0cfce704bac218438436bd4388319d112780509ea474d5b3253d45746a62713aR123). > The logic

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

2023-12-22 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/76021 >From 4954f52278ca41652be79318843d3538a2eb1205 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 19 Dec 2023 23:25:57 -0800 Subject: [PATCH 1/2] [clang-format] Add an fnmatch-like function for

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

2023-12-22 Thread Owen Pan via cfe-commits
@@ -0,0 +1,169 @@ +//===- unittest/Format/MatchFilePathTest.cpp --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [clang-format] Fix operator overload inconsistency in `BreakAfterAttributes: Always` (PR #74943)

2023-12-21 Thread Owen Pan via cfe-commits
@@ -583,20 +583,26 @@ bool ContinuationIndenter::mustBreak(const LineState ) { return true; } - // If the return type spans multiple lines, wrap before the function name. - if (((Current.is(TT_FunctionDeclarationName) && -!State.Line->ReturnTypeWrapped && -

[clang] [clang-format] Fix a bug in annotating function declaration names (PR #76206)

2023-12-21 Thread Owen Pan via cfe-commits
owenca wrote: See [here](https://discourse.llvm.org/t/why-are-the-breaks-sometimes-removed-when-alwaysbreakafterreturntype-is-all/75780/4?u=owenpan) for background info. https://github.com/llvm/llvm-project/pull/76206 ___ cfe-commits mailing list

[clang] [clang-format] Fix a bug in annotating function declaration names (PR #76206)

2023-12-21 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/76206 Annotates function declaration names having unnamed parameters. >From 170d2e573904286ae6ee8fad9df6ea467eb54eb8 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 21 Dec 2023 21:27:47 -0800 Subject: [PATCH]

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

2023-12-21 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/76021 >From 4954f52278ca41652be79318843d3538a2eb1205 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 19 Dec 2023 23:25:57 -0800 Subject: [PATCH] [clang-format] Add an fnmatch-like function for .clang-format-ignore

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

2023-12-21 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/76021 >From ea6418158c00b7b4ceb7a3192917ed009550ed11 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 19 Dec 2023 23:25:57 -0800 Subject: [PATCH] [clang-format] Add an fnmatch-like function for .clang-format-ignore

[clang] [clang-format] Support of TableGen formatting. (PR #76059)

2023-12-21 Thread Owen Pan via cfe-commits
owenca wrote: > I avoid this by using clang-format binary from main branch in my local. What > should I do with this failure? You can ignore it if running the in-tree clang-format is clean, e.g.: ``` $ clang/tools/clang-format/git-clang-format --binary build/bin/clang-format HEAD~

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

2023-12-21 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/76021 >From d3c7a45cfcd16974cdfd88d1f5381fc0f96184a1 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 19 Dec 2023 23:25:57 -0800 Subject: [PATCH] [clang-format] Add an fnmatch-like function for .clang-format-ignore

[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

[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] 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

[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 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 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-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-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

[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 & member; }\n" " anotherType \n" "}"); + + Style.ReferenceAlignment = FormatStyle::RAS_Left; + verifyFormat("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 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
@@ -164,6 +167,12 @@ class AnnotatingParser { TT_OverloadedOperatorLParen))) { return false; } + FormatToken *ClosingParen = nullptr; + if (Previous.Previous->is(tok::kw_operator) && + isFunctionDeclarationName(Style.isCpp(),

[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 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

[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

[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

[clang] [clang-format][NFC] Clean up the driver and getStyle() in Format.cpp (PR #74794)

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

[clang] [clang-format][NFC] Clean up the driver and getStyle() in Format.cpp (PR #74794)

2023-12-07 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/74794 None >From fb239719267ec97905ebb339176b5f7015de04eb Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 7 Dec 2023 17:42:45 -0800 Subject: [PATCH] [clang-format][NFC] Clean up ClangFormat.cpp and getStyle() in

[clang] b683709 - [clang-format] Fix a possible crash in `AlignAfterOpenBracket: BlockIndent`

2023-12-06 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2023-12-06T17:40:41-08:00 New Revision: b683709ea6eec7d0a388bd50c571774c9b9ffdb7 URL: https://github.com/llvm/llvm-project/commit/b683709ea6eec7d0a388bd50c571774c9b9ffdb7 DIFF: https://github.com/llvm/llvm-project/commit/b683709ea6eec7d0a388bd50c571774c9b9ffdb7.diff

[clang] [clang-format] Handle merging functions containing only a block comment (PR #74651)

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

[clang] [clang-format] Handle merging functions containing only a block comment (PR #74651)

2023-12-06 Thread Owen Pan via cfe-commits
@@ -411,9 +411,16 @@ class LineJoiner { } } +const auto *LastNonComment = TheLine->getLastNonComment(); +assert(LastNonComment); +// FIXME: There are probably cases where we should use LastNonComment owenca wrote: No. This is new from

[clang] [clang-format] Handle merging functions containing only a block comment (PR #74651)

2023-12-06 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/74651 Fixed #41854. >From 40859e0887fd53bbb02be213fcacf3d6d1a5a487 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Wed, 6 Dec 2023 12:01:19 -0800 Subject: [PATCH] [clang-format] Handle merging functions containing only

[clang] [clang-format][NFC] Refactor getting first/last non-comment of line (PR #74570)

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

[clang] [clang-format][NFC] Refactor getting first/last non-comment of line (PR #74570)

2023-12-05 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/74570 None >From a37925ae51d95e91d32ec50bc39a9b6e5b13c571 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 5 Dec 2023 23:31:28 -0800 Subject: [PATCH] [clang-format][NFC] Refactor getting first/last non-comment of

[clang] [compiler-rt] [llvm] [clang-tools-extra] [flang] [libc] [clang-format] Add "three dot" diff option to git-clang-format (PR #74230)

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

[clang] [compiler-rt] [llvm] [clang-tools-extra] [flang] [libc] [clang-format] Add "three dot" diff option to git-clang-format (PR #74230)

2023-12-05 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/74230 >From ae4097b53b90e31802be0be5c8a81fb74c81efc9 Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Sat, 2 Dec 2023 23:46:58 -0800 Subject: [PATCH 1/3] [clang-format] Add "three dot" diff option to

[clang] [clang-format][NFC] Use `prog` in clang-format-diff.py (PR #74399)

2023-12-05 Thread Owen Pan via cfe-commits
owenca wrote: > You can remove the useless `import os` then :-) Good catch! https://github.com/llvm/llvm-project/pull/74399 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format][NFC] Use `prog` in clang-format-diff.py (PR #74399)

2023-12-05 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/74399 >From ee039e7c50751fabdbaadae73a0a09bc905620f2 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Mon, 4 Dec 2023 17:33:47 -0800 Subject: [PATCH 1/3] [clang-format][NFC] Use `prog` in clang-format-diff.py This is a

[clang] [clang-format][NFC] Use `prog` in clang-format-diff.py (PR #74399)

2023-12-04 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/74399 >From ee039e7c50751fabdbaadae73a0a09bc905620f2 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Mon, 4 Dec 2023 17:33:47 -0800 Subject: [PATCH 1/2] [clang-format][NFC] Use `prog` in clang-format-diff.py This is a

[clang] [clang-format][NFC] Use `prog` in clang-format-diff.py (PR #74399)

2023-12-04 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/74399 This is a minor improvement to #73491. >From ee039e7c50751fabdbaadae73a0a09bc905620f2 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Mon, 4 Dec 2023 17:33:47 -0800 Subject: [PATCH] [clang-format][NFC] Use `prog`

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

2023-12-04 Thread Owen Pan via cfe-commits
https://github.com/owenca closed 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 #74293)

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

[clang] [clang-format] Add "three dot" diff option to git-clang-format (PR #74230)

2023-12-04 Thread Owen Pan via cfe-commits
@@ -328,6 +337,10 @@ def compute_diff(commits, files, staged): git_tool = 'diff-tree' elif staged: extra_args += ['--cached'] + + if len(commits) > 1 and diff_common_commit: +commits = [f'{commits[0]}...{commits[1]}'] owenca wrote:

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