[clang] [clang-format] Add MacrosSkippedByRemoveParentheses option (PR #148345)

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

[clang] [clang-format] Add MacrosSkippedByRemoveParentheses option (PR #148345)

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

[clang] [clang-format] Add FunctionLikeMacros option (PR #148345)

2025-07-13 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/148345 >From 3affefb96efe2d2955be66c247276b81d5d1d3a1 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 12 Jul 2025 00:09:49 -0700 Subject: [PATCH 1/2] [clang-format] Add FunctionLikeMacros option This allows RemovePa

[clang] [clang-format][NFC] Simplify some logic in BreakableLineCommentSection (PR #148324)

2025-07-13 Thread Owen Pan via cfe-commits
@@ -927,14 +927,12 @@ BreakableLineCommentSection::BreakableLineCommentSection( } if (Lines[i].size() != IndentPrefix.size()) { -PrefixSpaceChange[i] = FirstLineSpaceChange; +assert(Lines[i].size() > IndentPrefix.size()); -if (SpacesInPref

[clang] [clang-format] Add FunctionLikeMacros option (PR #148345)

2025-07-12 Thread Owen Pan via cfe-commits
@@ -2786,6 +2786,11 @@ struct FormatStyle { /// \version 3.7 std::vector ForEachMacros; + /// A vector of function-like macros whose invocations should be skipped by + /// ``RemoveParentheses``. + /// \version 21 + std::vector FunctionLikeMacros; owenc

[clang] [clang-format][NFC] Simplify some logic in BreakableLineCommentSection (PR #148324)

2025-07-12 Thread Owen Pan via cfe-commits
@@ -927,14 +927,12 @@ BreakableLineCommentSection::BreakableLineCommentSection( } if (Lines[i].size() != IndentPrefix.size()) { -PrefixSpaceChange[i] = FirstLineSpaceChange; +assert(Lines[i].size() > IndentPrefix.size()); -if (SpacesInPref

[clang] [clang-format] Add FunctionLikeMacros option (PR #148345)

2025-07-12 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/148345 This allows RemoveParentheses to skip the invocations of function-like macros. Fixes #68354. Fixes #147780. >From 3affefb96efe2d2955be66c247276b81d5d1d3a1 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 12 J

[clang] [clang-format][NFC] Simplify some logic in BreakableLineCommentSection (PR #148324)

2025-07-11 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/148324 None >From 88f34fb41704bdd6f6de743a5b467cdc3c938cc4 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 11 Jul 2025 18:18:18 -0700 Subject: [PATCH] [clang-format][NFC] Simplify some logic in BreakableLineComment

[clang] 2f1673e - Follow up on #147623

2025-07-11 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2025-07-11T18:15:27-07:00 New Revision: 2f1673eaa0e3b0c98cdd66429849ec27e220055b URL: https://github.com/llvm/llvm-project/commit/2f1673eaa0e3b0c98cdd66429849ec27e220055b DIFF: https://github.com/llvm/llvm-project/commit/2f1673eaa0e3b0c98cdd66429849ec27e220055b.diff LOG:

[clang] [clang-format] Split line comments separated by backslashes (PR #147648)

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

[clang] [clang-format] Split line comments separated by backslashes (PR #147648)

2025-07-10 Thread Owen Pan via cfe-commits
@@ -513,9 +513,9 @@ struct FormatStyle { ENAS_LeftWithLastLine, /// Align escaped newlines in the right-most column. /// \code -/// #define A \ -/// int ;

[clang] [clang-format][NFC] Replace a function with StringRef::contains (PR #146245)

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

[clang] [clang-format] Split line comments separated by backslashes (PR #147648)

2025-07-09 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/147648 >From 3efb5ca11d67ad36c4cbb1ea78220a1ca69a8339 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 8 Jul 2025 21:16:12 -0700 Subject: [PATCH 1/2] [clang-format] Split line comments separated by backslashes Fixes

[clang] [clang-format] Split line comments separated by backslashes (PR #147648)

2025-07-09 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/147648 >From 3efb5ca11d67ad36c4cbb1ea78220a1ca69a8339 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 8 Jul 2025 21:16:12 -0700 Subject: [PATCH 1/2] [clang-format] Split line comments separated by backslashes Fixes

[clang] [clang-format] Split line comments separated by backslashes (PR #147648)

2025-07-08 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/147648 Fixes #147341 >From 3efb5ca11d67ad36c4cbb1ea78220a1ca69a8339 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 8 Jul 2025 21:16:12 -0700 Subject: [PATCH] [clang-format] Split line comments separated by backslas

[clang] Address a handful of C4146 compiler warnings where literals can be replaced with std::numeric_limits (PR #147623)

2025-07-08 Thread Owen Pan via cfe-commits
@@ -777,7 +779,7 @@ template <> struct MappingTraits { IO.mapOptional("Maximum", signedMaximum); Space.Maximum = static_cast(signedMaximum); -if (Space.Maximum != -1u) +if (Space.Maximum != std::numeric_limits::max()) owenca wrote: ```suggest

[clang] a5af874 - [clang-format][NFC] Use `empty()` instead of comparing size() to 0 or 1

2025-07-06 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2025-07-06T23:54:00-07:00 New Revision: a5af8745039f906c4fc4184a1fe0d35d42355f52 URL: https://github.com/llvm/llvm-project/commit/a5af8745039f906c4fc4184a1fe0d35d42355f52 DIFF: https://github.com/llvm/llvm-project/commit/a5af8745039f906c4fc4184a1fe0d35d42355f52.diff LOG:

[clang] [clang-format][NFC] Replace a function with StringRef::contains (PR #146245)

2025-07-06 Thread Owen Pan via cfe-commits
owenca wrote: Had we used `StringRef::contains` initially, would you still insist that it be replaced with a "more performant" local function? Please note that the code is not on a performance critical path, and the difference in time it takes to run the relevant unit tests for 100 times is wi

[clang] [clang-format][NFC] Replace size() with empty() (PR #147164)

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

[clang] [clang-format][NFC] Replace size() with empty() (PR #147164)

2025-07-05 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/147164 None >From e6945b8f51409e1ffd71a47b70e06599774d213e Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 5 Jul 2025 15:15:05 -0700 Subject: [PATCH] [clang-format][NFC] Replace size() with empty() --- clang/lib/F

[clang] [clang-format] Stop crashing when the input contains `??/\n` (PR #147156)

2025-07-05 Thread Owen Pan via cfe-commits
owenca wrote: > I added code to count the number of characters in the escape sequence > probably just because the block of code used to have a comment saying someone > should add the feature. > I am not sure we should support the trigraph. I don't know anyone who uses > it. The C2y draft does

[clang] [clang-format] Propagate `LeadingEmptyLinesAffected` when joining lines (PR #146761)

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

[clang] [clang-format] Propagate `LeadingEmptyLinesAffected` when joining lines (PR #146761)

2025-07-05 Thread Owen Pan via cfe-commits
@@ -986,7 +986,7 @@ class LineJoiner { void join(AnnotatedLine &A, const AnnotatedLine &B) { assert(!A.Last->Next); assert(!B.First->Previous); -if (B.Affected) +if (B.Affected || (B.LeadingEmptyLinesAffected && A.Last->Children.empty())) owe

[clang] [clang-format] Propagate `LeadingEmptyLinesAffected` when joining lines (PR #146761)

2025-07-05 Thread Owen Pan via cfe-commits
@@ -986,7 +986,7 @@ class LineJoiner { void join(AnnotatedLine &A, const AnnotatedLine &B) { assert(!A.Last->Next); assert(!B.First->Previous); -if (B.Affected) +if (B.Affected || (B.LeadingEmptyLinesAffected && A.Last->Children.empty())) owe

[clang] [clang-format] Propagate `LeadingEmptyLinesAffected` when joining lines (PR #146761)

2025-07-04 Thread Owen Pan via cfe-commits
@@ -986,7 +986,7 @@ class LineJoiner { void join(AnnotatedLine &A, const AnnotatedLine &B) { assert(!A.Last->Next); assert(!B.First->Previous); -if (B.Affected) +if (B.Affected || (B.LeadingEmptyLinesAffected && A.Last->Children.empty())) owe

[clang] [clang-format] Propagate `LeadingEmptyLinesAffected` when joining lines (PR #146761)

2025-07-04 Thread Owen Pan via cfe-commits
@@ -41,6 +41,8 @@ TEST_F(FormatTestSelective, RemovesTrailingWhitespaceOfFormattedLine) { EXPECT_EQ("int a;", format("int a; ", 0, 0)); EXPECT_EQ("int a;\n", format("int a; \n \n \n ", 0, 0)); EXPECT_EQ("int a;\nint b;", format("int a; \nint b;", 0,

[clang] [clang-format][NFC] Replace a function with StringRef::contains (PR #146245)

2025-06-29 Thread Owen Pan via cfe-commits
owenca wrote: > While it is less code, I find a bit harder to understand and the code gen is > far worse: https://gcc.godbolt.org/z/KzG4YnTh3 `IsBlank` is misleading because of `std::isblank` whereas `Blanks.contains` is not, so the latter has better readability for me. As to the generated cod

[clang] [clang-format] Make EndsInComma in ContinuationIndenter consistent (PR #146256)

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

[clang] [clang-format][NFC] Replace a function with StringRef::contains (PR #146245)

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

[clang] [clang-format] Make EndsInComma in ContinuationIndenter consistent (PR #146256)

2025-06-28 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/146256 None >From b7dd2cee0b6064f29e1f9562d26675152bb2756b Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 28 Jun 2025 18:13:43 -0700 Subject: [PATCH] [clang-format] Make EndsInComma in ContinuationIndenter consist

[clang] [clang-format[NFC] Replace a function with StringRef::contains (PR #146245)

2025-06-28 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/146245 None >From 60a0768fef885cb87e564f6dba7e101befd6ab0d Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 28 Jun 2025 15:52:58 -0700 Subject: [PATCH] [clang-format[NFC] Replace a function with StringRef::contains

[clang] [clang-format] Fix a bug in `ReflowComments: Always` (PR #146202)

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

[clang] [clang-format] Fix an off-by-1 bug with -length option (PR #143302)

2025-06-28 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/143302 ___ 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 `ReflowComments: Always` (PR #146202)

2025-06-28 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/146202 Fixes #39150 >From 00c0c25a5f17a0077cfc8660020391684aa5 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 28 Jun 2025 00:25:02 -0700 Subject: [PATCH] [clang-format] Fix a bug in `ReflowComments: Always` Fi

[clang] [clang-format][NFC] Remove `\brief` from comments (PR #145853)

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

[clang] [clang-format] Fix an off-by-1 bug with -length option (PR #143302)

2025-06-26 Thread Owen Pan via cfe-commits
@@ -296,12 +296,16 @@ static bool fillRanges(MemoryBuffer *Code, } if (!EmptyLengths) Length = Lengths[I]; +if (Length == 0) { + errs() << "error: length should be at least 1\n"; + return true; +} if (Offset + Length > CodeSize) { err

[clang] [clang-format][NFC] Remove `\brief` from comments (PR #145853)

2025-06-26 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/145853 This was done before in https://reviews.llvm.org/D46320 >From 889e392fcf49c05ceea7949690b207b73f83d49b Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 26 Jun 2025 01:14:58 -0700 Subject: [PATCH] [clang-format

[clang] clang-format: Add IncludeSortKey option (PR #137840)

2025-06-26 Thread Owen Pan via cfe-commits
@@ -1647,7 +1647,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) { LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave; LLVMStyle.ShortNamespaceLines = 1; LLVMStyle.SkipMacroDefinitionBody = false; - LLVMStyle.SortIncludes = {/*Enabled=*/true,

[clang] clang-format: Add IncludeSortKey option (PR #137840)

2025-06-26 Thread Owen Pan via cfe-commits
@@ -1647,7 +1647,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) { LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave; LLVMStyle.ShortNamespaceLines = 1; LLVMStyle.SkipMacroDefinitionBody = false; - LLVMStyle.SortIncludes = {/*Enabled=*/true,

[clang] [clang-format] Fix an off-by-1 bug with -length option (PR #143302)

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

[clang] [clang-format] Fix an off-by-1 bug with -length option (PR #143302)

2025-06-25 Thread Owen Pan via cfe-commits
@@ -296,12 +296,16 @@ static bool fillRanges(MemoryBuffer *Code, } if (!EmptyLengths) Length = Lengths[I]; +if (Length == 0) { + errs() << "error: length should be at least 1\n"; + return true; +} if (Offset + Length > CodeSize) { err

[clang] [clang-format] Handle Trailing Whitespace After Line Continuation (P2223R2) (PR #145243)

2025-06-25 Thread Owen Pan via cfe-commits
@@ -25768,6 +25768,29 @@ TEST_F(FormatTest, OperatorPassedAsAFunctionPtr) { verifyFormat("foo(operator, , -42);", Style); } +TEST_F(FormatTest, LineSpliceWithTrailingWhitespace) { + // Test that each sequence of a backslash (\) immediately followed by zero or + // more hor

[clang] [clang-format] Handle Trailing Whitespace After Line Continuation (P2223R2) (PR #145243)

2025-06-25 Thread Owen Pan via cfe-commits
@@ -25768,6 +25768,29 @@ TEST_F(FormatTest, OperatorPassedAsAFunctionPtr) { verifyFormat("foo(operator, , -42);", Style); } +TEST_F(FormatTest, LineSpliceWithTrailingWhitespace) { + // Test that each sequence of a backslash (\) immediately followed by zero or + // more hor

[clang] [clang-format] Handle Trailing Whitespace After Line Continuation (P2223R2) (PR #145243)

2025-06-25 Thread Owen Pan via cfe-commits
@@ -1205,14 +1206,23 @@ static size_t countLeadingWhitespace(StringRef Text) { while (Cur < End) { if (isspace(Cur[0])) { ++Cur; -} else if (Cur[0] == '\\' && (Cur[1] == '\n' || Cur[1] == '\r')) { - // A '\' followed by a newline always escapes the newline,

[clang] [clang-format] Handle Trailing Whitespace After Line Continuation (P2223R2) (PR #145243)

2025-06-25 Thread Owen Pan via cfe-commits
@@ -1025,6 +1025,9 @@ clang-format ``enum`` enumerator lists. - Add ``OneLineFormatOffRegex`` option for turning formatting off for one line. - Add ``SpaceAfterOperatorKeyword`` option. +- Support trailing whitespace in line splicing. + (P2223R2

[clang] [clang-format] Handle Trailing Whitespace After Line Continuation (P2223R2) (PR #145243)

2025-06-25 Thread Owen Pan via cfe-commits
@@ -1205,14 +1206,23 @@ static size_t countLeadingWhitespace(StringRef Text) { while (Cur < End) { if (isspace(Cur[0])) { ++Cur; -} else if (Cur[0] == '\\' && (Cur[1] == '\n' || Cur[1] == '\r')) { - // A '\' followed by a newline always escapes the newline,

[clang] [clang-format] Improve QualifierAlignment in guessing macros (PR #145468)

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

[clang] [clang-format] Handle Trailing Whitespace After Line Continuation (P2223R2) (PR #145243)

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

[clang] [clang-format] Handle Trailing Whitespace After Line Continuation (P2223R2) (PR #145243)

2025-06-24 Thread Owen Pan via cfe-commits
@@ -1295,13 +1305,18 @@ FormatToken *FormatTokenLexer::getNextToken() { case '/': // The text was entirely whitespace when this loop was entered. Thus // this has to be an escape sequence. -assert(Text.substr(i, 2) == "\\\r" || Text.substr(i, 2) ==

[clang] [clang-format] Handle Trailing Whitespace After Line Continuation (P2223R2) (PR #145243)

2025-06-24 Thread Owen Pan via cfe-commits
@@ -1205,14 +1206,23 @@ static size_t countLeadingWhitespace(StringRef Text) { while (Cur < End) { if (isspace(Cur[0])) { owenca wrote: ```suggestion if (isWhitespace(Cur[0])) { ``` https://github.com/llvm/llvm-project/pull/145243 ___

[clang] [clang-format] Handle Trailing Whitespace After Line Continuation (P2223R2) (PR #145243)

2025-06-24 Thread Owen Pan via cfe-commits
@@ -1205,14 +1206,23 @@ static size_t countLeadingWhitespace(StringRef Text) { while (Cur < End) { if (isspace(Cur[0])) { ++Cur; -} else if (Cur[0] == '\\' && (Cur[1] == '\n' || Cur[1] == '\r')) { - // A '\' followed by a newline always escapes the newline,

[clang] [clang-format] Handle Trailing Whitespace After Line Continuation (P2223R2) (PR #145243)

2025-06-24 Thread Owen Pan via cfe-commits
@@ -1295,13 +1305,18 @@ FormatToken *FormatTokenLexer::getNextToken() { case '/': // The text was entirely whitespace when this loop was entered. Thus // this has to be an escape sequence. -assert(Text.substr(i, 2) == "\\\r" || Text.substr(i, 2) ==

[clang] [clang-format] Improve QualifierAlignment in guessing macros (PR #145468)

2025-06-23 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/145468 Fixes #145388 >From 349d309467c1251a9206f665886bde06b96ced32 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Mon, 23 Jun 2025 23:32:31 -0700 Subject: [PATCH] [clang-format] Improve QualifierAlignment in guessing m

[clang] [clang-format] Handle Trailing Whitespace After Line Continuation (P2223R2) (PR #145243)

2025-06-23 Thread Owen Pan via cfe-commits
@@ -25768,6 +25768,29 @@ TEST_F(FormatTest, OperatorPassedAsAFunctionPtr) { verifyFormat("foo(operator, , -42);", Style); } +TEST_F(FormatTest, LineSpliceWithTrailingWhitespace) { + // Test that each sequence of a backslash (\) immediately followed by zero or + // more hor

[clang] [clang-format] Handle Trailing Whitespace After Line Continuation (P2223R2) (PR #145243)

2025-06-23 Thread Owen Pan via cfe-commits
@@ -25768,6 +25768,29 @@ TEST_F(FormatTest, OperatorPassedAsAFunctionPtr) { verifyFormat("foo(operator, , -42);", Style); } +TEST_F(FormatTest, LineSpliceWithTrailingWhitespace) { + // Test that each sequence of a backslash (\) immediately followed by zero or + // more hor

[clang] [clang/docs] add a missing brace in ClangFormatStyleOptions.rst (PR #145145)

2025-06-21 Thread Owen Pan via cfe-commits
@@ -6992,7 +6992,7 @@ the configuration (without a prefix: ``Auto``). .. code-block:: c++ namespace N1 { - namespace N2 + namespace N2 { owenca wrote: This file is generated from `clang/include/clang/Format/Format.h`. Please edit that fil

[clang] [clang-format] Stop moving lambda to new line only to indent it more. (PR #141576)

2025-06-15 Thread Owen Pan via cfe-commits
@@ -325,13 +325,30 @@ bool ContinuationIndenter::canBreak(const LineState &State) { if (Current.isMemberAccess() && CurrentState.ContainsUnwrappedBuilder) return false; - // Don't create a 'hanging' indent if there are multiple blocks in a single - // statement and we

[clang] [clang-format][NFC] Clean up DisallowLineBreaks lambda (PR #144255)

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

[clang] [clang-format][NFC] Upgrade IndentBraces option to a struct (PR #143663)

2025-06-15 Thread Owen Pan via cfe-commits
owenca wrote: > I don't understand this fix, it needs tests to show what you are doing See https://github.com/llvm/llvm-project/pull/143249#discussion_r2136966951 and https://github.com/llvm/llvm-project/pull/143249#issuecomment-2957775336. IMO, the current `BraceWrapping.IndentBraces` boolean

[clang] [clang-format][NFC] Clean up DisallowLineBreaks lambda (PR #144255)

2025-06-15 Thread Owen Pan via cfe-commits
@@ -706,42 +706,48 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, const FormatToken &Previous = *State.NextToken->Previous; auto &CurrentState = State.Stack.back(); - bool DisallowLineBreaksOnThisLine = - Style.LambdaBodyIndentati

[clang] [clang-format][NFC] Clean up DisallowLineBreaks lambda (PR #144255)

2025-06-15 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/144255 >From e959ae809abb119effd17534c199f1e6c174d749 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 15 Jun 2025 01:42:20 -0700 Subject: [PATCH 1/2] [clang-format][NFC] Clean up DisallowLineBreaks lambda See also h

[clang] [clang-format][NFC] Clean up DisallowLineBreaks lambda (PR #144255)

2025-06-15 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/144255 >From e959ae809abb119effd17534c199f1e6c174d749 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 15 Jun 2025 01:42:20 -0700 Subject: [PATCH] [clang-format][NFC] Clean up DisallowLineBreaks lambda See also https

[clang] [clang-format][NFC] Clean up DisallowLineBreaks lambda (PR #144255)

2025-06-15 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/144255 See also https://github.com/llvm/llvm-project/pull/141576/files#r2141808121 >From d75bb33657f4fd2bd7ceea8aabfc1fd4d8a4eb25 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 15 Jun 2025 01:42:20 -0700 Subject: [

[clang] [clang-format] Fix a bug in annotating braces (PR #144095)

2025-06-14 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/144095 ___ 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 braces (PR #144095)

2025-06-13 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/144095 ___ 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 braces (PR #144095)

2025-06-13 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/144095 Stop looking for function decls after hitting a BK_BracedInit l_brace. Fixes #144057. >From 8fa1829548708152118b8f24b9069580f92a750d Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 13 Jun 2025 08:30:21 -0700

[clang] [clang-format] Fix an off-by-1 bug with -length option (PR #143302)

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

[clang] [clang-format] Fix an off-by-1 bug with -length option (PR #143302)

2025-06-12 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/143302 >From 68f668608d800c1411fd259be569bd3db36d1b12 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 8 Jun 2025 00:36:08 -0700 Subject: [PATCH] [clang-format] Fix an off-by-1 bug with -length option Also validate t

[clang] Reland "[clang-format][NFC] Clean up fillRanges() in ClangFormat.cpp" (PR #143477)

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

[clang] [clang-format] Stop moving lambda to new line only to indent it more. (PR #141576)

2025-06-11 Thread Owen Pan via cfe-commits
@@ -325,13 +325,30 @@ bool ContinuationIndenter::canBreak(const LineState &State) { if (Current.isMemberAccess() && CurrentState.ContainsUnwrappedBuilder) return false; - // Don't create a 'hanging' indent if there are multiple blocks in a single - // statement and we

[clang] [clang-format] Stop moving lambda to new line only to indent it more. (PR #141576)

2025-06-11 Thread Owen Pan via cfe-commits
@@ -325,13 +325,30 @@ bool ContinuationIndenter::canBreak(const LineState &State) { if (Current.isMemberAccess() && CurrentState.ContainsUnwrappedBuilder) return false; - // Don't create a 'hanging' indent if there are multiple blocks in a single - // statement and we

[clang] [clang-format] Stop moving lambda to new line only to indent it more. (PR #141576)

2025-06-11 Thread Owen Pan via cfe-commits
@@ -325,13 +325,30 @@ bool ContinuationIndenter::canBreak(const LineState &State) { if (Current.isMemberAccess() && CurrentState.ContainsUnwrappedBuilder) return false; - // Don't create a 'hanging' indent if there are multiple blocks in a single - // statement and we

[clang] Reland "[clang-format][NFC] Clean up fillRanges() in ClangFormat.cpp" (PR #143477)

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

[clang] Reland "[clang-format][NFC] Clean up fillRanges() in ClangFormat.cpp" (PR #143477)

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

[clang] Reapply "[clang-format][NFC] Clean up fillRanges() in ClangFormat.cpp" (PR #143477)

2025-06-10 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/143477 >From 7f745330975e0e360e9a42b9d57c3e3afa3680f8 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 7 Jun 2025 20:59:53 -0700 Subject: [PATCH 1/2] [clang-format][NFC] Clean up fillRanges() in ClangFormat.cpp (#143

[clang] [clang-format] Add options to control wrapped lambda brace indent. (PR #143249)

2025-06-10 Thread Owen Pan via cfe-commits
owenca wrote: See https://clang.llvm.org/docs/ClangFormatStyleOptions.html#adding-additional-style-options. IMO, when it's difficult to name the new options, it will be hard for people to understand what they do. @mydeveloperday WDYT? https://github.com/llvm/llvm-project/pull/143249 _

[clang] [clang-format] Add options to control wrapped lambda brace indent. (PR #143249)

2025-06-09 Thread Owen Pan via cfe-commits
@@ -1547,6 +1547,38 @@ struct FormatStyle { bool BeforeWhile; /// Indent the wrapped braces themselves. bool IndentBraces; +/// Indent nested wrapped lambda braces. owenca wrote: If we allow this new option, I want a separate NFC patch that upg

[clang] Reapply "[clang-format][NFC] Clean up fillRanges() in ClangFormat.cpp" (PR #143477)

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

[clang] Cleanup (PR #143477)

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

[clang] Cleanup (PR #143477)

2025-06-09 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/143477 None >From 7f745330975e0e360e9a42b9d57c3e3afa3680f8 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 7 Jun 2025 20:59:53 -0700 Subject: [PATCH 1/2] [clang-format][NFC] Clean up fillRanges() in ClangFormat.cpp

[clang] [clang-format] Parse JSON outermost l_brace as braced list brace (PR #143327)

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

[clang] [clang-format] Parse JSON outermost l_brace as braced list brace (PR #143327)

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

[clang] [clang-format] Parse JSON outermost l_brace as braced list brace (PR #143327)

2025-06-08 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/143327 Fix github.com/llvm/llvm-project/issues/65400#issuecomment-2922181979 >From ab36d65d7c0f677b196ac3aa0cf976fb483fad98 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 1 Jun 2025 22:35:14 -0700 Subject: [PATCH]

[clang] [clang-format] Fix an off-by-1 bug with -length option (PR #143302)

2025-06-08 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/143302 >From 68f668608d800c1411fd259be569bd3db36d1b12 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 8 Jun 2025 00:36:08 -0700 Subject: [PATCH] [clang-format] Fix an off-by-1 bug with -length option Also validate t

[clang] [clang-format] Fix an off-by-1 bug with -length option (PR #143302)

2025-06-08 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/143302 Also validate the argument value. Fixes #56245 >From 30e0165a2d5c7ee8fc6b7f1edcf9322e18f4334e Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sun, 8 Jun 2025 00:36:08 -0700 Subject: [PATCH] [clang-format] Fix an

[clang] [clang-format][NFC] Clean up fillRanges() in ClangFormat.cpp (PR #143236)

2025-06-07 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/143236 ___ 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 fillRanges() in ClangFormat.cpp (PR #143236)

2025-06-07 Thread Owen Pan via cfe-commits
@@ -284,27 +284,23 @@ static bool fillRanges(MemoryBuffer *Code, errs() << "error: number of -offset and -length arguments must match.\n"; return true; } - for (unsigned i = 0, e = Offsets.size(); i != e; ++i) { -if (Offsets[i] >= Code->getBufferSize()) { -

[clang] [clang-format][NFC] Clean up fillRanges() in ClangFormat.cpp (PR #143236)

2025-06-07 Thread Owen Pan via cfe-commits
@@ -284,27 +284,23 @@ static bool fillRanges(MemoryBuffer *Code, errs() << "error: number of -offset and -length arguments must match.\n"; owenca wrote: Actually, we can achieve that by handling `Offsets.size() == 1 && Lengths.empty()` separately. https://

[clang] [clang-format][NFC] Clean up fillRanges() in ClangFormat.cpp (PR #143236)

2025-06-07 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/143236 >From 1ece3adee540295efbe04fc74876efd39549e577 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 6 Jun 2025 23:10:18 -0700 Subject: [PATCH 1/3] [clang-format][NFC] Clean up fillRanges() in ClangFormat.cpp ---

[clang] [clang-format][NFC] Clean up fillRanges() in ClangFormat.cpp (PR #143236)

2025-06-07 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/143236 >From 1ece3adee540295efbe04fc74876efd39549e577 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 6 Jun 2025 23:10:18 -0700 Subject: [PATCH 1/2] [clang-format][NFC] Clean up fillRanges() in ClangFormat.cpp ---

[clang] [clang-format][NFC] Clean up fillRanges() in ClangFormat.cpp (PR #143236)

2025-06-06 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/143236 None >From 1ece3adee540295efbe04fc74876efd39549e577 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 6 Jun 2025 23:10:18 -0700 Subject: [PATCH] [clang-format][NFC] Clean up fillRanges() in ClangFormat.cpp ---

[clang] [clang-format] Handle function decls with MS calling conventions (PR #143083)

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

[clang] [clang-format] Fix Microsoft calling convensions preventing function names from being marked TT_StartOfName (PR #143047)

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

[clang] [clang-format] Handle function decls with MS calling conventions (PR #143083)

2025-06-05 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/143083 None >From 6f319be22826718c82b027c605885d6b95ed5689 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 5 Jun 2025 23:48:47 -0700 Subject: [PATCH] [clang-format] Handle function decls with MS calling conventions

[clang] [clang-format] Handle requires clause following a pointer type (PR #142893)

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

[clang] [clang-format] More consumeToken() cleanup similar to #142104 (PR #143063)

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

[clang] [clang-format] More consumeToken() cleanup (PR #143063)

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

[clang] [clang-format] More consumeToken() cleanup similar to #142104 (PR #143063)

2025-06-05 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/143063 >From 9c2e7a25245259af7ecdf5815fb0b6314b23a7d4 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 5 Jun 2025 21:39:49 -0700 Subject: [PATCH] [clang-format] More consumeToken() cleanup similar to #142104 --- cla

[clang] [clang-format] More consumeToken() cleanup similar to #142104 (PR #143063)

2025-06-05 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/143063 None >From af43a40d33dd7af17b852cfd60df3c9cd1594935 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 5 Jun 2025 21:39:49 -0700 Subject: [PATCH] [clang-format] More consumeToken() cleanup similar to #142104 --

[clang] [clang-format] Handle requires clause following a pointer type (PR #142893)

2025-06-05 Thread Owen Pan via cfe-commits
owenca wrote: > For all sane code this works. Although there are valid codes where a star can > preceed a requires expression. Sure, but I think that's also true for the existing `tok::greater` and `tok::amp` cases. https://github.com/llvm/llvm-project/pull/142893

  1   2   3   4   5   6   7   8   9   10   >