[clang] 0fe12a7 - [clang-format][NFC] Remove a pointer in ContinuationIndenter

2024-11-25 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-11-25T00:35:50-08:00 New Revision: 0fe12a7db3f6663c9f2572ff0232e56f1bd411ae URL: https://github.com/llvm/llvm-project/commit/0fe12a7db3f6663c9f2572ff0232e56f1bd411ae DIFF: https://github.com/llvm/llvm-project/commit/0fe12a7db3f6663c9f2572ff0232e56f1bd411ae.diff LOG:

[clang] 9b5b3ed - [clang-format][doc] Fix formatting, etc.

2024-11-28 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-11-28T22:00:23-08:00 New Revision: 9b5b3edd64e56af02295c0365269177443d4a64d URL: https://github.com/llvm/llvm-project/commit/9b5b3edd64e56af02295c0365269177443d4a64d DIFF: https://github.com/llvm/llvm-project/commit/9b5b3edd64e56af02295c0365269177443d4a64d.diff LOG:

[clang] [clang-format] Fix an assertion failure in RemoveSemicolon (PR #117472)

2024-11-24 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/117472 Fixes #117290. >From 9a2a93fbb50163e593f6b48a279bea9f70424c06 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 24 Nov 2024 00:43:29 -0800 Subject: [PATCH] [clang-format] Fix an assertion failure in RemoveSemic

[clang] [clang-format] fix: add missing `default_extensions` values to `git-clang-format` (PR #117730)

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

[clang] [clang-format] fix: add missing `default_extensions` values to `git-clang-format` (PR #117730)

2024-11-26 Thread Owen Pan via cfe-commits
https://github.com/owenca approved this pull request. https://github.com/llvm/llvm-project/pull/117730 ___ 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-11-29 Thread Owen Pan via cfe-commits
owenca wrote: > As a reviewer that means we have to download the review, rebuild the rst then > check it. I don't quite understand the problem we are trying to solve here? > Given that the python script unpacks the Format.h and makes the rst I would > prefer to see the finished rst as part of

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

2024-12-01 Thread Owen Pan via cfe-commits
owenca wrote: > Can you explicate on what your requirements are here? I don't see why just > wrapping the python script in CMake does anything tangible here. Having a > build target that modifies the source directory is also weird and something > that we should avoid if possible, in my opinion

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

2024-11-30 Thread Owen Pan via cfe-commits
owenca wrote: > What's the point of adding it to the `FormatTests` target though? Just to > ensure proper test coverage of the `dump_format_style.py` file? That and to also ensure that the edited Format.h doesn't break the python script. > Thinking about this a bit more, I think we can probab

[clang] Add `.cjs` extension handling for JavaScript Language. (PR #118188)

2024-11-30 Thread Owen Pan via cfe-commits
owenca wrote: You need to also update the command-line input file extensions, docs, and git-clang-format. https://github.com/llvm/llvm-project/pull/118188 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/l

[clang] b9731a4 - [clang-format][doc] Minor cleanup

2024-11-24 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-11-24T23:15:39-08:00 New Revision: b9731a479cb053cd07cc5f460b097c5f2d5f396e URL: https://github.com/llvm/llvm-project/commit/b9731a479cb053cd07cc5f460b097c5f2d5f396e DIFF: https://github.com/llvm/llvm-project/commit/b9731a479cb053cd07cc5f460b097c5f2d5f396e.diff LOG:

[clang] Add `.cjs` extension handling for JavaScript Language. (PR #118188)

2024-12-01 Thread Owen Pan via cfe-commits
@@ -87,7 +87,7 @@ static cl::opt AssumeFileName( "supported:\n" " CSharp: .cs\n" " Java: .java\n" - " JavaScript: .mjs .js .ts\n" + " JavaScript: .cjs .mjs .js .ts\n" owenca wrote: ```suggestio

[clang] Add `.cjs` extension handling for JavaScript Language. (PR #118188)

2024-12-01 Thread Owen Pan via cfe-commits
@@ -94,7 +94,7 @@ def main(): # Other languages that clang-format supports 'proto', 'protodevel', # Protocol Buffers 'java', # Java - 'mjs', 'js', # JavaScript + 'cjs', 'mjs', 'js', # JavaScript owenca wrote: ```suggestion

[clang] [clang-format] Add support for `.cjs` as JavaScript file extension (PR #118188)

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

[clang] Add `.cjs` extension handling for JavaScript Language. (PR #118188)

2024-12-01 Thread Owen Pan via cfe-commits
@@ -49,7 +49,7 @@ to format C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code. supported: CSharp: .cs Java: .java - Ja

[clang] [clang-format] Fix idempotent format of hash in macro body (PR #118513)

2024-12-03 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/118513 Fixes #118334. >From 309952ef482ccbef6cd13f90388139db435b4368 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 3 Dec 2024 08:51:13 -0800 Subject: [PATCH] [clang-format] Fix idempotent format of hash in macro b

[clang] [clang-format] Add support for `.cjs` as JavaScript file extension (PR #118188)

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

[clang] [clang-format] Add support for `.cjs` as JavaScript file extension (PR #118188)

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

[clang] [llvm] [clang-format] Add cmake target clang-format-style-options for updating ClangFormatStyleOptions.rst (PR #111513)

2024-12-04 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] [clang-format] Fix an assertion failure in RemoveSemicolon (PR #117472)

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

[clang] [llvm] [clang-format] Add new cmake target, `clang-format-style-options`, for updating ClangFormatStyleOptions.rst. (PR #111513)

2024-12-04 Thread Owen Pan via cfe-commits
@@ -53,3 +53,13 @@ foreach (file IN LISTS files) endforeach () add_custom_target(clang-format-check-format DEPENDS ${check_format_depends}) + +set(style_options_depends ${CLANG_SOURCE_DIR}/docs/ClangFormatStyleOptions.rst) +add_custom_command(OUTPUT ${style_options_depends} --

[clang] [llvm] [clang-format] Add cmake target clang-format-style-options for updating ClangFormatStyleOptions.rst (PR #111513)

2024-12-04 Thread Owen Pan via cfe-commits
https://github.com/owenca closed 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 cmake target clang-format-style-options for updating ClangFormatStyleOptions.rst (PR #111513)

2024-12-04 Thread Owen Pan via cfe-commits
https://github.com/owenca approved this pull request. 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] [clang-format] Add test to ensure formatting options docs are updated (PR #118154)

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

[clang] [llvm] [clang-format] Add new cmake target, `clang-format-style-options`, for updating ClangFormatStyleOptions.rst. (PR #111513)

2024-12-04 Thread Owen Pan via cfe-commits
@@ -53,3 +53,13 @@ foreach (file IN LISTS files) endforeach () add_custom_target(clang-format-check-format DEPENDS ${check_format_depends}) + +set(style_options_depends ${CLANG_SOURCE_DIR}/docs/ClangFormatStyleOptions.rst) +add_custom_command(OUTPUT ${style_options_depends} +

[clang] [llvm] [clang-format] Add new cmake target, `clang-format-style-options`, for updating ClangFormatStyleOptions.rst. (PR #111513)

2024-12-04 Thread Owen Pan via cfe-commits
@@ -53,3 +53,13 @@ foreach (file IN LISTS files) endforeach () add_custom_target(clang-format-check-format DEPENDS ${check_format_depends}) + +set(style_options_depends ${CLANG_SOURCE_DIR}/docs/ClangFormatStyleOptions.rst) +add_custom_command(OUTPUT ${style_options_depends} +

[clang] eeadd01 - [clang-format] Also check ClangFormat.rst is up to date in docs_updated.test

2024-12-08 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-12-08T01:15:45-08:00 New Revision: eeadd0128df848eb858ae718984a13fa2c923775 URL: https://github.com/llvm/llvm-project/commit/eeadd0128df848eb858ae718984a13fa2c923775 DIFF: https://github.com/llvm/llvm-project/commit/eeadd0128df848eb858ae718984a13fa2c923775.diff LOG:

[clang] 6b1c357 - [clang-format] Add cmake target clang-format-help to update ClangFormat.rst

2024-12-07 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-12-07T22:41:50-08:00 New Revision: 6b1c357acc312961743bef05f99120e7c68b2e25 URL: https://github.com/llvm/llvm-project/commit/6b1c357acc312961743bef05f99120e7c68b2e25 DIFF: https://github.com/llvm/llvm-project/commit/6b1c357acc312961743bef05f99120e7c68b2e25.diff LOG:

[clang] [clang-format] Reorder TokenAnnotator::canBreakBefore (PR #119044)

2024-12-07 Thread Owen Pan via cfe-commits
@@ -6105,6 +6105,33 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line, return false; } + // We only break before r_brace if there was a corresponding break before + // the l_brace, which is tracked by BreakBeforeClosingBrace. owenca w

[clang] [clang-format] Reorder TokenAnnotator::canBreakBefore (PR #119044)

2024-12-07 Thread Owen Pan via cfe-commits
@@ -9383,6 +9383,13 @@ TEST_F(FormatTest, AlignsAfterOpenBracket) { "(a, )) &&\n" ");", Style); + verifyFormat("void foo(\n" + "void (*foobarpntr)(\n" +

[clang] [clang-format] Reorder TokenAnnotator::canBreakBefore (PR #119044)

2024-12-07 Thread Owen Pan via cfe-commits
@@ -6105,6 +6105,33 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line, return false; } + // We only break before r_brace if there was a corresponding break before + // the l_brace, which is tracked by BreakBeforeClosingBrace. + if (Right.is(tok::r_br

[clang] e25c556 - [clang-format][NFC] Reformat git-clang-format with `black -l80`

2024-12-05 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-12-05T23:18:24-08:00 New Revision: e25c556abeb9ae5f82da42cd26b9dae8462a7197 URL: https://github.com/llvm/llvm-project/commit/e25c556abeb9ae5f82da42cd26b9dae8462a7197 DIFF: https://github.com/llvm/llvm-project/commit/e25c556abeb9ae5f82da42cd26b9dae8462a7197.diff LOG:

[clang] f0b09df - [clang-format] Add cmake target clang-format-style-options

2024-12-05 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-12-05T19:38:34-08:00 New Revision: f0b09dfd4c84fe8ffbc726da39ee5255e1a22a2f URL: https://github.com/llvm/llvm-project/commit/f0b09dfd4c84fe8ffbc726da39ee5255e1a22a2f DIFF: https://github.com/llvm/llvm-project/commit/f0b09dfd4c84fe8ffbc726da39ee5255e1a22a2f.diff LOG:

[clang] [llvm] [clang-format] Add cmake target clang-format-style-options for updating ClangFormatStyleOptions.rst (PR #111513)

2024-12-05 Thread Owen Pan via cfe-commits
owenca wrote: > If CLANG_INCLUDE_DOCS=OFF then this should be skipped, otherwise the build > will fail if llvm/clang/docs doesn't exist. This was fixed in f0b09dfd4c84fe8ffbc726da39ee5255e1a22a2f, which also addressed an issue that ClangFormatStyleOptions.rst would be deleted by `ninja clean`

[clang] [clang-format] Add test to ensure formatting options docs are updated (PR #118154)

2024-12-05 Thread Owen Pan via cfe-commits
owenca wrote: > When running the new testcase the file plurals.txt, which is in the repo, is > opened for writing? Is this really desired? Fixed in 74d29c6393df606e98e7c42b9a97f56f335e3ffb. https://github.com/llvm/llvm-project/pull/118154 ___ cfe-com

[clang] fb2cbc0 - [clang-format] Reformat Python script git-clang-format with black

2024-12-05 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-12-05T20:26:02-08:00 New Revision: fb2cbc00e0b27bc25afd8c831151333a41820bc0 URL: https://github.com/llvm/llvm-project/commit/fb2cbc00e0b27bc25afd8c831151333a41820bc0 DIFF: https://github.com/llvm/llvm-project/commit/fb2cbc00e0b27bc25afd8c831151333a41820bc0.diff LOG:

[clang] 411df3b - [clang-format] Make command lines of dump_format_[style|help].py consistent

2024-12-09 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-12-09T00:56:24-08:00 New Revision: 411df3bb4941318a02a59b4cd7a898d4f9b788a3 URL: https://github.com/llvm/llvm-project/commit/411df3bb4941318a02a59b4cd7a898d4f9b788a3 DIFF: https://github.com/llvm/llvm-project/commit/411df3bb4941318a02a59b4cd7a898d4f9b788a3.diff LOG:

[clang] [clang-format] Fix an assertion failure in RemoveSemicolon (PR #117472)

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

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

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

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

2024-12-28 Thread Owen Pan via cfe-commits
@@ -361,9 +361,19 @@ 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-12-28 Thread Owen Pan via cfe-commits
https://github.com/owenca approved this pull request. https://github.com/llvm/llvm-project/pull/105597 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

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

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

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

[clang] [clang-format] Skip line splices when sorting C++ includes (PR #120680)

2024-12-23 Thread Owen Pan via cfe-commits
@@ -3246,8 +3246,15 @@ tooling::Replacements sortCppIncludes(const FormatStyle &Style, StringRef Code, SmallVector RawStringMatches; std::string RawStringTermination = ")\""; - for (;;) { -auto Pos = Code.find('\n', SearchFrom); + for (const auto Size = Code.size();

[clang] [clang-format] extend clang-format directive with options to prevent formatting for one line (PR #118566)

2024-12-23 Thread Owen Pan via cfe-commits
owenca wrote: > A nice multiline example I stumbled upon is: > > ```c++ > Tree tree[] > { > {'D', tree + 1, tree + 2}, > //│ > //┌───┴┐ > //│

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

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

[clang] [clang-format] Add LT_RequiresExpression and LT_SimpleRequirement (PR #121681)

2025-01-06 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/121681 >From 14e26d9bb27724705e51fc134a4f3df2a09807e6 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 4 Jan 2025 23:42:38 -0800 Subject: [PATCH 1/2] [clang-format] Add LT_RequiresExpression and LT_SimpleRequirement

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

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

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

2025-01-02 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/106145 >From dde31f15552cb4f95a50e0835238062a0e6c69d8 Mon Sep 17 00:00:00 2001 From: dmasloff Date: Mon, 26 Aug 2024 22:11:05 +0300 Subject: [PATCH 01/12] fix merge conflict --- clang/docs/ClangFormatStyleOptions.rst

[clang] [clang-format] Support globstar in .clang-format-ignore (PR #121404)

2024-12-31 Thread Owen Pan via cfe-commits
@@ -164,6 +164,41 @@ TEST_F(MatchFilePathTest, Path) { EXPECT_FALSE(match("foo\\", R"(foo*\)")); } +TEST_F(MatchFilePathTest, Globstar) { + EXPECT_TRUE(match("/", "**")); + EXPECT_TRUE(match("foo", "**")); + EXPECT_TRUE(match("/foo", "**")); + EXPECT_TRUE(match("foo/", "

[clang] [clang-format] Support globstar in .clang-format-ignore (PR #121404)

2025-01-01 Thread Owen Pan via cfe-commits
@@ -164,6 +164,41 @@ TEST_F(MatchFilePathTest, Path) { EXPECT_FALSE(match("foo\\", R"(foo*\)")); } +TEST_F(MatchFilePathTest, Globstar) { + EXPECT_TRUE(match("/", "**")); + EXPECT_TRUE(match("foo", "**")); + EXPECT_TRUE(match("/foo", "**")); + EXPECT_TRUE(match("foo/", "

[clang] [clang-format] Support globstar in .clang-format-ignore (PR #121404)

2025-01-01 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/121404 >From 36efaa2849ee6276be5b3c0739f295d0921d1e6e Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 31 Dec 2024 08:13:53 -0800 Subject: [PATCH 1/3] [clang-format] Support globstar in .clang-format-ignore Closes #1

[clang] [clang-format] Support globstar in .clang-format-ignore (PR #121404)

2025-01-01 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/121404 >From 36efaa2849ee6276be5b3c0739f295d0921d1e6e Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 31 Dec 2024 08:13:53 -0800 Subject: [PATCH 1/4] [clang-format] Support globstar in .clang-format-ignore Closes #1

[clang] [clang-format] Add `VariableTemplates` option (PR #121318)

2025-01-01 Thread Owen Pan via cfe-commits
owenca wrote: > Should there be a parse test? About half of the `List of Strings` options don't have a `CHECK_PARSE` test. I'll fix that in a separate patch. https://github.com/llvm/llvm-project/pull/121318 ___ cfe-commits mailing list cfe-commits@li

[clang] [Clang] Repair the function "rParenEndsCast" to make incorrect judgments in template variable cases (PR #120904)

2025-01-01 Thread Owen Pan via cfe-commits
owenca wrote: See #121318. https://github.com/llvm/llvm-project/pull/120904 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] extend clang-format directive with options to prevent formatting for one line (PR #118566)

2025-01-01 Thread Owen Pan via cfe-commits
owenca wrote: > > If we were to add // clang-format off-next-line, would "next line" mean the > > next physical or logical/unwrapped line? > > I would expect it to apply only to the physical line, similar to how other > formatters work. However, the main concern doesn’t seem to be about its >

[clang] [clang-format] Add `VariableTemplates` option (PR #121318)

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

[clang] [clang-format][NFC] Add missing config tests for List of Strings (PR #121451)

2025-01-01 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/121451 None >From 305aacf68126a7827376a0718a774006f10879f4 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Wed, 1 Jan 2025 20:15:26 -0800 Subject: [PATCH] [clang-format][NFC] Add missing config tests for List of Strings

[clang] [clang-format] Add `VariableTemplates` option (PR #121318)

2025-01-01 Thread Owen Pan via cfe-commits
owenca wrote: > > Should there be a parse test? > > About half of the `List of Strings` options don't have a `CHECK_PARSE` test. > I'll fix that in a separate patch. See #121451. https://github.com/llvm/llvm-project/pull/121318 ___ cfe-commits maili

[clang] [clang-format] Add an option to control indentation of `export { ... }` (PR #110381)

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

[clang] 064da42 - [clang-format][NFC] Remove unneeded ST_ChildBlock in annotator

2025-01-07 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2025-01-07T00:51:29-08:00 New Revision: 064da423c3b46907f5011a4537a88fbae9ac03d4 URL: https://github.com/llvm/llvm-project/commit/064da423c3b46907f5011a4537a88fbae9ac03d4 DIFF: https://github.com/llvm/llvm-project/commit/064da423c3b46907f5011a4537a88fbae9ac03d4.diff LOG:

[clang] [clang-format] Add LT_RequiresExpression and LT_SimpleRequirement (PR #121681)

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

[clang] [clang-format] Add VariableTemplates option (PR #121318)

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

[clang] [clang-format] Add `VariableTemplates` option (PR #121318)

2024-12-30 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/121318 >From abbe00e409219bcc3ce08c21548d809c9d5bea39 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 29 Dec 2024 20:17:46 -0800 Subject: [PATCH] [clang-format] Add VariableTemplate option Closes #120148. --- clang

[clang] [clang-format] Add `VariableTemplates` option (PR #121318)

2024-12-30 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/121318 >From abbe00e409219bcc3ce08c21548d809c9d5bea39 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 29 Dec 2024 20:17:46 -0800 Subject: [PATCH] [clang-format] Add VariableTemplate option Closes #120148. --- clang

[clang] [clang-format] Add `VariableTemplates` option (PR #121318)

2024-12-30 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/121318 >From 8f61998f9a5339a9c1c04176bf3d74331532eb75 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 29 Dec 2024 20:17:46 -0800 Subject: [PATCH] [clang-format] Add VariableTemplate option Closes #120148. --- clang

[clang] [clang-format] Add `VariableTemplates` option (PR #121318)

2024-12-30 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/121318 >From 8f61998f9a5339a9c1c04176bf3d74331532eb75 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 29 Dec 2024 20:17:46 -0800 Subject: [PATCH] [clang-format] Add VariableTemplate option Closes #120148. --- clang

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

2024-12-30 Thread Owen Pan via cfe-commits
https://github.com/owenca requested changes to this pull request. Please enable "Allowing edits by maintainers". https://github.com/llvm/llvm-project/pull/106145 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mai

[clang] [clang-format] Add `VariableTemplates` option (PR #121318)

2024-12-30 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/121318 >From 7e865d66f147da3afa1ebcd55354e97fdfd8374a Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 29 Dec 2024 20:17:46 -0800 Subject: [PATCH] [clang-format] Add VariableTemplate option Closes #120148. --- clang

[clang] [clang-format] Add `VariableTemplates` option (PR #121318)

2024-12-30 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/121318 >From 7e865d66f147da3afa1ebcd55354e97fdfd8374a Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 29 Dec 2024 20:17:46 -0800 Subject: [PATCH] [clang-format] Add VariableTemplate option Closes #120148. --- clang

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

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

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

2024-12-30 Thread Owen Pan via cfe-commits
@@ -28314,6 +28320,116 @@ TEST_F(FormatTest, KeepFormFeed) { Style); } +TEST_F(FormatTest, ShortNamespacesOption) { + auto BaseStyle = getLLVMStyle(); + BaseStyle.AllowShortNamespacesOnASingleLine = true; + BaseStyle.FixNamespaceComments = false; + BaseStyle

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

2024-12-30 Thread Owen Pan via cfe-commits
@@ -28314,6 +28320,116 @@ TEST_F(FormatTest, KeepFormFeed) { Style); } +TEST_F(FormatTest, ShortNamespacesOption) { + auto BaseStyle = getLLVMStyle(); + BaseStyle.AllowShortNamespacesOnASingleLine = true; + BaseStyle.FixNamespaceComments = false; + BaseStyle

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

2024-12-30 Thread Owen Pan via cfe-commits
@@ -28314,6 +28320,116 @@ TEST_F(FormatTest, KeepFormFeed) { Style); } +TEST_F(FormatTest, ShortNamespacesOption) { + auto BaseStyle = getLLVMStyle(); + BaseStyle.AllowShortNamespacesOnASingleLine = true; + BaseStyle.FixNamespaceComments = false; + BaseStyle

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

2024-12-30 Thread Owen Pan via cfe-commits
@@ -28314,6 +28320,116 @@ TEST_F(FormatTest, KeepFormFeed) { Style); } +TEST_F(FormatTest, ShortNamespacesOption) { + auto BaseStyle = getLLVMStyle(); + BaseStyle.AllowShortNamespacesOnASingleLine = true; + BaseStyle.FixNamespaceComments = false; + BaseStyle

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

2024-12-30 Thread Owen Pan via cfe-commits
@@ -616,6 +626,71 @@ 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-12-30 Thread Owen Pan via cfe-commits
https://github.com/owenca commented: Final NFC cleanup. https://github.com/llvm/llvm-project/pull/105597 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-12-30 Thread Owen Pan via cfe-commits
@@ -28314,6 +28320,116 @@ TEST_F(FormatTest, KeepFormFeed) { Style); } +TEST_F(FormatTest, ShortNamespacesOption) { + auto BaseStyle = getLLVMStyle(); + BaseStyle.AllowShortNamespacesOnASingleLine = true; + BaseStyle.FixNamespaceComments = false; + BaseStyle

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

2024-12-30 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/105597 >From 93eb3d89652607173f4f68fce7dcc5b2bd33f266 Mon Sep 17 00:00:00 2001 From: Galen Elias Date: Wed, 21 Aug 2024 16:33:42 -0700 Subject: [PATCH 01/17] clang-format: Add "AllowShortNamespacesOnASingleLine" option

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

2024-12-30 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/105597 >From 93eb3d89652607173f4f68fce7dcc5b2bd33f266 Mon Sep 17 00:00:00 2001 From: Galen Elias Date: Wed, 21 Aug 2024 16:33:42 -0700 Subject: [PATCH 01/18] clang-format: Add "AllowShortNamespacesOnASingleLine" option

[clang] [clang-format] Add `VariableTemplates` option (PR #121318)

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

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

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

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

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

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

2024-12-29 Thread Owen Pan via cfe-commits
https://github.com/owenca commented: Also, additional cleanup of `tryMergeNamespace()`: ```cpp if (Limit == 0) return 0; -if (I[1]->InPPDirective != (*I)->InPPDirective || -(I[1]->InPPDirective && I[1]->First->HasUnescapedNewline)) { + +assert(I[1]); +const auto &L

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

2024-12-29 Thread Owen Pan via cfe-commits
@@ -4504,6 +4504,16 @@ TEST_F(FormatTest, FormatsCompactNamespaces) { "} // namespace bb\n" "} // namespace aa", Style); + + verifyFormat("namespace a { namespace b { namespace c {\n" + "}}} // namespace a::b::

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

2024-12-29 Thread Owen Pan via cfe-commits
@@ -4484,7 +4484,7 @@ TEST_F(FormatTest, FormatsCompactNamespaces) { "} // namespace A", Style); - Style.ColumnLimit = 40; + Style.ColumnLimit = 41; owenca wrote: ```suggestion Style.ColumnLimit = 40; ``` See below. https://

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

2024-12-29 Thread Owen Pan via cfe-commits
@@ -916,6 +983,21 @@ class LineJoiner { return 1 + I[1]->Last->TotalLength + 1 + I[2]->Last->TotalLength <= Limit; } + bool nextNLinesFitInto(SmallVectorImpl::const_iterator I, + SmallVectorImpl::const_iterator E, + unsign

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

2024-12-29 Thread Owen Pan via cfe-commits
@@ -4504,6 +4504,16 @@ TEST_F(FormatTest, FormatsCompactNamespaces) { "} // namespace bb\n" "} // namespace aa", Style); + + verifyFormat("namespace a { namespace b { namespace c {\n" + "}}} // namespace a::b::

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

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

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

2024-12-27 Thread Owen Pan via cfe-commits
@@ -616,6 +627,63 @@ 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-12-27 Thread Owen Pan via cfe-commits
https://github.com/owenca commented: Please rebase and run `ninja clang-format-style`. https://github.com/llvm/llvm-project/pull/105597 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-12-27 Thread Owen Pan via cfe-commits
@@ -988,6 +988,10 @@ struct FormatStyle { /// \version 3.7 bool AllowShortLoopsOnASingleLine; + /// If ``true``, ``namespace a { class b; }`` can be put on a single line. + /// \version 20 + bool AllowShortNamespacesOnASingleLine; owenca wrote: You nee

[clang] [clang-format] Support globstar in .clang-format-ignore (PR #121404)

2024-12-31 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/121404 Closes #114969. >From 8b7802141853f77f3f074e6f41f416dfd25d90e4 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 31 Dec 2024 08:13:53 -0800 Subject: [PATCH] [clang-format] Support globstar in .clang-format-igno

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

2024-12-30 Thread Owen Pan via cfe-commits
@@ -28104,6 +28104,138 @@ TEST_F(FormatTest, BreakBinaryOperations) { Style); } +TEST_F(FormatTest, WrapNamespaceBodyWithEmptyLinesNever) { + auto Style = getLLVMStyle(); + Style.FixNamespaceComments = false; + Style.WrapNamespaceBodyWithEmptyLines = FormatSt

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

2024-12-30 Thread Owen Pan via cfe-commits
@@ -1493,6 +1493,22 @@ static auto computeNewlines(const AnnotatedLine &Line, Newlines = 1; } + if (Style.WrapNamespaceBodyWithEmptyLines != FormatStyle::WNBWELS_Leave) { +// Modify empty lines after TT_NamespaceLBrace. +if (PreviousLine && PreviousLine->endsWit

[clang] [clang-format] Hanlde qualified type name for `QualifierAlignment` (PR #125327)

2025-02-03 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/125327 >From af3d964d74634f0dd9f7216572c1d852b7a549dc Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 31 Jan 2025 18:32:33 -0800 Subject: [PATCH 1/3] [clang-format] Hanlde qualified type names Fixes #125178. --- cl

[clang] [clang-format] Hanlde qualified type name for `QualifierAlignment` (PR #125327)

2025-02-03 Thread Owen Pan via cfe-commits
@@ -412,6 +414,15 @@ const FormatToken *LeftRightQualifierAlignmentFixer::analyzeLeft( // The case `const long long volatile int` -> `const volatile long long int` // The case `long volatile long int const` -> `const volatile long long int` if (TypeToken->isTypeName(Lang

[clang] [clang-format] Hanlde qualified type name for `QualifierAlignment` (PR #125327)

2025-02-03 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/125327 >From af3d964d74634f0dd9f7216572c1d852b7a549dc Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 31 Jan 2025 18:32:33 -0800 Subject: [PATCH 1/2] [clang-format] Hanlde qualified type names Fixes #125178. --- cl

[clang] [clang-format] Fix annotation of Java/JavaScript keyword extends (PR #125038)

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

[clang] [clang-format] Add ClassHeadName to help annotating StartOfName (PR #124891)

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

[clang] [clang-format] Fix mismatched break in BlockIndent (PR #124998)

2025-01-30 Thread Owen Pan via cfe-commits
@@ -349,6 +349,13 @@ bool ContinuationIndenter::canBreak(const LineState &State) { } } + // Allow breaking before the right parens with block indentation if there was + // a break after the left parens, which is tracked by BreakBeforeClosingParen owen

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