[clang] [clang-format] Add -ConfigFile option (PR #113864)

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

[clang] [clang-format][CMake] Generate formatting options docs during build (PR #113739)

2024-10-27 Thread Owen Pan via cfe-commits
@@ -143,8 +143,17 @@ if (LLVM_ENABLE_SPHINX) gen_rst_file_from_td(DiagnosticsReference.rst -gen-diag-docs ../include/clang/Basic/Diagnostic.td "${docs_targets}") gen_rst_file_from_td(ClangCommandLineReference.rst -gen-opt-docs ../include/clang/Driver/ClangOptionDocs.td

[clang] [clang-format][CMake] Generate formatting options docs during build (PR #113739)

2024-10-27 Thread Owen Pan via cfe-commits
@@ -185,6651 +179,10 @@ the configuration (without a prefix: ``Auto``). subdirectories. This is also possible through the command line, e.g.: ``--style={BasedOnStyle: InheritParentConfig, ColumnLimit: 20}`` +.. This section of the file is automatically generated by the

[clang] [clang-format][CMake] Generate formatting options docs during build (PR #113739)

2024-10-27 Thread Owen Pan via cfe-commits
@@ -143,8 +143,17 @@ if (LLVM_ENABLE_SPHINX) gen_rst_file_from_td(DiagnosticsReference.rst -gen-diag-docs ../include/clang/Basic/Diagnostic.td "${docs_targets}") gen_rst_file_from_td(ClangCommandLineReference.rst -gen-opt-docs ../include/clang/Driver/ClangOptionDocs.td

[clang] [clang-format] Make bitwise and imply requires clause (PR #110942)

2024-10-27 Thread Owen Pan via cfe-commits
@@ -1296,6 +1296,15 @@ TEST_F(TokenAnnotatorTest, UnderstandsRequiresClausesAndConcepts) { Tokens = annotate("bool x = t && requires(Foo x) { x.foo(); };"); ASSERT_EQ(Tokens.size(), 25u) << Tokens; EXPECT_TOKEN(Tokens[5], tok::kw_requires, TT_RequiresExpression); + + //

[clang] [clang-format][CMake] Generate formatting options docs during build (PR #113739)

2024-10-27 Thread Owen Pan via cfe-commits
@@ -143,8 +143,17 @@ if (LLVM_ENABLE_SPHINX) gen_rst_file_from_td(DiagnosticsReference.rst -gen-diag-docs ../include/clang/Basic/Diagnostic.td "${docs_targets}") gen_rst_file_from_td(ClangCommandLineReference.rst -gen-opt-docs ../include/clang/Driver/ClangOptionDocs.td

[clang] [clang-format] Print the names of unfound files in error messages (PR #113640)

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

[clang] [clang-format] Print the names of unfound files in error messages (PR #113640)

2024-10-24 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/113640 >From 274b7cbdd8989c9f34c3df4041fa9098857bcc89 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 24 Oct 2024 20:05:52 -0700 Subject: [PATCH 1/3] [clang-format] Print the names of unfound files in error messages

[clang] [clang-format] Print the names of unfound files in error messages (PR #113640)

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

[clang] [clang-format] Fix working -assume-filename with .clang-format-ignore (PR #113100)

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

[clang] 78e7d95 - [clang-format][NFC] Use CLANG_SOURCE_DIR in CMakeLists

2024-10-24 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-10-24T18:36:58-07:00 New Revision: 78e7d9592d7c3b500ae2bae097d8cd7cd9369671 URL: https://github.com/llvm/llvm-project/commit/78e7d9592d7c3b500ae2bae097d8cd7cd9369671 DIFF: https://github.com/llvm/llvm-project/commit/78e7d9592d7c3b500ae2bae097d8cd7cd9369671.diff LOG:

[clang] [clang-format] Fix working -assume-filename with .clang-format-ignore (PR #113100)

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

[clang] [llvm] [clang-format] Add CI check confirming ClangFormatStyleOptions.rst is up-to-date. (PR #111513)

2024-10-24 Thread Owen Pan via cfe-commits
@@ -53,3 +53,10 @@ foreach (file IN LISTS files) endforeach () add_custom_target(clang-format-check-format DEPENDS ${check_format_depends}) + +add_custom_target(clang-format-style-options +COMMAND "${Python3_EXECUTABLE}" dump_format_style.py owenca wrote:

[clang] [llvm] [clang-format] Add CI check confirming ClangFormatStyleOptions.rst is up-to-date. (PR #111513)

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

[clang] [llvm] [clang-format] Add CI check confirming ClangFormatStyleOptions.rst is up-to-date. (PR #111513)

2024-10-24 Thread Owen Pan via cfe-commits
@@ -53,3 +53,10 @@ foreach (file IN LISTS files) endforeach () add_custom_target(clang-format-check-format DEPENDS ${check_format_depends}) + +add_custom_target(clang-format-style-options +COMMAND "${Python3_EXECUTABLE}" dump_format_style.py +WORKING_DIRECTORY "${CMAKE

[clang] [clang-format] Add KeepFormFeed option (PR #113268)

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

[clang] [clang-format] Add TemplateNames option to help parse C++ angles (PR #109916)

2024-10-23 Thread Owen Pan via cfe-commits
@@ -5230,6 +5239,7 @@ struct FormatStyle { TableGenBreakingDAGArgOperators == R.TableGenBreakingDAGArgOperators && TableGenBreakInsideDAGArg == R.TableGenBreakInsideDAGArg && + TabWidth == R.TabWidth && TemplateNames == R.TemplateN

[clang] [clang-format] Add ConfigFile option (PR #113864)

2024-10-31 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/113864 >From 85f78a4879a37fb367dccd5299b35d1c75c2b46f Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 27 Oct 2024 22:22:11 -0700 Subject: [PATCH 1/2] [clang-format] Add ConfigFile option Closes #107808. --- clang/d

[clang] [clang-format] Fix a regression in parsing `switch` in macro call (PR #114506)

2024-10-31 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/114506 Fixes #114408. >From 4702c777252678bf3633fd72a0470d135a54c4ba Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 31 Oct 2024 21:40:17 -0700 Subject: [PATCH] [clang-format] Fix a regression in parsing `switch` in

[clang] [clang-format][CMake] Generate formatting options docs during build (PR #113739)

2024-10-31 Thread Owen Pan via cfe-commits
owenca wrote: @boomanaiden154 can we have `clang-format-style-options` rebuilt only when it's outdated, i.e. only if at least one of the following has been updated? ``` clang/include/clang/Format/Format.h clang/include/clang/Tooling/Inclusions/IncludeStyle.h clang/docs/ClangFormatStyleOptions.rs

[clang] [clang-format] Fix path expansion inside git-clang-format.bat (PR #114078)

2024-10-29 Thread Owen Pan via cfe-commits
@@ -1 +1 @@ -py -3 "%~pn0" %* +py -3 "%~dpn0" %* owenca wrote: ```suggestion py -3 "%~f0" %* ``` See https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/call#batch-parameters. https://github.com/llvm/llvm-project/pull/114078 ___

[clang] [clang-format] convert path to Windows path if user is using a MSYS2 shell (PR #111526)

2024-10-29 Thread Owen Pan via cfe-commits
owenca wrote: > > I personally use Cygwin and it's git understands unix paths is that not the > > case for msys2 > > Git can understand (and will return a) unix path, but it seems MSYS2's python > won't accept unix path. It fails at `os.chdir(toplevel)`, and `toplevel` is a > unix path. Isn'

[clang] [NFC] Delete unused clang-formatted-file.txt/ClangFormattedStatus.rst files (PR #109220)

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

[clang] [clang-format] Fix path expansion inside git-clang-format.bat (PR #114078)

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

[clang] [clang-format] Fix path expansion inside git-clang-format.bat (PR #114078)

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

[clang] [clang-format] Fix path expansion inside git-clang-format.bat (PR #114078)

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

[clang] [clang-format] Annotate the l_paren of function pointer types (PR #109229)

2024-09-18 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/109229 Fixes #109146. >From 84c166dfabc3f314cd922baa3933b3d0ea11e08e Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Wed, 18 Sep 2024 21:03:24 -0700 Subject: [PATCH] [clang-format] Annotate the l_paren of function pointe

[clang] [clang-format] Fix a bug in annotating StartOfName (PR #99791)

2024-09-18 Thread Owen Pan via cfe-commits
owenca wrote: Wouldn't you have the same problem if we were to backport the fix, say, to 18.1.9? Anyway, LLVM 19.1.0 has just been released. https://github.com/llvm/llvm-project/pull/99791 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:

[clang] [clang-format] Fix regression in BAS_AlwaysBreak for-await (PR #108634)

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

[clang] clang-format: Add AlignFunctionDeclarations attribute to AlignConsecutiveDeclarations (PR #108241)

2024-09-22 Thread Owen Pan via cfe-commits
owenca wrote: > In regards to the "Test documentation build / Test documentation build > (pull_request) " failure, I'm honestly not sure how to fix the formatting in > this. I'm not seeing anything wrong with my addition in Format.h, but maybe > there's something I'm missing. I never touch Cla

[clang] clang-format: Add AlignFunctionDeclarations attribute to AlignConsecutiveDeclarations (PR #108241)

2024-09-22 Thread Owen Pan via cfe-commits
@@ -225,6 +225,21 @@ struct FormatStyle { /// bbb = 2; /// \endcode bool AlignCompound; +/// Only for ``AlignConsecutiveDeclarations``. Whether function declarations +/// are aligned. +/// \code +/// true: +/// unsigned int f1(void); +

[clang] [clang-format] Fix regression with BlockIndent of Braced Initializers (PR #108717)

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

[clang] [clang-format] Fix regression with BlockIndent of Braced Initializers (PR #108717)

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

[clang] clang-format: Add AlignFunctionDeclarations attribute to AlignConsecutiveDeclarations (PR #108241)

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

[clang] clang-format: Add AlignFunctionDeclarations attribute to AlignConsecutiveDeclarations (PR #108241)

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

[clang] clang-format: Add AlignFunctionDeclarations attribute to AlignConsecutiveDeclarations (PR #108241)

2024-09-22 Thread Owen Pan via cfe-commits
@@ -225,6 +225,21 @@ struct FormatStyle { /// bbb = 2; /// \endcode bool AlignCompound; +/// Only for ``AlignConsecutiveDeclarations``. Whether function declarations +/// are aligned. +/// \code +/// true: +/// unsigned int f1(void); +

[clang] clang-format: Add AlignFunctionDeclarations attribute to AlignConsecutiveDeclarations (PR #108241)

2024-09-22 Thread Owen Pan via cfe-commits
@@ -409,6 +409,21 @@ the configuration (without a prefix: ``Auto``). int *p; int (*f)(); + * ``bool AlignFunctionDeclarations`` Only for ``AlignConsecutiveDeclarations``. Whether function declarations owenca wrote: Version badge is unsupport

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -972,6 +972,11 @@ struct FormatStyle { /// \version 3.7 bool AllowShortLoopsOnASingleLine; + /// If ``true``, ``namespace a { class b; }`` can be put on a single a single + /// line. owenca wrote: ```suggestion /// If ``true``, ``namespace a { clas

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -616,6 +626,62 @@ class LineJoiner { return 1; } + unsigned tryMergeNamespace(SmallVectorImpl::const_iterator I, + SmallVectorImpl::const_iterator E, + unsigned Limit) { +if (Limit == 0) + return 0; +

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -616,6 +626,62 @@ class LineJoiner { return 1; } + unsigned tryMergeNamespace(SmallVectorImpl::const_iterator I, + SmallVectorImpl::const_iterator E, + unsigned Limit) { +if (Limit == 0) + return 0; +

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -616,6 +626,62 @@ class LineJoiner { return 1; } + unsigned tryMergeNamespace(SmallVectorImpl::const_iterator I, + SmallVectorImpl::const_iterator E, + unsigned Limit) { +if (Limit == 0) + return 0; +

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -27981,6 +27981,132 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, ShortNamespacesOption) { + auto BaseStyle = getLLVMStyle(); + BaseStyle.AllowShortNamespacesOnASingleLine = true; + BaseStyle.FixNamespaceComments = false; + +

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -27981,6 +27981,132 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, ShortNamespacesOption) { + auto BaseStyle = getLLVMStyle(); + BaseStyle.AllowShortNamespacesOnASingleLine = true; + BaseStyle.FixNamespaceComments = false; + +

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -27981,6 +27981,132 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, ShortNamespacesOption) { + auto BaseStyle = getLLVMStyle(); + BaseStyle.AllowShortNamespacesOnASingleLine = true; + BaseStyle.FixNamespaceComments = false; + +

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -616,6 +626,62 @@ class LineJoiner { return 1; } + unsigned tryMergeNamespace(SmallVectorImpl::const_iterator I, + SmallVectorImpl::const_iterator E, + unsigned Limit) { +if (Limit == 0) + return 0; +

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -616,6 +626,62 @@ class LineJoiner { return 1; } + unsigned tryMergeNamespace(SmallVectorImpl::const_iterator I, + SmallVectorImpl::const_iterator E, + unsigned Limit) { +if (Limit == 0) o

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -361,9 +361,18 @@ class LineJoiner { const auto *FirstNonComment = TheLine->getFirstNonComment(); if (!FirstNonComment) return 0; + // FIXME: There are probably cases where we should use FirstNonComment // instead of TheLine->First. +if (TheLine

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -616,6 +626,62 @@ class LineJoiner { return 1; } + unsigned tryMergeNamespace(SmallVectorImpl::const_iterator I, + SmallVectorImpl::const_iterator E, + unsigned Limit) { +if (Limit == 0) + return 0; +

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -616,6 +626,62 @@ class LineJoiner { return 1; } + unsigned tryMergeNamespace(SmallVectorImpl::const_iterator I, + SmallVectorImpl::const_iterator E, + unsigned Limit) { +if (Limit == 0) + return 0; +

[clang] [clang-format] Fix regression with BlockIndent of Braced Initializers (PR #108717)

2024-09-21 Thread Owen Pan via cfe-commits
@@ -9395,6 +9398,9 @@ TEST_F(FormatTest, AlignsAfterOpenBracket) { "fooo(new FOO::BA(\n" "XXXZ()));", Style); + verifyFormat("aaa const aa{\n" + "a(a

[clang] [clang-format] Fix regression with BlockIndent of Braced Initializers (PR #108717)

2024-09-21 Thread Owen Pan via cfe-commits
@@ -9336,6 +9336,9 @@ TEST_F(FormatTest, AlignsAfterOpenBracket) { "ccc(a, //\n" "b));", Style); + verifyFormat("aaa const aa{\n" + "a(aaa, aa

[clang] [clang-format] Fix regression with BlockIndent of Braced Initializers (PR #108717)

2024-09-21 Thread Owen Pan via cfe-commits
@@ -348,6 +348,13 @@ bool ContinuationIndenter::canBreak(const LineState &State) { } } + // Don't allow breaking before a closing right brace of a block-indented + // braced list initializer if there was not already a break. owenca wrote: ```suggesti

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -28104,6 +28104,253 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, WrapNamespaceBodyWithEmptyLinesNever) { + FormatStyle Style = getLLVMStyle(); + Style.FixNamespaceComments = false; + Style.ShortNamespaceLines = 0; + Style.M

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -28104,6 +28104,253 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, WrapNamespaceBodyWithEmptyLinesNever) { + FormatStyle Style = getLLVMStyle(); + Style.FixNamespaceComments = false; + Style.ShortNamespaceLines = 0; + Style.M

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -28104,6 +28104,253 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, WrapNamespaceBodyWithEmptyLinesNever) { + FormatStyle Style = getLLVMStyle(); + Style.FixNamespaceComments = false; + Style.ShortNamespaceLines = 0; + Style.M

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -28104,6 +28104,253 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, WrapNamespaceBodyWithEmptyLinesNever) { + FormatStyle Style = getLLVMStyle(); + Style.FixNamespaceComments = false; + Style.ShortNamespaceLines = 0; + Style.M

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -28104,6 +28104,253 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, WrapNamespaceBodyWithEmptyLinesNever) { + FormatStyle Style = getLLVMStyle(); + Style.FixNamespaceComments = false; + Style.ShortNamespaceLines = 0; + Style.M

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -28104,6 +28104,253 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, WrapNamespaceBodyWithEmptyLinesNever) { + FormatStyle Style = getLLVMStyle(); + Style.FixNamespaceComments = false; + Style.ShortNamespaceLines = 0; + Style.M

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -28104,6 +28104,253 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, WrapNamespaceBodyWithEmptyLinesNever) { + FormatStyle Style = getLLVMStyle(); + Style.FixNamespaceComments = false; + Style.ShortNamespaceLines = 0; + Style.M

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -28104,6 +28104,253 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, WrapNamespaceBodyWithEmptyLinesNever) { + FormatStyle Style = getLLVMStyle(); + Style.FixNamespaceComments = false; + Style.ShortNamespaceLines = 0; + Style.M

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -28104,6 +28104,253 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, WrapNamespaceBodyWithEmptyLinesNever) { + FormatStyle Style = getLLVMStyle(); + Style.FixNamespaceComments = false; + Style.ShortNamespaceLines = 0; + Style.M

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -28104,6 +28104,253 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, WrapNamespaceBodyWithEmptyLinesNever) { + FormatStyle Style = getLLVMStyle(); owenca wrote: ```suggestion auto Style = getLLVMStyle(); ``` h

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -28104,6 +28104,253 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, WrapNamespaceBodyWithEmptyLinesNever) { + FormatStyle Style = getLLVMStyle(); + Style.FixNamespaceComments = false; + Style.ShortNamespaceLines = 0; + Style.M

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -28104,6 +28104,253 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, WrapNamespaceBodyWithEmptyLinesNever) { + FormatStyle Style = getLLVMStyle(); + Style.FixNamespaceComments = false; + Style.ShortNamespaceLines = 0; + Style.M

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

2024-09-22 Thread Owen Pan via cfe-commits
@@ -28104,6 +28104,253 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, WrapNamespaceBodyWithEmptyLinesNever) { + FormatStyle Style = getLLVMStyle(); + Style.FixNamespaceComments = false; + Style.ShortNamespaceLines = 0; + Style.M

[clang] [clang-format] Annotate the l_paren of function pointer types (PR #109229)

2024-09-20 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/109229 >From 84c166dfabc3f314cd922baa3933b3d0ea11e08e Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Wed, 18 Sep 2024 21:03:24 -0700 Subject: [PATCH] [clang-format] Annotate the l_paren of function pointer types Fixes #

[clang] [clang-format] Correctly annotate */& in if condition with braced init (PR #109505)

2024-09-20 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/109505 Fixes #109371. >From 192deb4adc9f7e77167a02c060eef8c91932b912 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 20 Sep 2024 20:28:31 -0700 Subject: [PATCH] [clang-format] Correctly annotate */& in if condition

[clang] [clang-format] Fix a bug in annotating angles containing FatArrow (PR #108671)

2024-09-24 Thread Owen Pan via cfe-commits
@@ -243,14 +244,16 @@ class AnnotatingParser { // operator that was misinterpreted because we are parsing template // parameters. // FIXME: This is getting out of hand, write a decent parser. - if (InExpr && !Line.startsWith(tok::kw_template) && + if

[clang] [clang-format] Handle template closer followed by empty paretheses (PR #110408)

2024-09-28 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/110408 Fixes #109925. >From 27135c008868cc4f17b7ca5ff9c2af9c2fc02135 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 28 Sep 2024 22:42:56 -0700 Subject: [PATCH] [clang-format] Handle template closer followed by empt

[clang] [clang-format] Fix a bug in annotating angles containing FatArrow (PR #108671)

2024-09-28 Thread Owen Pan via cfe-commits
@@ -243,14 +244,16 @@ class AnnotatingParser { // operator that was misinterpreted because we are parsing template // parameters. // FIXME: This is getting out of hand, write a decent parser. - if (InExpr && !Line.startsWith(tok::kw_template) && + if

[clang] [clang-format] Correctly annotate pointer/reference in range-for loop (PR #109361)

2024-09-19 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/109361 Fixes #109358. >From d954c56f41a96ace6b507f6e6f4531c885db9f38 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 19 Sep 2024 18:56:38 -0700 Subject: [PATCH] [clang-format] Correctly annotate pointer/reference in

[clang] [clang-format] Correctly annotate pointer/reference in `if` statement (PR #109370)

2024-09-19 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/109370 Fixes #60146. >From bbe60a2126bd90835738485955fbe05f530afb6e Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 19 Sep 2024 21:12:06 -0700 Subject: [PATCH] [clang-format] Correctly annotate pointer/reference in

[clang] [clang-format] Correctly annotate pointer/reference in range-for loop (PR #109361)

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

[clang] [clang-format] Correctly annotate pointer/reference in `if` statement (PR #109370)

2024-09-20 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/109370 ___ 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 angles containing FatArrow (PR #108671)

2024-09-30 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/108671 ___ 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 angles containing FatArrow (PR #108671)

2024-09-30 Thread Owen Pan via cfe-commits
@@ -243,14 +244,16 @@ class AnnotatingParser { // operator that was misinterpreted because we are parsing template // parameters. // FIXME: This is getting out of hand, write a decent parser. - if (InExpr && !Line.startsWith(tok::kw_template) && + if

[clang] [clang-format] Annotate the l_paren of function pointer types (PR #109229)

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

[clang] [clang-format] Correctly annotate */& in if condition with braced init (PR #109505)

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

[clang] [clang-format] Add TemplateNames option to help parse C++ angles (PR #109916)

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

[clang] [clang-format] Handle template closer followed by empty paretheses (PR #110408)

2024-10-02 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/110408 >From 27135c008868cc4f17b7ca5ff9c2af9c2fc02135 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 28 Sep 2024 22:42:56 -0700 Subject: [PATCH 1/2] [clang-format] Handle template closer followed by empty parethese

[clang] [clang-format] Handle template closer followed by empty paretheses (PR #110408)

2024-10-02 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/110408 ___ 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 PointerOrReference (PR #110945)

2024-10-02 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/110945 Fixes #110879. >From ab6f3f4950a5ca1e1297437940730b43746c7f6a Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Wed, 2 Oct 2024 19:30:30 -0700 Subject: [PATCH] [clang-format] Fix a bug in annotating PointerOrReferen

[clang] [clang-format] Handle template closer followed by braces (PR #110971)

2024-10-03 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/110971 Fixes #110968. >From b98834264b09fb283cc060ee06576b014809ec5f Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 3 Oct 2024 01:57:14 -0700 Subject: [PATCH] [clang-format] Handle template closer followed by brace

[clang] [clang-format] Make some binary operations imply requires clause (PR #110942)

2024-10-02 Thread Owen Pan via cfe-commits
@@ -3528,6 +3528,17 @@ bool UnwrappedLineParser::parseRequires() { return false; } break; +case tok::equalequal: +case tok::greaterequal: +case tok::lessequal: +case tok::r_paren: +case tok::pipepipe: + if (OpenAngles == 0) { +

[clang] [clang-format] Make some binary operations imply requires clause (PR #110942)

2024-10-03 Thread Owen Pan via cfe-commits
@@ -3528,6 +3528,17 @@ bool UnwrappedLineParser::parseRequires() { return false; } break; +case tok::equalequal: +case tok::greaterequal: +case tok::lessequal: +case tok::r_paren: +case tok::pipepipe: + if (OpenAngles == 0) { +

[clang] [clang-format] Make some binary operations imply requires clause (PR #110942)

2024-10-03 Thread Owen Pan via cfe-commits
@@ -3528,6 +3528,17 @@ bool UnwrappedLineParser::parseRequires() { return false; } break; +case tok::equalequal: +case tok::greaterequal: +case tok::lessequal: +case tok::r_paren: +case tok::pipepipe: + if (OpenAngles == 0) { +

[clang] [clang-format] Fix a bug that misannotates binary operators */&/&& (PR #110945)

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

[clang] [clang-format] Make some binary operations imply requires clause (PR #110942)

2024-10-03 Thread Owen Pan via cfe-commits
@@ -3528,6 +3528,17 @@ bool UnwrappedLineParser::parseRequires() { return false; } break; +case tok::equalequal: +case tok::greaterequal: +case tok::lessequal: +case tok::r_paren: +case tok::pipepipe: + if (OpenAngles == 0) { +

[clang] [clang-format[NFC] Clean up FormatTestBase and Proto/TextProto tests (PR #108334)

2024-09-17 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/108334 ___ 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 SpacesInParens InConditionalStatements (PR #108797)

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

[clang] [clang-format] Reimplement InsertNewlineAtEOF (PR #108513)

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

[clang] [clang-format] Handle C-style cast of qualified type (PR #108929)

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

[clang] [clang-format] Fix working -assume-filename with .clang-format-ignore (PR #113100)

2024-10-23 Thread Owen Pan via cfe-commits
@@ -46,5 +46,16 @@ // CHECK5-NEXT: {{Formatting \[4/5] .*foo\.c}} // CHECK5-NOT: foo.js +// RUN: echo "foo.*" > .clang-format-ignore +// RUN: touch foo.c +// RUN: echo foo | clang-format -assume-filename=foo.c 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK6 -allow-empty

[clang] [clang-format] Fix working -assume-filename with .clang-format-ignore (PR #113100)

2024-10-23 Thread Owen Pan via cfe-commits
@@ -707,8 +707,11 @@ int main(int argc, const char **argv) { errs() << "Clang-formatting " << LineNo << " files\n"; } - if (FileNames.empty()) + if (FileNames.empty()) { +if (!AssumeFileName.empty() && isIgnored(AssumeFileName)) owenca wrote: ```s

[clang] [clang-format] Fix working -assume-filename with .clang-format-ignore (PR #113100)

2024-10-23 Thread Owen Pan via cfe-commits
@@ -46,5 +46,16 @@ // CHECK5-NEXT: {{Formatting \[4/5] .*foo\.c}} // CHECK5-NOT: foo.js +// RUN: echo "foo.*" > .clang-format-ignore +// RUN: touch foo.c +// RUN: echo foo | clang-format -assume-filename=foo.c 2>&1 \ owenca wrote: ```suggestion // RUN: echo "

[clang] [clang-format] Fix working -assume-filename with .clang-format-ignore (PR #113100)

2024-10-23 Thread Owen Pan via cfe-commits
@@ -46,5 +46,16 @@ // CHECK5-NEXT: {{Formatting \[4/5] .*foo\.c}} // CHECK5-NOT: foo.js +// RUN: echo "foo.*" > .clang-format-ignore +// RUN: touch foo.c +// RUN: echo foo | clang-format -assume-filename=foo.c 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK6 -allow-empty

[clang] 04f14e4 - [clang-format] Remove repeated `TabWidth` in Format.h

2024-10-24 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-10-23T21:47:11-07:00 New Revision: 04f14e4d652a344fedea6de8df532e88a652bcc4 URL: https://github.com/llvm/llvm-project/commit/04f14e4d652a344fedea6de8df532e88a652bcc4 DIFF: https://github.com/llvm/llvm-project/commit/04f14e4d652a344fedea6de8df532e88a652bcc4.diff LOG:

[clang] [clang-format] clang-format-ignore: Add support for double asterisk patterns (PR #110560)

2024-11-06 Thread Owen Pan via cfe-commits
@@ -164,6 +164,40 @@ TEST_F(MatchFilePathTest, Path) { EXPECT_FALSE(match("foo\\", R"(foo*\)")); } +TEST_F(MatchFilePathTest, DoubleAsterisk) { + EXPECT_TRUE(match("a/b/c/d.cpp", "**b**")); + EXPECT_TRUE(match("a/b/c/d.cpp", "**/b/**")); + EXPECT_TRUE(match("a/b/c/d_e.cpp

[clang] [llvm] [clang-format] Add CI check confirming ClangFormatStyleOptions.rst is up-to-date. (PR #111513)

2024-11-06 Thread Owen Pan via cfe-commits
@@ -53,3 +53,10 @@ foreach (file IN LISTS files) endforeach () add_custom_target(clang-format-check-format DEPENDS ${check_format_depends}) + +add_custom_target(clang-format-style-options +COMMAND "${Python3_EXECUTABLE}" dump_format_style.py +WORKING_DIRECTORY "${CMAKE

[clang] [clang-format][CMake] Generate formatting options docs during build (PR #113739)

2024-11-06 Thread Owen Pan via cfe-commits
owenca wrote: > > can we have clang-format-style-options rebuilt only when it's outdated, > > i.e. only if at least one of the following has been updated? > > We can, but it requires more changes that I'm not sure are worth doing given > that this step takes essentially zero time compared to r

<    13   14   15   16   17   18   19   20   21   22   >